提交 1fe5748c authored 作者: Serhij S's avatar Serhij S

pipe build pattern fix

上级 37bbaa5a
...@@ -57,37 +57,37 @@ impl Pipe { ...@@ -57,37 +57,37 @@ impl Pipe {
) )
} }
/// Adds a command line argument /// Adds a command line argument
pub fn arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self { pub fn arg(mut self, arg: impl AsRef<OsStr>) -> Self {
self.args.push(arg.as_ref().to_owned()); self.args.push(arg.as_ref().to_owned());
self self
} }
/// Adds multiple command line arguments /// Adds multiple command line arguments
pub fn args(&mut self, args: impl IntoIterator<Item = impl AsRef<OsStr>>) -> &mut Self { pub fn args(mut self, args: impl IntoIterator<Item = impl AsRef<OsStr>>) -> Self {
self.args self.args
.extend(args.into_iter().map(|x| x.as_ref().to_owned())); .extend(args.into_iter().map(|x| x.as_ref().to_owned()));
self self
} }
/// Adds an environment variable /// Adds an environment variable
pub fn env(&mut self, key: impl Into<String>, value: impl Into<String>) -> &mut Self { pub fn env(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
self.environment.insert(key.into(), value.into()); self.environment.insert(key.into(), value.into());
self self
} }
/// Adds multiple environment variables /// Adds multiple environment variables
pub fn envs( pub fn envs(
&mut self, mut self,
envs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, envs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> &mut Self { ) -> Self {
self.environment self.environment
.extend(envs.into_iter().map(|(k, v)| (k.into(), v.into()))); .extend(envs.into_iter().map(|(k, v)| (k.into(), v.into())));
self self
} }
/// STDIN data for the subprocess /// STDIN data for the subprocess
pub fn input_data(&mut self, data: impl Into<Vec<u8>>) -> &mut Self { pub fn input_data(mut self, data: impl Into<Vec<u8>>) -> Self {
self.input_data = Some(data.into()); self.input_data = Some(data.into());
self self
} }
/// Delay before restarting the subprocess after it terminates /// Delay before restarting the subprocess after it terminates
pub fn restart_delay(&mut self, delay: Duration) -> &mut Self { pub fn restart_delay(mut self, delay: Duration) -> Self {
self.restart_delay = delay; self.restart_delay = delay;
self self
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论