Trait InquireLength

Source
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§

Source

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()

Implementations on Foreign Types§

Source§

impl InquireLength for &str

Source§

impl<T> InquireLength for &[T]

Implementors§