Crate file_futures [−] [src]
File Futures
This crate provides the Futures abstraction around many of the poll methods provided in tokio-fs.
There's really not much to it.
Example
use std::io::SeekFrom; use file_futures::AsyncFile; use futures::Future; use tokio_fs::File; fn main() { let future = File::create("/tmp/some-tmpfile") .map_err(|e| println!("Create Error {}", e)) .and_then(|_| { let future1 = File::open("/tmp/some-tmpfile") .and_then(|file| file.metadata().and_then(|(_file, _metadata)| Ok(()))) .map_err(|e| println!("Error1: {}", e)); let future2 = File::open("/tmp/some-tmpfile") .and_then(|file| { file.seek(SeekFrom::Start(30)) .and_then(|(_file, _from_start)| Ok(())) }) .map_err(|e| println!("Error2: {}", e)); future1.join(future2) }) .map_err(|_| panic!("Error somewhere")); tokio::run(future.map(|_| ())); }
Structs
GetMetadata | |
Seek | |
SetLen | |
SetPermissions | |
SyncAll | |
SyncData | |
TryClone |
Traits
AsyncFile |
The trait that provides the futures associated with |