From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/tokio/src/fs/rename.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 vendor/tokio/src/fs/rename.rs (limited to 'vendor/tokio/src/fs/rename.rs') diff --git a/vendor/tokio/src/fs/rename.rs b/vendor/tokio/src/fs/rename.rs new file mode 100644 index 000000000..4f980821d --- /dev/null +++ b/vendor/tokio/src/fs/rename.rs @@ -0,0 +1,17 @@ +use crate::fs::asyncify; + +use std::io; +use std::path::Path; + +/// Renames a file or directory to a new name, replacing the original file if +/// `to` already exists. +/// +/// This will not work if the new name is on a different mount point. +/// +/// This is an async version of [`std::fs::rename`](std::fs::rename) +pub async fn rename(from: impl AsRef, to: impl AsRef) -> io::Result<()> { + let from = from.as_ref().to_owned(); + let to = to.as_ref().to_owned(); + + asyncify(move || std::fs::rename(from, to)).await +} -- cgit v1.2.3