[][src]Struct libp2p::core::nodes::node::NodeStream

pub struct NodeStream<TMuxer, TUserData> where
    TMuxer: StreamMuxer
{ /* fields omitted */ }

Implementation of Stream that handles a node.

The stream will receive substreams and can be used to open new outgoing substreams. Destroying the NodeStream will not close the existing substreams.

The stream will close once both the inbound and outbound channels are closed, and no more outbound substream attempt is pending.

Methods

impl<TMuxer, TUserData> NodeStream<TMuxer, TUserData> where
    TMuxer: StreamMuxer
[src]

pub fn new(muxer: TMuxer) -> NodeStream<TMuxer, TUserData>[src]

Creates a new node events stream.

pub fn open_substream(&mut self, user_data: TUserData)[src]

Starts the process of opening a new outbound substream.

After calling this method, polling the stream should eventually produce either an OutboundSubstream event or an OutboundClosed event containing the user data that has been passed to this method.

pub fn is_remote_acknowledged(&self) -> bool[src]

Returns true if the remote has shown any sign of activity after the muxer has been open.

See StreamMuxer::is_remote_acknowledged.

#[must_use] pub fn close(self) -> (Close<TMuxer>, Vec<TUserData>)[src]

Destroys the node stream and returns all the pending outbound substreams, plus an object that signals the remote that we shut down the connection.

pub fn cancel_outgoing(&mut self) -> Vec<TUserData>[src]

Destroys all outbound streams and returns the corresponding user data.

pub fn poll(
    &mut self,
    cx: &mut Context
) -> Poll<Result<NodeEvent<TMuxer, TUserData>, Error>>
[src]

Provides an API similar to Future.

Trait Implementations

impl<TMuxer, TUserData> Debug for NodeStream<TMuxer, TUserData> where
    TMuxer: StreamMuxer
[src]

impl<TMuxer, TUserData> Drop for NodeStream<TMuxer, TUserData> where
    TMuxer: StreamMuxer
[src]

Auto Trait Implementations

impl<TMuxer, TUserData> RefUnwindSafe for NodeStream<TMuxer, TUserData> where
    TMuxer: RefUnwindSafe,
    TUserData: RefUnwindSafe,
    <TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe

impl<TMuxer, TUserData> Send for NodeStream<TMuxer, TUserData> where
    TMuxer: Send + Sync,
    TUserData: Send,
    <TMuxer as StreamMuxer>::OutboundSubstream: Send

impl<TMuxer, TUserData> Sync for NodeStream<TMuxer, TUserData> where
    TMuxer: Send + Sync,
    TUserData: Sync,
    <TMuxer as StreamMuxer>::OutboundSubstream: Sync

impl<TMuxer, TUserData> Unpin for NodeStream<TMuxer, TUserData> where
    TUserData: Unpin,
    <TMuxer as StreamMuxer>::OutboundSubstream: Unpin

impl<TMuxer, TUserData> UnwindSafe for NodeStream<TMuxer, TUserData> where
    TMuxer: RefUnwindSafe,
    TUserData: RefUnwindSafe + UnwindSafe,
    <TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe + UnwindSafe

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>,