[go: up one dir, main page]

Enum Endianness

Source
pub enum Endianness {
    LittleEndian,
    BigEndian,
}

Variants§

§

LittleEndian

§

BigEndian

Implementations§

Source§

impl Endianness

Source

pub const NATIVE: Endianness = Endianness::LittleEndian

Source§

impl Endianness

Source

pub fn conversion_necessary(self) -> bool

Source

pub fn swap_slice_u8(self, _: &mut [u8])

Source

pub fn swap_slice_i8(self, _: &mut [i8])

Source§

impl Endianness

Source

pub fn read_u16(self, slice: &[u8]) -> u16

Source

pub fn swap_u16(self, value: &mut u16)

Source

pub fn swap_slice_u16(self, slice: &mut [u16])

Source§

impl Endianness

Source

pub fn read_u32(self, slice: &[u8]) -> u32

Source

pub fn swap_u32(self, value: &mut u32)

Source

pub fn swap_slice_u32(self, slice: &mut [u32])

Source§

impl Endianness

Source

pub fn read_u64(self, slice: &[u8]) -> u64

Source

pub fn swap_u64(self, value: &mut u64)

Source

pub fn swap_slice_u64(self, slice: &mut [u64])

Source§

impl Endianness

Source

pub fn read_u128(self, slice: &[u8]) -> u128

Source

pub fn swap_u128(self, value: &mut u128)

Source

pub fn swap_slice_u128(self, slice: &mut [u128])

Source§

impl Endianness

Source

pub fn read_i16(self, slice: &[u8]) -> i16

Source

pub fn swap_i16(self, value: &mut i16)

Source

pub fn swap_slice_i16(self, slice: &mut [i16])

Source§

impl Endianness

Source

pub fn read_i32(self, slice: &[u8]) -> i32

Source

pub fn swap_i32(self, value: &mut i32)

Source

pub fn swap_slice_i32(self, slice: &mut [i32])

Source§

impl Endianness

Source

pub fn read_i64(self, slice: &[u8]) -> i64

Source

pub fn swap_i64(self, value: &mut i64)

Source

pub fn swap_slice_i64(self, slice: &mut [i64])

Source§

impl Endianness

Source

pub fn read_i128(self, slice: &[u8]) -> i128

Source

pub fn swap_i128(self, value: &mut i128)

Source

pub fn swap_slice_i128(self, slice: &mut [i128])

Source§

impl Endianness

Source

pub fn read_f32(self, slice: &[u8]) -> f32

Source

pub fn read_f64(self, slice: &[u8]) -> f64

Source

pub fn swap_f32(self, value: &mut f32)

Source

pub fn swap_f64(self, value: &mut f64)

Source

pub fn swap_slice_f32(self, slice: &mut [f32])

Source

pub fn swap_slice_f64(self, slice: &mut [f64])

Trait Implementations§

Source§

impl Clone for Endianness

Source§

fn clone(&self) -> Endianness

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Context for Endianness

Source§

impl Debug for Endianness

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Ord for Endianness

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Endianness

Source§

fn eq(&self, other: &Endianness) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Endianness

Source§

fn partial_cmp(&self, other: &Endianness) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, C: Context> Readable<'a, C> for Endianness

Source§

fn read_from<R: Reader<'a, C>>(reader: &mut R) -> Result<Self, C::Error>

Source§

fn minimum_bytes_needed() -> usize

Source§

fn read_from_buffer(buffer: &'a [u8]) -> Result<Self, C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Deserializes from a given buffer. Read more
Source§

fn read_with_length_from_buffer( buffer: &'a [u8], ) -> (Result<Self, C::Error>, usize)
where Self: DefaultContext<Context = C>, C: Default,

Deserializes from a given buffer while also returning the amount of bytes consumed. Read more
Source§

fn read_from_buffer_copying_data(buffer: &[u8]) -> Result<Self, C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Deserializes from a given buffer. Read more
Source§

fn read_with_length_from_buffer_copying_data( buffer: &[u8], ) -> (Result<Self, C::Error>, usize)
where Self: DefaultContext<Context = C>, C: Default,

Deserializes from a given buffer while also returning the amount of bytes consumed. Read more
Source§

fn read_from_stream_unbuffered(stream: impl Read) -> Result<Self, C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Reads from a given stream without any buffering. Read more
Source§

fn read_from_stream_buffered(stream: impl Read) -> Result<Self, C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Reads from a given stream with internal buffering. Read more
Source§

fn read_from_file(path: impl AsRef<Path>) -> Result<Self, C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Source§

fn read_from_buffer_with_ctx( context: C, buffer: &'a [u8], ) -> Result<Self, C::Error>

Source§

fn read_with_length_from_buffer_with_ctx( context: C, buffer: &'a [u8], ) -> (Result<Self, C::Error>, usize)

Source§

fn read_from_buffer_copying_data_with_ctx( context: C, buffer: &[u8], ) -> Result<Self, C::Error>

Source§

fn read_with_length_from_buffer_copying_data_with_ctx( context: C, buffer: &[u8], ) -> (Result<Self, C::Error>, usize)

Source§

fn read_with_length_from_buffer_copying_data_with_ctx_mut( context: &mut C, buffer: &[u8], ) -> (Result<Self, C::Error>, usize)

Source§

fn read_from_stream_unbuffered_with_ctx<S: Read>( context: C, stream: S, ) -> Result<Self, C::Error>

Source§

fn read_from_stream_buffered_with_ctx<S: Read>( context: C, stream: S, ) -> Result<Self, C::Error>

Source§

fn read_from_file_with_ctx( context: C, path: impl AsRef<Path>, ) -> Result<Self, C::Error>

Source§

impl<C: Context> Writable<C> for Endianness

Source§

fn write_to<T: ?Sized + Writer<C>>( &self, writer: &mut T, ) -> Result<(), C::Error>

Source§

fn bytes_needed(&self) -> Result<usize, C::Error>

Source§

fn write_to_buffer(&self, buffer: &mut [u8]) -> Result<(), C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Source§

fn write_to_vec(&self) -> Result<Vec<u8>, C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Source§

fn write_to_stream<S: Write>(&self, stream: S) -> Result<(), C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Source§

fn write_to_file(&self, path: impl AsRef<Path>) -> Result<(), C::Error>
where Self: DefaultContext<Context = C>, C: Default,

Source§

fn write_to_buffer_with_ctx( &self, context: C, buffer: &mut [u8], ) -> Result<(), C::Error>

Source§

fn write_to_buffer_with_ctx_mut( &self, context: &mut C, buffer: &mut [u8], ) -> Result<(), C::Error>

Source§

fn write_to_vec_with_ctx(&self, context: C) -> Result<Vec<u8>, C::Error>

Source§

fn write_to_vec_with_ctx_mut( &self, context: &mut C, ) -> Result<Vec<u8>, C::Error>

Source§

fn write_to_stream_with_ctx<S: Write>( &self, context: C, stream: S, ) -> Result<(), C::Error>

Source§

fn write_to_file_with_ctx( &self, context: C, path: impl AsRef<Path>, ) -> Result<(), C::Error>

Source§

impl Copy for Endianness

Source§

impl Eq for Endianness

Source§

impl StructuralPartialEq for Endianness

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.