pub trait Backend {
// Required methods
fn validate(
&self,
config: &HostsConfig,
) -> Result<Vec<ValidationResult>, HostsError>;
fn update(&self, config: &HostsConfig) -> Result<String, HostsError>;
fn remove(&self, hostnames: &[String]) -> Result<String, HostsError>;
fn generate_manual_instructions(&self, config: &HostsConfig) -> String;
}Expand description
Ported from the Backend interface in interface.go.
Required Methods§
Sourcefn validate(
&self,
config: &HostsConfig,
) -> Result<Vec<ValidationResult>, HostsError>
fn validate( &self, config: &HostsConfig, ) -> Result<Vec<ValidationResult>, HostsError>
Checks if hostnames in /etc/hosts match the expected
configuration. Returns validation results for any hostnames that
are missing or incorrect; an empty result means all are valid.
Sourcefn update(&self, config: &HostsConfig) -> Result<String, HostsError>
fn update(&self, config: &HostsConfig) -> Result<String, HostsError>
Computes the new /etc/hosts content with hostnames added or
updated. Does not write the file.
Sourcefn remove(&self, hostnames: &[String]) -> Result<String, HostsError>
fn remove(&self, hostnames: &[String]) -> Result<String, HostsError>
Computes the new /etc/hosts content with hostnames removed.
Does not write the file.
Sourcefn generate_manual_instructions(&self, config: &HostsConfig) -> String
fn generate_manual_instructions(&self, config: &HostsConfig) -> String
Generates instructions for manually updating /etc/hosts.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".