fn take(self, limit: u64) -> Take<Self>
    where
        Self: Sized,
    {
        assert_read(Take::new(self, limit))
    }
/// Creates an AsyncRead adapter which will read at most `limit` bytes
/// from the underlying reader.
///
/// # Examples
///
/// ```
/// # futures::executor::block_on(async {
/// use futures::io::{AsyncReadExt, Cursor};
///
/// let reader = Cursor::new(&b"12345678"[..]);
/// let mut buffer = [0; 5];
///
/// let mut take = reader.take(4);
/// let n = take.read(&mut buffer).await?;
///
/// assert_eq!(n, 4);
/// assert_eq!(&buffer, b"1234\0");
/// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
/// ```
Creates an AsyncRead adapter which will read at most `limit` bytes
from the underlying reader.
Creates an AsyncRead adapter which will read at most ` limit ` bytes from the underlying reader .
fn take(self, limit: u64) -> Take<Self>
    where
        Self: Sized,
    {
        assert_read(Take::new(self, limit))
    }
fn take ( self , limit : u64 ) -> Take < Self > where Self : Sized , { assert_read ( Take :: new ( self , limit ) ) }
Creates an AsyncRead adapter which will read at most `limit` bytes
from the underlying reader.
Creates an AsyncRead adapter which will read at most ` limit ` bytes from the underlying reader .
self
limit
u64
self
limit
u64
examples
None
futures::executor::block_on(async {
use futures::io::{AsyncReadExt, Cursor}.



let mut take = reader.take(4);
let n = take.read(&mut buffer).await?.


use futures :: io :: { AsyncReadExt Cursor } . let mut take = reader . take ( 4 ) ; let n = take . read ( &mut buffer ) . await? .
ok::<(), box<dyn std::error::error>>(()) }).unwrap();
None