Trait pod::Pod [] [src]

pub unsafe trait Pod: Sized {
    unsafe fn uninitialized() -> Self { ... }
    fn zeroed() -> Self { ... }
    fn copy(&self) -> Self { ... }
    fn map<T: Pod>(&self) -> Option<&T> { ... }
    fn map_mut<T: Pod>(&mut self) -> Option<&mut T> { ... }
    fn map_copy<T: Pod>(&self) -> Option<T> { ... }
    fn try_map<T: Pod>(&self) -> Option<&T> { ... }
    fn try_map_mut<T: Pod>(&mut self) -> Option<&mut T> { ... }
    fn try_map_copy<T: Pod>(&self) -> Option<T> { ... }
    fn map_box<T: Pod>(self: Box<Self>) -> Result<Box<T>, Box<Self>> { ... }
    fn split<T: Pod>(&self) -> Option<&[T]> { ... }
    fn split_mut<T: Pod>(&mut self) -> Option<&mut [T]> { ... }
    fn try_split<T: Pod>(&self) -> &[T] { ... }
    fn try_split_mut<T: Pod>(&mut self) -> &mut [T] { ... }
    fn split_box<T: Pod>(self: Box<Self>) -> Result<Box<[T]>, Box<Self>> { ... }
    fn split_vec<T: Pod>(self: Box<Self>) -> Result<Vec<T>, Box<Self>> { ... }
    fn map_slice<T: Pod>(s: &[Self]) -> Option<&[T]> { ... }
    fn map_slice_mut<T: Pod>(s: &mut [Self]) -> Option<&mut [T]> { ... }
    fn try_map_slice<T: Pod>(s: &[Self]) -> &[T] { ... }
    fn try_map_slice_mut<T: Pod>(s: &mut [Self]) -> &mut [T] { ... }
    fn map_slice_box<T: Pod>(s: Box<[Self]>) -> Result<Box<[T]>, Box<[Self]>> { ... }
    fn map_slice_vec<T: Pod>(s: Vec<Self>) -> Result<Vec<T>, Vec<Self>> { ... }
    fn merge<T: Pod>(s: &[Self]) -> Option<&T> { ... }
    fn merge_mut<T: Pod>(s: &mut [Self]) -> Option<&mut T> { ... }
    fn merge_copy<T: Pod>(s: &[Self]) -> Option<T> { ... }
    fn try_merge<T: Pod>(s: &[Self]) -> Option<&T> { ... }
    fn try_merge_mut<T: Pod>(s: &mut [Self]) -> Option<&mut T> { ... }
    fn try_merge_copy<T: Pod>(s: &[Self]) -> Option<T> { ... }
    fn merge_box<T: Pod>(s: Box<[Self]>) -> Result<Box<T>, Box<[Self]>> { ... }
    fn merge_vec<T: Pod>(s: Vec<Self>) -> Result<Box<T>, Vec<Self>> { ... }
    unsafe fn from_ptr<T>(source: *const T) -> Self { ... }
    fn from_ref<T: Pod>(p: &T) -> Option<Self> { ... }
    fn from_slice<T: Pod>(p: &[T]) -> Option<Self> { ... }
    fn from_boxed_slice<T: Pod>(p: Box<[T]>) -> Result<Box<Self>, Box<[T]>> { ... }
    fn from_vec<T: Pod>(p: Vec<T>) -> Result<Box<Self>, Vec<T>> { ... }
    fn slice_from_boxed_slice<T: Pod>(
        p: Box<[T]>
    ) -> Result<Box<[Self]>, Box<[T]>> { ... } fn ref_from<T: Pod>(p: &T) -> Option<&Self> { ... } fn ref_from_mut<T: Pod>(p: &mut T) -> Option<&mut Self> { ... } fn ref_from_slice<T: Pod>(p: &[T]) -> Option<&Self> { ... } fn ref_from_slice_mut<T: Pod>(p: &mut [T]) -> Option<&mut Self> { ... } fn as_bytes(&self) -> &[u8] { ... } fn as_bytes_mut(&mut self) -> &mut [u8] { ... } fn from_bytes(p: &[u8]) -> Option<Self> { ... } fn ref_from_bytes(p: &[u8]) -> Option<&Self> { ... } fn ref_from_bytes_mut(p: &mut [u8]) -> Option<&mut Self> { ... } fn from_byte_slice(p: Box<[u8]>) -> Result<Box<Self>, Box<[u8]>> { ... } fn from_byte_vec(p: Vec<u8>) -> Result<Box<Self>, Vec<u8>> { ... } fn into_byte_slice(self: Box<Self>) -> Box<[u8]> { ... } fn into_byte_vec(self: Box<Self>) -> Vec<u8> { ... } fn as_aligned_mut<T: Pod + Aligned<Unaligned = Self>>(
        &mut self
    ) -> Option<&mut T>
    where
        Self: Copy + Unaligned
, { ... } fn from_unaligned_mut<T: Copy + Unaligned>(s: &mut T) -> Option<&mut Self>
    where
        Self: Aligned<Unaligned = T>
, { ... } fn from_unaligned<T: Copy + Unaligned>(s: T) -> Self
    where
        Self: Aligned<Unaligned = T>
, { ... } }

