pub struct TokenStream {
pub spans: Vec<TokenSpan>,
/* private fields */
}Expand description
Source-backed token stream (span-only).
This is intended as a high-performance representation for callers that
want to avoid allocating a String per token. It can materialize owned
Tokens when needed (FFI/debug).
Fields§
§spans: Vec<TokenSpan>Implementations§
Source§impl TokenStream
impl TokenStream
pub fn new(formula: &str) -> Result<Self, TokenizerError>
pub fn new_with_dialect( formula: &str, dialect: FormulaDialect, ) -> Result<Self, TokenizerError>
pub fn source(&self) -> &str
pub fn dialect(&self) -> FormulaDialect
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, index: usize) -> Option<TokenView<'_>>
pub fn to_tokens(&self) -> Vec<Token>
pub fn render(&self) -> String
Trait Implementations§
Source§impl Clone for TokenStream
impl Clone for TokenStream
Source§fn clone(&self) -> TokenStream
fn clone(&self) -> TokenStream
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TokenStream
impl RefUnwindSafe for TokenStream
impl Send for TokenStream
impl Sync for TokenStream
impl Unpin for TokenStream
impl UnwindSafe for TokenStream
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)