diff --git a/sentry-core/src/performance.rs b/sentry-core/src/performance.rs index 9b48e911..5416746e 100644 --- a/sentry-core/src/performance.rs +++ b/sentry-core/src/performance.rs @@ -402,7 +402,7 @@ pub type TracesSampler = dyn Fn(&TransactionContext) -> f32 + Send + Sync; // global API types: /// A wrapper that groups a [`Transaction`] and a [`Span`] together. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub enum TransactionOrSpan { /// A [`Transaction`]. Transaction(Transaction), @@ -958,6 +958,12 @@ impl Transaction { } } +impl PartialEq for Transaction { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.inner, &other.inner) + } +} + /// A smart pointer to a span's [`data` field](protocol::Span::data). pub struct Data<'a>(MutexGuard<'a, protocol::Span>); @@ -1203,6 +1209,12 @@ impl Span { } } +impl PartialEq for Span { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.span, &other.span) + } +} + /// Represents a key-value pair such as an HTTP header. pub type TraceHeader = (&'static str, String);