Enum bytemuck::PodCastError
source · pub enum PodCastError {
TargetAlignmentGreaterAndInputNotAligned,
OutputSliceWouldHaveSlop,
SizeMismatch,
AlignmentMismatch,
}
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.
Trait Implementations§
source§impl Clone for PodCastError
impl Clone for PodCastError
source§fn clone(&self) -> PodCastError
fn clone(&self) -> PodCastError
Returns a copy 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 PodCastError
impl Debug for PodCastError
source§impl Display for PodCastError
impl Display for PodCastError
source§impl From<PodCastError> for CheckedCastError
impl From<PodCastError> for CheckedCastError
source§fn from(err: PodCastError) -> CheckedCastError
fn from(err: PodCastError) -> CheckedCastError
Converts to this type from the input type.
source§impl Hash for PodCastError
impl Hash for PodCastError
source§impl PartialEq for PodCastError
impl PartialEq for PodCastError
source§fn eq(&self, other: &PodCastError) -> bool
fn eq(&self, other: &PodCastError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for PodCastError
impl Eq for PodCastError
impl StructuralPartialEq for PodCastError
Auto Trait Implementations§
impl Freeze for PodCastError
impl RefUnwindSafe for PodCastError
impl Send for PodCastError
impl Sync for PodCastError
impl Unpin for PodCastError
impl UnwindSafe for PodCastError
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)