Skip to content
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

fs: misc small API tweaks #3315

Merged
merged 2 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tokio/src/fs/copy.rs
Expand Up @@ -20,7 +20,7 @@ use std::path::Path;
/// # }
/// ```

pub async fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<u64, std::io::Error> {
pub async fn copy(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<u64, std::io::Error> {
let from = from.as_ref().to_owned();
let to = to.as_ref().to_owned();
asyncify(|| std::fs::copy(from, to)).await
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/fs/dir_builder.rs
Expand Up @@ -96,7 +96,7 @@ impl DirBuilder {
/// Ok(())
/// }
/// ```
pub async fn create<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
pub async fn create(&self, path: impl AsRef<Path>) -> io::Result<()> {
let path = path.as_ref().to_owned();
let mut builder = std::fs::DirBuilder::new();
builder.recursive(self.recursive);
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/fs/write.rs
Expand Up @@ -19,7 +19,7 @@ use std::{io, path::Path};
/// # Ok(())
/// # }
/// ```
pub async fn write<C: AsRef<[u8]> + Unpin>(path: impl AsRef<Path>, contents: C) -> io::Result<()> {
pub async fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> io::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this even + Unpin in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea... probably accident / left over.

let path = path.as_ref().to_owned();
let contents = contents.as_ref().to_owned();

Expand Down