all: change optional to result of io (#16075)

This commit is contained in:
yuyi 2022-10-16 14:28:57 +08:00 committed by GitHub
parent 6e46933c55
commit f6844e9766
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
187 changed files with 1885 additions and 1874 deletions

View file

@ -6,14 +6,14 @@ import sim.args as simargs
import sim.img
fn main() {
args := simargs.parse_args(extra_workers: 1)? as simargs.ParallelArgs
args := simargs.parse_args(extra_workers: 1)! as simargs.ParallelArgs
img_settings := img.image_settings_from_grid(args.grid)
request_chan := chan &sim.SimRequest{cap: args.workers}
result_chan := chan &sim.SimResult{cap: args.workers}
mut writer := img.ppm_writer_for_fname(args.filename, img_settings)?
mut writer := img.ppm_writer_for_fname(args.filename, img_settings)!
mut workers := []thread{cap: args.workers + 1}
mut bmark := benchmark.start()
@ -39,7 +39,7 @@ fn main() {
workers << go img.image_worker(mut writer, result_chan, img_settings)
handle_request := fn [request_chan] (request &sim.SimRequest) ? {
handle_request := fn [request_chan] (request &sim.SimRequest) ! {
request_chan <- request
}