pub trait HumanThroughput: Sealed + Sized {
    // Required method
    fn human_throughput<'a>(
        self,
        unit: impl Into<Cow<'a, str>>
    ) -> HumanThroughputData<'a>;

    // Provided methods
    fn human_throughput_bare(self) -> HumanThroughputData<'static> { ... }
    fn human_throughput_bytes(self) -> HumanThroughputData<'static> { ... }
}
Expand description

Human Throughput trait, supporting all Rust primitive number types.

Required Methods§

source

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

Generate beautiful human-readable throughputs supporting automatic prefixes and custom units.

use human_repr::HumanThroughput;
assert_eq!("1.2k°C/s", 1234.5.human_throughput("°C"));

Provided Methods§

source

fn human_throughput_bare(self) -> HumanThroughputData<'static>

Generate beautiful human-readable throughputs supporting automatic prefixes.

use human_repr::HumanThroughput;
assert_eq!("1.2k/s", 1234.5.human_throughput_bare());
source

fn human_throughput_bytes(self) -> HumanThroughputData<'static>

Generate beautiful human-readable throughputs supporting automatic prefixes and Bytes B as the unit.

use human_repr::HumanThroughput;
assert_eq!("1.2kB/s", 1234.5.human_throughput_bytes());

Implementations on Foreign Types§

source§

impl HumanThroughput for i8

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for u128

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for i32

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for i128

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for i16

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for f32

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for u64

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for u8

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for isize

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for f64

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for usize

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for i64

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for u16

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

source§

impl HumanThroughput for u32

source§

fn human_throughput<'a>( self, unit: impl Into<Cow<'a, str>> ) -> HumanThroughputData<'a>

Implementors§