pub struct Scope { /* private fields */ }
Expand description
Holds contextual data for the current scope.
The scope is an object that can cloned efficiently and stores data that is locally relevant to an event. For instance the scope will hold recorded breadcrumbs and similar information.
The scope can be interacted with in two ways:
- the scope is routinely updated with information by functions such as
add_breadcrumb
which will modify the currently top-most scope. - the topmost scope can also be configured through the
configure_scope
method.
Note that the scope can only be modified but not inspected. Only the client can use the scope to extract information currently.
Implementations
sourceimpl Scope
impl Scope
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the scope.
By default a scope will inherit all values from the higher scope. In some situations this might not be what a user wants. Calling this method will wipe all data contained within.
sourcepub fn set_transaction(&mut self, transaction: Option<&str>)
pub fn set_transaction(&mut self, transaction: Option<&str>)
Sets the transaction.
sourcepub fn remove_tag(&mut self, key: &str)
pub fn remove_tag(&mut self, key: &str)
Removes a tag.
sourcepub fn set_context<C: Into<Context>>(&mut self, key: &str, value: C)
pub fn set_context<C: Into<Context>>(&mut self, key: &str, value: C)
Sets a context for a key.
sourcepub fn remove_context(&mut self, key: &str)
pub fn remove_context(&mut self, key: &str)
Removes a context for a key.
sourcepub fn remove_extra(&mut self, key: &str)
pub fn remove_extra(&mut self, key: &str)
Removes a extra.
sourcepub fn add_event_processor(
&mut self,
f: Box<dyn Fn(Event<'static>) -> Option<Event<'static>> + Send + Sync>
)
pub fn add_event_processor(
&mut self,
f: Box<dyn Fn(Event<'static>) -> Option<Event<'static>> + Send + Sync>
)
Add an event processor to the scope.
sourcepub fn apply_to_event(&self, event: Event<'static>) -> Option<Event<'static>>
pub fn apply_to_event(&self, event: Event<'static>) -> Option<Event<'static>>
Applies the contained scoped data to fill an event.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl !UnwindSafe for Scope
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more