PlaceholderGuard

Struct PlaceholderGuard 

Source
pub struct PlaceholderGuard<'a, Key, Val, We, B, L> {
    lifecycle: &'a L,
    shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>,
    shared: Arc<Placeholder<Val>>,
    inserted: bool,
}

Fields§

§lifecycle: &'a L§shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>§shared: Arc<Placeholder<Val>>§inserted: bool

Implementations§

Source§

impl<'a, Key, Val, We, B, L> PlaceholderGuard<'a, Key, Val, We, B, L>

Source

pub fn start_loading( lifecycle: &'a L, shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>, shared: Arc<Placeholder<Val>>, ) -> Self

Source

fn handle_notification( lifecycle: &'a L, shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>, shared: Arc<Placeholder<Val>>, ) -> Result<Val, PlaceholderGuard<'a, Key, Val, We, B, L>>
where Val: Clone,

Source

fn join_waiters( _locked_shard: RwLockWriteGuard<'a, CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>, shared: &Arc<Placeholder<Val>>, waiter_new: impl FnOnce() -> Option<Waiter>, ) -> Option<Val>
where Val: Clone,

Source§

impl<'a, Key: Eq + Hash, Val: Clone, We: Weighter<Key, Val>, B: BuildHasher, L: Lifecycle<Key, Val>> PlaceholderGuard<'a, Key, Val, We, B, L>

Source

pub fn join<Q>( lifecycle: &'a L, shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>, hash: u64, key: &Q, timeout: Option<Duration>, ) -> GuardResult<'a, Key, Val, We, B, L>
where Q: Hash + Equivalent<Key> + ToOwned<Owned = Key> + ?Sized,

Source

fn join_timeout( lifecycle: &'a L, shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>, shared: Arc<Placeholder<Val>>, parked_thread: Option<ThreadId>, notified: &AtomicBool, ) -> GuardResult<'a, Key, Val, We, B, L>

Source§

impl<Key: Eq + Hash, Val: Clone, We: Weighter<Key, Val>, B: BuildHasher, L: Lifecycle<Key, Val>> PlaceholderGuard<'_, Key, Val, We, B, L>

Source

pub fn insert(self, value: Val) -> Result<(), Val>

Inserts the value into the placeholder

Returns Err if the placeholder isn’t in the cache anymore. A placeholder can be removed as a result of a remove call or a non-placeholder insert with the same key.

Source

pub fn insert_with_lifecycle(self, value: Val) -> Result<L::RequestState, Val>

Inserts the value into the placeholder

Returns Err if the placeholder isn’t in the cache anymore. A placeholder can be removed as a result of a remove call or a non-placeholder insert with the same key.

Source§

impl<Key, Val, We, B, L> PlaceholderGuard<'_, Key, Val, We, B, L>

Trait Implementations§

Source§

impl<Key, Val, We, B, L> Debug for PlaceholderGuard<'_, Key, Val, We, B, L>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Key, Val, We, B, L> Drop for PlaceholderGuard<'_, Key, Val, We, B, L>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, Key, Val, We, B, L> Freeze for PlaceholderGuard<'a, Key, Val, We, B, L>

§

impl<'a, Key, Val, We, B, L> RefUnwindSafe for PlaceholderGuard<'a, Key, Val, We, B, L>

§

impl<'a, Key, Val, We, B, L> Send for PlaceholderGuard<'a, Key, Val, We, B, L>
where L: Sync + Send, Val: Sync + Send, B: Send + Sync, We: Send + Sync, Key: Send + Sync,

§

impl<'a, Key, Val, We, B, L> Sync for PlaceholderGuard<'a, Key, Val, We, B, L>
where L: Sync + Send, Val: Sync + Send, B: Send + Sync, We: Send + Sync, Key: Send + Sync,

§

impl<'a, Key, Val, We, B, L> Unpin for PlaceholderGuard<'a, Key, Val, We, B, L>

§

impl<'a, Key, Val, We, B, L> UnwindSafe for PlaceholderGuard<'a, Key, Val, We, B, L>

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.