pub enum BitError {
TargetAlignmentGreaterAndInputNotAligned,
OutputSliceWouldHaveSlop,
SizeMismatch,
AlignmentMismatch,
InvalidBitPattern,
}Expand description
The things that can go wrong when casting between [Pod] data forms.
Variants§
TargetAlignmentGreaterAndInputNotAligned
You tried to cast a reference into a reference to a type with a higher alignment requirement but the input reference wasn’t aligned.
OutputSliceWouldHaveSlop
If the element size of a slice changes, then the output slice changes length accordingly. If the output slice wouldn’t be a whole number of elements, then the conversion fails.
SizeMismatch
When casting an individual T, &T, or &mut T value the
source size and destination size must be an exact match.
AlignmentMismatch
For this type of cast the alignments must be exactly the same and they were not so now you’re sad.
This error is generated only by operations that cast allocated types
(such as Box and Vec), because in that case the alignment must stay
exact.
InvalidBitPattern
When casting to a [BitPattern] type, it is possible that the
original data contains an invalid bit pattern. If so, the cast will
fail and this error will be returned. Will never happen on casts
between Pod types.
Trait Implementations§
impl Copy for BitError
impl Eq for BitError
impl StructuralPartialEq for BitError
Auto Trait Implementations§
impl Freeze for BitError
impl RefUnwindSafe for BitError
impl Send for BitError
impl Sync for BitError
impl Unpin for BitError
impl UnsafeUnpin for BitError
impl UnwindSafe for BitError
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
Source§impl<S, T> CastRangeInto<T> for Swhere
T: CastRangeFrom<S>,
impl<S, T> CastRangeInto<T> for Swhere
T: CastRangeFrom<S>,
fn cast_range_into(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more