Add a dedicated Future for retrieving the metadata of a file (#385)

This commit is contained in:
Jake Goulding
2018-06-18 16:00:43 -07:00
committed by Carl Lerche
parent 85cf47de86
commit b2f77dcebe
3 changed files with 49 additions and 1 deletions
+7
View File
@@ -3,10 +3,12 @@
//! [`File`]: file/struct.File.html
mod create;
mod metadata;
mod open;
mod open_options;
pub use self::create::CreateFuture;
pub use self::metadata::MetadataFuture;
pub use self::open::OpenFuture;
pub use self::open_options::OpenOptions;
@@ -133,6 +135,11 @@ impl File {
::blocking_io(|| self.std().set_len(size))
}
/// Queries metadata about the underlying file.
pub fn metadata(self) -> MetadataFuture {
MetadataFuture::new(self)
}
/// Queries metadata about the underlying file.
pub fn poll_metadata(&mut self) -> Poll<Metadata, io::Error> {
::blocking_io(|| self.std().metadata())