Struct libp2p_swarm::Swarm
source · pub struct Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,{ /* private fields */ }
Expand description
Contains the state of the network, plus the way it should behave.
Note: Needs to be polled via <Swarm as Stream>
in order to make
progress.
Implementations§
source§impl<TBehaviour> Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
impl<TBehaviour> Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
sourcepub fn new(
transport: Boxed<(PeerId, StreamMuxerBox)>,
behaviour: TBehaviour,
local_peer_id: PeerId,
config: Config
) -> Self
pub fn new( transport: Boxed<(PeerId, StreamMuxerBox)>, behaviour: TBehaviour, local_peer_id: PeerId, config: Config ) -> Self
Creates a new Swarm
from the given Transport
, NetworkBehaviour
, PeerId
and
Config
.
sourcepub fn network_info(&self) -> NetworkInfo
pub fn network_info(&self) -> NetworkInfo
Returns information about the connections underlying the Swarm
.
sourcepub fn listen_on(
&mut self,
addr: Multiaddr
) -> Result<ListenerId, TransportError<Error>>
pub fn listen_on( &mut self, addr: Multiaddr ) -> Result<ListenerId, TransportError<Error>>
Starts listening on the given address. Returns an error if the address is not supported.
Listeners report their new listening addresses as SwarmEvent::NewListenAddr
.
Depending on the underlying transport, one listener may have multiple listening addresses.
sourcepub fn remove_listener(&mut self, listener_id: ListenerId) -> bool
pub fn remove_listener(&mut self, listener_id: ListenerId) -> bool
Remove some listener.
Returns true
if there was a listener with this ID, false
otherwise.
sourcepub fn dial(&mut self, opts: impl Into<DialOpts>) -> Result<(), DialError>
pub fn dial(&mut self, opts: impl Into<DialOpts>) -> Result<(), DialError>
Dial a known or unknown peer.
See also DialOpts
.
let mut swarm = build_swarm();
// Dial a known peer.
swarm.dial(PeerId::random());
// Dial an unknown peer.
swarm.dial("/ip6/::1/tcp/12345".parse::<Multiaddr>().unwrap());
sourcepub fn listeners(&self) -> impl Iterator<Item = &Multiaddr>
pub fn listeners(&self) -> impl Iterator<Item = &Multiaddr>
Returns an iterator that produces the list of addresses we’re listening on.
sourcepub fn local_peer_id(&self) -> &PeerId
pub fn local_peer_id(&self) -> &PeerId
Returns the peer ID of the swarm passed as parameter.
sourcepub fn external_addresses(&self) -> impl Iterator<Item = &Multiaddr>
pub fn external_addresses(&self) -> impl Iterator<Item = &Multiaddr>
List all confirmed external address for the local node.
sourcepub fn add_external_address(&mut self, a: Multiaddr)
pub fn add_external_address(&mut self, a: Multiaddr)
Add a confirmed external address for the local node.
This function should only be called with addresses that are guaranteed to be reachable.
The address is broadcast to all NetworkBehaviour
s via FromSwarm::ExternalAddrConfirmed
.
sourcepub fn remove_external_address(&mut self, addr: &Multiaddr)
pub fn remove_external_address(&mut self, addr: &Multiaddr)
Remove an external address for the local node.
The address is broadcast to all NetworkBehaviour
s via FromSwarm::ExternalAddrExpired
.
sourcepub fn disconnect_peer_id(&mut self, peer_id: PeerId) -> Result<(), ()>
pub fn disconnect_peer_id(&mut self, peer_id: PeerId) -> Result<(), ()>
Disconnects a peer by its peer ID, closing all connections to said peer.
Returns Ok(())
if there was one or more established connections to the peer.
Closing a connection via Swarm::disconnect_peer_id
will poll ConnectionHandler::poll_close
to completion.
Use this function if you want to close a connection despite it still being in use by one or more handlers.
sourcepub fn close_connection(&mut self, connection_id: ConnectionId) -> bool
pub fn close_connection(&mut self, connection_id: ConnectionId) -> bool
Attempt to gracefully close a connection.
Closing a connection is asynchronous but this function will return immediately.
A SwarmEvent::ConnectionClosed
event will be emitted once the connection is actually closed.
Returns
true
if the connection was established and is now being closed.false
if the connection was not found or is no longer established.
sourcepub fn is_connected(&self, peer_id: &PeerId) -> bool
pub fn is_connected(&self, peer_id: &PeerId) -> bool
Checks whether there is an established connection to a peer.
sourcepub fn connected_peers(&self) -> impl Iterator<Item = &PeerId>
pub fn connected_peers(&self) -> impl Iterator<Item = &PeerId>
Returns the currently connected peers.
sourcepub fn behaviour(&self) -> &TBehaviour
pub fn behaviour(&self) -> &TBehaviour
Returns a reference to the provided NetworkBehaviour
.
sourcepub fn behaviour_mut(&mut self) -> &mut TBehaviour
pub fn behaviour_mut(&mut self) -> &mut TBehaviour
Returns a mutable reference to the provided NetworkBehaviour
.
Trait Implementations§
source§impl<TBehaviour> FusedStream for Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
impl<TBehaviour> FusedStream for Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
The stream of swarm events never terminates, so we can implement fused for it.
source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true
if the stream should no longer be polled.source§impl<TBehaviour> Stream for Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
impl<TBehaviour> Stream for Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
Stream of events returned by Swarm
.
Includes events from the NetworkBehaviour
as well as events about
connection and listener status. See SwarmEvent
for details.
Note: This stream is infinite and it is guaranteed that
futures::Stream::poll_next
will never return Poll::Ready(None)
.
§type Item = SwarmEvent<<TBehaviour as NetworkBehaviour>::ToSwarm>
type Item = SwarmEvent<<TBehaviour as NetworkBehaviour>::ToSwarm>
impl<TBehaviour> Unpin for Swarm<TBehaviour>where
TBehaviour: NetworkBehaviour,
Auto Trait Implementations§
impl<TBehaviour> !RefUnwindSafe for Swarm<TBehaviour>
impl<TBehaviour> Send for Swarm<TBehaviour>where
TBehaviour: Send,
impl<TBehaviour> !Sync for Swarm<TBehaviour>
impl<TBehaviour> !UnwindSafe for Swarm<TBehaviour>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<I> IntoStream for Iwhere
I: Stream,
impl<I> IntoStream for Iwhere
I: Stream,
§type IntoStream = I
type IntoStream = I
source§fn into_stream(self) -> I
fn into_stream(self) -> I
source§impl<S> StreamExt for S
impl<S> StreamExt for S
source§fn next(&mut self) -> NextFuture<'_, Self> ⓘwhere
Self: Unpin,
fn next(&mut self) -> NextFuture<'_, Self> ⓘwhere
Self: Unpin,
source§fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self> ⓘ
fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self> ⓘ
source§fn count(self) -> CountFuture<Self> ⓘwhere
Self: Sized,
fn count(self) -> CountFuture<Self> ⓘwhere
Self: Sized,
source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
source§fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
items of the stream. Read moresource§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
items of the stream. Read moresource§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
step
th item. Read moresource§fn chain<U>(self, other: U) -> Chain<Self, U>
fn chain<U>(self, other: U) -> Chain<Self, U>
source§fn collect<C>(self) -> CollectFuture<Self, C> ⓘ
fn collect<C>(self) -> CollectFuture<Self, C> ⓘ
source§fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C> ⓘ
fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C> ⓘ
source§fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B> ⓘ
fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B> ⓘ
predicate
is true
and those for which it is
false
, and then collects them into two collections. Read moresource§fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T> ⓘ
fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T> ⓘ
source§fn try_fold<T, E, F, B>(
&mut self,
init: B,
f: F
) -> TryFoldFuture<'_, Self, F, B> ⓘ
fn try_fold<T, E, F, B>( &mut self, init: B, f: F ) -> TryFoldFuture<'_, Self, F, B> ⓘ
source§fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
(index, item)
. Read moresource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn nth(&mut self, n: usize) -> NthFuture<'_, Self> ⓘwhere
Self: Unpin,
fn nth(&mut self, n: usize) -> NthFuture<'_, Self> ⓘwhere
Self: Unpin,
n
th item of the stream. Read moresource§fn last(self) -> LastFuture<Self> ⓘwhere
Self: Sized,
fn last(self) -> LastFuture<Self> ⓘwhere
Self: Sized,
source§fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P> ⓘ
fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P> ⓘ
source§fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F> ⓘ
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F> ⓘ
source§fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P> ⓘ
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P> ⓘ
source§fn for_each<F>(self, f: F) -> ForEachFuture<Self, F> ⓘ
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F> ⓘ
source§fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F> ⓘ
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F> ⓘ
source§fn zip<U>(self, other: U) -> Zip<Self, U>
fn zip<U>(self, other: U) -> Zip<Self, U>
source§fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB> ⓘ
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB> ⓘ
source§fn race<S>(self, other: S) -> Race<Self, S>
fn race<S>(self, other: S) -> Race<Self, S>
other
stream, with no preference for either stream when both are ready. Read moresource§impl<S> StreamExt for S
impl<S> StreamExt for S
source§fn next(&mut self) -> NextFuture<'_, Self> ⓘwhere
Self: Unpin,
fn next(&mut self) -> NextFuture<'_, Self> ⓘwhere
Self: Unpin,
source§fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self> ⓘ
fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self> ⓘ
source§fn count(self) -> CountFuture<Self> ⓘwhere
Self: Sized,
fn count(self) -> CountFuture<Self> ⓘwhere
Self: Sized,
source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
source§fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
items of the stream. Read moresource§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
items of the stream. Read moresource§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
step
th item. Read moresource§fn chain<U>(self, other: U) -> Chain<Self, U>
fn chain<U>(self, other: U) -> Chain<Self, U>
source§fn collect<C>(self) -> CollectFuture<Self, C> ⓘ
fn collect<C>(self) -> CollectFuture<Self, C> ⓘ
source§fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C> ⓘ
fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C> ⓘ
source§fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B> ⓘ
fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B> ⓘ
predicate
is true
and those for which it is
false
, and then collects them into two collections. Read moresource§fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T> ⓘ
fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T> ⓘ
source§fn try_fold<T, E, F, B>(
&mut self,
init: B,
f: F
) -> TryFoldFuture<'_, Self, F, B> ⓘ
fn try_fold<T, E, F, B>( &mut self, init: B, f: F ) -> TryFoldFuture<'_, Self, F, B> ⓘ
source§fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
(index, item)
. Read moresource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn nth(&mut self, n: usize) -> NthFuture<'_, Self> ⓘwhere
Self: Unpin,
fn nth(&mut self, n: usize) -> NthFuture<'_, Self> ⓘwhere
Self: Unpin,
n
th item of the stream. Read moresource§fn last(self) -> LastFuture<Self> ⓘwhere
Self: Sized,
fn last(self) -> LastFuture<Self> ⓘwhere
Self: Sized,
source§fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P> ⓘ
fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P> ⓘ
source§fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F> ⓘ
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F> ⓘ
source§fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P> ⓘ
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P> ⓘ
source§fn for_each<F>(self, f: F) -> ForEachFuture<Self, F> ⓘ
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F> ⓘ
source§fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F> ⓘ
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F> ⓘ
source§fn zip<U>(self, other: U) -> Zip<Self, U>
fn zip<U>(self, other: U) -> Zip<Self, U>
source§fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB> ⓘ
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB> ⓘ
source§fn race<S>(self, other: S) -> Race<Self, S>
fn race<S>(self, other: S) -> Race<Self, S>
other
stream, with no preference for either stream when both are ready. Read moresource§impl<T> StreamExt for T
impl<T> StreamExt for T
source§fn next(&mut self) -> Next<'_, Self> ⓘwhere
Self: Unpin,
fn next(&mut self) -> Next<'_, Self> ⓘwhere
Self: Unpin,
source§fn into_future(self) -> StreamFuture<Self> ⓘ
fn into_future(self) -> StreamFuture<Self> ⓘ
source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
source§fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
source§fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
source§fn collect<C>(self) -> Collect<Self, C> ⓘ
fn collect<C>(self) -> Collect<Self, C> ⓘ
source§fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB> ⓘ
fn unzip<A, B, FromA, FromB>(self) -> Unzip<Self, FromA, FromB> ⓘ
source§fn concat(self) -> Concat<Self> ⓘ
fn concat(self) -> Concat<Self> ⓘ
source§fn count(self) -> Count<Self> ⓘwhere
Self: Sized,
fn count(self) -> Count<Self> ⓘwhere
Self: Sized,
source§fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> ⓘ
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> ⓘ
source§fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F> ⓘ
fn any<Fut, F>(self, f: F) -> Any<Self, Fut, F> ⓘ
true
if any element in stream satisfied a predicate. Read moresource§fn all<Fut, F>(self, f: F) -> All<Self, Fut, F> ⓘ
fn all<Fut, F>(self, f: F) -> All<Self, Fut, F> ⓘ
true
if all element in stream satisfied a predicate. Read moresource§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
source§fn flatten_unordered(
self,
limit: impl Into<Option<usize>>
) -> FlattenUnorderedWithFlowController<Self, ()>
fn flatten_unordered( self, limit: impl Into<Option<usize>> ) -> FlattenUnorderedWithFlowController<Self, ()>
source§fn flat_map_unordered<U, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> FlatMapUnordered<Self, U, F>
fn flat_map_unordered<U, F>( self, limit: impl Into<Option<usize>>, f: F ) -> FlatMapUnordered<Self, U, F>
StreamExt::map
but flattens nested Stream
s
and polls them concurrently, yielding items in any order, as they made
available. Read moresource§fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>
fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F>
StreamExt::fold
that holds internal state
and produces a new stream. Read moresource§fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F>
true
. Read moresource§fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F>
true
. Read moresource§fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>
fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut>
source§fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> ⓘ
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> ⓘ
source§fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> ⓘ
fn for_each_concurrent<Fut, F>( self, limit: impl Into<Option<usize>>, f: F ) -> ForEachConcurrent<Self, Fut, F> ⓘ
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
items of the underlying stream. Read moresource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
items of the underlying stream. Read moresource§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
source§fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + Send + 'a>>
source§fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>>where
Self: Sized + 'a,
source§fn buffered(self, n: usize) -> Buffered<Self>
fn buffered(self, n: usize) -> Buffered<Self>
source§fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self>
source§fn zip<St>(self, other: St) -> Zip<Self, St>
fn zip<St>(self, other: St) -> Zip<Self, St>
source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
peek
method. Read moresource§fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
fn chunks(self, capacity: usize) -> Chunks<Self>where
Self: Sized,
source§fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>where
Self: Sized,
source§fn forward<S>(self, sink: S) -> Forward<Self, S> ⓘ
fn forward<S>(self, sink: S) -> Forward<Self, S> ⓘ
source§fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>)
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn left_stream<B>(self) -> Either<Self, B> ⓘ
fn left_stream<B>(self) -> Either<Self, B> ⓘ
source§fn right_stream<B>(self) -> Either<B, Self> ⓘ
fn right_stream<B>(self) -> Either<B, Self> ⓘ
source§fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>where
Self: Unpin,
Stream::poll_next
on Unpin
stream types.source§fn select_next_some(&mut self) -> SelectNextSome<'_, Self> ⓘwhere
Self: Unpin + FusedStream,
fn select_next_some(&mut self) -> SelectNextSome<'_, Self> ⓘwhere
Self: Unpin + FusedStream,
source§impl<T> StreamExt for T
impl<T> StreamExt for T
source§fn next(&mut self) -> NextFuture<'_, Self>where
Self: Unpin,
fn next(&mut self) -> NextFuture<'_, Self>where
Self: Unpin,
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements. Read moresource§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
source§fn throttle(self, d: Duration) -> Throttle<Self>where
Self: Sized,
fn throttle(self, d: Duration) -> Throttle<Self>where
Self: Sized,
source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
step
th element. Read moresource§fn chain<U>(self, other: U) -> Chain<Self, U>
fn chain<U>(self, other: U) -> Chain<Self, U>
source§fn cloned<'a, T>(self) -> Cloned<Self>
fn cloned<'a, T>(self) -> Cloned<Self>
source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
source§fn cycle(self) -> Cycle<Self>
fn cycle(self) -> Cycle<Self>
source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
source§fn delay(self, dur: Duration) -> Delay<Self>where
Self: Sized,
fn delay(self, dur: Duration) -> Delay<Self>where
Self: Sized,
source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn last(self) -> LastFuture<Self, Self::Item>where
Self: Sized,
fn last(self) -> LastFuture<Self, Self::Item>where
Self: Sized,
source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
None
. Read moresource§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
source§fn min_by_key<B, F>(self, key_by: F) -> MinByKeyFuture<Self, Self::Item, F>
fn min_by_key<B, F>(self, key_by: F) -> MinByKeyFuture<Self, Self::Item, F>
None
is returned. Read moresource§fn max_by_key<B, F>(self, key_by: F) -> MaxByKeyFuture<Self, Self::Item, F>
fn max_by_key<B, F>(self, key_by: F) -> MaxByKeyFuture<Self, Self::Item, F>
None
is returned. Read moresource§fn min_by<F>(self, compare: F) -> MinByFuture<Self, F, Self::Item>
fn min_by<F>(self, compare: F) -> MinByFuture<Self, F, Self::Item>
None
is returned. Read moresource§fn max(self) -> MaxFuture<Self, Self::Item>
fn max(self) -> MaxFuture<Self, Self::Item>
None
is returned. Read moresource§fn min(self) -> MinFuture<Self, Self::Item>
fn min(self) -> MinFuture<Self, Self::Item>
None
is returned. Read moresource§fn max_by<F>(self, compare: F) -> MaxByFuture<Self, F, Self::Item>
fn max_by<F>(self, compare: F) -> MaxByFuture<Self, F, Self::Item>
None
is returned. Read moresource§fn nth(&mut self, n: usize) -> NthFuture<'_, Self>
fn nth(&mut self, n: usize) -> NthFuture<'_, Self>
source§fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F, Self::Item>
fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F, Self::Item>
source§fn find<P>(&mut self, p: P) -> FindFuture<'_, Self, P>
fn find<P>(&mut self, p: P) -> FindFuture<'_, Self, P>
source§fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F>
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F>
source§fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, F, B>
fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, F, B>
source§fn partition<B, F>(self, f: F) -> PartitionFuture<Self, F, B>
fn partition<B, F>(self, f: F) -> PartitionFuture<Self, F, B>
source§fn for_each<F>(self, f: F) -> ForEachFuture<Self, F>
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F>
source§fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F, Self::Item>
fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F, Self::Item>
source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
skip
s elements based on a predicate. Read moresource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read moresource§fn timeout(self, dur: Duration) -> Timeout<Self>
fn timeout(self, dur: Duration) -> Timeout<Self>
source§fn try_fold<B, F, T, E>(
&mut self,
init: T,
f: F
) -> TryFoldFuture<'_, Self, F, T>
fn try_fold<B, F, T, E>( &mut self, init: T, f: F ) -> TryFoldFuture<'_, Self, F, T>
source§fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F>
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F>
source§fn zip<U>(self, other: U) -> Zip<Self, U>
fn zip<U>(self, other: U) -> Zip<Self, U>
source§fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB>
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB>
source§fn collect<'a, B>(self) -> Pin<Box<dyn Future<Output = B> + Send + 'a>>
fn collect<'a, B>(self) -> Pin<Box<dyn Future<Output = B> + Send + 'a>>
source§fn merge<U>(self, other: U) -> Merge<Self, U>
fn merge<U>(self, other: U) -> Merge<Self, U>
source§fn partial_cmp<S>(self, other: S) -> PartialCmpFuture<Self, S>
fn partial_cmp<S>(self, other: S) -> PartialCmpFuture<Self, S>
Stream
with those
of another. Read moresource§fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P>
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P>
source§fn cmp<S>(self, other: S) -> CmpFuture<Self, S>
fn cmp<S>(self, other: S) -> CmpFuture<Self, S>
Stream
with those
of another using ‘Ord’. Read moresource§fn count(self) -> CountFuture<Self>where
Self: Sized,
fn count(self) -> CountFuture<Self>where
Self: Sized,
source§fn ne<S>(self, other: S) -> NeFuture<Self, S>
fn ne<S>(self, other: S) -> NeFuture<Self, S>
Stream
are lexicographically
not equal to those of another. Read moresource§fn ge<S>(self, other: S) -> GeFuture<Self, S>
fn ge<S>(self, other: S) -> GeFuture<Self, S>
Stream
are lexicographically
greater than or equal to those of another. Read moresource§fn eq<S>(self, other: S) -> EqFuture<Self, S>
fn eq<S>(self, other: S) -> EqFuture<Self, S>
Stream
are lexicographically
equal to those of another. Read moresource§fn gt<S>(self, other: S) -> GtFuture<Self, S>
fn gt<S>(self, other: S) -> GtFuture<Self, S>
Stream
are lexicographically
greater than those of another. Read moresource§fn le<S>(self, other: S) -> LeFuture<Self, S>
fn le<S>(self, other: S) -> LeFuture<Self, S>
Stream
are lexicographically
less or equal to those of another. Read moresource§fn lt<S>(self, other: S) -> LtFuture<Self, S>
fn lt<S>(self, other: S) -> LtFuture<Self, S>
Stream
are lexicographically
less than those of another. Read more