Open
Description
BufResult
being aliased to a tuple makes it less ergonomic than a standard Result
could be.
In future, a std::ops::Try
implementation could help, but it needs a local type to be implemented on.
I propose to make use of the standard infrastructure provided by Result
and provide the buffer with a new error type:
use std::error::Error;
use std::io;
pub type BufResult<T, B> = Result<(T, B), BufError<B>>;
#[derive(Debug)]
pub struct BufError<B>(pub io::Error, pub B);
impl<B: Debug> Error for BufError<B> {
// ...
}