use super::blocking_io; use std::fs::{self, Metadata}; use std::future::Future; use std::io; use std::path::Path; use std::pin::Pin; use std::task::Context; use std::task::Poll; /// Queries the file system metadata for a path. pub fn metadata

(path: P) -> MetadataFuture

where P: AsRef + Send + 'static, { MetadataFuture::new(path) } /// Future returned by `metadata`. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct MetadataFuture

where P: AsRef + Send + 'static, { path: P, } impl

MetadataFuture

where P: AsRef + Send + 'static, { pub(crate) fn new(path: P) -> Self { Self { path } } } impl

Future for MetadataFuture

where P: AsRef + Send + 'static, { type Output = io::Result; fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { blocking_io(|| fs::metadata(&self.path)) } }