pub struct Display { /* private fields */ }
Expand description
A helper/builder that displays amount with specified settings.
This provides richer interface than fmt::Formatter
:
- Ability to select denomination
- Show or hide denomination
- Dynamically-selected denomination - show in sats if less than 1 BTC.
However, this can still be combined with fmt::Formatter
options to precisely control zeros,
padding, alignment… The formatting works like floats from core
but note that precision will
never be lossy - that means no rounding.
Note: This implementation is currently unstable. The only thing that we can promise is that
unless the precision is changed, this will display an accurate, human-readable number, and the
default serialization (one with unmodified fmt::Formatter
options) will round-trip with FromStr
See Amount::display_in
and Amount::display_dynamic
on how to construct this.
Implementations§
source§impl Display
impl Display
sourcepub fn show_denomination(self) -> Self
pub fn show_denomination(self) -> Self
Makes subsequent calls to Display::fmt
display denomination.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Display
impl RefUnwindSafe for Display
impl Send for Display
impl Sync for Display
impl Unpin for Display
impl UnwindSafe for Display
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)