Enum safe_transmute::Error
source · pub enum Error {
Guard(GuardError),
Unaligned {
offset: usize,
},
InvalidValue,
}
Expand description
A transmutation error. This type describes possible errors originating from operations in this crate.
Examples
assert_eq!(guarded_transmute_bool_pedantic(&[0x05]),
Err(Error::InvalidValue));
Variants
Guard(GuardError)
The data does not respect the target type’s boundaries.
Unaligned
Fields
offset: usize
The given data slice is not properly aligned for the target type.
It would have been properly aligned if offset
bytes were shifted
(discarded) from the front of the slice.
This is currently unused.
InvalidValue
The data contains an invalid value for the target type.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourceimpl From<GuardError> for Error
impl From<GuardError> for Error
sourcefn from(o: GuardError) -> Error
fn from(o: GuardError) -> Error
Converts to this type from the input type.
impl Copy for Error
impl Eq for Error
impl StructuralEq 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more