From b2dc1d868cbcc916733ce9dfa82c2a9dc688cfa3 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Thu, 30 Apr 2020 01:09:28 +0800 Subject: [PATCH] &Path -> AsRef --- src/local_util.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/local_util.rs b/src/local_util.rs index bb9922f..c876422 100644 --- a/src/local_util.rs +++ b/src/local_util.rs @@ -5,7 +5,8 @@ use std::{ }; use rust_util::{ XResult, new_box_error, }; -pub fn read_file_content(file: &Path, large_file_len: u64) -> XResult { +pub fn read_file_content>(p: P, large_file_len: u64) -> XResult { + let file = p.as_ref(); if !file.exists() { return Err(new_box_error(&format!("File not exists: {:?}", file))); }