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§
Required Methods§
Provided Methods§
Sourcefn hex_reserve_suggestion(self) -> usize
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.