Skip to main content

Fetcher

Trait Fetcher 

Source
pub trait Fetcher: Send + Sync {
    // Required method
    fn fetch(&self, url: &str, dest: &Path) -> Result<(), String>;
}
Expand description

Downloads a URL to a file.

Behind a trait for the same reason the build service’s toolchain is (PM.5): the interesting behaviour around it — where the bytes land, what manifest gets synthesised, what happens when the download fails — should be testable without reaching the network, which is neither fast nor available in CI sandboxes.

Required Methods§

Source

fn fetch(&self, url: &str, dest: &Path) -> Result<(), String>

Fetch url, writing the body to dest.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§