Trait Event

Source
pub trait Event: Sized {
    type Encoding: Encoding;

    // Required methods
    fn visit_event<'a>(&'a mut self, visitor: &mut impl EventVisitor<'a>);
    fn visit_string_mut(
        &mut self,
        path: &Path<'_>,
        visit: impl FnMut(&mut String) -> bool,
    );
}
Expand description

Any object that can be scanned by SDS needs to implement Event. You can think of an Event as a “JSON-like” object that has a nested map of values with String keys.

Required Associated Types§

Source

type Encoding: Encoding

The encoding used to calculate match indices. The actual data itself must always be UTF-8.

Required Methods§

Source

fn visit_event<'a>(&'a mut self, visitor: &mut impl EventVisitor<'a>)

Recursively visit all strings contained in the object.

Source

fn visit_string_mut( &mut self, path: &Path<'_>, visit: impl FnMut(&mut String) -> bool, )

Visit the string at the specified path. The path is guaranteed to be valid, it will be a path that was previously used in visit_event'. This is used to replace redacted content. visit` returns a bool indicating if the string was mutated.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Event for String

Source§

type Encoding = Utf8Encoding

Source§

fn visit_event<'path>(&'path mut self, visitor: &mut impl EventVisitor<'path>)

Source§

fn visit_string_mut( &mut self, _path: &Path<'_>, visit: impl FnMut(&mut String) -> bool, )

Implementors§