Coverage Report

Created: 2026-03-31 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.50.0/src/fs/rename.rs
Line
Count
Source
1
use crate::fs::asyncify;
2
3
use std::io;
4
use std::path::Path;
5
6
/// Renames a file or directory to a new name, replacing the original file if
7
/// `to` already exists.
8
///
9
/// This will not work if the new name is on a different mount point.
10
///
11
/// This is an async version of [`std::fs::rename`].
12
0
pub async fn rename(from: impl AsRef<Path>, to: impl AsRef<Path>) -> io::Result<()> {
Unexecuted instantiation: tokio::fs::rename::rename::<&std::path::PathBuf, &std::path::PathBuf>
Unexecuted instantiation: tokio::fs::rename::rename::<_, _>
13
0
    let from = from.as_ref().to_owned();
14
0
    let to = to.as_ref().to_owned();
15
16
0
    asyncify(move || std::fs::rename(from, to)).await
Unexecuted instantiation: tokio::fs::rename::rename::<&std::path::PathBuf, &std::path::PathBuf>::{closure#0}::{closure#0}
Unexecuted instantiation: tokio::fs::rename::rename::<_, _>::{closure#0}::{closure#0}
17
0
}
Unexecuted instantiation: tokio::fs::rename::rename::<&std::path::PathBuf, &std::path::PathBuf>::{closure#0}
Unexecuted instantiation: tokio::fs::rename::rename::<_, _>::{closure#0}