Enum push_decode::ReadError
source · pub enum ReadError<Decode, Read = Error> {
Read(Read),
Decode(Decode),
}Expand description
Returned when either reading or decoding fails.
Note that the Read type param only defaults to std::io::Error with std feature enabled.
Variants§
Implementations§
source§impl<D, R> ReadError<D, R>
impl<D, R> ReadError<D, R>
sourcepub fn convert_either<E>(self) -> E
pub fn convert_either<E>(self) -> E
Converts the inner errors to another type E.
sourcepub fn map_read<E, F>(self, map: F) -> ReadError<D, E>where
F: FnOnce(R) -> E,
pub fn map_read<E, F>(self, map: F) -> ReadError<D, E>where
F: FnOnce(R) -> E,
Converts the read error using a closure.
This is analogous to Result::map/Result::map_err and leaves Decode intact.
sourcepub fn map_decode<E, F>(self, map: F) -> ReadError<E, R>where
F: FnOnce(D) -> E,
pub fn map_decode<E, F>(self, map: F) -> ReadError<E, R>where
F: FnOnce(D) -> E,
Converts the decode error using a closure.
This is analogous to Result::map/Result::map_err and leaves Read intact.
source§impl<E> ReadError<E, Infallible>
impl<E> ReadError<E, Infallible>
sourcepub fn into_decode(self) -> E
pub fn into_decode(self) -> E
Statically proves that reading is infallible and converts to decode error.
Trait Implementations§
source§impl<D: Error + 'static, R: Error + 'static> Error for ReadError<D, R>
Available on crate feature std only.
impl<D: Error + 'static, R: Error + 'static> Error for ReadError<D, R>
Available on crate feature
std only.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()
source§impl<E: Error + Send + Sync + 'static> From<ReadError<E>> for Error
Available on crate feature std only.
impl<E: Error + Send + Sync + 'static> From<ReadError<E>> for Error
Available on crate feature
std only.source§impl From<ReadError<Infallible, Infallible>> for Infallible
impl From<ReadError<Infallible, Infallible>> for Infallible
source§fn from(error: ReadError<Infallible, Infallible>) -> Self
fn from(error: ReadError<Infallible, Infallible>) -> Self
Converts to this type from the input type.
source§impl<Decode: PartialEq, Read: PartialEq> PartialEq for ReadError<Decode, Read>
impl<Decode: PartialEq, Read: PartialEq> PartialEq for ReadError<Decode, Read>
impl<Decode: Copy, Read: Copy> Copy for ReadError<Decode, Read>
impl<Decode: Eq, Read: Eq> Eq for ReadError<Decode, Read>
impl<Decode, Read> StructuralEq for ReadError<Decode, Read>
impl<Decode, Read> StructuralPartialEq for ReadError<Decode, Read>
Auto Trait Implementations§
impl<Decode, Read> RefUnwindSafe for ReadError<Decode, Read>where
Decode: RefUnwindSafe,
Read: RefUnwindSafe,
impl<Decode, Read> Send for ReadError<Decode, Read>
impl<Decode, Read> Sync for ReadError<Decode, Read>
impl<Decode, Read> Unpin for ReadError<Decode, Read>
impl<Decode, Read> UnwindSafe for ReadError<Decode, Read>where
Decode: UnwindSafe,
Read: UnwindSafe,
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