Enum Endianness

Source
pub enum Endianness {
    Little,
    Big,
}
Expand description

An endianness that is selectable at run-time.

Variants§

§

Little

Little endian byte order.

§

Big

Big endian byte order.

Trait Implementations§

Source§

impl Clone for Endianness

Source§

fn clone(&self) -> Endianness

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Endianness

Source§

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

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

impl Default for Endianness

Source§

fn default() -> Endianness

Returns the “default value” for a type. Read more
Source§

impl Endian for Endianness

Source§

fn from_big_endian(big_endian: bool) -> Option<Self>

Construct a specification for the endianness of some values. Read more
Source§

fn is_big_endian(self) -> bool

Return true for big endian byte order.
Source§

fn from_little_endian(little_endian: bool) -> Option<Self>

Construct a specification for the endianness of some values. Read more
Source§

fn is_little_endian(self) -> bool

Return true for little endian byte order.
Source§

fn read_u16(self, n: u16) -> u16

Converts an unsigned 16 bit integer to native endian.
Source§

fn read_u32(self, n: u32) -> u32

Converts an unsigned 32 bit integer to native endian.
Source§

fn read_u64(self, n: u64) -> u64

Converts an unsigned 64 bit integer to native endian.
Source§

fn read_i16(self, n: i16) -> i16

Converts a signed 16 bit integer to native endian.
Source§

fn read_i32(self, n: i32) -> i32

Converts a signed 32 bit integer to native endian.
Source§

fn read_i64(self, n: i64) -> i64

Converts a signed 64 bit integer to native endian.
Source§

fn read_u16_bytes(self, n: [u8; 2]) -> u16

Converts an unaligned unsigned 16 bit integer to native endian.
Source§

fn read_u32_bytes(self, n: [u8; 4]) -> u32

Converts an unaligned unsigned 32 bit integer to native endian.
Source§

fn read_u64_bytes(self, n: [u8; 8]) -> u64

Converts an unaligned unsigned 64 bit integer to native endian.
Source§

fn read_i16_bytes(self, n: [u8; 2]) -> i16

Converts an unaligned signed 16 bit integer to native endian.
Source§

fn read_i32_bytes(self, n: [u8; 4]) -> i32

Converts an unaligned signed 32 bit integer to native endian.
Source§

fn read_i64_bytes(self, n: [u8; 8]) -> i64

Converts an unaligned signed 64 bit integer to native endian.
Source§

fn write_u16(self, n: u16) -> u16

Converts an unsigned 16 bit integer from native endian.
Source§

fn write_u32(self, n: u32) -> u32

Converts an unsigned 32 bit integer from native endian.
Source§

fn write_u64(self, n: u64) -> u64

Converts an unsigned 64 bit integer from native endian.
Source§

fn write_i16(self, n: i16) -> i16

Converts a signed 16 bit integer from native endian.
Source§

fn write_i32(self, n: i32) -> i32

Converts a signed 32 bit integer from native endian.
Source§

fn write_i64(self, n: i64) -> i64

Converts a signed 64 bit integer from native endian.
Source§

fn write_u16_bytes(self, n: u16) -> [u8; 2]

Converts an unaligned unsigned 16 bit integer from native endian.
Source§

fn write_u32_bytes(self, n: u32) -> [u8; 4]

Converts an unaligned unsigned 32 bit integer from native endian.
Source§

fn write_u64_bytes(self, n: u64) -> [u8; 8]

Converts an unaligned unsigned 64 bit integer from native endian.
Source§

fn write_i16_bytes(self, n: i16) -> [u8; 2]

Converts an unaligned signed 16 bit integer from native endian.
Source§

fn write_i32_bytes(self, n: i32) -> [u8; 4]

Converts an unaligned signed 32 bit integer from native endian.
Source§

fn write_i64_bytes(self, n: i64) -> [u8; 8]

Converts an unaligned signed 64 bit integer from native endian.
Source§

impl Hash for Endianness

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given [Hasher]. Read more
1.3.0§

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

Feeds a slice of this type into the given [Hasher]. 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§

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 Copy for Endianness

Source§

impl Eq for Endianness

Source§

impl StructuralPartialEq for Endianness

Auto Trait Implementations§

§

impl Freeze for Endianness

§

impl RefUnwindSafe for Endianness

§

impl Send for Endianness

§

impl Sync for Endianness

§

impl Unpin for Endianness

§

impl UnwindSafe for Endianness

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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

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

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.