#[repr(transparent)]pub struct Hex<T: ?Sized>(pub T);
Expand description
Lowercase hex serialization of bytes T
.
This is a simple wrapper around a sequence of bytes T
that will be serialized,
deserialized and formatted as a lowercase hexadecimal string.
The type has a transparent representation, and implements the
relevant bytemuck
traits, which allows using it even in situations
where you do not have ownership of the T
.
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<'a, T> Deserialize<'a> for Hex<T>
impl<'a, T> Deserialize<'a> for Hex<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: Ord + ?Sized> Ord for Hex<T>
impl<T: Ord + ?Sized> Ord for Hex<T>
Source§impl<T: PartialOrd + ?Sized> PartialOrd for Hex<T>
impl<T: PartialOrd + ?Sized> PartialOrd for Hex<T>
Source§impl<T: ?Sized> TransparentWrapper<T> for Hex<T>
impl<T: ?Sized> TransparentWrapper<T> for Hex<T>
Source§fn wrap_ref(s: &Inner) -> &Self
fn wrap_ref(s: &Inner) -> &Self
Convert a reference to the inner type into a reference to the wrapper
type.
Source§fn wrap_mut(s: &mut Inner) -> &mut Self
fn wrap_mut(s: &mut Inner) -> &mut Self
Convert a mutable reference to the inner type into a mutable reference to
the wrapper type.
Source§fn wrap_slice(s: &[Inner]) -> &[Self]where
Self: Sized,
fn wrap_slice(s: &[Inner]) -> &[Self]where
Self: Sized,
Convert a slice to the inner type into a slice to the wrapper type.
Source§fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]where
Self: Sized,
fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]where
Self: Sized,
Convert a mutable slice to the inner type into a mutable slice to the
wrapper type.
Source§fn peel_ref(s: &Self) -> &Inner
fn peel_ref(s: &Self) -> &Inner
Convert a reference to the wrapper type into a reference to the inner
type.
Source§fn peel_mut(s: &mut Self) -> &mut Inner
fn peel_mut(s: &mut Self) -> &mut Inner
Convert a mutable reference to the wrapper type into a mutable reference
to the inner type.
Source§fn peel_slice(s: &[Self]) -> &[Inner]where
Self: Sized,
fn peel_slice(s: &[Self]) -> &[Inner]where
Self: Sized,
Convert a slice to the wrapped type into a slice to the inner type.
Source§fn peel_slice_mut(s: &mut [Self]) -> &mut [Inner]where
Self: Sized,
fn peel_slice_mut(s: &mut [Self]) -> &mut [Inner]where
Self: Sized,
Convert a mutable slice to the wrapped type into a mutable slice to the
inner type.
impl<T: Copy + ?Sized> Copy for Hex<T>
impl<T: Eq + ?Sized> Eq for Hex<T>
impl<T> Pod for Hex<T>
impl<T: ?Sized> StructuralPartialEq for Hex<T>
Auto Trait Implementations§
impl<T> Freeze for Hex<T>
impl<T> RefUnwindSafe for Hex<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Hex<T>
impl<T> Sync for Hex<T>
impl<T> Unpin for Hex<T>
impl<T> UnwindSafe for Hex<T>where
T: UnwindSafe + ?Sized,
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)