#[non_exhaustive]pub enum TryPutAtError {
OutOfBounds(OutOfBounds),
InsufficientSpace(InsufficientSpaceAt),
}Expand description
An error that occurs when trying to write at a specific offset in the buffer.
This error is returned when the offset is out of bounds or when there is insufficient space to write the requested data.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
OutOfBounds(OutOfBounds)
An error that occurs when trying to write at an offset that is out of bounds for the buffer.
InsufficientSpace(InsufficientSpaceAt)
An error that occurs when there is not enough space in the buffer to write the requested data.
Implementations§
Source§impl TryPutAtError
impl TryPutAtError
Sourcepub const fn out_of_bounds(offset: usize, length: usize) -> Self
pub const fn out_of_bounds(offset: usize, length: usize) -> Self
Creates a new TryPutAtError::OutOfBounds error.
Sourcepub const fn insufficient_space(
requested: NonZeroUsize,
available: usize,
offset: usize,
) -> Self
pub const fn insufficient_space( requested: NonZeroUsize, available: usize, offset: usize, ) -> Self
Creates a new TryPutAtError::InsufficientSpace error.
§Panics
Panics (in all build profiles) if requested <= available, since that would
not represent an error condition.
Trait Implementations§
Source§impl Clone for TryPutAtError
impl Clone for TryPutAtError
Source§impl Debug for TryPutAtError
impl Debug for TryPutAtError
Source§impl Display for TryPutAtError
impl Display for TryPutAtError
impl Eq for TryPutAtError
Source§impl Error for TryPutAtError
impl Error for TryPutAtError
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<InsufficientSpaceAt> for TryPutAtError
impl From<InsufficientSpaceAt> for TryPutAtError
Source§fn from(source: InsufficientSpaceAt) -> Self
fn from(source: InsufficientSpaceAt) -> Self
Converts to this type from the input type.
Source§impl From<OutOfBounds> for TryPutAtError
impl From<OutOfBounds> for TryPutAtError
Source§fn from(source: OutOfBounds) -> Self
fn from(source: OutOfBounds) -> Self
Converts to this type from the input type.
Source§impl From<TryPutAtError> for Error
Available on crate feature std only.
impl From<TryPutAtError> for Error
Available on crate feature
std only.Source§fn from(e: TryPutAtError) -> Self
fn from(e: TryPutAtError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TryPutAtError
impl PartialEq for TryPutAtError
impl StructuralPartialEq for TryPutAtError
Auto Trait Implementations§
impl Freeze for TryPutAtError
impl RefUnwindSafe for TryPutAtError
impl Send for TryPutAtError
impl Sync for TryPutAtError
impl Unpin for TryPutAtError
impl UnsafeUnpin for TryPutAtError
impl UnwindSafe for TryPutAtError
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