Feature gate: #![feature(path_trailing_sep)]
This is a tracking issue for the Path::has_trailing_sep and related methods, which enforce whether a Path or PathBuf ends in a trailing separator.
Public API
impl Path {
fn has_trailing_sep(&self) -> bool;
fn with_trailing_sep(&self) -> Cow<'_, Path>;
fn trim_trailing_sep(&self) -> &Path;
}
impl PathBuf {
fn set_trailing_sep(&mut self, suffix: bool);
fn push_trailing_sep(&mut self);
fn pop_trailing_sep(&mut self);
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
Unresolved Questions
- Should we offer the
set_trailing_sep API or push_trailing_sep/pop_trailing_sep separately? Right now, both are offered to see which is preferred.
- Is
trim_trailing_sep necessary? It wasn't in the original ACP.
trim_trailing_sep will leave / as /, but has_trailing_sep returns true for /. That seems like a possible bug?
Feature gate:
#![feature(path_trailing_sep)]This is a tracking issue for the
Path::has_trailing_sepand related methods, which enforce whether aPathorPathBufends in a trailing separator.Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)PathBuf::has_dir_suffixlibs-team#335Path::has_trailing_sepand related methods #142506Unresolved Questions
set_trailing_sepAPI orpush_trailing_sep/pop_trailing_sepseparately? Right now, both are offered to see which is preferred.trim_trailing_sepnecessary? It wasn't in the original ACP.trim_trailing_sepwill leave/as/, buthas_trailing_sepreturns true for/. That seems like a possible bug?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