pub struct TryPeekError { /* private fields */ }Expand description
An error that occurs when trying to peek at data beyond the buffer’s available bytes.
This error indicates that a peek operation failed because the buffer does not contain enough bytes at the current position. Peek operations never modify the buffer position, so this error leaves the buffer in its original state.
Implementations§
Source§impl TryPeekError
impl TryPeekError
Sourcepub const fn new(requested: usize, available: usize) -> Self
pub const fn new(requested: usize, available: usize) -> Self
Creates a new TryPeekError with the requested and available bytes.
§Panics
- In debug builds, panics if
requested <= available(this would not be an error condition). - The
requestedvalue must be a non-zero.
Sourcepub const fn requested(&self) -> usize
pub const fn requested(&self) -> usize
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 TryPeekError
impl Clone for TryPeekError
Source§fn clone(&self) -> TryPeekError
fn clone(&self) -> TryPeekError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TryPeekError
impl Debug for TryPeekError
Source§impl Display for TryPeekError
impl Display for TryPeekError
Source§impl Error for TryPeekError
impl Error for TryPeekError
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<TryPeekError> for Error
impl From<TryPeekError> for Error
Source§fn from(e: TryPeekError) -> Self
fn from(e: TryPeekError) -> 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 PartialEq for TryPeekError
impl PartialEq for TryPeekError
impl Copy for TryPeekError
impl Eq for TryPeekError
impl StructuralPartialEq for TryPeekError
Auto Trait Implementations§
impl Freeze for TryPeekError
impl RefUnwindSafe for TryPeekError
impl Send for TryPeekError
impl Sync for TryPeekError
impl Unpin for TryPeekError
impl UnwindSafe for TryPeekError
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