[−][src]Struct agilulf_protocol::AsyncReadBuffer
A Read buffer to provide read_exact
and read_line
methods.
Amazingly there isn't an AsyncBuffer
for latest futures! The implementation of this struct is
similar with BufferReader
in std. The implementation of read_exact
and read_line
learns
from BufferRead
trait in std.
Methods
impl<T: AsyncRead + Unpin> AsyncReadBuffer<T>
[src]
pub fn new(stream: T) -> AsyncReadBuffer<T>
[src]
pub async fn fill_buf<'_>(&'_ mut self) -> Result<&'_ [u8]>
[src]
pub fn consume(&mut self, amt: usize)
[src]
pub async fn read_line<'_>(&'_ mut self) -> Result<Vec<u8>>
[src]
Note: The return value of this method contains "\r\n".
This method will find "\n" and check whether the former one byte is "\r". If it is, it will be consumed and return.
pub async fn read_exact<'_>(&'_ mut self, size: usize) -> Result<Vec<u8>>
[src]
impl<T: AsyncRead + Unpin + 'static> AsyncReadBuffer<T>
[src]
pub fn into_reply_stream(self) -> impl Stream<Item = Result<Reply>>
[src]
Convert a AsyncReadBuffer
into Stream<Item = Result<Reply>>
.
The implementation of it is use futures::stream::unfold" and every time it will read one reply on this stream (with the help of
read_exactand
read_line`)
impl<T: AsyncRead + Unpin + 'static> AsyncReadBuffer<T>
[src]
pub fn into_command_stream(self) -> impl Stream<Item = Result<Command>>
[src]
Convert a AsyncReadBuffer
into Stream<Item = Result<Command>>
.
Auto Trait Implementations
impl<T> Send for AsyncReadBuffer<T> where
T: Send,
T: Send,
impl<T> Unpin for AsyncReadBuffer<T>
impl<T> Sync for AsyncReadBuffer<T> where
T: Sync,
T: Sync,
impl<T> UnwindSafe for AsyncReadBuffer<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for AsyncReadBuffer<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,