I like this change quite a bit. However, is there a more succinct way than
the following to take an action on EOF:

match reader.read(buff) {
    Ok(cnt) => {
        // Do something
    }
    Err(io_error) => match io_error.kind {
        EndOfFile => {
            // Do something for EOF
        }
        _ => return Err(io_error)
    }
}

-Palmer Cox



On Mon, Feb 3, 2014 at 9:19 PM, Alex Crichton <a...@crichton.co> wrote:

> > By returning a Result from all function calls, it's not much cleaner
> > to handle errors
>
> Oops, wrong word there, I meant to indicate that it *is* much cleaner
> to handle errors with Result rather than conditions.
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to