A marker trait indicating that a type is Plain Old Data.

It is unsafe to impl this manually, use #[derive(Pod)] instead.

Provided Methods

Generates a new uninitialized instance of a POD type.

Creates a new zeroed instance of a POD type.

Creates a copy of this POD instance

Converts a POD reference from one to another type of the same size.

Returns None if the two types are misaligned or not the same size.

Converts a mutable POD reference from one to another type of the same size.

Returns None if the two types are misaligned or not the same size.

Converts a POD type from one to another of the same size.

Returns None if the two types are not the same size.

Converts a POD reference from one to another type of the same or lesser size.

Returns None if the two types are misaligned or T is larger.

Converts a mutable POD reference from one to another type of the same or lesser size.

Returns None if the two types are misaligned or T is larger.

Converts a POD type from one to another of the same or lesser size.

Returns None if T is larger.

Converts a boxed POD type from one to another of the same size.

Fails if the two types are misaligned or not the same size.

Converts a POD reference into a slice of another type.

Returns None if the types are misaligned or do not fit perfectly.

Converts a mutable POD reference into a slice of another type.

Returns None if the types are misaligned or do not fit perfectly.

Converts a POD reference into a slice of another type.

Returns an empty slice if the types are misaligned.

Converts a mutable POD reference into a slice of another type.

Returns an empty slice if the types are misaligned.

Converts a boxed POD object into a boxed slice of another type.

Fails if the types are misaligned or do not fit perfectly.

Converts a boxed POD object into a vector of another type.

Fails if the types are misaligned or do not fit perfectly.

Maps a POD slice from one type to another.

Returns None if the slice is misaligned or the output type does not perfectly fit.

Maps a mutable POD slice from one type to another.

Returns None if the slice is misaligned or the output type does not perfectly fit.

Maps a POD slice from one type to another.

Returns None if the slice is misaligned.

Maps a mutable POD slice from one type to another.

Returns None if the slice is misaligned.

Maps a boxed POD slice from one type to another.

Fails if the slice is misaligned or does not perfectly fit.

Maps a POD vector from one type to another.

Fails if the slice is misaligned or does not perfectly fit.

Converts a POD slice into another type.

Returns None if the types are misaligned or not the same size.

Converts a mutable POD slice into another type.

Returns None if the types are misaligned or not the same size.

Converts a POD slice into another type.

Returns None if the types are not the same size.

Converts a POD slice into another type.

Returns None if the types are misaligned or T is larger.

Converts a mutable POD slice into another type.

Returns None if the types are misaligned or T is larger.

Converts a POD slice into another type.

Returns None if T is larger.

Converts a boxed POD slice into another boxed type.

Fails if the types are misaligned or not the same size.

Converts a POD vector into another boxed type.

Fails if the types are misaligned or not the same size.

Creates a new POD instance from an unaligned pointer.

This is an unsafe operation because the pointer is not validated in any way.

Creates a new POD instance with the inverse of map_copy()

Creates a new POD instance with the inverse of merge_copy()

Creates a new POD instance with the inverse of merge_box()

Creates a new POD instance with the inverse of merge_vec()

Creates a new POD instance with the inverse of map_slice_box()

Creates a POD reference with the inverse of map()

Creates a mutable POD reference with the inverse of map_mut()

Creates a POD reference with the inverse of merge()

Creates a mutable POD reference with the inverse of merge_mut()

Borrows the POD as a byte slice

Borrows the POD as a mutable byte slice

Safely creates a POD value from a potentially unaligned slice

Returns None if slice.len() is not the same as the type's size

Borrows a new instance of the POD from a byte slice

Returns None if slice.len() is not the same as the type's size

Borrows a mutable instance of the POD from a mutable byte slice

Returns None if slice.len() is not the same as the type's size

Converts a boxed slice to a boxed instance of the POD type

Fails if slice.len() is not the same as the type's size

Converts a byte vector to a boxed instance of the POD type

Fails if vec.len() is not the same as the type's size

Converts a boxed POD to a boxed slice

Converts a boxed POD to a byte vector

Safely borrows the aligned value mutably

See also: Aligned::from_unaligned_mut

Safely borrows the unaligned value mutably

See also: Aligned::from_unaligned_mut

Safely converts an unaligned value to its aligned equivalent

See also: Aligned::from_unaligned

Implementors