// A missing file: err(e) binds the io_error, matched like any closed enum. // expect: run // grant: src=fs.read:/in // result: 1 // phase: 6 // spec: docs/spec/15-source-language.md module demo.ioerror fn main(src: cap) -> u8 effects [fs.read] { match fs.open_read(src, b"/in/missing.txt") { ok(f) => { fs.close(move f) or trap; 0 } err(e) => match e { io_error::not_found => 1, io_error::permission_denied => 2, io_error::already_exists => 3, io_error::invalid_input => 4, io_error::no_space => 5, io_error::broken_pipe => 6, io_error::connection_refused => 7, io_error::connection_reset => 8, io_error::address_in_use => 9, io_error::address_unavailable => 10, io_error::timed_out => 11, io_error::other => 12, }, } }