summaryrefslogtreecommitdiffstats
path: root/src/parse.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-03 06:36:44 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-03 06:37:17 -0500
commitae132f478c6cfc6ffb062fecd7efb42ac4e5d804 (patch)
treed91ea9575cdd6e3509d67bcc1373ac3afba3dccb /src/parse.rs
parent4142936f657004f88e259583136f25f566b0b1c0 (diff)
downloadnbsh-ae132f478c6cfc6ffb062fecd7efb42ac4e5d804.tar.gz
nbsh-ae132f478c6cfc6ffb062fecd7efb42ac4e5d804.zip
stop cloning exe and env all over the place
Diffstat (limited to 'src/parse.rs')
-rw-r--r--src/parse.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/parse.rs b/src/parse.rs
index 0249d7f..4bdbce2 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -51,11 +51,8 @@ impl Exe {
self.args.iter().map(|arg| arg.word.as_ref())
}
- pub fn shift(&self) -> Self {
- let mut new = self.clone();
- let new_exe = new.args.remove(0);
- new.exe = new_exe;
- new
+ pub fn shift(&mut self) {
+ self.exe = self.args.remove(0);
}
}
@@ -75,8 +72,8 @@ impl Pipeline {
))
}
- pub fn exes(&self) -> &[Exe] {
- &self.exes
+ pub fn into_exes(self) -> impl Iterator<Item = Exe> {
+ self.exes.into_iter()
}
pub fn input_string(&self) -> &str {