Struct sentry::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>(&mut self, key: &str, value: V)
where V: ToString,

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>(&mut self, key: &str, value: C)
where C: Into<Context>,

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 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<(), Error>

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§

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

🔬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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more