pub trait CharType:
Copy
+ PartialEq
+ Eq
+ Hash
+ Display
+ Debug
+ 'static
+ From<u8>
+ Default {
type Allchars<A: Default>: AllCharsTrait<Self, A>;
const MAX: Self;
Show 19 methods
// Required methods
fn from_u8_iter(iter: &mut IntoIter<u8>) -> Option<Self>;
fn from_str(s: &str) -> TeXStr<Self>;
fn is_eol(self) -> Option<bool>;
fn is_eol_pair(self, next: Self) -> bool;
fn par_token() -> TeXStr<Self>;
fn relax_token() -> TeXStr<Self>;
fn empty_str() -> TeXStr<Self>;
fn starting_catcode_scheme() -> CategoryCodeScheme<Self>;
fn newline() -> Self;
fn carriage_return() -> Self;
fn backslash() -> Self;
fn zeros() -> Self::Allchars<Self>;
fn ident() -> Self::Allchars<Self>;
fn rep_field<A: Clone + Default>(a: A) -> Self::Allchars<A>;
fn char_str(&self) -> String;
fn as_bytes(&self) -> Vec<u8> ⓘ;
fn from_i64(i: i64) -> Option<Self>;
fn to_usize(self) -> usize;
// Provided method
fn display_str(str: &TeXStr<Self>, f: &mut Formatter<'_>) -> Result { ... }
}
Expand description
Required Associated Constants§
Required Associated Types§
Sourcetype Allchars<A: Default>: AllCharsTrait<Self, A>
type Allchars<A: Default>: AllCharsTrait<Self, A>
The type of the array/vec/whatever of all possible characters. For u8
, this is [A;256]
.
Required Methods§
Sourcefn from_u8_iter(iter: &mut IntoIter<u8>) -> Option<Self>
fn from_u8_iter(iter: &mut IntoIter<u8>) -> Option<Self>
Parses a character from a byte iterator. For u8
, this is just iter.next()
.
Sourcefn is_eol(self) -> Option<bool>
fn is_eol(self) -> Option<bool>
Whether the character is an end-of-line character.
Should return:
Some(true)
: is end of line (e.g.\n
).Some(false)
: is not end of line.None
: might be, depending on the next character - e.g.\r
, in which case the next character should be checked to be\n
.
Sourcefn is_eol_pair(self, next: Self) -> bool
fn is_eol_pair(self, next: Self) -> bool
Should return:
true
: if the pair (self
,next
) represents an end of line (e.g.\r\n
).false
: if not; in which caseself
itself is considered to be an end of line (e.g.\r
).
Sourcefn relax_token() -> TeXStr<Self>
fn relax_token() -> TeXStr<Self>
The string “relax” as a TeXStr
<Self>
.
Sourcefn starting_catcode_scheme() -> CategoryCodeScheme<Self>
fn starting_catcode_scheme() -> CategoryCodeScheme<Self>
The starting category code scheme for this character type, see STARTING_SCHEME_U8
.
fn newline() -> Self
fn carriage_return() -> Self
fn backslash() -> Self
fn zeros() -> Self::Allchars<Self>
fn ident() -> Self::Allchars<Self>
fn rep_field<A: Clone + Default>(a: A) -> Self::Allchars<A>
fn char_str(&self) -> String
fn as_bytes(&self) -> Vec<u8> ⓘ
fn from_i64(i: i64) -> Option<Self>
fn to_usize(self) -> usize
Provided Methods§
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.