Trait cli_autoupdate::Registry

source ·
pub trait Registry {
    // Required methods
    fn get_base_url(&self) -> Url;
    fn get_update_path<C: Config>(&self, config: &C) -> String;
    fn get_basic_auth(&self) -> (Option<String>, Option<String>);
}
Expand description

This trait is responsible to gives the base url for and the final path of the update json package description

Eg:

    use cli_autoupdate::{Config, Registry};
	struct MyRegistry
    impl Registry for MyRegistry {
		fn get_base_url(&self) -> Url {
			Url::parse("https://registry.example/").unwrap()
		}
		fn get_update_path<C: Config>(&self, config: &C) -> String {
			format!("{}.json", config.target())
		}
		fn get_basic_auth(&self) -> (Option<String>, Option<String>) {
			(None, None)
		}
	}

Required Methods§

source

fn get_base_url(&self) -> Url

base url of the repository. This is also used together with the RemoteVersion::path to create the final download url.

source

fn get_update_path<C: Config>(&self, config: &C) -> String

This is the relative update json path, according to the configuration path.

source

fn get_basic_auth(&self) -> (Option<String>, Option<String>)

Object Safety§

This trait is not object safe.

Implementors§