fs: misc small API tweaks (#3315)

This commit is contained in:
Carl Lerche
2020-12-22 11:13:41 -08:00
committed by GitHub
parent 7d28e4cdbb
commit 2ee9520d10
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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<()> {
let path = path.as_ref().to_owned();
let contents = contents.as_ref().to_owned();