From 785da58fc732931a9a45cf598e5876a337e24011 Mon Sep 17 00:00:00 2001 From: Hristo Venev Date: Mon, 30 Sep 2019 14:51:59 +0300 Subject: Simplify main functions. --- src/fileutil.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/fileutil.rs') diff --git a/src/fileutil.rs b/src/fileutil.rs index 0d76dfe..d00575b 100644 --- a/src/fileutil.rs +++ b/src/fileutil.rs @@ -84,7 +84,12 @@ pub fn update(path: &Path, data: &[u8]) -> io::Result<()> { tmp.sync_done()?.rename_to(path) } -pub fn load(path: &Path) -> io::Result>> { +#[inline] +pub fn load(path: &impl AsRef) -> io::Result>> { + _load(path.as_ref()) +} + +fn _load(path: &Path) -> io::Result>> { let mut file = match fs::File::open(&path) { Ok(file) => file, Err(e) => { -- cgit