pub struct Display<T> { /* private fields */ }Expand description
A wrapper for displaying a byte slice as a hexadecimal string.
§Examples
let bytes = &[0xde, 0xad, 0xbe, 0xef];
let displayed = fashex::Display::from(bytes);
assert_eq!(format!("{}", &displayed), "deadbeef");
assert_eq!(format!("{:X}", &displayed), "DEADBEEF");
assert_eq!(format!("{:#x}", &displayed), "0xdeadbeef");
assert_eq!(format!("{:#X}", &displayed), "0xDEADBEEF");§Notes
The input bytes should be less than or equal to 128 bytes in length when
the alloc feature is disabled.
Implementations§
Trait Implementations§
Source§impl<T> BorrowMut<T> for Display<T>
impl<T> BorrowMut<T> for Display<T>
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T: Copy> Copy for Display<T>
impl<T: Eq> Eq for Display<T>
impl<T: PartialEq> StructuralPartialEq for Display<T>
Auto Trait Implementations§
impl<T> Freeze for Display<T>where
T: Freeze,
impl<T> RefUnwindSafe for Display<T>where
T: RefUnwindSafe,
impl<T> Send for Display<T>where
T: Send,
impl<T> Sync for Display<T>where
T: Sync,
impl<T> Unpin for Display<T>where
T: Unpin,
impl<T> UnsafeUnpin for Display<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Display<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