pub trait Character:
Sized
+ Eq
+ Copy
+ Display
+ Debug
+ From<u8>
+ TryInto<u8>
+ TryFrom<u64>
+ Into<u64>
+ Ord
+ Hash
+ Default
+ 'static {
type CharMap<A: Clone + Default>: CharacterMap<Self, A>;
type Iter<'a>: ExactSizeIterator<Item = Self>;
const MIN: Self;
const MAX: Self;
// Required methods
fn convert(input: Vec<u8>) -> TextLine<Self>;
fn display_fmt<W: Write>(&self, target: &mut W);
fn to_char(&self) -> char;
fn starting_catcode_scheme() -> CategoryCodeScheme<Self>;
fn string_to_iter(string: &str) -> Self::Iter<'_>;
// Provided methods
fn display(&self) -> DisplayableCharacter<Self> { ... }
fn display_opt(c: Option<Self>) -> DisplayableCharacterOpt<Self> { ... }
}Expand description
A single character in a .tex file; in plain TeX, this is a u8,
but in e.g. XeTeX, it is a UTF-8 character.
Required Associated Constants§
Required Associated Types§
Sourcetype CharMap<A: Clone + Default>: CharacterMap<Self, A>
type CharMap<A: Clone + Default>: CharacterMap<Self, A>
Type that maps characters to other data.
Sourcetype Iter<'a>: ExactSizeIterator<Item = Self>
type Iter<'a>: ExactSizeIterator<Item = Self>
Iterator over characters in a string.
Required Methods§
Sourcefn display_fmt<W: Write>(&self, target: &mut W)
fn display_fmt<W: Write>(&self, target: &mut W)
Display this character to a Write (e.g. a &mut String). Relevant for e.g.
TeX’s convention to display control characters using ^^ encoding.
Sourcefn starting_catcode_scheme() -> CategoryCodeScheme<Self>
fn starting_catcode_scheme() -> CategoryCodeScheme<Self>
The starting CategoryCodeScheme for this character type.
Sourcefn string_to_iter(string: &str) -> Self::Iter<'_>
fn string_to_iter(string: &str) -> Self::Iter<'_>
Convert a string to an iterator over characters.
Provided Methods§
Sourcefn display(&self) -> DisplayableCharacter<Self>
fn display(&self) -> DisplayableCharacter<Self>
Convert this character to a DisplayableCharacter that calls display; useful in
format! and write! macros.
Sourcefn display_opt(c: Option<Self>) -> DisplayableCharacterOpt<Self>
fn display_opt(c: Option<Self>) -> DisplayableCharacterOpt<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.