pub struct Hex<T: AsRef<[u8]>>(pub T);Expand description
Display/Debug wrapper that renders bytes as lowercase hex without allocating an intermediate String.
Use this in Display or Debug implementations to format a byte slice
directly into the output Formatter via const-hex’s stack-allocated
buffer. For owned conversion to String, use hex() instead.
§Examples
use commonware_formatting::Hex;
struct Digest([u8; 32]);
impl core::fmt::Display for Digest {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", Hex(&self.0))
}
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: AsRef<[u8]>> Debug for Hex<T>
Available on neither commonware_stability_GAMMA nor commonware_stability_DELTA nor commonware_stability_EPSILON nor commonware_stability_RESERVED.
impl<T: AsRef<[u8]>> Debug for Hex<T>
Available on neither
commonware_stability_GAMMA nor commonware_stability_DELTA nor commonware_stability_EPSILON nor commonware_stability_RESERVED.Auto Trait Implementations§
impl<T> Freeze for Hex<T>where
T: Freeze,
impl<T> RefUnwindSafe for Hex<T>where
T: RefUnwindSafe,
impl<T> Send for Hex<T>where
T: Send,
impl<T> Sync for Hex<T>where
T: Sync,
impl<T> Unpin for Hex<T>where
T: Unpin,
impl<T> UnsafeUnpin for Hex<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Hex<T>where
T: 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