pub struct TokenStream { /* private fields */ }Expand description
Represents a stream of tokens, typically derived from a log line.
A TokenStream stores a sequence of (Offset, Token) pairs, preserving
the original position and type of each token within the source string.
Implementations§
Source§impl TokenStream
impl TokenStream
Sourcepub fn from_unicode_line(line: &str) -> Self
pub fn from_unicode_line(line: &str) -> Self
Creates a TokenStream from a Unicode log line.
This function splits the input line by ASCII whitespace and attempts to
identify and intern each word as a Token::Value(TypedToken::String). It also
calculates and stores the Offset for each token.
§Arguments
line- The input log line as a string slice.
§Returns
A new TokenStream instance.
Sourcepub fn first(&self) -> Option<Token>
pub fn first(&self) -> Option<Token>
Returns the first Token in the stream.
§Returns
An Option<Token> containing a clone of the first token if the stream is not empty,
otherwise None.
Trait Implementations§
Source§impl Clone for TokenStream
impl Clone for TokenStream
Source§fn clone(&self) -> TokenStream
fn clone(&self) -> TokenStream
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TokenStream
impl Debug for TokenStream
Source§impl Display for TokenStream
impl Display for TokenStream
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the TokenStream for display.
This implementation reconstructs the original string from the tokens and their offsets, preserving the original whitespace between tokens.
§Arguments
f- The formatter to write into.
§Returns
A fmt::Result indicating success or failure of the formatting operation.
Source§impl PartialEq for TokenStream
impl PartialEq for TokenStream
impl StructuralPartialEq for TokenStream
Auto Trait Implementations§
impl Freeze for TokenStream
impl RefUnwindSafe for TokenStream
impl Send for TokenStream
impl Sync for TokenStream
impl Unpin for TokenStream
impl UnsafeUnpin for TokenStream
impl UnwindSafe for TokenStream
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more