[−][src]Enum spirit_tokio::either::Either
The Either
type allows to wrap two similar Fragment
s and let the user choose
which one will be used.
For example, if your server could run both on common TCP and unix domain stream sockets, you
could use the Either<TcpListen, UnixListen>
. This fragment would then create resources of
type Either<TcpListener, UnixListener>
.
Many traits are delegated through to one or the other instance inside (in case both implement
it). So, the above resource will implement the Accept
trait that will accept
instances of Either<TcpStream, UnixStream>
. These'll in turn implement AsyncRead
and
AsyncWrite
, therefore can be handled uniformly just as connections.
Deserialization
This uses the untagged serde attribute. This means there are no additional configuration
options present and the choice is made by trying to first deserialize the A
variant and
if that fails, trying the B
one. Therefore, the inner resource configs need to have some
distinct fields. In our example, this would parse as TcpListen
:
[[listen]]
port = 1234
While this as an UnixListen
:
[[listen]]
path = "/tmp/socket"
If you need different parsing, you can use either a newtype or remote derive.
Other similar types
This is not the only Either
type around. Unfortunately, none of the available ones was just
right for the use case here, so this crate rolls its own. But it provides From
/Into
conversions between them, if the corresponding feature on this crate is enabled.
More than two options
This allows only two variants. However, if you need more, it is possible to nest them and form a tree.
Drawbacks
Due to the complexity of implementation, the Fragment
is implemented for either only if
both variants are Fragment
s with simple enough Driver
s (drivers that don't sub-divide
their Fragment
s). Therefore, Vec<Either<TcpListen, UnixListen>>
will work, but
Either<Vec<TcpListen>, Vec<UnixListen>>
will not.
This is an implementation limitation and may be lifted in the future (PRs are welcome).
Examples
use std::sync::Arc; use serde::Deserialize; use spirit::{AnyError, Empty, Pipeline, Spirit}; use spirit::prelude::*; #[cfg(unix)] use spirit_tokio::either::Either; use spirit_tokio::handlers::PerConnection; use spirit_tokio::net::TcpListen; #[cfg(unix)] use spirit_tokio::net::unix::UnixListen; use tokio::prelude::*; // If we want to work on systems that don't have unix domain sockets... #[cfg(unix)] type Listener = Either<TcpListen, UnixListen>; #[cfg(not(unix))] type Listener = TcpListen; const DEFAULT_CONFIG: &str = r#" [[listening_socket]] port = 1235 max-conn = 20 error-sleep = "100ms" "#; #[derive(Default, Deserialize)] struct Config { listening_socket: Vec<Listener>, } impl Config { fn listen(&self) -> Vec<Listener> { self.listening_socket.clone() } } async fn handle_connection<C: AsyncWrite + Unpin>(mut conn: C) -> Result<(), AnyError> { conn.write_all(b"hello world").await?; conn.shutdown().await?; Ok(()) } fn main() { let handler = PerConnection(|conn, _cfg: &_| async { if let Err(e) = handle_connection(conn).await { eprintln!("Error: {}", e); } }); Spirit::<Empty, Config>::new() .config_defaults(DEFAULT_CONFIG) .with(Pipeline::new("listen").extract_cfg(Config::listen).transform(handler)) .run(|spirit| { Ok(()) }); }
Variants
Implementations
impl<T> Either<T, T>
[src]
pub fn into_inner(self) -> T
[src]
Extracts the inner value in case both have the same type.
Sometimes, a series of operations produces an Either
with both types the same. In such
case, Either
plays no role anymore and this method can be used to get to the inner value.
Trait Implementations
impl<A, B> Accept for Either<A, B> where
A: Accept,
B: Accept,
[src]
A: Accept,
B: Accept,
type Connection = Either<A::Connection, B::Connection>
The type of the accepted connection.
fn poll_accept(
&mut self,
ctx: &mut Context<'_>
) -> Poll<Result<Self::Connection, IoError>>
[src]
&mut self,
ctx: &mut Context<'_>
) -> Poll<Result<Self::Connection, IoError>>
fn accept(&mut self) -> AcceptFuture<'_, Self>ⓘNotable traits for AcceptFuture<'_, A>
impl<A: Accept, '_> Future for AcceptFuture<'_, A> type Output = Result<A::Connection, IoError>;
[src]
Notable traits for AcceptFuture<'_, A>
impl<A: Accept, '_> Future for AcceptFuture<'_, A> type Output = Result<A::Connection, IoError>;
impl<A, B> AsyncBufRead for Either<A, B> where
A: AsyncBufRead + Unpin,
B: AsyncBufRead + Unpin,
[src]
A: AsyncBufRead + Unpin,
B: AsyncBufRead + Unpin,
fn poll_fill_buf(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<&[u8], IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<&[u8], IoError>>
fn consume(self: Pin<&mut Self>, amt: usize)
[src]
impl<A, B> AsyncRead for Either<A, B> where
A: AsyncRead + Unpin,
B: AsyncRead + Unpin,
[src]
A: AsyncRead + Unpin,
B: AsyncRead + Unpin,
fn poll_read(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut [u8]
) -> Poll<Result<usize, IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut [u8]
) -> Poll<Result<usize, IoError>>
fn poll_read_buf<Bu: BufMut>(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut Bu
) -> Poll<Result<usize, IoError>> where
Self: Sized,
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut Bu
) -> Poll<Result<usize, IoError>> where
Self: Sized,
unsafe fn prepare_uninitialized_buffer(
&self,
buf: &mut [MaybeUninit<u8>]
) -> bool
[src]
&self,
buf: &mut [MaybeUninit<u8>]
) -> bool
impl<A, B> AsyncSeek for Either<A, B> where
A: AsyncSeek + Unpin,
B: AsyncSeek + Unpin,
[src]
A: AsyncSeek + Unpin,
B: AsyncSeek + Unpin,
fn start_seek(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
position: SeekFrom
) -> Poll<Result<(), IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
position: SeekFrom
) -> Poll<Result<(), IoError>>
fn poll_complete(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<u64, IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<u64, IoError>>
impl<A, B> AsyncWrite for Either<A, B> where
A: AsyncWrite + Unpin,
B: AsyncWrite + Unpin,
[src]
A: AsyncWrite + Unpin,
B: AsyncWrite + Unpin,
fn poll_write(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize, IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize, IoError>>
fn poll_flush(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
fn poll_shutdown(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
fn poll_write_buf<BU: Buf>(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut BU
) -> Poll<Result<usize, IoError>> where
Self: Sized,
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut BU
) -> Poll<Result<usize, IoError>> where
Self: Sized,
impl<A: Clone, B: Clone> Clone for Either<A, B>
[src]
impl<A, B, AR, BR> Comparable<Either<AR, BR>> for Either<A, B> where
A: Comparable<AR>,
B: Comparable<BR>,
[src]
A: Comparable<AR>,
B: Comparable<BR>,
fn compare(&self, rhs: &Either<AR, BR>) -> Comparison
[src]
impl<A: Copy, B: Copy> Copy for Either<A, B>
[src]
impl<A: Debug, B: Debug> Debug for Either<A, B>
[src]
impl<'de, A, B> Deserialize<'de> for Either<A, B> where
A: Deserialize<'de>,
B: Deserialize<'de>,
[src]
A: Deserialize<'de>,
B: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<A, B> Driver<Either<A, B>> for EitherDriver<A, B> where
A: Fragment,
A::Driver: Driver<A, SubFragment = A> + Default,
B: Fragment,
B::Driver: Driver<B, SubFragment = B> + Default,
[src]
A: Fragment,
A::Driver: Driver<A, SubFragment = A> + Default,
B: Fragment,
B::Driver: Driver<B, SubFragment = B> + Default,
type SubFragment = Either<A, B>
fn instructions<T, I>(
&mut self,
fragment: &Either<A, B>,
transform: &mut T,
name: &'static str
) -> Result<Vec<Instruction<T::OutputResource>>, Vec<AnyError>> where
T: Transformation<<Self::SubFragment as Fragment>::Resource, I, Self::SubFragment>,
[src]
&mut self,
fragment: &Either<A, B>,
transform: &mut T,
name: &'static str
) -> Result<Vec<Instruction<T::OutputResource>>, Vec<AnyError>> where
T: Transformation<<Self::SubFragment as Fragment>::Resource, I, Self::SubFragment>,
fn confirm(&mut self, name: &'static str)
[src]
fn abort(&mut self, name: &'static str)
[src]
fn maybe_cached(&self, fragment: &Either<A, B>, name: &'static str) -> bool
[src]
impl<A: Eq, B: Eq> Eq for Either<A, B>
[src]
impl<A, B> Fragment for Either<A, B> where
A: Fragment,
A::Driver: Driver<A, SubFragment = A>,
B: Fragment,
B::Driver: Driver<B, SubFragment = B>,
[src]
A: Fragment,
A::Driver: Driver<A, SubFragment = A>,
B: Fragment,
B::Driver: Driver<B, SubFragment = B>,
type Driver = EitherDriver<A, B>
The default driver to be used by the fragment. Read more
type Installer = EitherInstaller<A::Installer, B::Installer>
The default installer to be used unless a transformation or the user doesn't provide one. Read more
type Seed = Either<A::Seed, B::Seed>
The intermediate product if the fragment supports two-stage creation of
Resource
s. If not, it can be set to ()
. Read more
type Resource = Either<A::Resource, B::Resource>
The actual product this Fragment
creates.
fn make_seed(&self, name: &'static str) -> Result<Self::Seed, AnyError>
[src]
fn make_resource(
&self,
seed: &mut Self::Seed,
name: &'static str
) -> Result<Self::Resource, AnyError>
[src]
&self,
seed: &mut Self::Seed,
name: &'static str
) -> Result<Self::Resource, AnyError>
const RUN_BEFORE_CONFIG: bool
[src]
fn create(
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Sync + Send>>
[src]
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Sync + Send>>
fn init<B>(
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Sync + Send>> where
B: Extensible<Ok = B>,
<B as Extensible>::Config: DeserializeOwned,
<B as Extensible>::Config: Send,
<B as Extensible>::Config: Sync,
<B as Extensible>::Config: 'static,
<B as Extensible>::Opts: StructOpt,
<B as Extensible>::Opts: Send,
<B as Extensible>::Opts: Sync,
<B as Extensible>::Opts: 'static,
[src]
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Sync + Send>> where
B: Extensible<Ok = B>,
<B as Extensible>::Config: DeserializeOwned,
<B as Extensible>::Config: Send,
<B as Extensible>::Config: Sync,
<B as Extensible>::Config: 'static,
<B as Extensible>::Opts: StructOpt,
<B as Extensible>::Opts: Send,
<B as Extensible>::Opts: Sync,
<B as Extensible>::Opts: 'static,
impl<A, B> From<Either<A, B>> for Either<A, B>
[src]
impl<A, B> From<Either<A, B>> for Either<A, B>
[src]
fn from(e: OtherEither<A, B>) -> Self
[src]
impl<A, B> Future for Either<A, B> where
A: Future + Unpin,
B: Future + Unpin,
[src]
A: Future + Unpin,
B: Future + Unpin,
type Output = Either<A::Output, B::Output>
The type of value produced on completion.
fn poll(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<Self::Output>
[src]
impl<A: Hash, B: Hash> Hash for Either<A, B>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<A, B, RA, RB, O, C> Installer<Either<RA, RB>, O, C> for EitherInstaller<A, B> where
A: Installer<RA, O, C>,
B: Installer<RB, O, C>,
[src]
A: Installer<RA, O, C>,
B: Installer<RB, O, C>,
type UninstallHandle = Either<A::UninstallHandle, B::UninstallHandle>
A handle representing lifetime of the resource. Read more
fn install(
&mut self,
resource: Either<RA, RB>,
name: &'static str
) -> Self::UninstallHandle
[src]
&mut self,
resource: Either<RA, RB>,
name: &'static str
) -> Self::UninstallHandle
fn init<E: Extensible<Opts = O, Config = C, Ok = E>>(
&mut self,
builder: E,
name: &'static str
) -> Result<E, AnyError> where
E::Config: DeserializeOwned + Send + Sync + 'static,
E::Opts: StructOpt + Send + Sync + 'static,
[src]
&mut self,
builder: E,
name: &'static str
) -> Result<E, AnyError> where
E::Config: DeserializeOwned + Send + Sync + 'static,
E::Opts: StructOpt + Send + Sync + 'static,
impl<A, B> Into<Either<A, B>> for Either<A, B>
[src]
impl<A, B> Into<Either<A, B>> for Either<A, B>
[src]
fn into(self) -> OtherEither<A, B>
[src]
impl<A: Ord, B: Ord> Ord for Either<A, B>
[src]
fn cmp(&self, other: &Either<A, B>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<A: PartialEq, B: PartialEq> PartialEq<Either<A, B>> for Either<A, B>
[src]
impl<A: PartialOrd, B: PartialOrd> PartialOrd<Either<A, B>> for Either<A, B>
[src]
fn partial_cmp(&self, other: &Either<A, B>) -> Option<Ordering>
[src]
fn lt(&self, other: &Either<A, B>) -> bool
[src]
fn le(&self, other: &Either<A, B>) -> bool
[src]
fn gt(&self, other: &Either<A, B>) -> bool
[src]
fn ge(&self, other: &Either<A, B>) -> bool
[src]
impl<A, B> Serialize for Either<A, B> where
A: Serialize,
B: Serialize,
[src]
A: Serialize,
B: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<A, B> Stackable for Either<A, B> where
A: Stackable,
B: Stackable,
[src]
A: Stackable,
B: Stackable,
impl<A, B> Stream for Either<A, B> where
A: Stream + Unpin,
B: Stream + Unpin,
[src]
A: Stream + Unpin,
B: Stream + Unpin,
type Item = Either<A::Item, B::Item>
Values yielded by the stream.
fn poll_next(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Option<Self::Item>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Option<Self::Item>>
fn size_hint(&self) -> (usize, Option<usize>)
[src]
impl<A, B> StructDoc for Either<A, B> where
A: StructDoc,
B: StructDoc,
[src]
A: StructDoc,
B: StructDoc,
fn document() -> Documentation
[src]
impl<A, B> StructuralEq for Either<A, B>
[src]
impl<A, B> StructuralPartialEq for Either<A, B>
[src]
Auto Trait Implementations
impl<A, B> RefUnwindSafe for Either<A, B> where
A: RefUnwindSafe,
B: RefUnwindSafe,
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Either<A, B> where
A: Send,
B: Send,
A: Send,
B: Send,
impl<A, B> Sync for Either<A, B> where
A: Sync,
B: Sync,
A: Sync,
B: Sync,
impl<A, B> Unpin for Either<A, B> where
A: Unpin,
B: Unpin,
A: Unpin,
B: Unpin,
impl<A, B> UnwindSafe for Either<A, B> where
A: UnwindSafe,
B: UnwindSafe,
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<R> AsyncBufReadExt for R where
R: AsyncBufRead + ?Sized,
[src]
R: AsyncBufRead + ?Sized,
fn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>
) -> ReadUntil<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>
) -> ReadUntil<'a, Self> where
Self: Unpin,
fn read_line(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn split(self, byte: u8) -> Split<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn lines(self) -> Lines<Self>
[src]
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
[src]
R: AsyncRead + ?Sized,
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: AsyncRead,
[src]
R: AsyncRead,
fn read(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_buf<B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B> where
B: BufMut,
Self: Unpin,
[src]
B: BufMut,
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u8(&'a mut self) -> ReadU8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i8(&'a mut self) -> ReadI8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u16(&'a mut self) -> ReadU16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i16(&'a mut self) -> ReadI16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u32(&'a mut self) -> ReadU32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i32(&'a mut self) -> ReadI32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u64(&'a mut self) -> ReadU64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i64(&'a mut self) -> ReadI64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u128(&'a mut self) -> ReadU128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i128(&'a mut self) -> ReadI128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u16_le(&'a mut self) -> ReadU16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i16_le(&'a mut self) -> ReadI16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u32_le(&'a mut self) -> ReadU32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i32_le(&'a mut self) -> ReadI32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u64_le(&'a mut self) -> ReadU64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i64_le(&'a mut self) -> ReadI64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_u128_le(&'a mut self) -> ReadU128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_i128_le(&'a mut self) -> ReadI128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_to_end(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn read_to_string(&'a mut self, dst: &'a mut String) -> ReadToString<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn take(self, limit: u64) -> Take<Self>
[src]
impl<S> AsyncSeekExt for S where
S: AsyncSeek + ?Sized,
[src]
S: AsyncSeek + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
[src]
W: AsyncWrite + ?Sized,
fn write(&'a mut self, src: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_buf<B>(&'a mut self, src: &'a mut B) -> WriteBuf<'a, Self, B> where
B: Buf,
Self: Unpin,
[src]
B: Buf,
Self: Unpin,
fn write_all(&'a mut self, src: &'a [u8]) -> WriteAll<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u8(&'a mut self, n: u8) -> WriteU8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i8(&'a mut self, n: i8) -> WriteI8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u16(&'a mut self, n: u16) -> WriteU16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i16(&'a mut self, n: i16) -> WriteI16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u32(&'a mut self, n: u32) -> WriteU32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i32(&'a mut self, n: i32) -> WriteI32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u64(&'a mut self, n: u64) -> WriteU64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i64(&'a mut self, n: i64) -> WriteI64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u128(&'a mut self, n: u128) -> WriteU128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i128(&'a mut self, n: i128) -> WriteI128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u16_le(&'a mut self, n: u16) -> WriteU16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i16_le(&'a mut self, n: i16) -> WriteI16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u32_le(&'a mut self, n: u32) -> WriteU32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i32_le(&'a mut self, n: i32) -> WriteI32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u64_le(&'a mut self, n: u64) -> WriteU64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i64_le(&'a mut self, n: i64) -> WriteI64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_u128_le(&'a mut self, n: u128) -> WriteU128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn write_i128_le(&'a mut self, n: i128) -> WriteI128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn shutdown(&mut self) -> Shutdown<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> FutureExt for T where
T: Future + ?Sized,
[src]
T: Future + ?Sized,
fn map<U, F>(self, f: F) -> Map<Self, F> where
F: FnOnce(Self::Output) -> U,
[src]
F: FnOnce(Self::Output) -> U,
fn map_into<U>(self) -> MapInto<Self, U> where
Self::Output: Into<U>,
[src]
Self::Output: Into<U>,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F> where
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
[src]
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
fn left_future<B>(self) -> Either<Self, B> where
B: Future<Output = Self::Output>,
[src]
B: Future<Output = Self::Output>,
fn right_future<A>(self) -> Either<A, Self> where
A: Future<Output = Self::Output>,
[src]
A: Future<Output = Self::Output>,
fn into_stream(self) -> IntoStream<Self>
[src]
fn flatten(self) -> Flatten<Self> where
Self::Output: Future,
[src]
Self::Output: Future,
fn flatten_stream(self) -> FlattenStream<Self> where
Self::Output: Stream,
[src]
Self::Output: Stream,
fn fuse(self) -> Fuse<Self>
[src]
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnOnce(&Self::Output),
[src]
F: FnOnce(&Self::Output),
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
Self: UnwindSafe,
fn shared(self) -> Shared<Self> where
Self::Output: Clone,
[src]
Self::Output: Clone,
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a + Send>> where
Self: Send + 'a,
[src]
Self: Send + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>> where
Self: 'a,
[src]
Self: 'a,
fn unit_error(self) -> UnitError<Self>
[src]
fn never_error(self) -> NeverError<Self>
[src]
fn poll_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output> where
Self: Unpin,
[src]
Self: Unpin,
fn now_or_never(self) -> Option<Self::Output>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
type Output = <F as Future>::Output
into_future
)The output that the future will produce on completion.
type Future = F
into_future
)Which kind of future are we turning this into?
fn into_future(self) -> <F as IntoFuture>::Future
[src]
impl<T> IntoResult<T> for T
[src]
impl<F> Optional for F where
F: Stackable,
[src]
F: Stackable,
impl<T> StreamExt for T where
T: Stream + ?Sized,
[src]
T: Stream + ?Sized,
fn next(&mut self) -> Next<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn into_future(self) -> StreamFuture<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn map<T, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> T,
[src]
F: FnMut(Self::Item) -> T,
fn enumerate(self) -> Enumerate<Self>
[src]
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F> where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
[src]
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = Option<T>>,
[src]
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = Option<T>>,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future,
[src]
F: FnMut(Self::Item) -> Fut,
Fut: Future,
fn collect<C>(self) -> Collect<Self, C> where
C: Default + Extend<Self::Item>,
[src]
C: Default + Extend<Self::Item>,
fn concat(self) -> Concat<Self> where
Self::Item: Extend<<Self::Item as IntoIterator>::Item>,
Self::Item: IntoIterator,
Self::Item: Default,
[src]
Self::Item: Extend<<Self::Item as IntoIterator>::Item>,
Self::Item: IntoIterator,
Self::Item: Default,
fn cycle(self) -> Cycle<Self> where
Self: Clone,
[src]
Self: Clone,
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> where
F: FnMut(T, Self::Item) -> Fut,
Fut: Future<Output = T>,
[src]
F: FnMut(T, Self::Item) -> Fut,
Fut: Future<Output = T>,
fn flatten(self) -> Flatten<Self> where
Self::Item: Stream,
[src]
Self::Item: Stream,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
F: FnMut(Self::Item) -> U,
U: Stream,
[src]
F: FnMut(Self::Item) -> U,
U: Stream,
fn scan<S, B, Fut, F>(self, initial_state: S, f: F) -> Scan<Self, S, Fut, F> where
F: FnMut(&mut S, Self::Item) -> Fut,
Fut: Future<Output = Option<B>>,
[src]
F: FnMut(&mut S, Self::Item) -> Fut,
Fut: Future<Output = Option<B>>,
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F> where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
[src]
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F> where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
[src]
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
fn take_until<Fut>(self, fut: Fut) -> TakeUntil<Self, Fut> where
Fut: Future,
[src]
Fut: Future,
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
[src]
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
[src]
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
fn take(self, n: usize) -> Take<Self>
[src]
fn skip(self, n: usize) -> Skip<Self>
[src]
fn fuse(self) -> Fuse<Self>
[src]
fn by_ref(&mut self) -> &mut Self
[src]
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
Self: UnwindSafe,
fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a + Send>> where
Self: Send + 'a,
[src]
Self: Send + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>> where
Self: 'a,
[src]
Self: 'a,
fn buffered(self, n: usize) -> Buffered<Self> where
Self::Item: Future,
[src]
Self::Item: Future,
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self> where
Self::Item: Future,
[src]
Self::Item: Future,
fn zip<St>(self, other: St) -> Zip<Self, St> where
St: Stream,
[src]
St: Stream,
fn chain<St>(self, other: St) -> Chain<Self, St> where
St: Stream<Item = Self::Item>,
[src]
St: Stream<Item = Self::Item>,
fn peekable(self) -> Peekable<Self>
[src]
fn chunks(self, capacity: usize) -> Chunks<Self>
[src]
fn ready_chunks(self, capacity: usize) -> ReadyChunks<Self>
[src]
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnMut(&Self::Item),
[src]
F: FnMut(&Self::Item),
fn left_stream<B>(self) -> Either<Self, B> where
B: Stream<Item = Self::Item>,
[src]
B: Stream<Item = Self::Item>,
fn right_stream<B>(self) -> Either<B, Self> where
B: Stream<Item = Self::Item>,
[src]
B: Stream<Item = Self::Item>,
fn poll_next_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> where
Self: Unpin,
[src]
Self: Unpin,
fn select_next_some(&mut self) -> SelectNextSome<'_, Self> where
Self: Unpin + FusedStream,
[src]
Self: Unpin + FusedStream,
impl<St> StreamExt for St where
St: Stream + ?Sized,
[src]
St: Stream + ?Sized,
fn next(&mut self) -> Next<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
fn try_next<T, E>(&mut self) -> TryNext<'_, Self> where
Self: Stream<Item = Result<T, E>> + Unpin,
[src]
Self: Stream<Item = Result<T, E>> + Unpin,
fn map<T, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> T,
[src]
F: FnMut(Self::Item) -> T,
fn merge<U>(self, other: U) -> Merge<Self, U> where
U: Stream<Item = Self::Item>,
[src]
U: Stream<Item = Self::Item>,
fn filter<F>(self, f: F) -> Filter<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F> where
F: FnMut(Self::Item) -> Option<T>,
[src]
F: FnMut(Self::Item) -> Option<T>,
fn fuse(self) -> Fuse<Self>
[src]
fn take(self, n: usize) -> Take<Self>
[src]
fn take_while<F>(self, f: F) -> TakeWhile<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
fn skip(self, n: usize) -> Skip<Self>
[src]
fn skip_while<F>(self, f: F) -> SkipWhile<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F> where
F: FnMut(Self::Item) -> bool,
Self: Unpin,
[src]
F: FnMut(Self::Item) -> bool,
Self: Unpin,
fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F> where
F: FnMut(Self::Item) -> bool,
Self: Unpin,
[src]
F: FnMut(Self::Item) -> bool,
Self: Unpin,
fn chain<U>(self, other: U) -> Chain<Self, U> where
U: Stream<Item = Self::Item>,
[src]
U: Stream<Item = Self::Item>,
fn fold<B, F>(self, init: B, f: F) -> FoldFuture<Self, B, F> where
F: FnMut(B, Self::Item) -> B,
[src]
F: FnMut(B, Self::Item) -> B,
fn collect<T>(self) -> Collect<Self, T> where
T: FromStream<Self::Item>,
[src]
T: FromStream<Self::Item>,
fn timeout(self, duration: Duration) -> Timeout<Self>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,