Struct blart::ToUIntBE

source ·
pub struct ToUIntBE<N>(PhantomData<N>);
Expand description

This struct represents a conversion of signed integers to a format that allows the natural ordering of the numbers to match the lexicographic ordering of the bytes.

This is done by converting the numbers to their unsigned equivalent using x XOR (2 ^ (b - 1)) where b is the number of bits, then converting the unsigned value to a big endian format if needed.

Tuple Fields§

§0: PhantomData<N>

Trait Implementations§

source§

impl BytesMapping for ToUIntBE<NonZeroI128>

§

type Domain = NonZeroI128

The unconverted type that has a specific ordering
§

type Bytes = [u8; 16]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<NonZeroI16>

§

type Domain = NonZeroI16

The unconverted type that has a specific ordering
§

type Bytes = [u8; 2]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<NonZeroI32>

§

type Domain = NonZeroI32

The unconverted type that has a specific ordering
§

type Bytes = [u8; 4]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<NonZeroI64>

§

type Domain = NonZeroI64

The unconverted type that has a specific ordering
§

type Bytes = [u8; 8]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<NonZeroI8>

§

type Domain = NonZeroI8

The unconverted type that has a specific ordering
§

type Bytes = [u8; 1]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<NonZeroIsize>

§

type Domain = NonZeroIsize

The unconverted type that has a specific ordering
§

type Bytes = [u8; 8]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<i128>

§

type Domain = i128

The unconverted type that has a specific ordering
§

type Bytes = [u8; 16]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<i16>

§

type Domain = i16

The unconverted type that has a specific ordering
§

type Bytes = [u8; 2]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<i32>

§

type Domain = i32

The unconverted type that has a specific ordering
§

type Bytes = [u8; 4]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<i64>

§

type Domain = i64

The unconverted type that has a specific ordering
§

type Bytes = [u8; 8]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<i8>

§

type Domain = i8

The unconverted type that has a specific ordering
§

type Bytes = [u8; 1]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToUIntBE<isize>

§

type Domain = isize

The unconverted type that has a specific ordering
§

type Bytes = [u8; 8]

The bytestring type that the Self::Domain is converted to.
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type

Auto Trait Implementations§

§

impl<N> RefUnwindSafe for ToUIntBE<N>where N: RefUnwindSafe,

§

impl<N> Send for ToUIntBE<N>where N: Send,

§

impl<N> Sync for ToUIntBE<N>where N: Sync,

§

impl<N> Unpin for ToUIntBE<N>where N: Unpin,

§

impl<N> UnwindSafe for ToUIntBE<N>where N: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.