mirror of
https://github.com/rust-lang/rust
synced 2024-10-19 15:03:55 +00:00
Rollup merge of #93976 - SUPERCILEX:separator_str, r=yaahc
Add MAIN_SEPARATOR_STR Currently, if someone needs access to the path separator as a str, they need to go through this mess: ```rust unsafe { std::str::from_utf8_unchecked(slice::from_ref(&(MAIN_SEPARATOR as u8))) } ``` This PR just re-exports an existing path separator str API.
This commit is contained in:
commit
09350d2cf0
|
@ -268,6 +268,12 @@ pub fn is_separator(c: char) -> bool {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
|
||||
|
||||
/// The primary separator of path components for the current platform.
|
||||
///
|
||||
/// For example, `/` on Unix and `\` on Windows.
|
||||
#[unstable(feature = "main_separator_str", issue = "94071")]
|
||||
pub const MAIN_SEPARATOR_STR: &str = crate::sys::path::MAIN_SEP_STR;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Misc helpers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue