Skip to main content

Human

Trait Human 

Source
pub trait Human: Sized {
    type Rendered: Display;

    // Required method
    fn human(self) -> Self::Rendered;
}
Expand description

A quantity that renders itself the way an operator would write it.

use krabka_units::{fmt::Human, prelude::*};

assert_eq!(mebibytes(512).human().to_string(), "512MiB");
assert_eq!(days(7).human().to_string(), "7d");
assert_eq!(mebibytes_per_sec(10).human().to_string(), "10MiB/s");

Required Associated Types§

Source

type Rendered: Display

The Display adapter this quantity renders through.

Required Methods§

Source

fn human(self) -> Self::Rendered

This quantity, ready to print.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§