pub enum Error<SenderError: Error> {
EOF,
Sender(SenderError),
Parse(Box<dyn Error>),
}
Expand description
an error that can occur during deserialization
Variants§
EOF
end of file when another Item
was expected
Sender(SenderError)
error within the Sender
, e.g. a std::io::Error
if a std::fs::File
was used and an error occured while reading
Parse(Box<dyn Error>)
an error while parsing, hinting corrupt data or parsing of another type was wasn’t stored
Implementations§
source§impl<SenderError: Error> Error<SenderError>
impl<SenderError: Error> Error<SenderError>
sourcepub fn make_parse(err: impl Error + 'static) -> Self
pub fn make_parse(err: impl Error + 'static) -> Self
make a given error a parse error
useful when parsing to do something like
let buffer = receiver.auto()?;
let str = String::from_utf8(buffer).map_err(Error::make_parse)?;
sourcepub fn unwrap_sender(self) -> SenderError
pub fn unwrap_sender(self) -> SenderError
unwrap to a sender error only
useful when in main function that, for example, returns std::io::Error
to only see sender errors
panics
this function panics if the contained error is not a sender error
Trait Implementations§
source§impl<T: Error> Error for Error<T>
impl<T: Error> Error for Error<T>
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl<SenderError> !RefUnwindSafe for Error<SenderError>
impl<SenderError> !Send for Error<SenderError>
impl<SenderError> !Sync for Error<SenderError>
impl<SenderError> Unpin for Error<SenderError>where SenderError: Unpin,
impl<SenderError> !UnwindSafe for Error<SenderError>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more