[−][src]Struct libp2p_core::nodes::node::NodeStream
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]
TMuxer: StreamMuxer,
pub fn new(muxer: TMuxer) -> Self
[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) -> Poll<NodeEvent<TMuxer, TUserData>, IoError>
[src]
Provides an API similar to Future
.
Trait Implementations
impl<TMuxer, TUserData> Drop for NodeStream<TMuxer, TUserData> where
TMuxer: StreamMuxer,
[src]
TMuxer: StreamMuxer,
impl<TMuxer, TUserData> Debug for NodeStream<TMuxer, TUserData> where
TMuxer: StreamMuxer,
[src]
TMuxer: StreamMuxer,
Auto Trait Implementations
impl<TMuxer, TUserData> Unpin for NodeStream<TMuxer, TUserData> where
TUserData: Unpin,
<TMuxer as StreamMuxer>::OutboundSubstream: Unpin,
TUserData: Unpin,
<TMuxer as StreamMuxer>::OutboundSubstream: Unpin,
impl<TMuxer, TUserData> Sync for NodeStream<TMuxer, TUserData> where
TMuxer: Send + Sync,
TUserData: Sync,
<TMuxer as StreamMuxer>::OutboundSubstream: Sync,
TMuxer: Send + Sync,
TUserData: Sync,
<TMuxer as StreamMuxer>::OutboundSubstream: Sync,
impl<TMuxer, TUserData> Send for NodeStream<TMuxer, TUserData> where
TMuxer: Send + Sync,
TUserData: Send,
<TMuxer as StreamMuxer>::OutboundSubstream: Send,
TMuxer: Send + Sync,
TUserData: Send,
<TMuxer as StreamMuxer>::OutboundSubstream: Send,
impl<TMuxer, TUserData> RefUnwindSafe for NodeStream<TMuxer, TUserData> where
TMuxer: RefUnwindSafe,
TUserData: RefUnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe,
TMuxer: RefUnwindSafe,
TUserData: RefUnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe,
impl<TMuxer, TUserData> UnwindSafe for NodeStream<TMuxer, TUserData> where
TMuxer: RefUnwindSafe,
TUserData: RefUnwindSafe + UnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe + UnwindSafe,
TMuxer: RefUnwindSafe,
TUserData: RefUnwindSafe + UnwindSafe,
<TMuxer as StreamMuxer>::OutboundSubstream: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self