pub struct Options { /* private fields */ }Expand description
Options store for reading configuration values.
Implementations§
Source§impl Options
impl Options
Sourcepub fn builder<'a>() -> InitBuilder<'a>
pub fn builder<'a>() -> InitBuilder<'a>
Returns a builder for constructing an Options instance or
initializing the global store.
Configure optional parameters with the with_* methods, then finalize
with InitBuilder::build for a standalone instance or
InitBuilder::init for the global store.
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Load options using fallback chain: SENTRY_OPTIONS_DIR env var, then /etc/sentry-options
if it exists, otherwise sentry-options/.
Expects {dir}/schemas/ and {dir}/values/ subdirectories.
Sourcepub fn new_with_propagation_callback(
callback: PropagationCallback,
) -> Result<Self>
pub fn new_with_propagation_callback( callback: PropagationCallback, ) -> Result<Self>
Like [new], but with a propagation callback that fires (namespace, delay_secs)
whenever values are refreshed with a new generated_at timestamp.
Sourcepub fn from_directory(base_dir: &Path) -> Result<Self>
pub fn from_directory(base_dir: &Path) -> Result<Self>
Load options from a specific directory (useful for testing).
Expects {base_dir}/schemas/ and {base_dir}/values/ subdirectories.
Sourcepub fn from_schemas(schemas: &[(&str, &str)]) -> Result<Self>
pub fn from_schemas(schemas: &[(&str, &str)]) -> Result<Self>
Load options with schemas provided as in-memory JSON strings. Values are loaded from disk using the standard fallback chain.
Sourcepub fn get(&self, namespace: &str, key: &str) -> Result<Value>
pub fn get(&self, namespace: &str, key: &str) -> Result<Value>
Get an option value, returning the schema default if not set.
Sourcepub fn get_forced(&self, namespace: &str, key: &str) -> Result<Value>
pub fn get_forced(&self, namespace: &str, key: &str) -> Result<Value>
Like get, but always refreshes. Refresh incurs a cost
so this should only be used in testing.