Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mod foo;
- use foo::Bar;
- use foo::BarError;
- use std::io::{ErrorKind};
- fn main() {
- let mut bar = match Bar::read_from_file("./some_file.txt") {
- Ok(bar) => bar,
- Err(err) => {
- match err {
- BarError::Io(err) =>
- match err.kind() {
- ErrorKind::NotFound => panic!("File not found!"),
- _ => panic!("Some error!"),
- },
- }
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement