pub struct SchemaClassifier { /* private fields */ }Expand description
Recognizes the schema of parsed events from a set of signatures.
Signatures are sorted once at construction (specificity descending, then
name ascending) so classify returns the best match with
a single in-order scan.
Implementations§
Source§impl SchemaClassifier
impl SchemaClassifier
Sourcepub fn new(signatures: Vec<SchemaSignature>) -> SchemaClassifier
pub fn new(signatures: Vec<SchemaSignature>) -> SchemaClassifier
Build a classifier from an explicit signature set.
Sourcepub fn builtin() -> SchemaClassifier
pub fn builtin() -> SchemaClassifier
Build a classifier from the built-in signatures only.
Sourcepub fn with_user_signatures(user: Vec<SchemaSignature>) -> SchemaClassifier
pub fn with_user_signatures(user: Vec<SchemaSignature>) -> SchemaClassifier
Build a classifier from the built-ins plus user-supplied signatures. User signatures are added to (not replacing) the built-ins; a user signature with a higher specificity than a built-in wins on overlap.
Sourcepub fn classify<E>(&self, event: &E) -> Option<SchemaMatch>
pub fn classify<E>(&self, event: &E) -> Option<SchemaMatch>
Classify an event. Returns the highest-specificity matching schema, or
None when the event matches no signature (“unknown”).
Sourcepub fn classify_all<E>(&self, event: &E) -> Vec<String>
pub fn classify_all<E>(&self, event: &E) -> Vec<String>
All matching schema names for an event, most specific first. Useful for tuning signatures (seeing what else an event could match). Deduplicated by name while preserving order.
Sourcepub fn schema_names(&self) -> Vec<&str>
pub fn schema_names(&self) -> Vec<&str>
Distinct schema names this classifier can produce, most specific first.
Trait Implementations§
Source§impl Clone for SchemaClassifier
impl Clone for SchemaClassifier
Source§fn clone(&self) -> SchemaClassifier
fn clone(&self) -> SchemaClassifier
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 SchemaClassifier
impl Debug for SchemaClassifier
Source§impl Default for SchemaClassifier
impl Default for SchemaClassifier
Source§fn default() -> SchemaClassifier
fn default() -> SchemaClassifier
Auto Trait Implementations§
impl Freeze for SchemaClassifier
impl RefUnwindSafe for SchemaClassifier
impl Send for SchemaClassifier
impl Sync for SchemaClassifier
impl Unpin for SchemaClassifier
impl UnsafeUnpin for SchemaClassifier
impl UnwindSafe for SchemaClassifier
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§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, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
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