flowey_lib_common/
cfg_persistent_dir_cargo_install.rsuse flowey::node::prelude::*;
flowey_request! {
pub struct Request(pub WriteVar<Option<PathBuf>>);
}
new_flow_node!(struct Node);
impl FlowNode for Node {
type Request = Request;
fn imports(_ctx: &mut ImportCtx<'_>) {}
fn emit(requests: Vec<Self::Request>, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
let persistent_dir = ctx.persistent_dir();
ctx.emit_minor_rust_step("report cargo install persistent dir", |ctx| {
let persistent_dir = persistent_dir.claim(ctx);
let requests = requests
.into_iter()
.map(|x| x.0.claim(ctx))
.collect::<Vec<_>>();
|rt| {
let persistent_dir = persistent_dir.map(|x| rt.read(x));
for var in requests {
rt.write(var, &persistent_dir)
}
}
});
Ok(())
}
}