Trait human_repr::HumanThroughput
source · 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§
sourcefn human_throughput<'a>(
self,
unit: impl Into<Cow<'a, str>>
) -> HumanThroughputData<'a>
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§
sourcefn human_throughput_bare(self) -> HumanThroughputData<'static>
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());
sourcefn human_throughput_bytes(self) -> HumanThroughputData<'static>
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());