pub struct CachedAgentBuilder<T: CacheManager> { /* private fields */ }
Expand description
Builder for creating a CachedAgent
Implementations§
Source§impl<T: CacheManager> CachedAgentBuilder<T>
impl<T: CacheManager> CachedAgentBuilder<T>
Sourcepub fn agent_config(self, config: Config) -> Self
pub fn agent_config(self, config: Config) -> Self
Set the ureq agent configuration
The provided configuration will be used to preserve your settings like
timeout, proxy, TLS config, and user agent. However, http_status_as_error
will always be set to false
to ensure proper cache operation.
This is necessary because the cache middleware needs to see all HTTP responses (including 4xx and 5xx status codes) to make proper caching decisions.
Sourcepub fn cache_manager(self, manager: T) -> Self
pub fn cache_manager(self, manager: T) -> Self
Set the cache manager
Sourcepub fn cache_mode(self, mode: CacheMode) -> Self
pub fn cache_mode(self, mode: CacheMode) -> Self
Set the cache mode
Sourcepub fn cache_options(self, options: HttpCacheOptions) -> Self
pub fn cache_options(self, options: HttpCacheOptions) -> Self
Set cache options
Sourcepub fn build(self) -> Result<CachedAgent<T>, HttpCacheError>
pub fn build(self) -> Result<CachedAgent<T>, HttpCacheError>
Build the cached agent
Trait Implementations§
Source§impl<T: Debug + CacheManager> Debug for CachedAgentBuilder<T>
impl<T: Debug + CacheManager> Debug for CachedAgentBuilder<T>
Source§impl<T: CacheManager> Default for CachedAgentBuilder<T>
impl<T: CacheManager> Default for CachedAgentBuilder<T>
Auto Trait Implementations§
impl<T> Freeze for CachedAgentBuilder<T>where
T: Freeze,
impl<T> !RefUnwindSafe for CachedAgentBuilder<T>
impl<T> Send for CachedAgentBuilder<T>
impl<T> Sync for CachedAgentBuilder<T>
impl<T> Unpin for CachedAgentBuilder<T>where
T: Unpin,
impl<T> !UnwindSafe for CachedAgentBuilder<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more