pub enum Exception {
EndOfStream,
LimitReached,
ReadError(Error),
WriteError(Error),
ConnectError(Error),
}
Expand description
An exception value that is received in Protocol::exception
method
This thing is usually used for nice error detection. But sometimes it is also useful for valid protocol processing. For example it allows to detect end-of-stream-delimited prootols (of those which make of use of TCP half close)
Variants§
EndOfStream
End of stream reached (when reading)
This may be not a broken expectation, we just notify of end of stream always (if the state machine is still alive)
Note: the equivalent of end of stream for write system call is
translated to WriteError(WriteZero)
LimitReached
Limit for the number of bytes reached
This is called when there is alredy maximum bytes in the buffer
(third argument of Delimiter
) but no delimiter found.
ReadError(Error)
WriteError(Error)
ConnectError(Error)
Trait Implementations§
Source§impl Error for Exception
impl Error for Exception
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Auto Trait Implementations§
impl Freeze for Exception
impl !RefUnwindSafe for Exception
impl Send for Exception
impl Sync for Exception
impl Unpin for Exception
impl !UnwindSafe for Exception
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