Skip to main content

ConfigSection

Trait ConfigSection 

Source
pub trait ConfigSection:
    DeserializeOwned
    + Default
    + Send
    + Sync
    + 'static {
    // Required method
    fn section_name() -> &'static str;

    // Provided methods
    fn section_key(&self) -> &'static str { ... }
    fn load(loader: &DefaultLoader) -> Result<Self, ConfigError> { ... }
}
Expand description

Marks a typed struct as the owner of a named TOML section.

Implement this on any serde::Deserialize + Default config struct. The runtime calls ConfigSection::load once at startup — callers never write the loader call manually.

Required Methods§

Source

fn section_name() -> &'static str

The top-level TOML key for this section (e.g. "mtls", "authz").

Provided Methods§

Source

fn section_key(&self) -> &'static str

The top-level TOML key for this section from a runtime value.

Source

fn load(loader: &DefaultLoader) -> Result<Self, ConfigError>

Load this section from loader, returning Self::default() when the key is absent. Override only when custom merge logic is required.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§