Show More
@@ -479,10 +479,11 b' impl Extend<u8> for HgPathBuf {' | |||||
479 | } |
|
479 | } | |
480 | } |
|
480 | } | |
481 |
|
481 | |||
|
482 | /// Create a new [`OsString`] from types referenceable as [`HgPath`]. | |||
|
483 | /// | |||
482 | /// TODO: Once <https://www.mercurial-scm.org/wiki/WindowsUTF8Plan> is |
|
484 | /// TODO: Once <https://www.mercurial-scm.org/wiki/WindowsUTF8Plan> is | |
483 | /// implemented, these conversion utils will have to work differently depending |
|
485 | /// implemented, these conversion utils will have to work differently depending | |
484 | /// on the repository encoding: either `UTF-8` or `MBCS`. |
|
486 | /// on the repository encoding: either `UTF-8` or `MBCS`. | |
485 |
|
||||
486 | pub fn hg_path_to_os_string<P: AsRef<HgPath>>( |
|
487 | pub fn hg_path_to_os_string<P: AsRef<HgPath>>( | |
487 | hg_path: P, |
|
488 | hg_path: P, | |
488 | ) -> Result<OsString, HgPathError> { |
|
489 | ) -> Result<OsString, HgPathError> { | |
@@ -498,12 +499,14 b' pub fn hg_path_to_os_string<P: AsRef<HgP' | |||||
498 | Ok(os_str.to_os_string()) |
|
499 | Ok(os_str.to_os_string()) | |
499 | } |
|
500 | } | |
500 |
|
501 | |||
|
502 | /// Create a new [`PathBuf`] from types referenceable as [`HgPath`]. | |||
501 | pub fn hg_path_to_path_buf<P: AsRef<HgPath>>( |
|
503 | pub fn hg_path_to_path_buf<P: AsRef<HgPath>>( | |
502 | hg_path: P, |
|
504 | hg_path: P, | |
503 | ) -> Result<PathBuf, HgPathError> { |
|
505 | ) -> Result<PathBuf, HgPathError> { | |
504 | Ok(Path::new(&hg_path_to_os_string(hg_path)?).to_path_buf()) |
|
506 | Ok(Path::new(&hg_path_to_os_string(hg_path)?).to_path_buf()) | |
505 | } |
|
507 | } | |
506 |
|
508 | |||
|
509 | /// Create a new [`HgPathBuf`] from types referenceable as [`OsStr`]. | |||
507 | pub fn os_string_to_hg_path_buf<S: AsRef<OsStr>>( |
|
510 | pub fn os_string_to_hg_path_buf<S: AsRef<OsStr>>( | |
508 | os_string: S, |
|
511 | os_string: S, | |
509 | ) -> Result<HgPathBuf, HgPathError> { |
|
512 | ) -> Result<HgPathBuf, HgPathError> { | |
@@ -520,6 +523,7 b' pub fn os_string_to_hg_path_buf<S: AsRef' | |||||
520 | Ok(buf) |
|
523 | Ok(buf) | |
521 | } |
|
524 | } | |
522 |
|
525 | |||
|
526 | /// Create a new [`HgPathBuf`] from types referenceable as [`Path`]. | |||
523 | pub fn path_to_hg_path_buf<P: AsRef<Path>>( |
|
527 | pub fn path_to_hg_path_buf<P: AsRef<Path>>( | |
524 | path: P, |
|
528 | path: P, | |
525 | ) -> Result<HgPathBuf, HgPathError> { |
|
529 | ) -> Result<HgPathBuf, HgPathError> { |
General Comments 0
You need to be logged in to leave comments.
Login now