1
0
mirror of https://github.com/jht5945/finding.git synced 2025-12-27 13:20:03 +08:00

&Path -> AsRef<Path>

This commit is contained in:
2020-04-30 01:09:28 +08:00
parent 29fea6ac49
commit b2dc1d868c

View File

@@ -5,7 +5,8 @@ use std::{
}; };
use rust_util::{ XResult, new_box_error, }; use rust_util::{ XResult, new_box_error, };
pub fn read_file_content(file: &Path, large_file_len: u64) -> XResult<String> { pub fn read_file_content<P: AsRef<Path>>(p: P, large_file_len: u64) -> XResult<String> {
let file = p.as_ref();
if !file.exists() { if !file.exists() {
return Err(new_box_error(&format!("File not exists: {:?}", file))); return Err(new_box_error(&format!("File not exists: {:?}", file)));
} }