Mercurial > hg
changeset 50417:d27b6fc7c1bf
rustdoc: summary line for hg_path_to_os_string
The main motivation of this change is to avoid the TODO being
the summary line, even though this leads to a pretty obvious summary.
Then doc-comments for the other functions are introduced for
consistency.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Mon, 03 Apr 2023 16:03:41 +0200 |
parents | e2c8b30ab4e7 |
children | f2deaca3450e |
files | rust/hg-core/src/utils/hg_path.rs |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/utils/hg_path.rs Mon Apr 03 15:58:36 2023 +0200 +++ b/rust/hg-core/src/utils/hg_path.rs Mon Apr 03 16:03:41 2023 +0200 @@ -479,10 +479,11 @@ } } +/// Create a new [`OsString`] from types referenceable as [`HgPath`]. +/// /// TODO: Once <https://www.mercurial-scm.org/wiki/WindowsUTF8Plan> is /// implemented, these conversion utils will have to work differently depending /// on the repository encoding: either `UTF-8` or `MBCS`. - pub fn hg_path_to_os_string<P: AsRef<HgPath>>( hg_path: P, ) -> Result<OsString, HgPathError> { @@ -498,12 +499,14 @@ Ok(os_str.to_os_string()) } +/// Create a new [`PathBuf`] from types referenceable as [`HgPath`]. pub fn hg_path_to_path_buf<P: AsRef<HgPath>>( hg_path: P, ) -> Result<PathBuf, HgPathError> { Ok(Path::new(&hg_path_to_os_string(hg_path)?).to_path_buf()) } +/// Create a new [`HgPathBuf`] from types referenceable as [`OsStr`]. pub fn os_string_to_hg_path_buf<S: AsRef<OsStr>>( os_string: S, ) -> Result<HgPathBuf, HgPathError> { @@ -520,6 +523,7 @@ Ok(buf) } +/// Create a new [`HgPathBuf`] from types referenceable as [`Path`]. pub fn path_to_hg_path_buf<P: AsRef<Path>>( path: P, ) -> Result<HgPathBuf, HgPathError> {