Struct libp2p::kad::QueryStats[][src]

pub struct QueryStats { /* fields omitted */ }
Expand description

Execution statistics of a query.

Implementations

impl QueryStats[src]

pub fn empty() -> QueryStats[src]

pub fn num_requests(&self) -> u32[src]

Gets the total number of requests initiated by the query.

pub fn num_successes(&self) -> u32[src]

Gets the number of successful requests.

pub fn num_failures(&self) -> u32[src]

Gets the number of failed requests.

pub fn num_pending(&self) -> u32[src]

Gets the number of pending requests.

Note: A query can finish while still having pending requests, if the termination conditions are already met.

pub fn duration(&self) -> Option<Duration>[src]

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.

pub fn merge(self, other: QueryStats) -> QueryStats[src]

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

impl Clone for QueryStats[src]

pub fn clone(&self) -> QueryStats[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for QueryStats[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl PartialEq<QueryStats> for QueryStats[src]

pub fn eq(&self, other: &QueryStats) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &QueryStats) -> bool[src]

This method tests for !=.

impl Eq for QueryStats[src]

impl StructuralEq for QueryStats[src]

impl StructuralPartialEq for QueryStats[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V