Struct relay_event_schema::processor::ProcessingState

source ·
pub struct ProcessingState<'a> { /* private fields */ }
Expand description

An event’s processing state.

The processing state describes an item in an event which is being processed, an example of processing might be scrubbing the event for PII. The processing state itself describes the current item and it’s parent, which allows you to follow all the items up to the root item. You can think of processing an event as a visitor pattern visiting all items in the event and the processing state is a stack describing the currently visited item and all it’s parents.

Implementations§

source§

impl<'a> ProcessingState<'a>

source

pub fn root() -> &'static ProcessingState<'static>

Returns the root processing state.

source

pub fn new_root( attrs: Option<Cow<'static, FieldAttrs>>, value_type: impl IntoIterator<Item = ValueType>, ) -> ProcessingState<'static>

Creates a new root state.

source

pub fn enter_static( &'a self, key: &'static str, attrs: Option<Cow<'static, FieldAttrs>>, value_type: impl IntoIterator<Item = ValueType>, ) -> Self

Derives a processing state by entering a static key.

source

pub fn enter_borrowed( &'a self, key: &'a str, attrs: Option<Cow<'a, FieldAttrs>>, value_type: impl IntoIterator<Item = ValueType>, ) -> Self

Derives a processing state by entering a borrowed key.

source

pub fn enter_owned( self, key: String, attrs: Option<Cow<'a, FieldAttrs>>, value_type: impl IntoIterator<Item = ValueType>, ) -> Self

Derives a processing state by entering an owned key.

The new (child) state takes ownership of the current (parent) state.

source

pub fn enter_index( &'a self, idx: usize, attrs: Option<Cow<'a, FieldAttrs>>, value_type: impl IntoIterator<Item = ValueType>, ) -> Self

Derives a processing state by entering an index.

source

pub fn enter_nothing(&'a self, attrs: Option<Cow<'a, FieldAttrs>>) -> Self

Derives a processing state without adding a path segment. Useful in newtype structs.

source

pub fn path(&'a self) -> Path<'a>

Returns the path in the processing state.

source

pub fn value_type(&self) -> EnumSet<ValueType>

source

pub fn attrs(&self) -> &FieldAttrs

Returns the field attributes.

source

pub fn inner_attrs(&self) -> Option<Cow<'_, FieldAttrs>>

Derives the attrs for recursion.

source

pub fn iter(&'a self) -> ProcessingStateIter<'a>

Iterates through this state and all its ancestors up the hierarchy.

This starts at the top of the stack of processing states and ends at the root. Thus the first item returned is the currently visited leaf of the event structure.

source

pub fn try_into_parent(self) -> Result<Option<Self>, Self>

Returns the contained parent state.

  • Returns Ok(None) if the current state is the root.
  • Returns Err(self) if the current state does not own the parent state.
source

pub fn depth(&'a self) -> usize

Return the depth (~ indentation level) of the currently processed value.

source

pub fn entered_anything(&'a self) -> bool

Return whether the depth changed between parent and self.

This is false when we entered a newtype struct.

Trait Implementations§

source§

impl<'a> Clone for ProcessingState<'a>

source§

fn clone(&self) -> ProcessingState<'a>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for ProcessingState<'a>

source§

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

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

impl<'a> Default for ProcessingState<'a>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ProcessingState<'a>

§

impl<'a> RefUnwindSafe for ProcessingState<'a>

§

impl<'a> Send for ProcessingState<'a>

§

impl<'a> Sync for ProcessingState<'a>

§

impl<'a> Unpin for ProcessingState<'a>

§

impl<'a> UnwindSafe for ProcessingState<'a>

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, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V