pub struct Token<'a> {
pub text: &'a str,
pub byte_start: usize,
pub byte_end: usize,
pub position: usize,
pub position_length: usize,
pub word_id: WordId,
pub dictionary: &'a Dictionary,
pub user_dictionary: Option<&'a UserDictionary>,
/* private fields */
}Fields§
§text: &'a strText content of the token.
byte_start: usizeStarting position of the token in bytes.
byte_end: usizeEnding position of the token in bytes.
position: usizePosition, expressed in number of tokens.
position_length: usizeThe length expressed in terms of number of original tokens.
word_id: WordIdThe ID of the word and a flag to indicate whether the word is registered in the dictionary.
dictionary: &'a DictionaryReference of dictionary.
user_dictionary: Option<&'a UserDictionary>Reference of user dictionary.
Implementations§
Source§impl<'a> Token<'a>
impl<'a> Token<'a>
pub fn new( text: &'a str, start: usize, end: usize, position: usize, word_id: WordId, dictionary: &'a Dictionary, user_dictionary: Option<&'a UserDictionary>, ) -> Self
pub fn get_details(&mut self) -> Option<Vec<&str>>
pub fn set_details(&mut self, details: Option<Vec<String>>) -> &Token<'a>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
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