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:

  1. the scope is routinely updated with information by functions such as add_breadcrumb which will modify the currently top-most scope.
  2. 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§

source§

impl Scope

source

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.

source

pub fn clear_breadcrumbs(&mut self)

Deletes current breadcrumbs from the scope.

source

pub fn set_level(&mut self, level: Option<Level>)

Sets a level override.

source

pub fn set_fingerprint(&mut self, fingerprint: Option<&[&str]>)

Sets the fingerprint.

source

pub fn set_transaction(&mut self, transaction: Option<&str>)

Sets the transaction.

source

pub fn set_user(&mut self, user: Option<User>)

Sets the user for the current scope.

source

pub fn set_tag<V: ToString>(&mut self, key: &str, value: V)

Sets a tag to a specific value.

source

pub fn remove_tag(&mut self, key: &str)

Removes a tag.

If the tag is not set, does nothing.

source

pub fn set_context<C: Into<Context>>(&mut self, key: &str, value: C)

Sets a context for a key.

source

pub fn remove_context(&mut self, key: &str)

Removes a context for a key.

source

pub fn set_extra(&mut self, key: &str, value: Value)

Sets a extra to a specific value.

source

pub fn remove_extra(&mut self, key: &str)

Removes a extra.

source

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.

source

pub fn add_attachment(&mut self, attachment: Attachment)

Adds an attachment to the scope

source

pub fn clear_attachments(&mut self)

Clears attachments from the scope

source

pub fn apply_to_event(&self, event: Event<'static>) -> Option<Event<'static>>

Applies the contained scoped data to fill an event.

source

pub fn apply_to_transaction(&self, transaction: &mut Transaction<'static>)

Applies the contained scoped data to fill a transaction.

source

pub fn set_span(&mut self, span: Option<TransactionOrSpan>)

Set the given TransactionOrSpan as the active span for this scope.

source

pub fn get_span(&self) -> Option<TransactionOrSpan>

Returns the currently active span.

Trait Implementations§

source§

impl Clone for Scope

source§

fn clone(&self) -> Scope

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 Debug for Scope

source§

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

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

impl Default for Scope

source§

fn default() -> Scope

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

Auto Trait Implementations§

§

impl Freeze for Scope

§

impl !RefUnwindSafe for Scope

§

impl Send for Scope

§

impl Sync for Scope

§

impl Unpin for Scope

§

impl !UnwindSafe for Scope

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

§

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

§

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

§

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

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

source§

fn vzip(self) -> V