Struct libp2p::kad::QueryStats
source · pub struct QueryStats { /* private fields */ }
Expand description
Execution statistics of a query.
Implementations§
source§impl QueryStats
impl QueryStats
pub fn empty() -> QueryStats
sourcepub fn num_requests(&self) -> u32
pub fn num_requests(&self) -> u32
Gets the total number of requests initiated by the query.
sourcepub fn num_successes(&self) -> u32
pub fn num_successes(&self) -> u32
Gets the number of successful requests.
sourcepub fn num_failures(&self) -> u32
pub fn num_failures(&self) -> u32
Gets the number of failed requests.
sourcepub fn num_pending(&self) -> u32
pub fn num_pending(&self) -> u32
Gets the number of pending requests.
Note: A query can finish while still having pending requests, if the termination conditions are already met.
sourcepub fn duration(&self) -> Option<Duration>
pub fn duration(&self) -> Option<Duration>
Gets the duration of the query.
If the query has not yet finished, the duration is measured from the start of the query to the current instant.
If the query did not yet start (i.e. yield the first peer to contact),
None
is returned.
sourcepub fn merge(self, other: QueryStats) -> QueryStats
pub fn merge(self, other: QueryStats) -> QueryStats
Merges these stats with the given stats of another query, e.g. to accumulate statistics from a multi-phase query.
Counters are merged cumulatively while the instants for start and end of the queries are taken as the minimum and maximum, respectively.
Trait Implementations§
source§impl Clone for QueryStats
impl Clone for QueryStats
source§fn clone(&self) -> QueryStats
fn clone(&self) -> QueryStats
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for QueryStats
impl Debug for QueryStats
source§impl PartialEq for QueryStats
impl PartialEq for QueryStats
source§fn eq(&self, other: &QueryStats) -> bool
fn eq(&self, other: &QueryStats) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for QueryStats
impl StructuralPartialEq for QueryStats
Auto Trait Implementations§
impl Freeze for QueryStats
impl RefUnwindSafe for QueryStats
impl Send for QueryStats
impl Sync for QueryStats
impl Unpin for QueryStats
impl UnwindSafe for QueryStats
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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