-
Notifications
You must be signed in to change notification settings - Fork 52
feat: these for several path #78
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
Conversation
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.
The idea of these
would be to pass multiple paths to commands()
at once. What makes this hard isn't the API though, it's validating that it even makes sense for the launchers that are offered on each platform. Not all of them may support multiple paths at all, which is when one would have to let it fall back to launching each command individually.
Besides that, any use of unsafe
is unacceptable here and also not required. Instead of PathIter
, try to use something like impl IntoIterator<Item = impl AsRef<OsStr>>
or the version with explicit type constraints using where I: IntoIterator<Item = R>, R: AsRef<OsStr>
, you will probably have to fiddle with lifetimes a bit.
@Byron |
I think it means that launchers who can take multiple paths at once can be provided with multiple paths. The effect of this is defined by its implementation. |
@Byron |
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.
Thanks for trying to contribute!
However, it seems there is difficulty in communication and/or understanding, which is why I would prefer abandoning this PR instead of trying to push it into shape. My time is too scarce to be able to engage here.
Thanks for your understanding.
@@ -152,6 +153,22 @@ pub fn that(path: impl AsRef<OsStr>) -> io::Result<()> { | |||
Err(last_err.expect("no launcher worked, at least one error")) | |||
} | |||
|
|||
pub fn these( | |||
path: impl IntoIterator<Item = impl AsRef<OsStr>> + std::convert::AsRef<std::ffi::OsStr>, |
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.
There is no need for any function that can be emulated with for path in paths { open::that(path)?; }
Instead, in order to implement it as described in #70, launchers must be fed multiple paths if they support it.
Fixes : #70
Allow several paths with
these