Trait cli_autoupdate::Config
source · pub trait Config {
// Required method
fn target(&self) -> String;
// Provided method
fn version(&self) -> Version { ... }
}Expand description
Configuration implementation for the current package
Eg:
use cli_autoupdate::Config;
use semver::Version;
struct MyConfig;
impl Config for MyConfig {
fn version(&self) -> Version {
let version_str = std::env::var("CARGO_PKG_VERSION").unwrap();
Version::parse(version_str.as_str()).unwrap()
}
fn target(&self) -> String {
let target = std::env::var("TARGET").unwrap_or("aarch64-apple-darwin".to_string());
format!("{}", target)
}
}