diff options
author | F001 <changchun.fan@qq.com> | 2018-12-11 21:36:34 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-12-11 08:36:34 -0500 |
commit | c1de50b0ca9c6e1c8cd06347d19dd3db50db36d8 (patch) | |
tree | 8b1b21bee6630638016d4a7e1cd749c5cd887f16 /src/fs.rs | |
parent | 9a960b9f5804f5e855163e7ec43327c28daef845 (diff) |
Replace blocking! macro by generic function (#1305)
Diffstat (limited to 'src/fs.rs')
-rw-r--r-- | src/fs.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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))] |