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>
impl<'a> ProcessingState<'a>
sourcepub fn root() -> &'static ProcessingState<'static>
pub fn root() -> &'static ProcessingState<'static>
Returns the root processing state.
sourcepub fn new_root(
attrs: Option<Cow<'static, FieldAttrs>>,
value_type: impl IntoIterator<Item = ValueType>,
) -> ProcessingState<'static>
pub fn new_root( attrs: Option<Cow<'static, FieldAttrs>>, value_type: impl IntoIterator<Item = ValueType>, ) -> ProcessingState<'static>
Creates a new root state.
sourcepub fn enter_static(
&'a self,
key: &'static str,
attrs: Option<Cow<'static, FieldAttrs>>,
value_type: impl IntoIterator<Item = ValueType>,
) -> Self
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.
sourcepub fn enter_borrowed(
&'a self,
key: &'a str,
attrs: Option<Cow<'a, FieldAttrs>>,
value_type: impl IntoIterator<Item = ValueType>,
) -> Self
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.
sourcepub fn enter_owned(
self,
key: String,
attrs: Option<Cow<'a, FieldAttrs>>,
value_type: impl IntoIterator<Item = ValueType>,
) -> Self
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.
sourcepub fn enter_index(
&'a self,
idx: usize,
attrs: Option<Cow<'a, FieldAttrs>>,
value_type: impl IntoIterator<Item = ValueType>,
) -> Self
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.
sourcepub fn enter_nothing(&'a self, attrs: Option<Cow<'a, FieldAttrs>>) -> Self
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.
pub fn value_type(&self) -> EnumSet<ValueType>
sourcepub fn attrs(&self) -> &FieldAttrs
pub fn attrs(&self) -> &FieldAttrs
Returns the field attributes.
sourcepub fn inner_attrs(&self) -> Option<Cow<'_, FieldAttrs>>
pub fn inner_attrs(&self) -> Option<Cow<'_, FieldAttrs>>
Derives the attrs for recursion.
sourcepub fn iter(&'a self) -> ProcessingStateIter<'a> ⓘ
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.
sourcepub fn try_into_parent(self) -> Result<Option<Self>, Self>
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.
sourcepub fn depth(&'a self) -> usize
pub fn depth(&'a self) -> usize
Return the depth (~ indentation level) of the currently processed value.
sourcepub fn entered_anything(&'a self) -> bool
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>
impl<'a> Clone for ProcessingState<'a>
source§fn clone(&self) -> ProcessingState<'a>
fn clone(&self) -> ProcessingState<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for ProcessingState<'a>
impl<'a> Debug for ProcessingState<'a>
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> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)