Struct cached_path::CacheBuilder[][src]

pub struct CacheBuilder { /* fields omitted */ }

Builder to facilitate creating Cache objects.

Implementations

impl CacheBuilder[src]

pub fn new() -> CacheBuilder[src]

Construct a new CacheBuilder.

pub fn with_client_builder(client_builder: ClientBuilder) -> CacheBuilder[src]

Construct a new CacheBuilder with a ClientBuilder.

pub fn dir(self, dir: PathBuf) -> CacheBuilder[src]

Set the cache location. This can be set through the environment variable RUST_CACHED_PATH_ROOT. Otherwise it will default to a subdirectory named ‘cache’ of the default system temp directory.

pub fn client_builder(self, client_builder: ClientBuilder) -> CacheBuilder[src]

Set the ClientBuilder.

pub fn timeout(self, timeout: Duration) -> CacheBuilder[src]

Enable a request timeout.

pub fn connect_timeout(self, timeout: Duration) -> CacheBuilder[src]

Enable a timeout for the connect phase of each HTTP request.

pub fn max_retries(self, max_retries: u32) -> CacheBuilder[src]

Set maximum number of retries for HTTP requests.

pub fn max_backoff(self, max_backoff: u32) -> CacheBuilder[src]

Set the maximum backoff delay in milliseconds for retrying HTTP requests.

pub fn freshness_lifetime(self, freshness_lifetime: u64) -> CacheBuilder[src]

Set the default freshness lifetime, in seconds. The default is None, meaning the ETAG for an external resource will always be checked for a fresher value.

pub fn offline(self, offline: bool) -> CacheBuilder[src]

Only use offline functionality.

If set to true, when the cached path of an HTTP resource is requested, the latest cached version is returned without checking for freshness. But if no cached versions exist, a NoCachedVersions error is returned.

pub fn progress_bar(self, progress_bar: Option<ProgressBar>) -> CacheBuilder[src]

Set the type of progress bar to use.

The default is Some(ProgressBar::Full).

pub fn build(self) -> Result<Cache, Error>[src]

Build the Cache object.

Trait Implementations

impl Debug for CacheBuilder[src]

impl Default for CacheBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,