Struct pod::endian::EndianPrimitive [] [src]

pub struct EndianPrimitive<B, T: EndianConvert> {
    // some 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> EndianPrimitive<B, T>

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, T: EndianConvert> Pod for EndianPrimitive<B, T>

fn mut_aligned<T: Pod + Aligned<Unaligned=Self>>(&mut self) -> Option<&mut T> where Self: Copy + Unaligned

fn mut_unaligned<T: Copy + Unaligned>(s: &mut T) -> Option<&mut Self> where Self: Aligned<Unaligned=T>

fn aligned<T: Copy + Unaligned>(s: T) -> Self where Self: Aligned<Unaligned=T>

fn as_slice<'a>(&'a self) -> &'a [u8]

fn mut_slice<'a>(&'a mut self) -> &'a mut [u8]

fn from_slice<'a>(slice: &'a [u8]) -> &'a Self where Self: Unaligned

fn from_mut_slice<'a>(slice: &'a mut [u8]) -> &'a mut Self where Self: Unaligned

fn from_vec(vec: Vec<u8>) -> Box<Self> where Self: Unaligned

fn from_box(slice: Box<[u8]>) -> Box<Self> where Self: Unaligned

fn to_vec(self: Box<Self>) -> Vec<u8>

fn to_boxed_slice(self: Box<Self>) -> Box<[u8]>

fn map<'a, T: Pod + Unaligned>(&'a self) -> &'a T where Self: Unaligned

fn map_mut<'a, T: Pod + Unaligned>(&'a mut self) -> &'a mut T where Self: Unaligned

unsafe fn uninitialized() -> Self

fn zeroed() -> Self

fn map_slice<'a, T: Pod + Unaligned>(s: &'a [Self]) -> &'a [T] where Self: Unaligned

fn map_mut_slice<'a, T: Pod + Unaligned>(s: &'a mut [Self]) -> &'a mut [T] where Self: Unaligned

impl<B, T: EndianConvert> Unaligned for EndianPrimitive<B, T>

impl<B, T: EndianConvert> Packed for EndianPrimitive<B, T>

impl<B: ByteOrder, T: Default + EndianConvert> Default for EndianPrimitive<B, T>

fn default() -> Self

impl<B: ByteOrder, T: EndianConvert> From<T> for EndianPrimitive<B, T>

fn from(v: T) -> Self

impl<B: ByteOrder, T: Debug + EndianConvert> Debug for EndianPrimitive<B, T>

fn fmt(&self, f: &mut Formatter) -> Result

impl<BRHS: ByteOrder, RHS: EndianConvert, B: ByteOrder, T: EndianConvert + PartialEq<RHS>> PartialEq<EndianPrimitive<BRHS, RHS>> for EndianPrimitive<B, T>

fn eq(&self, other: &EndianPrimitive<BRHS, RHS>) -> bool

fn ne(&self, other: &Rhs) -> bool

impl<B: ByteOrder, T: EndianConvert + Eq> Eq for EndianPrimitive<B, T>

impl<BRHS: ByteOrder, RHS: EndianConvert, B: ByteOrder, T: EndianConvert + PartialOrd<RHS>> PartialOrd<EndianPrimitive<BRHS, RHS>> for EndianPrimitive<B, T>

fn partial_cmp(&self, other: &EndianPrimitive<BRHS, RHS>) -> Option<Ordering>

fn lt(&self, other: &Rhs) -> bool

fn le(&self, other: &Rhs) -> bool

fn gt(&self, other: &Rhs) -> bool

fn ge(&self, other: &Rhs) -> bool

impl<B: ByteOrder, T: EndianConvert + Ord> Ord for EndianPrimitive<B, T>

fn cmp(&self, other: &Self) -> Ordering

impl<B, T: EndianConvert + Hash> Hash for EndianPrimitive<B, T> where T::Unaligned: Hash

fn hash<H: Hasher>(&self, h: &mut H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl<B, T: EndianConvert> Clone for EndianPrimitive<B, T>

fn clone(&self) -> Self

fn clone_from(&mut self, source: &Self)

impl<B, T: EndianConvert> Copy for EndianPrimitive<B, T>