[][src]Struct libp2p::core::nodes::handled_node_tasks::HandledNodesTasks

pub struct HandledNodesTasks<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo = PeerId> { /* fields omitted */ }

Implementation of Stream that handles a collection of nodes.

Methods

impl<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo> HandledNodesTasks<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo>[src]

pub fn new(
) -> HandledNodesTasks<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo>
[src]

Creates a new empty collection.

pub fn add_reach_attempt<TFut, TMuxer>(
    &mut self,
    future: TFut,
    user_data: TUserData,
    handler: TIntoHandler
) -> TaskId where
    TConnInfo: Send + 'static,
    TFut: Future<Item = (TConnInfo, TMuxer), Error = TReachErr> + Send + 'static,
    THandlerErr: Error + Send + 'static,
    TInEvent: Send + 'static,
    TIntoHandler: IntoNodeHandler<TConnInfo> + Send + 'static,
    TMuxer: StreamMuxer + Send + Sync + 'static,
    TOutEvent: Send + 'static,
    TReachErr: Error + Send + 'static,
    <TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler: NodeHandler,
    <TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler: Send,
    <TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler: 'static,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::OutboundOpenInfo: Send,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::OutboundOpenInfo: 'static,
    <TMuxer as StreamMuxer>::OutboundSubstream: Send,
    <TMuxer as StreamMuxer>::OutboundSubstream: 'static,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::Substream == SubstreamRef<Arc<TMuxer>>,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::InEvent == TInEvent,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::OutEvent == TOutEvent,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::Error == THandlerErr, 
[src]

Adds to the collection a future that tries to reach a node.

This method spawns a task dedicated to resolving this future and processing the node's events.

pub fn add_connection<TMuxer, THandler>(
    &mut self,
    user_data: TUserData,
    muxer: TMuxer,
    handler: THandler
) -> TaskId where
    TConnInfo: Send + 'static,
    THandler: NodeHandler<Substream = SubstreamRef<Arc<TMuxer>>, InEvent = TInEvent, OutEvent = TOutEvent, Error = THandlerErr> + Send + 'static,
    THandlerErr: Error + Send + 'static,
    TInEvent: Send + 'static,
    TIntoHandler: IntoNodeHandler<TConnInfo, Handler = THandler> + Send + 'static,
    TMuxer: StreamMuxer + Send + Sync + 'static,
    TOutEvent: Send + 'static,
    TReachErr: Error + Send + 'static,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::OutboundOpenInfo: Send,
    <<TIntoHandler as IntoNodeHandler<TConnInfo>>::Handler as NodeHandler>::OutboundOpenInfo: 'static,
    <TMuxer as StreamMuxer>::OutboundSubstream: Send,
    <TMuxer as StreamMuxer>::OutboundSubstream: 'static, 
[src]

Adds an existing connection to a node to the collection.

This method spawns a task dedicated to processing the node's events.

No NodeReached event will be emitted for this task, since the node has already been reached.

pub fn broadcast_event(&mut self, event: &TInEvent) where
    TInEvent: Clone
[src]

Sends an event to all the tasks, including the pending ones.

pub fn task(&mut self, id: TaskId) -> Option<Task<TInEvent, TUserData>>[src]

Grants access to an object that allows controlling a task of the collection.

Returns None if the task id is invalid.

pub fn tasks(&'a self) -> impl Iterator<Item = TaskId> + 'a[src]

Returns a list of all the active tasks.

pub fn poll(
    &mut self
) -> Async<HandledNodesEvent<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo>>
[src]

Provides an API similar to Stream, except that it cannot produce an error.

Trait Implementations

impl<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo> Debug for HandledNodesTasks<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo> where
    TUserData: Debug
[src]

Auto Trait Implementations

impl<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo> Send for HandledNodesTasks<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo> where
    TConnInfo: Send,
    THandlerErr: Send,
    TInEvent: Send,
    TIntoHandler: Send,
    TOutEvent: Send,
    TReachErr: Send,
    TUserData: Send

impl<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo = PeerId> !Sync for HandledNodesTasks<TInEvent, TOutEvent, TIntoHandler, TReachErr, THandlerErr, TUserData, TConnInfo>

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T> Erased for T