pub struct ReadOnly<R>(pub R);Expand description
An adaptor which implements Splittable for any AsyncRead, with the
write half being ().
This can be used to create a framed stream with only a reader, using
the AsyncReadExt::framed or AsyncReadExt::bytes method.
Tuple Fields§
§0: RTrait Implementations§
Source§impl<R: AsyncRead> AsyncRead for ReadOnly<R>
impl<R: AsyncRead> AsyncRead for ReadOnly<R>
Source§impl<R> Splittable for ReadOnly<R>
impl<R> Splittable for ReadOnly<R>
Source§type ReadHalf = R
type ReadHalf = R
The type of the read half, which normally implements
AsyncRead or
AsyncReadAt.Source§type WriteHalf = ()
type WriteHalf = ()
The type of the write half, which normally implements
AsyncWrite or
AsyncWriteAt.Auto Trait Implementations§
impl<R> Freeze for ReadOnly<R>where
R: Freeze,
impl<R> RefUnwindSafe for ReadOnly<R>where
R: RefUnwindSafe,
impl<R> Send for ReadOnly<R>where
R: Send,
impl<R> Sync for ReadOnly<R>where
R: Sync,
impl<R> Unpin for ReadOnly<R>where
R: Unpin,
impl<R> UnsafeUnpin for ReadOnly<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for ReadOnly<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<A> AsyncReadExt for A
impl<A> AsyncReadExt for A
Source§async fn append<T: IoBufMut>(&mut self, buf: T) -> BufResult<usize, T>
async fn append<T: IoBufMut>(&mut self, buf: T) -> BufResult<usize, T>
Same as
AsyncRead::read, but it appends data to the end of the
buffer; in other words, it read to the beginning of the uninitialized
area.Source§async fn read_exact<T: IoBufMut>(&mut self, buf: T) -> BufResult<(), T>
async fn read_exact<T: IoBufMut>(&mut self, buf: T) -> BufResult<(), T>
Read the exact number of bytes required to fill the buf.
Source§async fn read_to_string(&mut self, buf: String) -> BufResult<usize, String>
async fn read_to_string(&mut self, buf: String) -> BufResult<usize, String>
Read all bytes as
String until underlying reader reaches EOF.Source§async fn read_to_end(&mut self, buf: Vec<u8>) -> BufResult<usize, Vec<u8>>
async fn read_to_end(&mut self, buf: Vec<u8>) -> BufResult<usize, Vec<u8>>
Read all bytes until underlying reader reaches
EOF.Source§async fn read_vectored_exact<T: IoVectoredBufMut>(
&mut self,
buf: T,
) -> BufResult<(), T>
async fn read_vectored_exact<T: IoVectoredBufMut>( &mut self, buf: T, ) -> BufResult<(), T>
Read the exact number of bytes required to fill the vectored buf.
Source§fn framed<T, C, F>(
self,
codec: C,
framer: F,
) -> Framed<Self::ReadHalf, Self::WriteHalf, C, F, T, T>where
Self: Splittable + Sized,
fn framed<T, C, F>(
self,
codec: C,
framer: F,
) -> Framed<Self::ReadHalf, Self::WriteHalf, C, F, T, T>where
Self: Splittable + Sized,
Create a
framed::Framed reader/writer with the given codec and
framer.Source§fn bytes(self) -> BytesFramed<Self::ReadHalf, Self::WriteHalf>where
Self: Splittable + Sized,
fn bytes(self) -> BytesFramed<Self::ReadHalf, Self::WriteHalf>where
Self: Splittable + Sized,
Available on crate feature
bytes only.Convenience method to create a
framed::BytesFramed reader/writter
out of a splittable.Source§fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
Creates an adaptor which reads at most
limit bytes from it. Read moreSource§async fn read_u8_le(&mut self) -> Result<u8>
async fn read_u8_le(&mut self) -> Result<u8>
Read a little endian
u8 from the underlying reader.Source§async fn read_u16_le(&mut self) -> Result<u16>
async fn read_u16_le(&mut self) -> Result<u16>
Read a little endian
u16 from the underlying reader.Source§async fn read_u32_le(&mut self) -> Result<u32>
async fn read_u32_le(&mut self) -> Result<u32>
Read a little endian
u32 from the underlying reader.Source§async fn read_u64_le(&mut self) -> Result<u64>
async fn read_u64_le(&mut self) -> Result<u64>
Read a little endian
u64 from the underlying reader.Source§async fn read_u128(&mut self) -> Result<u128>
async fn read_u128(&mut self) -> Result<u128>
Read a big endian
u128 from the underlying reader.Source§async fn read_u128_le(&mut self) -> Result<u128>
async fn read_u128_le(&mut self) -> Result<u128>
Read a little endian
u128 from the underlying reader.Source§async fn read_i8_le(&mut self) -> Result<i8>
async fn read_i8_le(&mut self) -> Result<i8>
Read a little endian
i8 from the underlying reader.Source§async fn read_i16_le(&mut self) -> Result<i16>
async fn read_i16_le(&mut self) -> Result<i16>
Read a little endian
i16 from the underlying reader.Source§async fn read_i32_le(&mut self) -> Result<i32>
async fn read_i32_le(&mut self) -> Result<i32>
Read a little endian
i32 from the underlying reader.Source§async fn read_i64_le(&mut self) -> Result<i64>
async fn read_i64_le(&mut self) -> Result<i64>
Read a little endian
i64 from the underlying reader.Source§async fn read_i128(&mut self) -> Result<i128>
async fn read_i128(&mut self) -> Result<i128>
Read a big endian
i128 from the underlying reader.Source§async fn read_i128_le(&mut self) -> Result<i128>
async fn read_i128_le(&mut self) -> Result<i128>
Read a little endian
i128 from the underlying reader.Source§async fn read_f32_le(&mut self) -> Result<f32>
async fn read_f32_le(&mut self) -> Result<f32>
Read a little endian
f32 from the underlying reader.Source§async fn read_f64_le(&mut self) -> Result<f64>
async fn read_f64_le(&mut self) -> Result<f64>
Read a little endian
f64 from the underlying reader.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more