-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tokio::fs::File doesn't expose into_std()
in 0.2
#1852
Comments
bartlomieju
changed the title
tokio::fs::File doesn't expose
tokio::fs::File doesn't expose Nov 28, 2019
into_std()
into_std()
in 0.2
what about |
pub async fn into_std(&self) -> io::Result<sys::File> {
let std = self.std.clone();
let std_file = asyncify(move || std.try_clone()).await?;
Ok(std_file)
} @carllerche something along those lines? I'll be happy to open a PR |
You would not need a clone. You would wait until the background operation is complete, then downcast then use You could also have a |
carllerche
pushed a commit
that referenced
this issue
Nov 29, 2019
In version 0.1 there was File::into_std method that destructured tokio_fs::File into std::fs:File. That method was lacking in version 0.2. Fixes: #1852
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
tokio 0.2
Description
In tokio 0.1 one could get underlying
std::fs::File
instance fromtokio::fs::File
like so:Unfortunately I did not find this method in tokio 0.2 which is very desirable - eg. I want to start new
Command
with file as stdout/stderr for that command.Command.stdout()
requiresInto<Stdio>
which is implemented forstd::fs::File
but nottokio::fs::File
.EDIT:
As I see that design of
tokio::fs::File
changed it's not really useful to destructure the file. Something likeasync fn try_clone_std() -> std::fs::File
would be fine 👍The text was updated successfully, but these errors were encountered: