[][src]Struct discv5::query_pool::Query

pub struct Query<TTarget, TNodeId, TResult> {
    id: QueryId,
    peer_iter: QueryPeerIter<TTarget, TNodeId, TResult>,
    started: Option<Instant>,
    target: TTarget,
}

A query in a QueryPool.

Fields

id: QueryId

The unique ID of the query.

peer_iter: QueryPeerIter<TTarget, TNodeId, TResult>

The peer iterator that drives the query state.

started: Option<Instant>

The instant when the query started (i.e. began waiting for the first result from a peer).

target: TTarget

Target we are looking for.

Implementations

impl<TTarget, TNodeId, TResult> Query<TTarget, TNodeId, TResult> where
    TTarget: Into<Key<TTarget>> + Clone,
    TNodeId: Into<Key<TNodeId>> + Eq + Clone,
    TResult: Into<TNodeId> + Clone
[src]

fn new(
    id: QueryId,
    peer_iter: QueryPeerIter<TTarget, TNodeId, TResult>,
    target: TTarget
) -> Self
[src]

Creates a new query without starting it.

pub fn id(&self) -> QueryId[src]

Gets the unique ID of the query.

pub fn on_failure(&mut self, peer: &TNodeId)[src]

Informs the query that the attempt to contact peer failed.

pub fn on_success<'a>(&mut self, peer: &TNodeId, new_peers: &'a [TResult]) where
    &'a TResult: Into<TNodeId>, 
[src]

Informs the query that the attempt to contact peer succeeded, possibly resulting in new peers that should be incorporated into the query, if applicable.

fn next(&mut self, now: Instant) -> QueryState<TNodeId>[src]

Advances the state of the underlying peer iterator.

pub fn into_result(self) -> QueryResult<TTarget, impl Iterator<Item = TNodeId>>[src]

Consumes the query, producing the final QueryResult.

pub fn target(&self) -> &TTarget[src]

Returns a reference to the query target.

pub fn target_mut(&mut self) -> &mut TTarget[src]

Returns a mutable reference to the query target.

Auto Trait Implementations

impl<TTarget, TNodeId, TResult> !RefUnwindSafe for Query<TTarget, TNodeId, TResult>

impl<TTarget, TNodeId, TResult> Send for Query<TTarget, TNodeId, TResult> where
    TNodeId: Send,
    TTarget: Send

impl<TTarget, TNodeId, TResult> !Sync for Query<TTarget, TNodeId, TResult>

impl<TTarget, TNodeId, TResult> Unpin for Query<TTarget, TNodeId, TResult> where
    TNodeId: Unpin,
    TTarget: Unpin

impl<TTarget, TNodeId, TResult> !UnwindSafe for Query<TTarget, TNodeId, TResult>

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

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.

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