ByteCast

Trait ByteCast 

Source
pub trait ByteCast: Copy {
    const SIZEOF: usize;
    const SIGNED: bool;

    // Required methods
    fn from_bytes<O: Order>(buf: &[u8]) -> Self;
    fn into_bytes<O: Order>(&self, buf: &mut [u8]);
}

Required Associated Constants§

Required Methods§

Source

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ByteCast for bool

Source§

const SIZEOF: usize = 1usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for i8

Source§

const SIZEOF: usize = 1usize

Source§

const SIGNED: bool = true

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for i16

Source§

const SIZEOF: usize = 2usize

Source§

const SIGNED: bool = true

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for i32

Source§

const SIZEOF: usize = 4usize

Source§

const SIGNED: bool = true

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for i64

Source§

const SIZEOF: usize = 8usize

Source§

const SIGNED: bool = true

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for i128

Source§

const SIZEOF: usize = 16usize

Source§

const SIGNED: bool = true

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for isize

Source§

const SIZEOF: usize = 8usize

Source§

const SIGNED: bool = true

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for u8

Source§

const SIZEOF: usize = 1usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for u16

Source§

const SIZEOF: usize = 2usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for u32

Source§

const SIZEOF: usize = 4usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for u64

Source§

const SIZEOF: usize = 8usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for u128

Source§

const SIZEOF: usize = 16usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Source§

impl ByteCast for usize

Source§

const SIZEOF: usize = 8usize

Source§

const SIGNED: bool = false

Source§

fn from_bytes<O: Order>(buf: &[u8]) -> Self

Source§

fn into_bytes<O: Order>(&self, buf: &mut [u8])

Implementors§