pub enum TransferLimitError<E, C = usize> {
LimitExceeded {
limit: C,
actual: C,
},
CounterOverflow {
bytes_seen: C,
chunk_len: usize,
},
Inner {
source: E,
},
}Expand description
Error returned by a transfer-limited stream.
Variants§
LimitExceeded
The stream produced more bytes than allowed.
Fields
§
limit: CConfigured maximum number of bytes.
§
actual: CNumber of bytes observed after reading the chunk that crossed the limit.
CounterOverflow
The cumulative byte count cannot be represented by the selected counter.
Fields
§
bytes_seen: CNumber of bytes counted before reading the chunk that overflowed.
Inner
The wrapped stream returned an error.
Fields
§
source: EOriginal stream error.
Implementations§
Source§impl<E, C> TransferLimitError<E, C>
impl<E, C> TransferLimitError<E, C>
Sourcepub fn is_limit_exceeded(&self) -> bool
pub fn is_limit_exceeded(&self) -> bool
Returns true when this error represents an exceeded transfer limit.
Sourcepub fn is_counter_overflow(&self) -> bool
pub fn is_counter_overflow(&self) -> bool
Returns true when the selected counter type could not represent the
cumulative byte count.
Sourcepub fn into_inner(self) -> Option<E>
pub fn into_inner(self) -> Option<E>
Returns the wrapped stream error, if this is an inner stream error.
Trait Implementations§
Source§impl<E, C> Display for TransferLimitError<E, C>where
C: Display,
impl<E, C> Display for TransferLimitError<E, C>where
C: Display,
Source§impl<E, C> Error for TransferLimitError<E, C>
impl<E, C> Error for TransferLimitError<E, C>
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<E, C> Freeze for TransferLimitError<E, C>
impl<E, C> RefUnwindSafe for TransferLimitError<E, C>where
C: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, C> Send for TransferLimitError<E, C>
impl<E, C> Sync for TransferLimitError<E, C>
impl<E, C> Unpin for TransferLimitError<E, C>
impl<E, C> UnsafeUnpin for TransferLimitError<E, C>where
C: UnsafeUnpin,
E: UnsafeUnpin,
impl<E, C> UnwindSafe for TransferLimitError<E, C>where
C: UnwindSafe,
E: 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