pub enum Error {
Incomplete,
BadOffset(usize),
BadInput {
err: &'static str,
},
}
Expand description
The error type for the byte
crate.
-
Error::BadOffset
will be returned when the offset parameter exceeds the slice’s length. -
Error::BadInput
andError::Incomplete
will be returned whentry_read()
ortry_write()
finds the bytes are invalid or not long enough to determine their validity.
Note that we usually use bytes.read()
in try_read()
which may return Error::BadOffset
,
indicating incomplete data. So the error will automatically be converted into
Error::Incomplete
if you use bytes.read()
(the same applies to write()
).
Variants§
Incomplete
The requested data is bigger than the available range
BadOffset(usize)
The offset is invalid
BadInput
The requested data content is invalid
Trait Implementations§
source§impl PartialEq for Error
impl PartialEq for Error
impl Copy for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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