[−][src]Struct discv5::query_pool::Query
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]
TTarget: Into<Key<TTarget>> + Clone,
TNodeId: Into<Key<TNodeId>> + Eq + Clone,
TResult: Into<TNodeId> + Clone,
fn new(
id: QueryId,
peer_iter: QueryPeerIter<TTarget, TNodeId, TResult>,
target: TTarget
) -> Self
[src]
id: QueryId,
peer_iter: QueryPeerIter<TTarget, TNodeId, TResult>,
target: TTarget
) -> Self
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]
&'a TResult: Into<TNodeId>,
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,
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,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,