From fd92a324630069138d079959367b8ad0bf7c642b Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 19 Dec 2024 16:33:09 +0100 Subject: [PATCH] Allow retrieving user of scope (#715) --- sentry-core/src/scope/real.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sentry-core/src/scope/real.rs b/sentry-core/src/scope/real.rs index 47dec48d..ed033fb0 100644 --- a/sentry-core/src/scope/real.rs +++ b/sentry-core/src/scope/real.rs @@ -197,6 +197,11 @@ impl Scope { self.user = user.map(Arc::new); } + /// Retrieves the user of the current scope. + pub fn user(&self) -> Option<&User> { + self.user.as_deref() + } + /// Sets a tag to a specific value. pub fn set_tag(&mut self, key: &str, value: V) { Arc::make_mut(&mut self.tags).insert(key.to_string(), value.to_string());