Struct libp2p_kad::QueryStats
source · [−]pub struct QueryStats { /* private fields */ }
Expand description
Execution statistics of a query.
Implementations
sourceimpl QueryStats
impl QueryStats
pub fn empty() -> Self
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) -> Self
pub fn merge(self, other: QueryStats) -> Self
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
sourceimpl Clone for QueryStats
impl Clone for QueryStats
sourcefn clone(&self) -> QueryStats
fn clone(&self) -> QueryStats
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for QueryStats
impl Debug for QueryStats
sourceimpl PartialEq<QueryStats> for QueryStats
impl PartialEq<QueryStats> for QueryStats
sourcefn eq(&self, other: &QueryStats) -> bool
fn eq(&self, other: &QueryStats) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &QueryStats) -> bool
fn ne(&self, other: &QueryStats) -> bool
This method tests for !=
.
impl Eq for QueryStats
impl StructuralEq for QueryStats
impl StructuralPartialEq for QueryStats
Auto Trait Implementations
impl RefUnwindSafe for QueryStats
impl Send for QueryStats
impl Sync for QueryStats
impl Unpin for QueryStats
impl UnwindSafe for QueryStats
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more