Struct DisplayHex

Source
pub struct DisplayHex<'a>(pub &'a [u8]);
Expand description

A display helper for formatting a slice of bytes as hex with different options using Rust’s builtin format language

Tuple Fields§

§0: &'a [u8]

Implementations§

Source§

impl<'a> DisplayHex<'a>

Source

pub fn new<'b, T>(item: &'b T) -> DisplayHex<'a>
where 'b: 'a, T: AsRef<[u8]>,

Display the underlying bytes of item as hexadecimal digits

Trait Implementations§

Source§

impl<'a> Display for DisplayHex<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> LowerHex for DisplayHex<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> PrettyPrint for DisplayHex<'a>

Source§

fn render(&self) -> Document

The core of the PrettyPrint functionality. Read more
Source§

fn to_pretty_string(&self) -> String

Produce a String containing the results of pretty-printing this object. Read more
Source§

fn pretty_print(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Pretty-print this object to the given core::fmt::Formatter. Read more
Source§

impl<'a> ToHex for DisplayHex<'a>

Source§

fn to_hex(&self) -> String

Convert this value to a String containing the hexadecimal digits that correspond to the byte representation of this value. Read more
Source§

fn to_hex_with_prefix(&self) -> String

Same as ToHex::to_hex, but ensures the output contains a leading 0x prefix.

Auto Trait Implementations§

§

impl<'a> Freeze for DisplayHex<'a>

§

impl<'a> RefUnwindSafe for DisplayHex<'a>

§

impl<'a> Send for DisplayHex<'a>

§

impl<'a> Sync for DisplayHex<'a>

§

impl<'a> Unpin for DisplayHex<'a>

§

impl<'a> UnwindSafe for DisplayHex<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V