Struct Take
pub struct Take<R> { /* private fields */ }
io-util only.Stream for the take method.
Implementations
impl<R: AsyncRead> Take<R>
pub fn limit(&self) -> u64
Returns the remaining number of bytes that can be read before this instance will return EOF.
Note
This instance may reach EOF after reading fewer bytes than indicated by this method if the underlying AsyncRead instance reaches EOF.
pub fn set_limit(&mut self, limit: u64)
Sets the number of bytes that can be read before this instance will return EOF. This is the same as constructing a new Take instance, so the amount of bytes read and the previous limit value don’t matter when calling this method.
pub fn get_mut(&mut self) -> &mut R
Gets a mutable reference to the underlying reader.
Care should be taken to avoid modifying the internal I/O state of the underlying reader as doing so may corrupt the internal limit of this Take.
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut R>
Gets a pinned mutable reference to the underlying reader.
Care should be taken to avoid modifying the internal I/O state of the underlying reader as doing so may corrupt the internal limit of this Take.
pub fn into_inner(self) -> R
Consumes the Take, returning the wrapped reader.
Trait Implementations
impl<R: AsyncBufRead> AsyncBufRead for Take<R>
impl<'__pin, R> Unpin for Take<R>where PinnedFieldsOf<__Origin<'__pin, R>>: Unpin,
Auto Trait Implementations
impl<R> Freeze for Take<R>where R: Freeze,
impl<R> RefUnwindSafe for Take<R>where R: RefUnwindSafe,
impl<R> Send for Take<R>where R: Send,
impl<R> Sync for Take<R>where R: Sync,
impl<R> UnsafeUnpin for Take<R>where R: UnsafeUnpin,
impl<R> UnwindSafe for Take<R>where R: UnwindSafe,
Blanket Implementations
impl<R> AsyncBufReadExt for Rwhere R: AsyncBufRead + ?Sized,
fn read_until<'a>( &'a mut self, byte: u8, buf: &'a mut Vec<u8>, ) -> ReadUntil<'a, Self>where Self: Unpin,
io-util only.fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where Self: Unpin,
io-util only.fn split(self, byte: u8) -> Split<Self>
io-util only.byte. Read more
fn fill_buf(&mut self) -> FillBuf<'_, Self>where Self: Unpin,
io-util only.fn lines(self) -> Lines<Self>where Self: Sized,
io-util only.BufRead::lines. Read more
impl<R> AsyncReadExt for R
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where Self: Unpin,
io-util only.fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
io-util only.fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where Self: Unpin,
io-util only.buf. Read more
fn read_u8(&mut self) -> ReadU8<&mut Self>where Self: Unpin,
io-util only.fn read_i8(&mut self) -> ReadI8<&mut Self>where Self: Unpin,
io-util only.fn read_u16(&mut self) -> ReadU16<&mut Self>where Self: Unpin,
io-util only.fn read_i16(&mut self) -> ReadI16<&mut Self>where Self: Unpin,
io-util only.fn read_u32(&mut self) -> ReadU32<&mut Self>where Self: Unpin,
io-util only.fn read_i32(&mut self) -> ReadI32<&mut Self>where Self: Unpin,
io-util only.fn read_u64(&mut self) -> ReadU64<&mut Self>where Self: Unpin,
io-util only.fn read_i64(&mut self) -> ReadI64<&mut Self>where Self: Unpin,
io-util only.fn read_u128(&mut self) -> ReadU128<&mut Self>where Self: Unpin,
io-util only.fn read_i128(&mut self) -> ReadI128<&mut Self>where Self: Unpin,
io-util only.fn read_f32(&mut self) -> ReadF32<&mut Self>where Self: Unpin,
io-util only.fn read_f64(&mut self) -> ReadF64<&mut Self>where Self: Unpin,
io-util only.fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where Self: Unpin,
io-util only.fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where Self: Unpin,
io-util only.fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where Self: Unpin,
io-util only.fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where Self: Unpin,
io-util only.fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where Self: Unpin,
io-util only.fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where Self: Unpin,
io-util only.fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where Self: Unpin,
io-util only.fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where Self: Unpin,
io-util only.fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where Self: Unpin,
io-util only.fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where Self: Unpin,
io-util only.fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where Self: Unpin,
io-util only.buf. Read more
fn read_to_string<'a>( &'a mut self, dst: &'a mut String, ) -> ReadToString<'a, Self>where Self: Unpin,
io-util only.buf. Read more
impl<T> BorrowMut<T> for Twhere T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> Instrument for T
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> WithSubscriber for T
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
MIT License
Copyright © Tokio Contributors
https://docs.rs/tokio/1.53.1/tokio/io/struct.Take.html