Trait async_proto::Protocol
source · [−]pub trait Protocol: Sized {
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>;
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>;
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>;
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>;
fn try_read(
stream: &mut impl Read,
buf: &mut Vec<u8>
) -> Result<Option<Self>, ReadError> { ... }
fn read_ws<'a, R: Stream<Item = Result<Message, Error>> + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>> { ... }
fn write_ws<'a, W: Sink<Message, Error = Error> + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
where
Self: Sync,
{ ... }
fn read_warp<'a, R: Stream<Item = Result<Message, Error>> + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>> { ... }
fn write_warp<'a, W: Sink<Message, Error = Error> + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
where
Self: Sync,
{ ... }
}
Expand description
This trait allows reading a value of an implementing type from an async or sync stream, as well as writing one to an async or sync sink.
Required methods
Reads a value of this type from an async stream.
Cancellation safety
Implementations of this method are generally not cancellation safe.
Writes a value of this type to an async sink.
Cancellation safety
Implementations of this method are generally not cancellation safe.
read-sync
only.Reads a value of this type from a sync stream.
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.Writes a value of this type to a sync sink.
Provided methods
read-sync
only.Attempts to read a value of this type from a prefix in a buffer and a suffix in a sync stream.
If io::ErrorKind::WouldBlock
is encountered, Ok(None)
is returned and the portion read successfully is appended to buf
. Otherwise, the prefix representing the returned value is removed from buf
.
Callers, not implementations, should ensure that stream
is non-blocking if desired.
Example
use {
std::net::TcpStream,
async_proto::Protocol,
};
struct Client {
tcp_stream: TcpStream,
buf: Vec<u8>,
}
impl Client {
fn new(tcp_stream: TcpStream) -> Self {
Self {
tcp_stream,
buf: Vec::default(),
}
}
fn try_read<T: Protocol>(&mut self) -> Result<Option<T>, async_proto::ReadError> {
self.tcp_stream.set_nonblocking(true)?;
T::try_read(&mut self.tcp_stream, &mut self.buf)
}
fn write<T: Protocol>(&mut self, msg: &T) -> Result<(), async_proto::WriteError> {
self.tcp_stream.set_nonblocking(false)?;
msg.write_sync(&mut self.tcp_stream)
}
}
tokio-tungstenite
only.Reads a value of this type from a tokio-tungstenite
websocket.
Cancellation safety
The default implementation of this method is cancellation safe if and only if the read-sync
feature is enabled.
tokio-tungstenite
only.Writes a value of this type to a tokio-tungstenite
websocket.
Cancellation safety
The default implementation of this method is not cancellation safe.
warp
only.Reads a value of this type from a warp
websocket.
Cancellation safety
The default implementation of this method is cancellation safe if and only if the read-sync
feature is enabled.
warp
only.Writes a value of this type to a warp
websocket.
Cancellation safety
The default implementation of this method is not cancellation safe.
Implementations on Foreign Types
sourceimpl Protocol for Utc
This is supported on crate feature chrono
only.
impl Protocol for Utc
chrono
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NaiveDate
This is supported on crate feature chrono
only.
impl Protocol for NaiveDate
chrono
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for FixedOffset
This is supported on crate feature chrono
only.
impl Protocol for FixedOffset
chrono
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<Tz: TimeZone> Protocol for DateTime<Tz> where
Tz: Protocol + TimeZone + Send + Sync + 'static,
Tz::Offset: Sync,
This is supported on crate feature chrono
only.
impl<Tz: TimeZone> Protocol for DateTime<Tz> where
Tz: Protocol + TimeZone + Send + Sync + 'static,
Tz::Offset: Sync,
chrono
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for Tz
This is supported on crate feature chrono-tz
only.
impl Protocol for Tz
chrono-tz
only.A timezone is represented as an IANA timezone identifier.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<F: Float, C: FloatChecker<F>> Protocol for NoisyFloat<F, C> where
F: Protocol + Float + Send + Sync + 'static,
C: FloatChecker<F> + Send + Sync,
This is supported on crate feature noisy_float
only.
impl<F: Float, C: FloatChecker<F>> Protocol for NoisyFloat<F, C> where
F: Protocol + Float + Send + Sync + 'static,
C: FloatChecker<F> + Send + Sync,
noisy_float
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for Map<String, Value>
This is supported on crate feature serde_json
only.
impl Protocol for Map<String, Value>
serde_json
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for Value
This is supported on crate feature serde_json
only.
impl Protocol for Value
serde_json
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for Number
This is supported on crate feature serde_json
only.
impl Protocol for Number
serde_json
only.fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for u8
impl Protocol for u8
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for i8
impl Protocol for i8
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for u16
impl Protocol for u16
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for i16
impl Protocol for i16
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for u32
impl Protocol for u32
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for i32
impl Protocol for i32
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for u64
impl Protocol for u64
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for i64
impl Protocol for i64
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for u128
impl Protocol for u128
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for i128
impl Protocol for i128
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<Idx: Protocol + Send + Sync> Protocol for RangeInclusive<Idx>
impl<Idx: Protocol + Send + Sync> Protocol for RangeInclusive<Idx>
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for ()
impl Protocol for ()
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync> Protocol for (A,)
impl<A: Protocol + Send + Sync> Protocol for (A,)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync> Protocol for (A, B)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync> Protocol for (A, B)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync> Protocol for (A, B, C)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync> Protocol for (A, B, C)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync> Protocol for (A, B, C, D)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync> Protocol for (A, B, C, D)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync> Protocol for (A, B, C, D, E)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync> Protocol for (A, B, C, D, E)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync, K: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J, K)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync, K: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J, K)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync, K: Protocol + Send + Sync, L: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J, K, L)
impl<A: Protocol + Send + Sync, B: Protocol + Send + Sync, C: Protocol + Send + Sync, D: Protocol + Send + Sync, E: Protocol + Send + Sync, F: Protocol + Send + Sync, G: Protocol + Send + Sync, H: Protocol + Send + Sync, I: Protocol + Send + Sync, J: Protocol + Send + Sync, K: Protocol + Send + Sync, L: Protocol + Send + Sync> Protocol for (A, B, C, D, E, F, G, H, I, J, K, L)
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T: Protocol + Send + Sync, const N: usize> Protocol for [T; N]
impl<T: Protocol + Send + Sync, const N: usize> Protocol for [T; N]
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for bool
impl Protocol for bool
Represented as one byte, with 0
for false
and 1
for true
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T: Protocol> Protocol for Box<T>
impl<T: Protocol> Protocol for Box<T>
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T: Protocol + Send + Sync> Protocol for Vec<T>
impl<T: Protocol + Send + Sync> Protocol for Vec<T>
A vector is prefixed with the length as a u64
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T: Protocol + Ord + Send + Sync + 'static> Protocol for BTreeSet<T>
impl<T: Protocol + Ord + Send + Sync + 'static> Protocol for BTreeSet<T>
A set is prefixed with the length as a u64
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T: Protocol + Eq + Hash + Send + Sync> Protocol for HashSet<T>
impl<T: Protocol + Eq + Hash + Send + Sync> Protocol for HashSet<T>
A set is prefixed with the length as a u64
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for String
impl Protocol for String
A string is encoded in UTF-8 and prefixed with the length in bytes as a u64
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<K: Protocol + Ord + Send + Sync + 'static, V: Protocol + Send + Sync + 'static> Protocol for BTreeMap<K, V>
impl<K: Protocol + Ord + Send + Sync + 'static, V: Protocol + Send + Sync + 'static> Protocol for BTreeMap<K, V>
A map is prefixed with the length as a u64
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<K: Protocol + Eq + Hash + Send + Sync, V: Protocol + Send + Sync> Protocol for HashMap<K, V>
impl<K: Protocol + Eq + Hash + Send + Sync, V: Protocol + Send + Sync> Protocol for HashMap<K, V>
A map is prefixed with the length as a u64
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<'cow, B: ToOwned + Sync + ?Sized> Protocol for Cow<'cow, B> where
B::Owned: Protocol + Send + Sync,
impl<'cow, B: ToOwned + Sync + ?Sized> Protocol for Cow<'cow, B> where
B::Owned: Protocol + Send + Sync,
A cow is represented like its owned variant.
Note that due to a restriction in the type system, writing a borrowed cow requires cloning it.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroU8
impl Protocol for NonZeroU8
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroI8
impl Protocol for NonZeroI8
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroU16
impl Protocol for NonZeroU16
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroI16
impl Protocol for NonZeroI16
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroU32
impl Protocol for NonZeroU32
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroI32
impl Protocol for NonZeroI32
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroU64
impl Protocol for NonZeroU64
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroI64
impl Protocol for NonZeroI64
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroU128
impl Protocol for NonZeroU128
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for NonZeroI128
impl Protocol for NonZeroI128
A nonzero integer is represented like its value.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for f32
impl Protocol for f32
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for f64
impl Protocol for f64
Primitive number types are encoded in big-endian format.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<Idx> Protocol for Range<Idx> where
Idx: Protocol + Send + Sync,
impl<Idx> Protocol for Range<Idx> where
Idx: Protocol + Send + Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<Idx> Protocol for RangeFrom<Idx> where
Idx: Protocol + Sync,
impl<Idx> Protocol for RangeFrom<Idx> where
Idx: Protocol + Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<Idx> Protocol for RangeTo<Idx> where
Idx: Protocol + Sync,
impl<Idx> Protocol for RangeTo<Idx> where
Idx: Protocol + Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<Idx> Protocol for RangeToInclusive<Idx> where
Idx: Protocol + Sync,
impl<Idx> Protocol for RangeToInclusive<Idx> where
Idx: Protocol + Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T> Protocol for Option<T> where
T: Protocol + Sync,
impl<T> Protocol for Option<T> where
T: Protocol + Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T, E> Protocol for Result<T, E> where
T: Protocol + Sync,
E: Protocol + Sync,
impl<T, E> Protocol for Result<T, E> where
T: Protocol + Sync,
E: Protocol + Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for Infallible
impl Protocol for Infallible
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl<T> Protocol for PhantomData<T> where
T: Sync,
impl<T> Protocol for PhantomData<T> where
T: Sync,
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for RangeFull
impl Protocol for RangeFull
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.sourceimpl Protocol for Duration
impl Protocol for Duration
A duration is represented as the number of whole seconds as a u64
followed by the number of subsecond nanoseconds as a u32
.
fn read<'a, R: AsyncRead + Unpin + Send + 'a>(
stream: &'a mut R
) -> Pin<Box<dyn Future<Output = Result<Self, ReadError>> + Send + 'a>>
fn write<'a, W: AsyncWrite + Unpin + Send + 'a>(
&'a self,
sink: &'a mut W
) -> Pin<Box<dyn Future<Output = Result<(), WriteError>> + Send + 'a>>
sourcefn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
fn read_sync(stream: &mut impl Read) -> Result<Self, ReadError>
read-sync
only.sourcefn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
fn write_sync(&self, sink: &mut impl Write) -> Result<(), WriteError>
write-sync
only.