Skip to content

chore(hub): Deprecate Hub::with#1126

Open
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/thread-hub-simplificationfrom
szokeasaurusrex/deprecate-hub-with
Open

chore(hub): Deprecate Hub::with#1126
szokeasaurusrex wants to merge 1 commit intoszokeasaurusrex/thread-hub-simplificationfrom
szokeasaurusrex/deprecate-hub-with

Conversation

@szokeasaurusrex
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex commented May 8, 2026

Following the safety improvements in #1123, Hub::with no longer offers any performance benefit over using Hub::current. Hub::current provides a simpler API, and also returns an owned Arc<Hub> rather than providing access to a &Arc<Hub> via a callback (necessitating a second clone for anyone needing an owned Arc<Hub> in that callback).

As Hub::current is the arguably better API, let's deprecate Hub::with and encourage folks to migrate.

Stacked on #1125

Following the safety improvements in #1123, `Hub::with` no longer offers any performance benefit over using `Hub::current`. `Hub::current` provides a simpler API, and also returns an owned `Arc<Hub>` rather than providing access to a `&Arc<Hub>` via a callback (necessitating a second clone for anyone needing an owned `Arc<Hub>` in that callback).

As `Hub::current` is the arguably better API, let's deprecate `Hub::with` and encourage folks to migrate.
Comment thread sentry-core/src/hub.rs
} else {
Default::default()
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, we might want a version of this where the closure takes Arc rather than &Arc

@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review May 8, 2026 12:20
@szokeasaurusrex szokeasaurusrex requested a review from lcian as a code owner May 8, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant