Enum esde::Error

source ·
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>

source

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)?;
source

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<SenderError: Debug + Error> Debug for Error<SenderError>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<SenderError: Error> Display for Error<SenderError>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Error> Error for Error<T>

1.30.0 · source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl<T: Error> From<&str> for Error<T>

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<Error> for Error<Error>

source§

fn from(value: Error) -> Self

Converts to this type from the input type.
source§

impl<T: Error> From<String> for Error<T>

source§

fn from(value: String) -> Self

Converts to this type from the input type.

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.