-
Notifications
You must be signed in to change notification settings - Fork 44
Implement pipeline constructor from exec iterator #60
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
Implement pipeline constructor from exec iterator #60
Conversation
Note that even without this PR it's possible to create pipelines with a dynamic number of components, it's just less convenient: let cmds: Vec<Exec> = ...;
cmds.reverse(); // easier to pop from the back
let mut pipeline = cmds.pop().unwrap() | cmds.pop.unwrap();
while let Some(cmd) = cmds.pop() {
pipeline = pipeline | cmd;
} |
I added an assert like the one in |
Thanks. If you don't mind, let's make it an explicit |
I changed the assert into a panic and also added a documentation example that panics. |
Probably should also use a different name for the function as clippy complains: https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait Not sure if from_iter trait would be the right choice here as we have the length limitation. The clippy lint:
Maybe |
Also, it could take |
Renamed it to |
Looks great, thanks for the patience. I've additionally renamed the At some point it's worth removing the panic for less than two |
Thanks for helping with the pull request! I guess its ready to be merged :D |
Reimplentation of #34 which allows to pass a iterator instead of a vector.