Trait rbatis_core::runtime::stream::Extend [−][src]
pub trait Extend<A> {
fn extend<'a, T>(
&'a mut self,
stream: T
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ
where
T: 'a + IntoStream<Item = A>,
<T as IntoStream>::IntoStream: Send;
}Expand description
Extends a collection with the contents of a stream.
Streams produce a series of values asynchronously, and collections can also be thought of as a
series of values. The Extend trait bridges this gap, allowing you to extend a collection
asynchronously by including the contents of that stream. When extending a collection with an
already existing key, that entry is updated or, in the case of collections that permit multiple
entries with equal keys, that entry is inserted.
Examples
use async_std::prelude::*; use async_std::stream; let mut v: Vec<usize> = vec![1, 2]; let s = stream::repeat(3usize).take(3); stream::Extend::extend(&mut v, s).await; assert_eq!(v, vec![1, 2, 3, 3, 3]);
Required methods
fn extend<'a, T>(
&'a mut self,
stream: T
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
T: 'a + IntoStream<Item = A>,
<T as IntoStream>::IntoStream: Send, [src]
fn extend<'a, T>(
&'a mut self,
stream: T
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
T: 'a + IntoStream<Item = A>,
<T as IntoStream>::IntoStream: Send, [src]Extends a collection with the contents of a stream.
Implementations on Foreign Types
pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = T>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = Cow<'b, str>>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = (K, V)>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = T>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = String>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = T>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = &'b str>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = (K, V)>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = char>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = T>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = T>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = ()>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = T>,
<S as IntoStream>::IntoStream: Send, [src]pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = &'b char>,
<S as IntoStream>::IntoStream: Send, [src]Implementors
pub fn extend<'a, S>(
&'a mut self,
stream: S
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send, Global>>ⓘ where
S: 'a + IntoStream<Item = P>,
<S as IntoStream>::IntoStream: Send, [src]