Add discoverable to_std_path_buf conversions (#64)#65
Open
chipsenkbeil wants to merge 1 commit into
Open
Conversation
Adds inherent methods on the types whose encoding is guaranteed (or runtime-resolved) to match the host platform's std::path::Path: - Utf8PlatformPath::as_std_path / to_std_path_buf and Utf8PlatformPathBuf::into_std_path_buf (infallible). - PlatformPath::to_std_path_buf_lossy (lossless on Unix-family via OsStrExt, lossy on Windows via to_string_lossy). - TypedPath::to_std_path_buf, TypedPathBuf::into_std_path_buf, Utf8TypedPath::to_std_path_buf, Utf8TypedPathBuf::into_std_path_buf - fallible, succeed only when the runtime variant matches the host. Also adds TryFrom<Utf8TypedPathBuf> for std::path::PathBuf to mirror the existing TryFrom<TypedPathBuf> impl. Per the design from #32, no conversion is exposed on UnixPath / WindowsPath / their UTF-8 counterparts directly. README documents the three supported patterns. No MSRV bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #64.
Adds inherent methods on the types whose encoding is guaranteed (or runtime-resolved) to match the host platform's
std::path::Path:Utf8PlatformPath::as_std_path/to_std_path_bufandUtf8PlatformPathBuf::into_std_path_buf(infallible).PlatformPath::to_std_path_buf_lossy(lossless on Unix-family viaOsStrExt, lossy on Windows viato_string_lossy).TypedPath::to_std_path_buf,TypedPathBuf::into_std_path_buf,Utf8TypedPath::to_std_path_buf,Utf8TypedPathBuf::into_std_path_bufAlso adds
TryFrom<Utf8TypedPathBuf>forstd::path::PathBufto mirror the existingTryFrom<TypedPathBuf>impl.Per the design from #32, no conversion is exposed on
UnixPath/WindowsPath/ their UTF-8 counterparts directly. README documents the three supported patterns. No MSRV bump.