Skip to main content

ConfigStore

Trait ConfigStore 

Source
pub trait ConfigStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get(&self, key: &str) -> Result<Option<PortValue>, SdkError>;
    fn set(&self, key: &str, value: PortValue) -> Result<(), SdkError>;
    fn list(&self) -> Result<Vec<(String, PortValue)>, SdkError>;

    // Provided method
    fn source(&self, _key: &str) -> Option<String> { ... }
}
Expand description

Layered configuration source (defaults → global → project → env → CLI).

Synchronous because configuration should always be readable without I/O once the product is initialized.

§Use cases

  • Read ~/.oxicode/settings.toml or ~/.oxios/config.toml
  • Merge per-project overrides
  • Apply environment variable fallbacks

Required Methods§

Source

fn get(&self, key: &str) -> Result<Option<PortValue>, SdkError>

Get a value by dotted key (e.g. "model.provider").

Source

fn set(&self, key: &str, value: PortValue) -> Result<(), SdkError>

Set a value at runtime (in-memory layer). Persistence is impl-defined.

Source

fn list(&self) -> Result<Vec<(String, PortValue)>, SdkError>

List all keys (for diagnostics, dumping, validation).

Provided Methods§

Source

fn source(&self, _key: &str) -> Option<String>

Returns the layer that supplied a key, for diagnostics.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§