summaryrefslogtreecommitdiffstats
path: root/vendor/tokio/src/fs/set_permissions.rs
blob: 09be02ea013d4399bfae3ab246b2da9c29331144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::fs::asyncify;

use std::fs::Permissions;
use std::io;
use std::path::Path;

/// Changes the permissions found on a file or a directory.
///
/// This is an async version of [`std::fs::set_permissions`][std]
///
/// [std]: fn@std::fs::set_permissions
pub async fn set_permissions(path: impl AsRef<Path>, perm: Permissions) -> io::Result<()> {
    let path = path.as_ref().to_owned();
    asyncify(|| std::fs::set_permissions(path, perm)).await
}