Trait hex_conservative::display::DisplayHex

source ·
pub trait DisplayHex: Copy + IsRef {
    type Display: Display + Debug + LowerHex + UpperHex;

    // Required method
    fn as_hex(self) -> Self::Display;

    // Provided method
    fn hex_reserve_suggestion(self) -> usize { ... }
}
Expand description

Extension trait for types that can be displayed as hex.

Types that have a single, obvious text representation being hex should not implement this trait and simply implement Display instead.

This trait should be generally implemented for references only. We would prefer to use GAT but that is beyond our MSRV. As a lint we require the IsRef trait which is implemented for all references.

Required Associated Types§

source

type Display: Display + Debug + LowerHex + UpperHex

The type providing fmt::Display implementation.

This is usually a wrapper type holding a reference to Self.

Required Methods§

source

fn as_hex(self) -> Self::Display

Display Self as a continuous sequence of ASCII hex chars.

Provided Methods§

source

fn hex_reserve_suggestion(self) -> usize

Hints how much bytes to reserve when creating a String.

Implementors that know the number of produced bytes upfront should override this. Defaults to 0.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> DisplayHex for &'a [u8; 1]

source§

impl<'a> DisplayHex for &'a [u8; 2]

source§

impl<'a> DisplayHex for &'a [u8; 3]

source§

impl<'a> DisplayHex for &'a [u8; 4]

source§

impl<'a> DisplayHex for &'a [u8; 5]

source§

impl<'a> DisplayHex for &'a [u8; 6]

source§

impl<'a> DisplayHex for &'a [u8; 7]

source§

impl<'a> DisplayHex for &'a [u8; 8]

source§

impl<'a> DisplayHex for &'a [u8; 9]

source§

impl<'a> DisplayHex for &'a [u8; 10]

source§

impl<'a> DisplayHex for &'a [u8; 11]

source§

impl<'a> DisplayHex for &'a [u8; 12]

source§

impl<'a> DisplayHex for &'a [u8; 13]

source§

impl<'a> DisplayHex for &'a [u8; 14]

source§

impl<'a> DisplayHex for &'a [u8; 15]

source§

impl<'a> DisplayHex for &'a [u8; 16]

source§

impl<'a> DisplayHex for &'a [u8; 20]

source§

impl<'a> DisplayHex for &'a [u8; 32]

source§

impl<'a> DisplayHex for &'a [u8; 33]

source§

impl<'a> DisplayHex for &'a [u8; 64]

source§

impl<'a> DisplayHex for &'a [u8; 65]

source§

impl<'a> DisplayHex for &'a [u8; 128]

source§

impl<'a> DisplayHex for &'a [u8; 256]

source§

impl<'a> DisplayHex for &'a [u8; 512]

source§

impl<'a> DisplayHex for &'a [u8; 1024]

source§

impl<'a> DisplayHex for &'a [u8; 2048]

source§

impl<'a> DisplayHex for &'a [u8; 4096]

source§

impl<'a> DisplayHex for &'a [u8]

Implementors§