pub fn filesizeformat(
bytes: u128,
precision: u8,
) -> Result<FilesizeFormatFilter, Infallible>Expand description
Returns adequate string representation (in KB, ..) of number of bytes
ยงExample
#[derive(Template)]
#[template(
source = "Filesize: {{ size_in_bytes | filesizeformat }}.",
ext = "html"
)]
struct Example {
size_in_bytes: u64,
}
let tmpl = Example { size_in_bytes: 1_234_567 };
assert_eq!(tmpl.to_string(), "Filesize: 1.23 MB.");