First download dependency using cargo
$ cargo add runcfgAlternatively you can add this to your cargo.toml
runcfg = "1.0.0"- Create an account at https://runcfg.com
- Download your .runcfg file from your project page at https://runcfg.com
- Place your .runcfg file at the root of your project
- Create an instance of the client in your code as follows:
use runcfg;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ExampleConfig {
#[serde(rename = "version")]
pub version: String,
#[serde(rename = "target")]
pub target: String,
#[serde(rename = "enabled")]
pub enabled: String,
}
fn load_config() {
let client = runcfg::Client::new();
let exampleConfig: ExampleConfig = client.load().unwrap();
assert_eq!(exampleConfig.version, "1");
}Now your remote config is available in your specified type.