Trait Pod

Source
pub unsafe trait Pod {
    // Required methods
    fn as_bytes(&self) -> &[u8] ;
    fn as_bytes_mut(&mut self) -> &mut [u8] ;

    // Provided methods
    fn from_bytes(bytes: &[u8]) -> Result<&Self>
       where Self: Sized { ... }
    unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
       where Self: Sized { ... }
    fn from_bytes_mut(bytes: &mut [u8]) -> Result<&mut Self>
       where Self: Sized { ... }
    unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
       where Self: Sized { ... }
}
Expand description

§Safety

Implementors must ensure that the type is nothing more than a sequence of bytes

Required Methods§

Source

fn as_bytes(&self) -> &[u8]

Source

fn as_bytes_mut(&mut self) -> &mut [u8]

Provided Methods§

Source

fn from_bytes(bytes: &[u8]) -> Result<&Self>
where Self: Sized,

§Errors

TODO

Source

unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self
where Self: Sized,

§Safety

TODO

Source

fn from_bytes_mut(bytes: &mut [u8]) -> Result<&mut Self>
where Self: Sized,

§Errors

TODO

Source

unsafe fn from_bytes_mut_unchecked(bytes: &mut [u8]) -> &mut Self
where Self: Sized,

§Safety

TODO

Implementations on Foreign Types§

Source§

impl Pod for f32

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for f64

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for i8

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for i16

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for i32

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for i64

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for i128

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for isize

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for u8

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for u16

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for u32

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for u64

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for u128

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl Pod for usize

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [f32; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [f64; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [i8; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [i16; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [i32; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [i64; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [i128; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [isize; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [u8; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [u16; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [u32; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [u64; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [u128; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Source§

impl<const N: usize> Pod for [usize; N]

Source§

fn as_bytes(&self) -> &[u8]

Source§

fn as_bytes_mut(&mut self) -> &mut [u8]

Implementors§