hash: bundles::Hash(hash.into()), kind,
};
let mut progress = termprogress::new();
- chan.cmd_withbulk(&cmd, &mut f, &mut io::sink(), &mut |pi|{
- progress.report(&pi);
- Ok(())
- })?;
+ chan.cmd_withbulk(&cmd, &mut f, &mut io::sink(), &mut *progress)?;
}
inventory::submit!{Subcommand(
game: instance_name.clone(),
id,
};
- chan.cmd_withbulk(&cmd, &mut io::empty(), &mut f, &mut |_| Ok(()))
+ chan.cmd_withbulk(&cmd, &mut io::empty(), &mut f,
+ &mut termprogress::NullReporter)
.context("download bundle")?;
f.flush().context("flush bundle file")?;
if let Some((path, tmp)) = path_tmp {
}
#[throws(AE)]
- pub fn cmd_withbulk<U,D,P>(&mut self, cmd: &MgmtCommand,
- up: &mut U, down: &mut D, progress: &mut P)
- -> MgmtResponse
+ pub fn cmd_withbulk<U,D>(&mut self, cmd: &MgmtCommand,
+ up: &mut U, down: &mut D,
+ progress: &mut dyn termprogress::Reporter)
+ -> MgmtResponse
where U: Read, D: Write,
- P: FnMut(ProgressInfo) -> Result<(),AE>,
{
use MgmtResponse::*;
let mut wbulk = self.write
.context("read response")?;
while let MR::Progress(pi) = resp {
resp = (&mut rbulk).read_rmp()?;
- progress(pi)?;
+ progress.report(&pi);
}
match &resp {
Progress(_) => panic!(),
#[throws(AE)]
pub fn cmd(&mut self, cmd: &MgmtCommand) -> MgmtResponse {
- self.cmd_withbulk(cmd, &mut io::empty(), &mut io::sink(), &mut |_|Ok(()))?
+ self.cmd_withbulk(cmd, &mut io::empty(), &mut io::sink(),
+ &mut termprogress::NullReporter)?
}
pub fn read_inner_mut(&mut self) -> &mut TimedFdReader {