Skip to main content

ConfigItem

Trait ConfigItem 

Source
pub trait ConfigItem:
    DeserializeOwned
    + Clone
    + Send
    + Sync
    + 'static {
    // Required method
    fn key() -> &'static str;
}
Expand description

Trait for configuration section types.

Types implementing this trait can be used with Config::get() to extract and deserialize specific sections from the configuration table.

Required Methods§

Source

fn key() -> &'static str

Returns the TOML section key for this configuration type.

§Example
[database]
host = "localhost"

In this example, the key() method for DatabaseConfig would return "database".

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§