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 slice to an element type with a higher alignment requirement but the slice wasn’t aligned.
OutputSliceWouldHaveSlop
If the element size 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 a slice you can’t convert between ZST elements and non-ZST
elements. 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
sourceimpl Clone for PodCastError
impl Clone for PodCastError
sourcefn clone(&self) -> PodCastError
fn clone(&self) -> PodCastError
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PodCastError
impl Debug for PodCastError
sourceimpl Display for PodCastError
impl Display for PodCastError
sourceimpl From<PodCastError> for CheckedCastError
impl From<PodCastError> for CheckedCastError
sourcefn from(err: PodCastError) -> CheckedCastError
fn from(err: PodCastError) -> CheckedCastError
Converts to this type from the input type.
sourceimpl Hash for PodCastError
impl Hash for PodCastError
sourceimpl PartialEq<PodCastError> for PodCastError
impl PartialEq<PodCastError> for PodCastError
impl Copy for PodCastError
impl Eq for PodCastError
impl StructuralEq for PodCastError
impl StructuralPartialEq for PodCastError
Auto Trait Implementations
impl RefUnwindSafe for PodCastError
impl Send for PodCastError
impl Sync for PodCastError
impl Unpin for PodCastError
impl UnwindSafe for PodCastError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more