Skip to content

Commit 311818b

Browse files
Ten0lcian
andauthored
feat: Make it possible to == Transaction/Span/TransactionOrSpan (#942)
Co-authored-by: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
1 parent f76beb0 commit 311818b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Improvements
6+
7+
- Make it possible to == Transaction/Span/TransactionOrSpan ([#942](https://github.com/getsentry/sentry-rust/pull/942)).
8+
39
## 0.46.0
410

511
### Breaking changes

sentry-core/src/performance.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ pub type TracesSampler = dyn Fn(&TransactionContext) -> f32 + Send + Sync;
402402
// global API types:
403403

404404
/// A wrapper that groups a [`Transaction`] and a [`Span`] together.
405-
#[derive(Clone, Debug)]
405+
#[derive(Clone, Debug, PartialEq)]
406406
pub enum TransactionOrSpan {
407407
/// A [`Transaction`].
408408
Transaction(Transaction),
@@ -958,6 +958,12 @@ impl Transaction {
958958
}
959959
}
960960

961+
impl PartialEq for Transaction {
962+
fn eq(&self, other: &Self) -> bool {
963+
Arc::ptr_eq(&self.inner, &other.inner)
964+
}
965+
}
966+
961967
/// A smart pointer to a span's [`data` field](protocol::Span::data).
962968
pub struct Data<'a>(MutexGuard<'a, protocol::Span>);
963969

@@ -1203,6 +1209,12 @@ impl Span {
12031209
}
12041210
}
12051211

1212+
impl PartialEq for Span {
1213+
fn eq(&self, other: &Self) -> bool {
1214+
Arc::ptr_eq(&self.span, &other.span)
1215+
}
1216+
}
1217+
12061218
/// Represents a key-value pair such as an HTTP header.
12071219
pub type TraceHeader = (&'static str, String);
12081220

0 commit comments

Comments
 (0)