# HG changeset patch # User Antoine Cezar # Date 2020-09-15 08:52:28 # Node ID 2d5dfc8fed5525ac01cf91c39b3e7a5cb27a051f # Parent 2f8227a125928a6f1670adb74c7bd117d7e5d958 hg-core: impl TryFrom for HgPathBuf Differential Revision: https://phab.mercurial-scm.org/D9048 diff --git a/rust/hg-core/src/utils/hg_path.rs b/rust/hg-core/src/utils/hg_path.rs --- a/rust/hg-core/src/utils/hg_path.rs +++ b/rust/hg-core/src/utils/hg_path.rs @@ -6,6 +6,7 @@ // GNU General Public License version 2 or any later version. use std::borrow::Borrow; +use std::convert::TryFrom; use std::ffi::{OsStr, OsString}; use std::fmt; use std::ops::Deref; @@ -515,6 +516,13 @@ pub fn path_to_hg_path_buf for HgPathBuf { + type Error = HgPathError; + fn try_from(path: PathBuf) -> Result { + path_to_hg_path_buf(path) + } +} + #[cfg(test)] mod tests { use super::*;