Skip to main content

Config

Trait Config 

Source
pub trait Config:
    Debug
    + Serialize
    + DeserializeOwned {
    // Provided methods
    fn save<P: AsRef<Path>>(&self, file: P) -> Result<()> { ... }
    fn load<P: AsRef<Path>>(file: P) -> Result<Self, ConfigError> { ... }
    fn load_binary(data: &[u8]) -> Result<Self, ConfigError> { ... }
}
Expand description

Configuration trait.

Provided Methods§

Source

fn save<P: AsRef<Path>>(&self, file: P) -> Result<()>

Available on crate feature std only.

Saves the configuration to a file.

§Arguments
  • file - File to save the configuration to.
§Returns

The output of the save operation.

Source

fn load<P: AsRef<Path>>(file: P) -> Result<Self, ConfigError>

Available on crate feature std only.

Loads the configuration from a file.

§Arguments
  • file - File to load the configuration from.
§Returns

The loaded configuration.

Source

fn load_binary(data: &[u8]) -> Result<Self, ConfigError>

Loads the configuration from a binary buffer.

§Arguments
  • data - Binary buffer to load the configuration from.
§Returns

The loaded configuration.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§