BigEndian

Struct BigEndian 

Source
pub struct BigEndian<T: Endianable>(/* private fields */);
Expand description

A wrapper type that ensures the inner Endianable value is treated as Big-Endian.

When creating a BigEndian instance, the value is converted to big-endian. When retrieving the inner value with get, it is converted back to the native endianness.

Implementations§

Source§

impl<T: Endianable> BigEndian<T>

Source

pub fn new(val: T) -> Self

Creates a new BigEndian instance from a value, converting it to big-endian.

Source

pub fn get(self) -> T

Returns the inner value, converting it from big-endian to the native endianness.

Source

pub fn get_raw(self) -> T

Returns the underlying native representation without any endian conversion.

Trait Implementations§

Source§

impl Byteable for BigEndian<f32>

Source§

type ByteArray = [u8; 4]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<f64>

Source§

type ByteArray = [u8; 8]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<i128>

Source§

type ByteArray = [u8; 16]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<i16>

Source§

type ByteArray = [u8; 2]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<i32>

Source§

type ByteArray = [u8; 4]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<i64>

Source§

type ByteArray = [u8; 8]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<i8>

Source§

type ByteArray = [u8; 1]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<isize>

Source§

type ByteArray = [u8; 8]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<u128>

Source§

type ByteArray = [u8; 16]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<u16>

Source§

type ByteArray = [u8; 2]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<u32>

Source§

type ByteArray = [u8; 4]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<u64>

Source§

type ByteArray = [u8; 8]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<u8>

Source§

type ByteArray = [u8; 1]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl Byteable for BigEndian<usize>

Source§

type ByteArray = [u8; 8]

The associated byte array type that can represent Self.
Source§

fn as_bytearray(self) -> Self::ByteArray

Converts self into its ByteableByteArray representation.
Source§

fn from_bytearray(ba: Self::ByteArray) -> Self

Creates an instance of Self from a ByteableByteArray.
Source§

fn binary_size() -> usize

Returns the size in bytes of the binary representation of this type.
Source§

impl<T: Clone + Endianable> Clone for BigEndian<T>

Source§

fn clone(&self) -> BigEndian<T>

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Endianable> Debug for BigEndian<T>

Source§

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

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

impl<T: Endianable + Default> Default for BigEndian<T>

Source§

fn default() -> Self

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

impl<T: Hash + Endianable> Hash for BigEndian<T>

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<T: Ord + Endianable> Ord for BigEndian<T>

Source§

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

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

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

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

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

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

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

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

impl<T: PartialEq + Endianable> PartialEq for BigEndian<T>

Source§

fn eq(&self, other: &Self) -> 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<T: PartialOrd + Endianable> PartialOrd for BigEndian<T>

Source§

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

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

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

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

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§

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

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

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<T: Copy + Endianable> Copy for BigEndian<T>

Source§

impl<T: Eq + Endianable> Eq for BigEndian<T>

Auto Trait Implementations§

§

impl<T> Freeze for BigEndian<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for BigEndian<T>
where T: RefUnwindSafe,

§

impl<T> Send for BigEndian<T>
where T: Send,

§

impl<T> Sync for BigEndian<T>
where T: Sync,

§

impl<T> Unpin for BigEndian<T>
where T: Unpin,

§

impl<T> UnwindSafe for BigEndian<T>
where T: UnwindSafe,

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
Source§

impl<Raw, Regular> ByteableRaw<Regular> for Raw
where Regular: ByteableRegular<Raw = Raw>, Raw: Byteable,

Source§

fn to_regular(self) -> Regular

Converts the raw representation to the regular form.
Source§

fn from_regular(regular: Regular) -> Raw

Converts the regular form to the raw representation.
§

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

§

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
§

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.