Trait byte_slice_cast::FromByteSlice

source ·
pub unsafe trait FromByteSlice
where Self: Sized,
{ // Required methods fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[Self], Error>; fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [Self], Error>; }
Expand description

Trait for converting from a byte slice to a slice of a fundamental, built-in numeric type.

This trait is an implementation detail. Use the AsSliceOf and AsMutSliceOf traits.

Required Methods§

source

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[Self], Error>

Convert from an immutable byte slice to a immutable slice of a fundamental, built-in numeric type

source

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [Self], Error>

Convert from an mutable byte slice to a mutable slice of a fundamental, built-in numeric type

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromByteSlice for f32

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[f32], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [f32], Error>

source§

impl FromByteSlice for f64

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[f64], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [f64], Error>

source§

impl FromByteSlice for i8

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[i8], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [i8], Error>

source§

impl FromByteSlice for i16

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[i16], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [i16], Error>

source§

impl FromByteSlice for i32

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[i32], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [i32], Error>

source§

impl FromByteSlice for i64

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[i64], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [i64], Error>

source§

impl FromByteSlice for i128

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[i128], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [i128], Error>

source§

impl FromByteSlice for isize

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[isize], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [isize], Error>

source§

impl FromByteSlice for u8

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[u8], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [u8], Error>

source§

impl FromByteSlice for u16

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[u16], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [u16], Error>

source§

impl FromByteSlice for u32

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[u32], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [u32], Error>

source§

impl FromByteSlice for u64

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[u64], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [u64], Error>

source§

impl FromByteSlice for u128

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>(slice: &T) -> Result<&[u128], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [u128], Error>

source§

impl FromByteSlice for usize

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[usize], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [usize], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[f32; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[f32; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[f64; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[f64; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[i8; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[i8; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[i16; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[i16; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[i32; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[i32; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[i64; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[i64; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[i128; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[i128; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[isize; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[isize; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[u8; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[u8; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[u16; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[u16; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[u32; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[u32; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[u64; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[u64; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[u128; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[u128; N]], Error>

source§

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

source§

fn from_byte_slice<T: AsRef<[u8]> + ?Sized>( slice: &T, ) -> Result<&[[usize; N]], Error>

source§

fn from_mut_byte_slice<T: AsMut<[u8]> + ?Sized>( slice: &mut T, ) -> Result<&mut [[usize; N]], Error>

Implementors§