pub trait InquireLength {
// Required method
fn inquire_length(&self) -> usize;
}
Expand description
Custom trait to call correct method to retrieve input length.
The method can vary depending on the type of input.
String inputs should count the number of graphemes, via
.graphemes(true).count()
, instead of the number of bytes
via .len()
. While simple slices should keep using .len()
Required Methods§
Sourcefn inquire_length(&self) -> usize
fn inquire_length(&self) -> usize
String inputs should count the number of graphemes, via
.graphemes(true).count()
, instead of the number of bytes
via .len()
. While simple slices keep using .len()