From e67b6a0e5fb3fb2b0e1973cbaf753c6a7220fc6e Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Sun, 8 Nov 2020 00:25:07 +1100 Subject: [PATCH] Functions that took &Path now take impl AsRef --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b78e003..83eab0d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -157,7 +157,8 @@ struct XDRFile { } impl XDRFile { - pub fn open(path: &Path, filemode: FileMode) -> Result { + pub fn open(path: impl AsRef, filemode: FileMode) -> Result { + let path = path.as_ref(); let path_p = path_to_cstring(path).into_raw(); let mode_p = CString::new(filemode.value()).unwrap().into_raw(); @@ -211,7 +212,7 @@ pub struct XTCTrajectory { } impl XTCTrajectory { - pub fn open(path: &Path, filemode: FileMode) -> Result { + pub fn open(path: impl AsRef, filemode: FileMode) -> Result { let xdr = XDRFile::open(path, filemode)?; Ok(XTCTrajectory { handle: xdr, @@ -299,7 +300,7 @@ pub struct TRRTrajectory { } impl TRRTrajectory { - pub fn open(path: &Path, filemode: FileMode) -> Result { + pub fn open(path: impl AsRef, filemode: FileMode) -> Result { let xdr = XDRFile::open(path, filemode)?; Ok(TRRTrajectory { handle: xdr,