pub enum Token {
ControlSymbol(char),
ControlWord {
name: String,
arg: Option<i32>,
},
ControlBin(Vec<u8>),
Text(Vec<u8>),
StartGroup,
EndGroup,
Newline(Vec<u8>),
}Variants§
ControlSymbol(char)
ControlWord
ControlBin(Vec<u8>)
Text(Vec<u8>)
Text is not str because it can be in any of various encodings - it’s up to the processor to identify any encoding information in the stream, and do any encoding conversion desired
StartGroup
EndGroup
Newline(Vec<u8>)
stores the actual bytes of newline found
Implementations§
Source§impl Token
impl Token
pub fn to_rtf(&self) -> Vec<u8> ⓘ
Sourcepub fn token_delimiter_after(&self, next_token: &Token) -> &'static str
pub fn token_delimiter_after(&self, next_token: &Token) -> &'static str
This function returns a control word delimiter if one is required, or an empty string if none is required
Control Word tokens must be delimited by a non-alphanumeric value, so if the subsequent content could be alphanumeric, a space (’ ’) delimiter must be inserted
Sourcepub fn token_delimiter_before(&self, prev_token: &Token) -> &'static str
pub fn token_delimiter_before(&self, prev_token: &Token) -> &'static str
This function returns a control word delimiter if one is required, or an empty string if none is required
Control Word tokens must be delimited by a non-alphanumeric value, so if the subsequent content could be alphanumeric, a space (’ ’) delimiter must be inserted
pub fn get_name(&self) -> Option<String>
pub fn get_arg(&self) -> Option<i32>
pub fn get_symbol(&self) -> Option<char>
pub fn get_bin(&self) -> Option<&[u8]>
pub fn get_text(&self) -> Option<&[u8]>
Trait Implementations§
impl Eq for Token
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more