Skip to main content

HasCharCount

Trait HasCharCount 

Source
pub trait HasCharCount {
    // Required method
    fn char_count(&self) -> usize;
}
Expand description

The number of characters property of a type.

Counts the number of contained characters. The character count may be different from the length if any character occupies more than one byte in memory.

This is usually a property of a container of chars like String, Vec<char> or &[char]

Required Methods§

Source

fn char_count(&self) -> usize

Returns the number of characters.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HasCharCount for &[char]

Source§

impl HasCharCount for &str

Source§

impl HasCharCount for String

Source§

impl HasCharCount for Vec<char>

Implementors§