Trait partial_io::ReadBufExt
source · [−]pub trait ReadBufExt {
fn with_limited<F, T>(&mut self, limit: usize, callback: F) -> T
where
F: FnOnce(&mut ReadBuf<'_>) -> T;
}Expand description
Extensions to tokio’s ReadBuf.
Requires the tokio1 feature to be enabled.
Required Methods
fn with_limited<F, T>(&mut self, limit: usize, callback: F) -> T where
F: FnOnce(&mut ReadBuf<'_>) -> T,
fn with_limited<F, T>(&mut self, limit: usize, callback: F) -> T where
F: FnOnce(&mut ReadBuf<'_>) -> T,
Convert this ReadBuf into a limited one backed by the same storage, then
call the callback with this limited instance..
Any changes to the ReadBuf made by the callback are reflected in the original
ReadBuf.
Implementations on Foreign Types
sourceimpl<'a> ReadBufExt for ReadBuf<'a>
impl<'a> ReadBufExt for ReadBuf<'a>
sourcefn with_limited<F, T>(&mut self, limit: usize, callback: F) -> T where
F: FnOnce(&mut ReadBuf<'_>) -> T,
fn with_limited<F, T>(&mut self, limit: usize, callback: F) -> T where
F: FnOnce(&mut ReadBuf<'_>) -> T,
Available on crate features
futures03 and tokio1 only.