Struct sentry_core::Scope
source · [−]pub struct Scope { /* private fields */ }
Expand description
Holds contextual data for the current scope.
The scope is an object that can be 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.
Deletes current breadcrumbs from the scope.
sourcepub fn set_fingerprint(&mut self, fingerprint: Option<&[&str]>)
pub fn set_fingerprint(&mut self, fingerprint: Option<&[&str]>)
Sets the fingerprint.
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.
If the tag is not set, does nothing.
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<F>(&mut self, f: F) where
F: Fn(Event<'static>) -> Option<Event<'static>> + Send + Sync + 'static,
pub fn add_event_processor<F>(&mut self, f: F) where
F: Fn(Event<'static>) -> Option<Event<'static>> + Send + Sync + 'static,
Add an event processor to the scope.
sourcepub fn add_attachment(&mut self, attachment: Attachment)
pub fn add_attachment(&mut self, attachment: Attachment)
Adds an attachment to the scope
sourcepub fn clear_attachments(&mut self)
pub fn clear_attachments(&mut self)
Clears attachments from 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.
sourcepub fn set_span(&mut self, span: Option<TransactionOrSpan>)
pub fn set_span(&mut self, span: Option<TransactionOrSpan>)
Set the given TransactionOrSpan
as the active span for this scope.
sourcepub fn get_span(&self) -> Option<TransactionOrSpan>
pub fn get_span(&self) -> Option<TransactionOrSpan>
Returns the currently active span.
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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more