pub struct InitBuilder<'a> { /* private fields */ }Expand description
Builder for initializing the global options store.
Define optional parameters with with_* methods, then finalize with init()
All settings are optional and independent:
with_directoryoverrides the base directorywith_schemassupplies schemas in memory instead of reading{dir}/schemas/with_callbackregisters a callback that fires on every value refresh.
Implementations§
Source§impl<'a> InitBuilder<'a>
impl<'a> InitBuilder<'a>
pub fn new() -> Self
Sourcepub fn with_directory(self, directory: impl Into<PathBuf>) -> Self
pub fn with_directory(self, directory: impl Into<PathBuf>) -> Self
Override the base directory. Expects {directory}/schemas/ and {directory}/values/ subdirectories.
Otherwise, defaults to the fallback chain: SENTRY_OPTIONS_DIR env var, then /etc/sentry-options
Sourcepub fn with_schemas(self, schemas: &'a [(&'a str, &'a str)]) -> Self
pub fn with_schemas(self, schemas: &'a [(&'a str, &'a str)]) -> Self
Provide schemas as in-memory (namespace, json) pairs instead of reading
them from {dir}/schemas/, intended to be used with include_str!
Sourcepub fn with_callback(self, callback: PropagationCallback) -> Self
pub fn with_callback(self, callback: PropagationCallback) -> Self
Register a callback that fires (namespace, delay_secs) whenever values
are refreshed with a new generated_at timestamp.
Sourcepub fn init(self) -> Result<()>
pub fn init(self) -> Result<()>
Initialize the global options store from the inputs.
Returns OptionsError::AlreadyInitialized if the store is already
initialized, leaving the existing configuration untouched. Callers that
want a no-op in that case can ignore the error with .ok().