Struct safe_transmute::error::IncompatibleVecTargetError[][src]

pub struct IncompatibleVecTargetError<S, T> {
    pub vec: Vec<S>,
    // some fields omitted
}

Incompatible vector transmutation error.

Returned when the element type S does not allow a safe vector transmutation to the target element type T. This happens when either the size or minimum memory alignment requirements are not met:

Fields

vec: Vec<S>

The original vector.

Implementations

impl<S, T> IncompatibleVecTargetError<S, T>[src]

pub fn new(vec: Vec<S>) -> Self[src]

Create an error with the given vector.

pub unsafe fn copy_unchecked(&self) -> Vec<T>[src]

Create a copy of the data, transmuted into a new vector. As the vector will be properly aligned for accessing values of type T, this operation will not fail due to memory alignment constraints.

Safety

The byte data in the vector needs to correspond to a valid contiguous sequence of T values.

pub fn copy(&self) -> Vec<T> where
    T: TriviallyTransmutable
[src]

Create a copy of the data, transmuted into a new vector. As T is trivially transmutable, and the new vector will be properly allocated for accessing values of type T, this operation is safe and will never fail.

Trait Implementations

impl<S: Clone, T: Clone> Clone for IncompatibleVecTargetError<S, T>[src]

impl<S, T> Debug for IncompatibleVecTargetError<S, T>[src]

impl<S, T> Display for IncompatibleVecTargetError<S, T>[src]

impl<S: Eq, T: Eq> Eq for IncompatibleVecTargetError<S, T>[src]

impl<S, T> Error for IncompatibleVecTargetError<S, T>[src]

impl<'a, S, T> From<IncompatibleVecTargetError<S, T>> for Error<'a, S, T>[src]

impl<S: Hash, T: Hash> Hash for IncompatibleVecTargetError<S, T>[src]

impl<S: PartialEq, T: PartialEq> PartialEq<IncompatibleVecTargetError<S, T>> for IncompatibleVecTargetError<S, T>[src]

impl<S, T> StructuralEq for IncompatibleVecTargetError<S, T>[src]

impl<S, T> StructuralPartialEq for IncompatibleVecTargetError<S, T>[src]

Auto Trait Implementations

impl<S, T> RefUnwindSafe for IncompatibleVecTargetError<S, T> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

impl<S, T> Send for IncompatibleVecTargetError<S, T> where
    S: Send,
    T: Send

impl<S, T> Sync for IncompatibleVecTargetError<S, T> where
    S: Sync,
    T: Sync

impl<S, T> Unpin for IncompatibleVecTargetError<S, T> where
    S: Unpin,
    T: Unpin

impl<S, T> UnwindSafe for IncompatibleVecTargetError<S, T> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.