AsyncCacheBuilder

Struct AsyncCacheBuilder 

Source
pub struct AsyncCacheBuilder<K, T, F, S = RandomState>
where T: Send + Sync + 'static, F: Fetcher<K, T>,
{ /* private fields */ }

Implementations§

Source§

impl<K, T, F, S> AsyncCacheBuilder<K, T, F, S>
where T: Send + Sync + Clone + 'static, F: Fetcher<K, T> + Sync + Send + 'static,

Source

pub fn new(refresh_interval: Duration, fetcher: F) -> Self

Source

pub fn with_expire(self, expire_interval: Option<Duration>) -> Self

Source

pub fn with_error_tx(self, tx: Sender<(K, F::Error)>) -> Self

Source

pub fn with_delete_tx(self, tx: Sender<(K, T)>) -> Self

Source

pub fn with_capacity(self, capacity: usize) -> Self

Source

pub fn build(self) -> AsyncCache<K, T, F, S>
where K: Eq + Hash + Sync + Send + Clone + 'static, S: BuildHasher + Default + Clone + Sync + Send + 'static,

Auto Trait Implementations§

§

impl<K, T, F, S> Freeze for AsyncCacheBuilder<K, T, F, S>
where F: Freeze,

§

impl<K, T, F, S> RefUnwindSafe for AsyncCacheBuilder<K, T, F, S>

§

impl<K, T, F, S> Send for AsyncCacheBuilder<K, T, F, S>
where F: Send, S: Send, K: Send,

§

impl<K, T, F, S> Sync for AsyncCacheBuilder<K, T, F, S>
where F: Sync, S: Sync, K: Send,

§

impl<K, T, F, S> Unpin for AsyncCacheBuilder<K, T, F, S>
where F: Unpin, S: Unpin,

§

impl<K, T, F, S> UnwindSafe for AsyncCacheBuilder<K, T, F, S>
where F: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.