Struct byteorder_pod::EndianPrimitive
[−]
[src]
#[repr(C)]pub struct EndianPrimitive<B, T: EndianConvert, Alignment = ()> { /* fields omitted */ }
A POD container for a primitive that stores a value in the specified endianness
in memory, and transforms on get
/set
Methods
impl<B: ByteOrder, T: EndianConvert, A> EndianPrimitive<B, T, A>
[src]
fn new(v: T) -> Self
Creates a new value
fn get(&self) -> T
Transforms to the native value
fn set(&mut self, v: T)
Transforms from a native value
fn raw(&self) -> &T::Unaligned
Gets the inner untransformed value
fn raw_mut(&mut self) -> &mut T::Unaligned
A mutable reference to the inner untransformed value
Trait Implementations
impl<B: Pod, T: EndianConvert, A> Pod for EndianPrimitive<B, T, A>
[src]
unsafe fn uninitialized() -> Self
Generates a new uninitialized instance of a POD type.
fn zeroed() -> Self
Creates a new zeroed instance of a POD type.
fn copy(&self) -> Self
Creates a copy of this POD instance
fn map<T>(&self) -> Option<&T> where
T: Pod,
T: Pod,
Converts a POD reference from one to another type of the same size. Read more
fn map_mut<T>(&mut self) -> Option<&mut T> where
T: Pod,
T: Pod,
Converts a mutable POD reference from one to another type of the same size. Read more
fn map_copy<T>(&self) -> Option<T> where
T: Pod,
T: Pod,
Converts a POD type from one to another of the same size. Read more
fn try_map<T>(&self) -> Option<&T> where
T: Pod,
T: Pod,
Converts a POD reference from one to another type of the same or lesser size. Read more
fn try_map_mut<T>(&mut self) -> Option<&mut T> where
T: Pod,
T: Pod,
Converts a mutable POD reference from one to another type of the same or lesser size. Read more
fn try_map_copy<T>(&self) -> Option<T> where
T: Pod,
T: Pod,
Converts a POD type from one to another of the same or lesser size. Read more
fn map_box<T>(self: Box<Self>) -> Result<Box<T>, Box<Self>> where
T: Pod,
T: Pod,
Converts a boxed POD type from one to another of the same size. Read more
fn split<T>(&self) -> Option<&[T]> where
T: Pod,
T: Pod,
Converts a POD reference into a slice of another type. Read more
fn split_mut<T>(&mut self) -> Option<&mut [T]> where
T: Pod,
T: Pod,
Converts a mutable POD reference into a slice of another type. Read more
fn try_split<T>(&self) -> &[T] where
T: Pod,
T: Pod,
Converts a POD reference into a slice of another type. Read more
fn try_split_mut<T>(&mut self) -> &mut [T] where
T: Pod,
T: Pod,
Converts a mutable POD reference into a slice of another type. Read more
fn split_box<T>(self: Box<Self>) -> Result<Box<[T]>, Box<Self>> where
T: Pod,
T: Pod,
Converts a boxed POD object into a boxed slice of another type. Read more
fn split_vec<T>(self: Box<Self>) -> Result<Vec<T>, Box<Self>> where
T: Pod,
T: Pod,
Converts a boxed POD object into a vector of another type. Read more
fn map_slice<T>(s: &[Self]) -> Option<&[T]> where
T: Pod,
T: Pod,
Maps a POD slice from one type to another. Read more
fn map_slice_mut<T>(s: &mut [Self]) -> Option<&mut [T]> where
T: Pod,
T: Pod,
Maps a mutable POD slice from one type to another. Read more
fn try_map_slice<T>(s: &[Self]) -> &[T] where
T: Pod,
T: Pod,
Maps a POD slice from one type to another. Read more
fn try_map_slice_mut<T>(s: &mut [Self]) -> &mut [T] where
T: Pod,
T: Pod,
Maps a mutable POD slice from one type to another. Read more
fn map_slice_box<T>(s: Box<[Self]>) -> Result<Box<[T]>, Box<[Self]>> where
T: Pod,
T: Pod,
Maps a boxed POD slice from one type to another. Read more
fn map_slice_vec<T>(s: Vec<Self>) -> Result<Vec<T>, Vec<Self>> where
T: Pod,
T: Pod,
Maps a POD vector from one type to another. Read more
fn merge<T>(s: &[Self]) -> Option<&T> where
T: Pod,
T: Pod,
Converts a POD slice into another type. Read more
fn merge_mut<T>(s: &mut [Self]) -> Option<&mut T> where
T: Pod,
T: Pod,
Converts a mutable POD slice into another type. Read more
fn merge_copy<T>(s: &[Self]) -> Option<T> where
T: Pod,
T: Pod,
Converts a POD slice into another type. Read more
fn try_merge<T>(s: &[Self]) -> Option<&T> where
T: Pod,
T: Pod,
Converts a POD slice into another type. Read more
fn try_merge_mut<T>(s: &mut [Self]) -> Option<&mut T> where
T: Pod,
T: Pod,
Converts a mutable POD slice into another type. Read more
fn try_merge_copy<T>(s: &[Self]) -> Option<T> where
T: Pod,
T: Pod,
Converts a POD slice into another type. Read more
fn merge_box<T>(s: Box<[Self]>) -> Result<Box<T>, Box<[Self]>> where
T: Pod,
T: Pod,
Converts a boxed POD slice into another boxed type. Read more
fn merge_vec<T>(s: Vec<Self>) -> Result<Box<T>, Vec<Self>> where
T: Pod,
T: Pod,
Converts a POD vector into another boxed type. Read more
unsafe fn from_ptr<T>(source: *const T) -> Self
Creates a new POD instance from an unaligned pointer. Read more
fn from_ref<T>(p: &T) -> Option<Self> where
T: Pod,
T: Pod,
Creates a new POD instance with the inverse of map_copy()
fn from_slice<T>(p: &[T]) -> Option<Self> where
T: Pod,
T: Pod,
Creates a new POD instance with the inverse of merge_copy()
fn from_boxed_slice<T>(p: Box<[T]>) -> Result<Box<Self>, Box<[T]>> where
T: Pod,
T: Pod,
Creates a new POD instance with the inverse of merge_box()
fn from_vec<T>(p: Vec<T>) -> Result<Box<Self>, Vec<T>> where
T: Pod,
T: Pod,
Creates a new POD instance with the inverse of merge_vec()
fn slice_from_boxed_slice<T>(p: Box<[T]>) -> Result<Box<[Self]>, Box<[T]>> where
T: Pod,
T: Pod,
Creates a new POD instance with the inverse of map_slice_box()
fn ref_from<T>(p: &T) -> Option<&Self> where
T: Pod,
T: Pod,
Creates a POD reference with the inverse of map()
fn ref_from_mut<T>(p: &mut T) -> Option<&mut Self> where
T: Pod,
T: Pod,
Creates a mutable POD reference with the inverse of map_mut()
fn ref_from_slice<T>(p: &[T]) -> Option<&Self> where
T: Pod,
T: Pod,
Creates a POD reference with the inverse of merge()
fn ref_from_slice_mut<T>(p: &mut [T]) -> Option<&mut Self> where
T: Pod,
T: Pod,
Creates a mutable POD reference with the inverse of merge_mut()
fn as_bytes(&self) -> &[u8]
Borrows the POD as a byte slice
fn as_bytes_mut(&mut self) -> &mut [u8]
Borrows the POD as a mutable byte slice
fn from_bytes(p: &[u8]) -> Option<Self>
Safely creates a POD value from a potentially unaligned slice Read more
fn ref_from_bytes(p: &[u8]) -> Option<&Self>
Borrows a new instance of the POD from a byte slice Read more
fn ref_from_bytes_mut(p: &mut [u8]) -> Option<&mut Self>
Borrows a mutable instance of the POD from a mutable byte slice Read more
fn from_byte_slice(p: Box<[u8]>) -> Result<Box<Self>, Box<[u8]>>
Converts a boxed slice to a boxed instance of the POD type Read more
fn from_byte_vec(p: Vec<u8>) -> Result<Box<Self>, Vec<u8>>
Converts a byte vector to a boxed instance of the POD type Read more
fn into_byte_slice(self: Box<Self>) -> Box<[u8]>
Converts a boxed POD to a boxed slice
fn into_byte_vec(self: Box<Self>) -> Vec<u8>
Converts a boxed POD to a byte vector
fn as_aligned_mut<T>(&mut self) -> Option<&mut T> where
Self: Copy + Unaligned,
T: Pod + Aligned<Unaligned = Self>,
Self: Copy + Unaligned,
T: Pod + Aligned<Unaligned = Self>,
Safely borrows the aligned value mutably Read more
fn from_unaligned_mut<T>(s: &mut T) -> Option<&mut Self> where
Self: Aligned<Unaligned = T>,
T: Copy + Unaligned,
Self: Aligned<Unaligned = T>,
T: Copy + Unaligned,
Safely borrows the unaligned value mutably Read more
fn from_unaligned<T>(s: T) -> Self where
Self: Aligned<Unaligned = T>,
T: Copy + Unaligned,
Self: Aligned<Unaligned = T>,
T: Copy + Unaligned,
Safely converts an unaligned value to its aligned equivalent Read more
impl<B, T: EndianConvert, A: Unaligned> Unaligned for EndianPrimitive<B, T, A>
[src]
impl<B, T: EndianConvert, A: Unaligned> Packed for EndianPrimitive<B, T, A>
[src]
impl<B: ByteOrder, T: Default + EndianConvert, A> Default for EndianPrimitive<B, T, A>
[src]
impl<B: ByteOrder, T: EndianConvert, A> From<T> for EndianPrimitive<B, T, A>
[src]
fn from(v: T) -> Self
Performs the conversion.
impl<B: ByteOrder, T: Debug + EndianConvert, A> Debug for EndianPrimitive<B, T, A>
[src]
impl<ARHS, A, BRHS: ByteOrder, RHS: EndianConvert, B: ByteOrder, T: EndianConvert + PartialEq<RHS>> PartialEq<EndianPrimitive<BRHS, RHS, ARHS>> for EndianPrimitive<B, T, A>
[src]
fn eq(&self, other: &EndianPrimitive<BRHS, RHS, ARHS>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<A, B: ByteOrder, T: EndianConvert + Eq> Eq for EndianPrimitive<B, T, A>
[src]
impl<ARHS, A, BRHS: ByteOrder, RHS: EndianConvert, B: ByteOrder, T: EndianConvert + PartialOrd<RHS>> PartialOrd<EndianPrimitive<BRHS, RHS, ARHS>> for EndianPrimitive<B, T, A>
[src]
fn partial_cmp(
&self,
other: &EndianPrimitive<BRHS, RHS, ARHS>
) -> Option<Ordering>
&self,
other: &EndianPrimitive<BRHS, RHS, ARHS>
) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<B: ByteOrder, T: EndianConvert + Ord, A> Ord for EndianPrimitive<B, T, A>
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<B, T: EndianConvert + Hash, A> Hash for EndianPrimitive<B, T, A> where
T::Unaligned: Hash,
[src]
T::Unaligned: Hash,
fn hash<H: Hasher>(&self, h: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<B, T: EndianConvert, A> Clone for EndianPrimitive<B, T, A>
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more