pub trait Length {
type Count: Display + Truthy;
// Required method
fn length(&self) -> Self::Count;
}Expand description
How many items {{ rows.length }} reports.
This follows handlebars.js, where length is an ordinary property lookup and a JS array carries
one. Only lists have it here: a String deliberately does not, because JS counts UTF-16 code
units and Rust would count either bytes or chars — all three disagree on the same text, and a
quietly different number is exactly what this crate promises never to produce.
Count is an associated type rather than a plain usize so that a list which
was never set can report nothing at all, as an undefined value does in handlebars.js, while a
list with no items in it reports 0.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".