From ad0efee0b2ee3b2c95d4e9c304bf9f5fd7d2161d Mon Sep 17 00:00:00 2001 From: Maayan Hanin Date: Sat, 15 Oct 2022 22:00:29 +0300 Subject: [PATCH] Fix: Path internal representation and conversions --- src/std_misc/path.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/std_misc/path.md b/src/std_misc/path.md index 48d85c1446..af0f3d388e 100644 --- a/src/std_misc/path.md +++ b/src/std_misc/path.md @@ -13,8 +13,10 @@ between `Path` and `PathBuf` is similar to that of `str` and `String`: a `PathBuf` can be mutated in-place, and can be dereferenced to a `Path`. Note that a `Path` is *not* internally represented as an UTF-8 string, but -instead is stored as a vector of bytes (`Vec`). Therefore, converting a -`Path` to a `&str` is *not* free and may fail (an `Option` is returned). +instead is stored as an `OsString`. Therefore, converting a `Path` to a `&str` +is *not* free and may fail (an `Option` is returned). However, a `Path` can be +freely converted to an `OsString` or `&OsStr` using `into_os_string` and +`as_os_str`, respectively. ```rust,editable use std::path::Path;