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§
source§impl Clone for PodCastError
impl Clone for PodCastError
source§fn clone(&self) -> PodCastError
fn clone(&self) -> PodCastError
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more