Skip to content

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

Merged
szokeasaurusrex merged 1 commit into
masterfrom
szokeasaurusrex/deprecate-hub-with
May 26, 2026
Merged

szokeasaurusrex merged 1 commit into
masterfrom
szokeasaurusrex/deprecate-hub-with

Conversation

@szokeasaurusrex

@szokeasaurusrex szokeasaurusrex commented May 8, 2026 •

Copy link
Copy Markdown
Member

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

Comment thread sentry-core/src/hub.rs Resolved
@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

@lcian lcian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, to the user we always give out an Arc::clone, and internally we use the direct with_borrow path which may panic, which we're making sure to use safely.
LGTM

@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/deprecate-hub-with branch from 3a1defa to 4573da4 Compare May 26, 2026 09:44
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/thread-hub-simplification branch from 752cbbc to 87d0c23 Compare May 26, 2026 09:44
Base automatically changed from szokeasaurusrex/thread-hub-simplification to master May 26, 2026 13:13
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.
@szokeasaurusrex
szokeasaurusrex force-pushed the szokeasaurusrex/deprecate-hub-with branch from 4573da4 to b54079c Compare May 26, 2026 13:15
@szokeasaurusrex
szokeasaurusrex enabled auto-merge (squash) May 26, 2026 13:15
@szokeasaurusrex
szokeasaurusrex merged commit 00f176c into master May 26, 2026
26 checks passed
@szokeasaurusrex
szokeasaurusrex deleted the szokeasaurusrex/deprecate-hub-with branch May 26, 2026 13:19
szokeasaurusrex added a commit that referenced this pull request Jun 25, 2026
Just realized we were missing a changelog entry for #1126.
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.

2 participants