pub struct Pending<T: PartialEq + Eq + Hash, V: Clone> { /* private fields */ }Implementations§
Source§impl<T: Copy + Clone + PartialEq + Eq + Hash, V: Clone> Pending<T, V>
impl<T: Copy + Clone + PartialEq + Eq + Hash, V: Clone> Pending<T, V>
Sourcepub fn contains(&self, item: impl Into<T>) -> bool
pub fn contains(&self, item: impl Into<T>) -> bool
Returns true if the pending queue contains the specified item.
Sourcepub fn contains_peer(&self, item: impl Into<T>, peer_ip: SocketAddr) -> bool
pub fn contains_peer(&self, item: impl Into<T>, peer_ip: SocketAddr) -> bool
Returns true if the pending queue contains the specified item for the specified peer IP.
Sourcepub fn contains_peer_with_sent_request(
&self,
item: impl Into<T>,
peer_ip: SocketAddr,
) -> bool
pub fn contains_peer_with_sent_request( &self, item: impl Into<T>, peer_ip: SocketAddr, ) -> bool
Returns true if the pending queue contains the specified item for the specified peer IP with a sent request.
Sourcepub fn get_peers(&self, item: impl Into<T>) -> Option<HashSet<SocketAddr>>
pub fn get_peers(&self, item: impl Into<T>) -> Option<HashSet<SocketAddr>>
Returns the peer IPs for the specified item.
Sourcepub fn num_callbacks(&self, item: impl Into<T>) -> usize
pub fn num_callbacks(&self, item: impl Into<T>) -> usize
Returns the number of pending callbacks for the specified item.
Sourcepub fn num_sent_requests(&self, item: impl Into<T>) -> usize
pub fn num_sent_requests(&self, item: impl Into<T>) -> usize
Returns the number of pending sent requests for the specified item.
Sourcepub fn insert(
&self,
item: impl Into<T>,
peer_ip: SocketAddr,
callback: Option<(Sender<V>, bool)>,
) -> bool
pub fn insert( &self, item: impl Into<T>, peer_ip: SocketAddr, callback: Option<(Sender<V>, bool)>, ) -> bool
Inserts the specified item and peer IP to the pending queue,
returning true if the peer IP was newly-inserted into the entry for the item.
In addition, an optional callback may be provided, that is triggered upon removal.
Note: The callback, if provided, is always inserted into the callback queue.
Sourcepub fn remove(
&self,
item: impl Into<T>,
callback_value: Option<V>,
) -> Option<HashSet<SocketAddr>>
pub fn remove( &self, item: impl Into<T>, callback_value: Option<V>, ) -> Option<HashSet<SocketAddr>>
Removes the specified item from the pending queue.
If the item exists and is removed, the peer IPs are returned.
If the item does not exist, None is returned.
Sourcepub fn clear_expired_callbacks_for_item(&self, now: i64, item: impl Into<T>)
pub fn clear_expired_callbacks_for_item(&self, now: i64, item: impl Into<T>)
Removes the callbacks for the specified item that have expired.
Sourcepub fn clear_expired_callbacks(&self)
pub fn clear_expired_callbacks(&self)
Removes the callbacks for all items have that expired.
Trait Implementations§
Auto Trait Implementations§
impl<T, V> !Freeze for Pending<T, V>
impl<T, V> !RefUnwindSafe for Pending<T, V>
impl<T, V> Send for Pending<T, V>
impl<T, V> Sync for Pending<T, V>
impl<T, V> Unpin for Pending<T, V>where
T: Unpin,
impl<T, V> UnsafeUnpin for Pending<T, V>
impl<T, V> !UnwindSafe for Pending<T, V>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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