pub fn read<P>(path: P) -> ReadFile<P>
where
    P: AsRef<Path> + Send + 'static,
{
    ReadFile {
        state: State::Open(File::open(path)),
    }
}
/// Creates a future which will open a file for reading and read the entire
/// contents into a buffer and return said buffer.
///
/// This is the async equivalent of `std::fs::read`.
///
/// # Examples
///
/// ```no_run
/// # extern crate tokio;
/// use tokio::prelude::Future;
/// fn main() {
///     let task = tokio::fs::read("foo.txt").map(|data| {
///         // do something with the contents of the file ...
///         println!("foo.txt contains {} bytes", data.len());
///     }).map_err(|e| {
///         // handle errors
///         eprintln!("IO error: {:?}", e);
///     });
///     tokio::run(task);
/// }
/// ```
Creates a future which will open a file for reading and read the entire
contents into a buffer and return said buffer.

This is the async equivalent of `std::fs::read`.
Creates a future which will open a file for reading and read the entire contents into a buffer and return said buffer . This is the async equivalent of ` std :: fs :: read ` .
pub fn read<P>(path: P) -> ReadFile<P>
where
    P: AsRef<Path> + Send + 'static,
{
    ReadFile {
        state: State::Open(File::open(path)),
    }
}
pub fn read < P > ( path : P ) -> ReadFile < P > where P : AsRef < Path > + Send + ' static , { ReadFile { state : State :: Open ( File :: open ( path ) ) , } }
Creates a future which will open a file for reading and read the entire
contents into a buffer and return said buffer.
Creates a future which will open a file for reading and read the entire contents into a buffer and return said buffer .
path
P
examples
None
extern crate tokio;
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::read("foo.txt").map(|data| {
do something with the contents of the file
println!("foo.txt contains {} bytes", data.len());
}).map_err(|e| {
handle errors
eprintln!("IO error: {:?}", e);
});
tokio::run(task);
}
```
use tokio :: prelude :: Future ; fn main () { let task = tokio :: fs :: read ( " foo . txt " ) . map ( |data| { do something with the contents of the file println! ( " foo . txt contains {} bytes " data . len () ) ; } ) . map_err ( |e| { handle errors eprintln! ( " IO error : { : ? } " e ) ; } ) ; tokio :: run ( task ) ; } ` ` `