-
Notifications
You must be signed in to change notification settings - Fork 13.6k
std: use a TAIT to define SplitPaths
on UNIX
#145242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Note that this does not concern the public |
library/std/src/sys/pal/unix/os.rs
Outdated
pub struct SplitPaths<'a> { | ||
iter: iter::Map<slice::Split<'a, u8, fn(&u8) -> bool>, fn(&'a [u8]) -> PathBuf>, | ||
} | ||
pub type SplitPaths<'a> = impl Iterator<Item = PathBuf> + 'a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these items be pub(crate)
if so?
We'd rather not be exposing a TAIT to downstream code, I imagine, so it might be better to enforce that with proper visibility:
pub type SplitPaths<'a> = impl Iterator<Item = PathBuf> + 'a; | |
pub(crate) type SplitPaths<'a> = impl Iterator<Item = PathBuf> + 'a; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the items in sys
is exposed publicly, but we still use pub
instead of pub(crate)
almost everywhere. I don't really want to break the pattern and cause unnecessary confusion.
3a4164f
to
cb388c6
Compare
Defining
SplitPaths
as a TAIT allows using closures instead of function pointers forsplit
andmap
.