Skip to main content

CharacterMap

Trait CharacterMap 

Source
pub trait CharacterMap<C: Character, A: Default>: Clone {
    // Required methods
    fn get(&self, c: C) -> &A;
    fn get_mut(&mut self, c: C) -> &mut A;
    fn default() -> Self;
}
Expand description

A map from characters C:Character to some other type A. For u8, we can simply use [A;256]. For example, a CategoryCodeScheme is a CharacterMap<CategoryCode>.

Required Methods§

Source

fn get(&self, c: C) -> &A

Source

fn get_mut(&mut self, c: C) -> &mut A

Source

fn default() -> Self

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<A: Clone + Default> CharacterMap<u8, A> for [A; 256]

Source§

fn get(&self, c: u8) -> &A

Source§

fn get_mut(&mut self, c: u8) -> &mut A

Source§

fn default() -> Self

Implementors§