Struct hua_core::cache::CacheBuilder
source · [−]pub struct CacheBuilder { /* private fields */ }
Expand description
Builder to facilitate creating Cache
objects.
Implementations
sourceimpl CacheBuilder
impl CacheBuilder
sourcepub fn new() -> CacheBuilder
pub fn new() -> CacheBuilder
Construct a new CacheBuilder
.
sourcepub fn with_client_builder(client_builder: ClientBuilder) -> CacheBuilder
pub fn with_client_builder(client_builder: ClientBuilder) -> CacheBuilder
Construct a new CacheBuilder
with a ClientBuilder
.
sourcepub fn dir(self, dir: PathBuf) -> CacheBuilder
pub fn dir(self, dir: PathBuf) -> CacheBuilder
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.
sourcepub fn client_builder(self, client_builder: ClientBuilder) -> CacheBuilder
pub fn client_builder(self, client_builder: ClientBuilder) -> CacheBuilder
Set the ClientBuilder
.
sourcepub fn timeout(self, timeout: Duration) -> CacheBuilder
pub fn timeout(self, timeout: Duration) -> CacheBuilder
Enable a request timeout.
sourcepub fn connect_timeout(self, timeout: Duration) -> CacheBuilder
pub fn connect_timeout(self, timeout: Duration) -> CacheBuilder
Enable a timeout for the connect phase of each HTTP request.
sourcepub fn max_retries(self, max_retries: u32) -> CacheBuilder
pub fn max_retries(self, max_retries: u32) -> CacheBuilder
Set maximum number of retries for HTTP requests.
sourcepub fn max_backoff(self, max_backoff: u32) -> CacheBuilder
pub fn max_backoff(self, max_backoff: u32) -> CacheBuilder
Set the maximum backoff delay in milliseconds for retrying HTTP requests.
sourcepub fn freshness_lifetime(self, freshness_lifetime: u64) -> CacheBuilder
pub fn freshness_lifetime(self, freshness_lifetime: u64) -> CacheBuilder
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.
sourcepub fn offline(self, offline: bool) -> CacheBuilder
pub fn offline(self, offline: bool) -> CacheBuilder
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.
sourcepub fn progress_bar(self, progress_bar: Option<ProgressBar>) -> CacheBuilder
pub fn progress_bar(self, progress_bar: Option<ProgressBar>) -> CacheBuilder
Set the type of progress bar to use.
The default is Some(ProgressBar::Full)
.
Trait Implementations
sourceimpl Debug for CacheBuilder
impl Debug for CacheBuilder
sourceimpl Default for CacheBuilder
impl Default for CacheBuilder
sourcefn default() -> CacheBuilder
fn default() -> CacheBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for CacheBuilder
impl Send for CacheBuilder
impl Sync for CacheBuilder
impl Unpin for CacheBuilder
impl !UnwindSafe for CacheBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more