Skip to main content

Event

Trait Event 

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

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

    // Provided method
    fn get_id(&self) -> Option<&str> { ... }
}
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>, ) -> Result<(), ScannerError>

Recursively visit all strings contained in the object.

Source

fn visit_string_mut( &mut self, path: &Path<'_>, visit: impl FnOnce(&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.

Provided Methods§

Source

fn get_id(&self) -> Option<&str>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Event for HashMap<String, Value, RandomState>

Source§

type Encoding = Utf8Encoding

Source§

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

Source§

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

Source§

impl Event for String

Source§

type Encoding = Utf8Encoding

Source§

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

Source§

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

Source§

impl Event for Value

Source§

type Encoding = Utf8Encoding

Source§

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

Source§

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

Implementors§