ConfigFile

Trait ConfigFile 

Source
pub trait ConfigFile:
    DeserializeOwned
    + Serialize
    + JsonSchema {
    // Required method
    fn config_file_path() -> PathBuf;

    // Provided methods
    fn delete(&self) -> Result<()> { ... }
    fn get_schema() -> Schema { ... }
    fn try_load() -> Result<Self, LoadConfigError> { ... }
    fn write(&self) -> Result<()> { ... }
    fn write_schema() -> Result<()> { ... }
}
Expand description

Trait defining a struct as representing a config file.

Required Methods§

Source

fn config_file_path() -> PathBuf

The path to the config file.

Provided Methods§

Source

fn delete(&self) -> Result<()>

Delete the config file.

Source

fn get_schema() -> Schema

Get the schema for the config file.

Source

fn try_load() -> Result<Self, LoadConfigError>

Try load the config file, linting it against its JSON schema.

Source

fn write(&self) -> Result<()>

Write the config file.

Source

fn write_schema() -> Result<()>

Write the schema to the schema file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§