pub struct FramedReader<R: AsyncRead> { /* private fields */ }Expand description
A reader which reads from a readable source in a framed manner. This reader
can only read frames generated by a FramedWriter.
Implementations§
Source§impl<R: AsyncRead> FramedReader<R>
impl<R: AsyncRead> FramedReader<R>
Sourcepub fn new(source: R) -> Self
pub fn new(source: R) -> Self
Creates a new framed reader which reads from the given readable source.
Sourcepub async fn read_frame(&mut self) -> Result<&[u8], ReadFrameError>
pub async fn read_frame(&mut self) -> Result<&[u8], ReadFrameError>
Reads a single frame from the readable source.
§Cancel Safety
This function is cancel safe, and can be used as one of the branches of
tokio::select without causing any data loss.
Auto Trait Implementations§
impl<R> Freeze for FramedReader<R>
impl<R> RefUnwindSafe for FramedReader<R>where
R: RefUnwindSafe,
impl<R> Send for FramedReader<R>where
R: Send,
impl<R> Sync for FramedReader<R>where
R: Sync,
impl<R> Unpin for FramedReader<R>
impl<R> UnwindSafe for FramedReader<R>where
R: UnwindSafe,
Blanket Implementations§
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