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)
    }
}

Required Methods§

source

fn target(&self) -> String

Returns the package specific path, used by the registry

Provided Methods§

source

fn version(&self) -> Version

Should return the current package version

Implementors§