pub enum StreamError<SourceErr, SinkErr>{
SourceError(SourceErr),
SinkError(SinkErr),
}
Expand description
A error that is raised by functions that move fallible Source
s into
fallible Sinks
.
In case this error is raised it can be matched to investigate if Source
or Sink
failed.
§Conversion
Both variants SourceError
and SinkError
are public exported.
Consequently, StreamError
can be constructed with .map_err(SourceError)
and .map_err(SinkError)
.
Variants§
Implementations§
Source§impl<SourceErr, SinkErr> StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> StreamError<SourceErr, SinkErr>
Sourcepub fn is_source_error(&self) -> bool
pub fn is_source_error(&self) -> bool
Checks if StreamError
was raised by the Source
.
Sourcepub fn is_sink_error(&self) -> bool
pub fn is_sink_error(&self) -> bool
Checks if StreamError
was raised by the Sink
.
Sourcepub fn inner_into<Err>(self) -> Err
pub fn inner_into<Err>(self) -> Err
Converts StreamError
into an inner error.
Sourcepub fn map_source<E, F>(self, f: F) -> StreamError<E, SinkErr>
pub fn map_source<E, F>(self, f: F) -> StreamError<E, SinkErr>
Convert using f
if a SourceError
Sourcepub fn map_sink<E, F>(self, f: F) -> StreamError<SourceErr, E>
pub fn map_sink<E, F>(self, f: F) -> StreamError<SourceErr, E>
Convert using f
if a SinkError
Sourcepub fn unwrap_source_error(self) -> SourceErr
pub fn unwrap_source_error(self) -> SourceErr
Sourcepub fn unwrap_sink_error(self) -> SinkErr
pub fn unwrap_sink_error(self) -> SinkErr
Sourcepub fn reverse(self) -> StreamError<SinkErr, SourceErr>
pub fn reverse(self) -> StreamError<SinkErr, SourceErr>
Switch source and sink error.
Trait Implementations§
Source§impl<SourceErr, SinkErr> Debug for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> Debug for StreamError<SourceErr, SinkErr>
Source§impl<SourceErr, SinkErr> Display for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> Display for StreamError<SourceErr, SinkErr>
Source§impl<SourceErr, SinkErr> Error for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> Error for StreamError<SourceErr, SinkErr>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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<SourceErr, SinkErr> Freeze for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> RefUnwindSafe for StreamError<SourceErr, SinkErr>where
SourceErr: RefUnwindSafe,
SinkErr: RefUnwindSafe,
impl<SourceErr, SinkErr> Send for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> Sync for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> Unpin for StreamError<SourceErr, SinkErr>
impl<SourceErr, SinkErr> UnwindSafe for StreamError<SourceErr, SinkErr>where
SourceErr: UnwindSafe,
SinkErr: 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