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,