pub(crate) struct JoinFuture<'a, 'b, Q: ?Sized, Key, Val, We, B, L> {
lifecycle: &'a L,
shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>,
hash: u64,
key: &'b Q,
state: JoinFutureState<Val>,
notified: AtomicBool,
_pin: PhantomPinned,
}Expand description
Future that checks for an existing placeholder and waits for it to be filled.
The shard lock is acquired as a local variable inside poll, never stored
in the future state, so the future remains Send.
§Pin safety
This future is !Unpin because poll registers &self.notified as a raw
pointer in the placeholder’s waiter list. Pin guarantees the future won’t
be moved after the first poll, keeping that pointer valid. The pointer is
cleaned up in drop_pending_waiter before the struct is destroyed.
Fields§
§lifecycle: &'a L§shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>§hash: u64§key: &'b Q§state: JoinFutureState<Val>§notified: AtomicBool§_pin: PhantomPinnedImplementations§
Source§impl<'a, 'b, Q: ?Sized, Key, Val, We, B, L> JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
impl<'a, 'b, Q: ?Sized, Key, Val, We, B, L> JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
pub(crate) fn new( lifecycle: &'a L, shard: &'a RwLock<CacheShard<Key, Val, We, B, L, Arc<Placeholder<Val>>>>, hash: u64, key: &'b Q, ) -> Self
Source§impl<Q: ?Sized, Key, Val, We, B, L> JoinFuture<'_, '_, Q, Key, Val, We, B, L>
impl<Q: ?Sized, Key, Val, We, B, L> JoinFuture<'_, '_, Q, Key, Val, We, B, L>
fn drop_pending_waiter(&mut self)
Trait Implementations§
Source§impl<Q: ?Sized, Key, Val, We, B, L> Drop for JoinFuture<'_, '_, Q, Key, Val, We, B, L>
impl<Q: ?Sized, Key, Val, We, B, L> Drop for JoinFuture<'_, '_, Q, Key, Val, We, B, L>
Source§impl<'a, Key: Eq + Hash, Q: Hash + Equivalent<Key> + ToOwned<Owned = Key> + ?Sized, Val, We: Weighter<Key, Val>, B: BuildHasher, L: Lifecycle<Key, Val>> Future for JoinFuture<'a, '_, Q, Key, Val, We, B, L>
impl<'a, Key: Eq + Hash, Q: Hash + Equivalent<Key> + ToOwned<Owned = Key> + ?Sized, Val, We: Weighter<Key, Val>, B: BuildHasher, L: Lifecycle<Key, Val>> Future for JoinFuture<'a, '_, Q, Key, Val, We, B, L>
Source§type Output = JoinResult<'a, Key, Val, We, B, L>
type Output = JoinResult<'a, Key, Val, We, B, L>
The type of value produced on completion.
Auto Trait Implementations§
impl<'a, 'b, Q, Key, Val, We, B, L> !Freeze for JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
impl<'a, 'b, Q, Key, Val, We, B, L> RefUnwindSafe for JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
impl<'a, 'b, Q, Key, Val, We, B, L> Send for JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
impl<'a, 'b, Q, Key, Val, We, B, L> Sync for JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
impl<'a, 'b, Q, Key, Val, We, B, L> !Unpin for JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
impl<'a, 'b, Q, Key, Val, We, B, L> UnwindSafe for JoinFuture<'a, 'b, Q, Key, Val, We, B, L>
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<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more