From b3e391e88fe321f6bd70a097899b8a25a9ba96cc Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Tue, 7 Jul 2026 17:16:50 +0200 Subject: [PATCH 1/2] chore!(core): Make `ClientOptions` non-exhaustive Make the `ClientOptions` struct `#[non_exhaustive]`. Users will now have to rely on the builder methods to construct `ClientOptions`. This change will allow us to introduce new configuration options in future SDK releases without requiring a breaking release. Closes [#1219](https://github.com/getsentry/sentry-rust/issues/1219) Closes [RUST-258](https://linear.app/getsentry/issue/RUST-258) --- CHANGELOG.md | 22 ++++++++++++++++++++++ sentry-core/src/clientoptions.rs | 1 + 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ada5ba4f..e55a665f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## Unreleased + +### Breaking Changes + +- [`ClientOptions`](https://docs.rs/sentry-core/0.49.0/sentry_core/struct.ClientOptions.html) is now `#[non_exhaustive]`. The struct must now be constructed with the builder-style setters: + + ```rust + // Before + let options = sentry::ClientOptions { + dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", + debug: true, + release: Some("my-app@1.0.0".into()), + ..Default::default() + }; + + // After + let options = sentry::ClientOptions::new() + .dsn("https://examplePublicKey@o0.ingest.sentry.io/0") + .debug(true) + .release("my-app@1.0.0"); + ``` + ## 0.48.4 ### New Features diff --git a/sentry-core/src/clientoptions.rs b/sentry-core/src/clientoptions.rs index 5554be8c..98cc5444 100644 --- a/sentry-core/src/clientoptions.rs +++ b/sentry-core/src/clientoptions.rs @@ -91,6 +91,7 @@ impl MaxRequestBodySize { /// ``` #[derive(Clone)] #[must_use = "ClientOptions must be passed to sentry::init to have any effect"] +#[non_exhaustive] pub struct ClientOptions { // Common options /// The DSN to use. From afcddde61813cea6476f91ca3fcfdcc95ac73fae Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Tue, 7 Jul 2026 17:21:25 +0200 Subject: [PATCH 2/2] fixup! chore!(core): Make `ClientOptions` non-exhaustive --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55a665f..a7f1292a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Breaking Changes -- [`ClientOptions`](https://docs.rs/sentry-core/0.49.0/sentry_core/struct.ClientOptions.html) is now `#[non_exhaustive]`. The struct must now be constructed with the builder-style setters: +- [`ClientOptions`](https://docs.rs/sentry-core/0.49.0/sentry_core/struct.ClientOptions.html) is now `#[non_exhaustive]` ([#1230](https://github.com/getsentry/sentry-rust/pull/1230)). The struct must now be constructed with the builder-style setters: ```rust // Before