Debian Codegraph @

third_party/rust/tokio/src/fs/set_permissions.rs

raw
1 use crate::fs::asyncify;
2
3 use std::fs::Permissions;
4 use std::io;
5 use std::path::Path;
6
7 /// Changes the permissions found on a file or a directory.
8 ///
9 /// This is an async version of [`std::fs::set_permissions`][std]
10 ///
11 /// [std]: fn@std::fs::set_permissions
12 pub async fn set_permissions(path: impl AsRef<Path>, perm: Permissions) -> io::Result<()> {
13 let path = path.as_ref().to_owned();
14 asyncify(|| std::fs::set_permissions(path, perm)).await
15 }