sentry_core

Struct 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T