summaryrefslogtreecommitdiffstats
path: root/tokio-fs/src/file/create.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio-fs/src/file/create.rs')
-rw-r--r--tokio-fs/src/file/create.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/tokio-fs/src/file/create.rs b/tokio-fs/src/file/create.rs
index da03779e..bc4661cb 100644
--- a/tokio-fs/src/file/create.rs
+++ b/tokio-fs/src/file/create.rs
@@ -1,8 +1,11 @@
use super::File;
-use futures::{try_ready, Future, Poll};
use std::fs::File as StdFile;
+use std::future::Future;
use std::io;
use std::path::Path;
+use std::pin::Pin;
+use std::task::Context;
+use std::task::Poll;
/// Future returned by `File::create` and resolves to a `File` instance.
#[derive(Debug)]
@@ -12,7 +15,7 @@ pub struct CreateFuture<P> {
impl<P> CreateFuture<P>
where
- P: AsRef<Path> + Send + 'static,
+ P: AsRef<Path> + Send + Unpin + 'static,
{
pub(crate) fn new(path: P) -> Self {
CreateFuture { path }
@@ -21,15 +24,14 @@ where
impl<P> Future for CreateFuture<P>
where
- P: AsRef<Path> + Send + 'static,
+ P: AsRef<Path> + Send + Unpin + 'static,
{
- type Item = File;
- type Error = io::Error;
+ type Output = io::Result<File>;
- fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
- let std = try_ready!(crate::blocking_io(|| StdFile::create(&self.path)));
+ fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
+ let std = ready!(crate::blocking_io(|| StdFile::create(&self.path)))?;
let file = File::from_std(std);
- Ok(file.into())
+ Poll::Ready(Ok(file.into()))
}
}