pub enum Token {
Wildcard,
TypedMatch(Grokker),
Value(TypedToken),
}Expand description
Represents a token within a log line, which can be a wildcard, a typed match, or a specific value.
Variants§
Wildcard
A wildcard token, matching any other token. Represented as “<*>” in display.
TypedMatch(Grokker)
A token that matches any value of a specific predefined type (e.g., UUID, IPv4).
Value(TypedToken)
A token containing a specific, non-wildcard value.
Implementations§
Source§impl Token
impl Token
Sourcepub fn from_parse(input: &str) -> Token
pub fn from_parse(input: &str) -> Token
Parses an input string and attempts to classify it into a Token type.
This function uses a set of regular expressions (MATCHERS) to determine
if the input string matches any known Grokker patterns. It prioritizes
more specific matches and handles ambiguities (e.g., a UUID also matching
a hostname pattern).
§Arguments
input- The string slice to parse.
§Returns
A Token representing the classification of the input string.
Trait Implementations§
Source§impl Display for Token
impl Display for Token
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the Token for display.
This implementation provides a string representation of the token,
using “<*>” for Wildcard tokens, the Grokker’s display for TypedMatch,
and the underlying value’s string representation for Value tokens.
§Arguments
f- The formatter to write into.
§Returns
A fmt::Result indicating success or failure of the formatting operation.
Source§impl From<Token> for DefaultSymbol
impl From<Token> for DefaultSymbol
Source§fn from(tok: Token) -> DefaultSymbol
fn from(tok: Token) -> DefaultSymbol
Converts a Token into its DefaultSymbol representation.
This conversion uses the global string interner to obtain a symbol
for the token’s string value or a predefined symbol for Wildcard
and TypedMatch tokens.
§Arguments
tok- TheTokento convert.
§Returns
The DefaultSymbol corresponding to the 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 UnsafeUnpin 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
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