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>
impl BytesMapping for ToUIntBE<NonZeroI128>
§type Domain = NonZeroI128
type Domain = NonZeroI128
The unconverted type that has a specific ordering
§type Bytes = [u8; 16]
type Bytes = [u8; 16]
The bytestring type that the
Self::Domain
is converted to.source§fn to_bytes(value: Self::Domain) -> Self::Bytes
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
fn from_bytes(bytes: Self::Bytes) -> Self::Domain
Convert the bytestring type back into the domain type
source§impl BytesMapping for ToUIntBE<NonZeroI16>
impl BytesMapping for ToUIntBE<NonZeroI16>
§type Domain = NonZeroI16
type Domain = NonZeroI16
The unconverted type that has a specific ordering
§type Bytes = [u8; 2]
type Bytes = [u8; 2]
The bytestring type that the
Self::Domain
is converted to.source§fn to_bytes(value: Self::Domain) -> Self::Bytes
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
fn from_bytes(bytes: Self::Bytes) -> Self::Domain
Convert the bytestring type back into the domain type
source§impl BytesMapping for ToUIntBE<NonZeroI32>
impl BytesMapping for ToUIntBE<NonZeroI32>
§type Domain = NonZeroI32
type Domain = NonZeroI32
The unconverted type that has a specific ordering
§type Bytes = [u8; 4]
type Bytes = [u8; 4]
The bytestring type that the
Self::Domain
is converted to.source§fn to_bytes(value: Self::Domain) -> Self::Bytes
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
fn from_bytes(bytes: Self::Bytes) -> Self::Domain
Convert the bytestring type back into the domain type
source§impl BytesMapping for ToUIntBE<NonZeroI64>
impl BytesMapping for ToUIntBE<NonZeroI64>
§type Domain = NonZeroI64
type Domain = NonZeroI64
The unconverted type that has a specific ordering
§type Bytes = [u8; 8]
type Bytes = [u8; 8]
The bytestring type that the
Self::Domain
is converted to.source§fn to_bytes(value: Self::Domain) -> Self::Bytes
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
fn from_bytes(bytes: Self::Bytes) -> Self::Domain
Convert the bytestring type back into the domain type
source§impl BytesMapping for ToUIntBE<NonZeroI8>
impl BytesMapping for ToUIntBE<NonZeroI8>
source§impl BytesMapping for ToUIntBE<NonZeroIsize>
impl BytesMapping for ToUIntBE<NonZeroIsize>
§type Domain = NonZeroIsize
type Domain = NonZeroIsize
The unconverted type that has a specific ordering
§type Bytes = [u8; 8]
type Bytes = [u8; 8]
The bytestring type that the
Self::Domain
is converted to.source§fn to_bytes(value: Self::Domain) -> Self::Bytes
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
fn from_bytes(bytes: Self::Bytes) -> Self::Domain
Convert the bytestring type back into the domain type
source§impl BytesMapping for ToUIntBE<i128>
impl BytesMapping for ToUIntBE<i128>
source§impl BytesMapping for ToUIntBE<i16>
impl BytesMapping for ToUIntBE<i16>
source§impl BytesMapping for ToUIntBE<i32>
impl BytesMapping for ToUIntBE<i32>
source§impl BytesMapping for ToUIntBE<i64>
impl BytesMapping for ToUIntBE<i64>
source§impl BytesMapping for ToUIntBE<i8>
impl BytesMapping for ToUIntBE<i8>
source§impl BytesMapping for ToUIntBE<isize>
impl BytesMapping for ToUIntBE<isize>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more