From 684b96b132282a4723e9fa847746b13ee0900ecb Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 4 Dec 2021 12:43:26 +0200 Subject: rustt funcs Sponsored-by: author --- subplot/benchmark.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 subplot/benchmark.rs diff --git a/subplot/benchmark.rs b/subplot/benchmark.rs new file mode 100644 index 0000000..1a64ecc --- /dev/null +++ b/subplot/benchmark.rs @@ -0,0 +1,26 @@ +// Implementations of Subplot scenario steps for sshca.md. + +use subplotlib::steplibrary::runcmd::Runcmd; + +use std::path::Path; + +#[derive(Default)] +struct SubplotContext {} + +impl ContextElement for SubplotContext {} + +#[step] +#[context(SubplotContext)] +#[context(Runcmd)] +fn install_rust_program(context: &ScenarioContext) { + let target_exe = env!("CARGO_BIN_EXE_obnam-benchmark"); + let target_path = Path::new(target_exe); + let target_path = target_path.parent().ok_or("No parent?")?; + context.with_mut( + |context: &mut Runcmd| { + context.prepend_to_path(target_path); + Ok(()) + }, + false, + )?; +} -- cgit v1.2.1