pub struct TryReadError { /* private fields */ }Expand description
An error that occurs when trying to read data from a buffer with insufficient bytes.
This error indicates that a read operation failed because the buffer does not contain enough bytes to satisfy the request. Failed read operations do not consume any bytes - the buffer position remains unchanged.
Implementations§
Source§impl TryReadError
impl TryReadError
Sourcepub const fn new(requested: NonZeroUsize, available: usize) -> Self
pub const fn new(requested: NonZeroUsize, available: usize) -> Self
Creates a new TryReadError with the requested and available bytes.
§Panics
- If
requested <= available(this would not be an error condition). - The
requestedvalue must be a non-zero.
Sourcepub const fn requested(&self) -> NonZeroUsize
pub const fn requested(&self) -> NonZeroUsize
Returns the number of bytes requested for the operation.
This is the minimum number of bytes needed for the operation to succeed.
Trait Implementations§
Source§impl Clone for TryReadError
impl Clone for TryReadError
Source§fn clone(&self) -> TryReadError
fn clone(&self) -> TryReadError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TryReadError
Source§impl Debug for TryReadError
impl Debug for TryReadError
Source§impl Display for TryReadError
impl Display for TryReadError
impl Eq for TryReadError
Source§impl Error for TryReadError
impl Error for TryReadError
1.30.0 · 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()
Source§impl From<TryGetError> for TryReadError
Available on crate feature bytes_1 only.
impl From<TryGetError> for TryReadError
Available on crate feature
bytes_1 only.Source§fn from(e: TryGetError) -> Self
fn from(e: TryGetError) -> Self
Converts to this type from the input type.
Source§impl From<TryPeekError> for TryReadError
impl From<TryPeekError> for TryReadError
Source§fn from(e: TryPeekError) -> Self
fn from(e: TryPeekError) -> Self
Converts to this type from the input type.
Source§impl From<TryReadError> for Error
Available on crate feature std only.
impl From<TryReadError> for Error
Available on crate feature
std only.Source§fn from(e: TryReadError) -> Self
fn from(e: TryReadError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TryReadError
impl PartialEq for TryReadError
Source§fn eq(&self, other: &TryReadError) -> bool
fn eq(&self, other: &TryReadError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TryReadError
Auto Trait Implementations§
impl Freeze for TryReadError
impl RefUnwindSafe for TryReadError
impl Send for TryReadError
impl Sync for TryReadError
impl Unpin for TryReadError
impl UnsafeUnpin for TryReadError
impl UnwindSafe for TryReadError
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