summaryrefslogtreecommitdiff
path: root/src/fs.rs
diff options
context:
space:
mode:
authorF001 <changchun.fan@qq.com>2018-12-11 21:36:34 +0800
committerRyan Dahl <ry@tinyclouds.org>2018-12-11 08:36:34 -0500
commitc1de50b0ca9c6e1c8cd06347d19dd3db50db36d8 (patch)
tree8b1b21bee6630638016d4a7e1cd749c5cd887f16 /src/fs.rs
parent9a960b9f5804f5e855163e7ec43327c28daef845 (diff)
Replace blocking! macro by generic function (#1305)
Diffstat (limited to 'src/fs.rs')
-rw-r--r--src/fs.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fs.rs b/src/fs.rs
index fde28efa2..228b4431e 100644
--- a/src/fs.rs
+++ b/src/fs.rs
@@ -13,9 +13,9 @@ use std::os::unix::fs::DirBuilderExt;
#[cfg(any(unix))]
use std::os::unix::fs::PermissionsExt;
-pub fn write_file(
+pub fn write_file<T: AsRef<[u8]>>(
filename: &Path,
- data: &[u8],
+ data: T,
perm: u32,
) -> std::io::Result<()> {
let is_append = perm & (1 << 31) != 0;
@@ -28,7 +28,7 @@ pub fn write_file(
.open(filename)?;
set_permissions(&mut file, perm)?;
- file.write_all(data)
+ file.write_all(data.as_ref())
}
#[cfg(any(unix))]