vipera

Crates.iovipera
lib.rsvipera
version0.1.2
sourcesrc
created_at2024-04-08 07:04:15.86636
updated_at2024-04-08 07:04:15.86636
descriptionsimple configuration file crate, but it works.
homepage
repositoryhttps://github.com/levinion/vipera
max_upload_size
id1199952
size14,005
Maruka (levinion)

documentation

https://docs.rs/vipera

README

Vipera

Intro

Vipera is a straightforward Rust configuration crate, drawing inspiration from the functionality of Viper. Designed with simplicity in mind, it offers an easy-to-use approach for handling configurations in Rust applications. Whether you're working on a small project or a larger application, Vipera provides the tools needed to manage configuration settings efficiently. With features reminiscent of Viper, Vipera simplifies the process of accessing and manipulating configuration data, empowering developers to focus on building robust software solutions without getting bogged down in the intricacies of configuration management.

Usage

use vipera::Configuration;

#[derive(serde::Deserialize, serde::Serialize, Default)]
struct Config {
    pub scale: f64,
    pub cursor_size: Option<u32>,
    pub refresh: Option<i32>,
}

impl vipera::Configuration for Config {
    fn vipera() -> vipera::Vipera {
        vipera::Vipera::new()
            .set_config_name("config.toml")
            .add_config_path("/etc/vipera")
            .add_config_path("$HOME/.config/vipera")
    }
}

fn main() {
    let config = Config::read_in_config().unwrap_or_default();
    config.write_config().unwrap();
}
Commit count: 6

cargo fmt