Skip to main content

Record

Struct Record 

Source
pub struct Record {
    pub uid: Uuid,
    /* private fields */
}
Expand description

Represents a processed log record.

A Record consists of a TokenStream (the tokenized log line) and a unique identifier (Uuid).

Fields§

§uid: Uuid

Implementations§

Source§

impl Record

Source

pub fn new(line: String) -> Self

Creates a new Record from a given log line string.

This involves tokenizing the line and generating a new UUID (version 1) for the record.

§Arguments
  • line - The raw log line as a String.
§Returns

A new Record instance.

Source

pub fn calc_sim_score(&self, candidate: &Record) -> u64

Calculates a similarity score between this Record (acting as a template) and a candidate Record.

The score is the number of matching tokens between the two records. A Token::Wildcard in the template matches any token in the candidate.

§Arguments
  • candidate - The Record to compare against this record.
§Returns

The similarity score as a u64.

Source

pub fn first(&self) -> Option<DefaultSymbol>

Returns the first token of the record’s TokenStream.

§Returns

An Option<DefaultSymbol> containing the first token if it exists, otherwise None.

Source

pub fn len(&self) -> usize

Returns the number of tokens in the record’s TokenStream.

§Returns

The length of the token stream as a usize.

Source

pub fn is_empty(&self) -> bool

Checks if the record’s TokenStream is empty.

§Returns

true if the token stream is empty, false otherwise.

Source

pub fn resolve(sym: DefaultSymbol) -> Option<String>

Resolves a DefaultSymbol back to its original string representation.

This is a utility method that uses the global string interner to retrieve the string associated with a given symbol.

§Arguments
  • sym - The DefaultSymbol to resolve.
§Returns

An Option<String> containing the resolved string if the symbol exists, otherwise None.

Trait Implementations§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Record

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Record

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Record

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the Record for display.

This implementation reconstructs the original log line from the TokenStream, preserving whitespace.

§Arguments
  • f - The formatter to write into.
§Returns

A fmt::Result indicating success or failure of the formatting operation.

Source§

impl IntoIterator for Record

Source§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
Source§

type Item = String

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a> IntoIterator for &'a Record

Source§

type Item = &'a Token

The type of the elements being iterated over.
Source§

type IntoIter = Map<Iter<'a, (Offset, Token)>, fn(&(Offset, Token)) -> &Token>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Joinable for T
where &'a T: for<'a> IntoIterator,

Source§

type Collection = T

Source§

fn join_with<S>(self, sep: S) -> Join<T, S>

Combine this object with a separator to create a new Join instance. Note that the separator does not have to share the same type as the iterator’s values. Read more
Source§

fn join_concat(self) -> Join<Self::Collection, NoSeparator>

Join this object with an empty separator. When rendered with Display, the underlying elements will be directly concatenated. Note that the separator, while empty, is still present, and will show up if you iterate this instance. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more