|
|
|
@ -53,10 +53,10 @@ pub trait BufRead {
|
|
|
|
|
/// use async_std::io::BufReader;
|
|
|
|
|
/// use async_std::prelude::*;
|
|
|
|
|
///
|
|
|
|
|
/// let mut f = BufReader::new(File::open("a.txt").await?);
|
|
|
|
|
/// let mut file = BufReader::new(File::open("a.txt").await?);
|
|
|
|
|
///
|
|
|
|
|
/// let mut buf = vec![0; 1024];
|
|
|
|
|
/// let n = f.read_until(b'\n', &mut buf).await?;
|
|
|
|
|
/// let n = file.read_until(b'\n', &mut buf).await?;
|
|
|
|
|
/// #
|
|
|
|
|
/// # Ok(()) }) }
|
|
|
|
|
/// ```
|
|
|
|
@ -104,10 +104,10 @@ pub trait BufRead {
|
|
|
|
|
/// use async_std::io::BufReader;
|
|
|
|
|
/// use async_std::prelude::*;
|
|
|
|
|
///
|
|
|
|
|
/// let mut f = BufReader::new(File::open("a.txt").await?);
|
|
|
|
|
/// let mut file = BufReader::new(File::open("a.txt").await?);
|
|
|
|
|
///
|
|
|
|
|
/// let mut buf = String::new();
|
|
|
|
|
/// f.read_line(&mut buf).await?;
|
|
|
|
|
/// file.read_line(&mut buf).await?;
|
|
|
|
|
/// #
|
|
|
|
|
/// # Ok(()) }) }
|
|
|
|
|
/// ```
|
|
|
|
@ -145,9 +145,8 @@ pub trait BufRead {
|
|
|
|
|
/// use async_std::io::BufReader;
|
|
|
|
|
/// use async_std::prelude::*;
|
|
|
|
|
///
|
|
|
|
|
/// let mut f = BufReader::new(File::open("a.txt").await?);
|
|
|
|
|
///
|
|
|
|
|
/// let mut lines = f.lines();
|
|
|
|
|
/// let file = File::open("a.txt").await?;
|
|
|
|
|
/// let mut lines = BufReader::new(file).lines();
|
|
|
|
|
/// let mut count = 0;
|
|
|
|
|
///
|
|
|
|
|
/// for line in lines.next().await {
|
|
|
|
|