[−][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::io::{AsyncWrite, AsyncWriteExt}; // 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.
pub fn poll_accept(
&mut self,
ctx: &mut Context<'_>
) -> Poll<Result<Self::Connection, IoError>>
[src]
&mut self,
ctx: &mut Context<'_>
) -> Poll<Result<Self::Connection, IoError>>
pub 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,
pub 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>>
pub 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,
pub fn poll_read(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut ReadBuf<'_>
) -> Poll<Result<(), IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut ReadBuf<'_>
) -> Poll<Result<(), IoError>>
impl<A, B> AsyncSeek for Either<A, B> where
A: AsyncSeek + Unpin,
B: AsyncSeek + Unpin,
[src]
A: AsyncSeek + Unpin,
B: AsyncSeek + Unpin,
pub fn start_seek(
self: Pin<&mut Self>,
position: SeekFrom
) -> Result<(), IoError>
[src]
self: Pin<&mut Self>,
position: SeekFrom
) -> Result<(), IoError>
pub 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,
pub 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>>
pub fn poll_flush(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
pub fn poll_shutdown(
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>
) -> Poll<Result<(), IoError>>
pub fn poll_write_vectored(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
bufs: &[IoSlice<'_>]
) -> Poll<Result<usize, IoError>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
bufs: &[IoSlice<'_>]
) -> Poll<Result<usize, IoError>>
pub fn is_write_vectored(&self) -> bool
[src]
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>,
pub 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>,
pub 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>
pub 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>,
pub fn confirm(&mut self, name: &'static str)
[src]
pub fn abort(&mut self, name: &'static str)
[src]
pub 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.
pub fn make_seed(&self, name: &'static str) -> Result<Self::Seed, AnyError>
[src]
pub 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>
pub const RUN_BEFORE_CONFIG: bool
[src]
pub fn create(
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Send + Sync, Global>>
[src]
&self,
name: &'static str
) -> Result<Self::Resource, Box<dyn Error + 'static + Send + Sync, Global>>
pub fn init<B>(
builder: B,
&'static str
) -> Result<B, Box<dyn Error + 'static + Send + Sync, Global>> 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 + Send + Sync, Global>> 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> 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.
pub fn poll(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<Self::Output>
[src]
impl<A: Hash, B: Hash> Hash for Either<A, B>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub 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
pub 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
pub 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: Ord, B: Ord> Ord for Either<A, B>
[src]
pub fn cmp(&self, other: &Either<A, B>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<A: PartialEq, B: PartialEq> PartialEq<Either<A, B>> for Either<A, B>
[src]
pub fn eq(&self, other: &Either<A, B>) -> bool
[src]
pub fn ne(&self, other: &Either<A, B>) -> bool
[src]
impl<A: PartialOrd, B: PartialOrd> PartialOrd<Either<A, B>> for Either<A, B>
[src]
pub fn partial_cmp(&self, other: &Either<A, B>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Either<A, B>) -> bool
[src]
pub fn le(&self, other: &Either<A, B>) -> bool
[src]
pub fn gt(&self, other: &Either<A, B>) -> bool
[src]
pub 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,
pub 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.
pub 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>>
pub fn size_hint(&self) -> (usize, Option<usize>)
impl<A, B> StructDoc for Either<A, B> where
A: StructDoc,
B: StructDoc,
[src]
A: StructDoc,
B: StructDoc,
pub 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,
[src]
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Either<A, B> where
A: Send,
B: Send,
[src]
A: Send,
B: Send,
impl<A, B> Sync for Either<A, B> where
A: Sync,
B: Sync,
[src]
A: Sync,
B: Sync,
impl<A, B> Unpin for Either<A, B> where
A: Unpin,
B: Unpin,
[src]
A: Unpin,
B: Unpin,
impl<A, B> UnwindSafe for Either<A, B> where
A: UnwindSafe,
B: UnwindSafe,
[src]
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,
pub fn read_until(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8, Global>
) -> ReadUntil<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8, Global>
) -> ReadUntil<'a, Self> where
Self: Unpin,
pub fn read_line(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn split(self, byte: u8) -> Split<Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn lines(self) -> Lines<Self>
[src]
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
[src]
R: AsyncRead + ?Sized,
pub fn chain<R>(self, next: R) -> Chain<Self, R> where
R: AsyncRead,
[src]
R: AsyncRead,
pub fn read(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_buf<B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B> where
Self: Unpin,
B: BufMut,
[src]
Self: Unpin,
B: BufMut,
pub fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u8(&'a mut self) -> ReadU8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i8(&'a mut self) -> ReadI8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u16(&'a mut self) -> ReadU16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i16(&'a mut self) -> ReadI16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u32(&'a mut self) -> ReadU32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i32(&'a mut self) -> ReadI32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u64(&'a mut self) -> ReadU64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i64(&'a mut self) -> ReadI64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u128(&'a mut self) -> ReadU128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i128(&'a mut self) -> ReadI128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u16_le(&'a mut self) -> ReadU16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i16_le(&'a mut self) -> ReadI16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u32_le(&'a mut self) -> ReadU32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i32_le(&'a mut self) -> ReadI32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u64_le(&'a mut self) -> ReadU64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i64_le(&'a mut self) -> ReadI64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_u128_le(&'a mut self) -> ReadU128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_i128_le(&'a mut self) -> ReadI128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEnd<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEnd<'a, Self> where
Self: Unpin,
pub fn read_to_string(
&'a mut self,
dst: &'a mut String
) -> ReadToString<'a, Self> where
Self: Unpin,
[src]
&'a mut self,
dst: &'a mut String
) -> ReadToString<'a, Self> where
Self: Unpin,
pub 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,
pub fn write(&'a mut self, src: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_buf<B>(&'a mut self, src: &'a mut B) -> WriteBuf<'a, Self, B> where
Self: Unpin,
B: Buf,
[src]
Self: Unpin,
B: Buf,
pub fn write_all(&'a mut self, src: &'a [u8]) -> WriteAll<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u8(&'a mut self, n: u8) -> WriteU8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i8(&'a mut self, n: i8) -> WriteI8<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u16(&'a mut self, n: u16) -> WriteU16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i16(&'a mut self, n: i16) -> WriteI16<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u32(&'a mut self, n: u32) -> WriteU32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i32(&'a mut self, n: i32) -> WriteI32<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u64(&'a mut self, n: u64) -> WriteU64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i64(&'a mut self, n: i64) -> WriteI64<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u128(&'a mut self, n: u128) -> WriteU128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i128(&'a mut self, n: i128) -> WriteI128<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u16_le(&'a mut self, n: u16) -> WriteU16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i16_le(&'a mut self, n: i16) -> WriteI16Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u32_le(&'a mut self, n: u32) -> WriteU32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i32_le(&'a mut self, n: i32) -> WriteI32Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u64_le(&'a mut self, n: u64) -> WriteU64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i64_le(&'a mut self, n: i64) -> WriteI64Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_u128_le(&'a mut self, n: u128) -> WriteU128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn write_i128_le(&'a mut self, n: i128) -> WriteI128Le<&'a mut Self> where
Self: Unpin,
[src]
Self: Unpin,
pub fn flush(&mut self) -> Flush<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub 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,
pub 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, 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?
pub 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<St> StreamExt for St where
St: Stream + ?Sized,
[src]
St: Stream + ?Sized,
pub fn next(&mut self) -> Next<'_, Self> where
Self: Unpin,
[src]
Self: Unpin,
pub 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,
pub fn map<T, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> T,
[src]
F: FnMut(Self::Item) -> T,
pub fn merge<U>(self, other: U) -> Merge<Self, U> where
U: Stream<Item = Self::Item>,
[src]
U: Stream<Item = Self::Item>,
pub fn filter<F>(self, f: F) -> Filter<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub 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>,
pub fn fuse(self) -> Fuse<Self>
[src]
pub fn take(self, n: usize) -> Take<Self>
[src]
pub fn take_while<F>(self, f: F) -> TakeWhile<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn skip(self, n: usize) -> Skip<Self>
[src]
pub fn skip_while<F>(self, f: F) -> SkipWhile<Self, F> where
F: FnMut(&Self::Item) -> bool,
[src]
F: FnMut(&Self::Item) -> bool,
pub fn all<F>(&mut self, f: F) -> AllFuture<'_, Self, F> where
Self: Unpin,
F: FnMut(Self::Item) -> bool,
[src]
Self: Unpin,
F: FnMut(Self::Item) -> bool,
pub fn any<F>(&mut self, f: F) -> AnyFuture<'_, Self, F> where
Self: Unpin,
F: FnMut(Self::Item) -> bool,
[src]
Self: Unpin,
F: FnMut(Self::Item) -> bool,
pub fn chain<U>(self, other: U) -> Chain<Self, U> where
U: Stream<Item = Self::Item>,
[src]
U: Stream<Item = Self::Item>,
pub 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,
pub fn collect<T>(self) -> Collect<Self, T> where
T: FromStream<Self::Item>,
[src]
T: FromStream<Self::Item>,
pub fn timeout(self, duration: Duration) -> Timeout<Self>
[src]
pub fn throttle(self, duration: Duration) -> Throttle<Self>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,