diff options
author | Aria Shrimpton <me@aria.rip> | 2024-02-05 13:36:55 +0000 |
---|---|---|
committer | Aria Shrimpton <me@aria.rip> | 2024-02-05 13:36:55 +0000 |
commit | 0e4934c578ecfc022ffc72c9bb2253290ce966af (patch) | |
tree | b63e99d6d2d879cc754b3ae338d3eaac8f5cffd4 /src/crates/cli | |
parent | 572b0387e6c3948e3fce0963d9f9b6f3437921b9 (diff) |
generate code for selected adaptive containers
Diffstat (limited to 'src/crates/cli')
-rw-r--r-- | src/crates/cli/src/estimate.rs | 9 | ||||
-rw-r--r-- | src/crates/cli/src/select.rs | 23 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/crates/cli/src/estimate.rs b/src/crates/cli/src/estimate.rs index 0ba0615..86e8d15 100644 --- a/src/crates/cli/src/estimate.rs +++ b/src/crates/cli/src/estimate.rs @@ -2,9 +2,10 @@ use std::iter::once; use anyhow::{anyhow, bail, Result}; use argh::FromArgs; -use candelabra::{select::Selection, types::Mapping2D}; +use candelabra::types::Mapping2D; use cargo_metadata::camino::Utf8PathBuf; use log::info; +use primrose::ContainerSelection; use crate::State; @@ -109,7 +110,11 @@ impl State { &assignments .into_iter() .map(|(f, ctn, sel)| { - (f, ctn.to_string(), Selection::Singular(sel.to_string())) + ( + f, + ctn.to_string(), + ContainerSelection::Singular(sel.to_string()), + ) }) .collect(), )? diff --git a/src/crates/cli/src/select.rs b/src/crates/cli/src/select.rs index 740b988..1578c1a 100644 --- a/src/crates/cli/src/select.rs +++ b/src/crates/cli/src/select.rs @@ -2,9 +2,8 @@ use std::collections::HashMap; use anyhow::Result; use argh::FromArgs; -use candelabra::select::Selection; use log::info; -use primrose::tools::nary_cartesian_product; +use primrose::{tools::nary_cartesian_product, ContainerSelection}; use tabled::{builder::Builder, settings::Style}; use crate::State; @@ -30,13 +29,15 @@ impl State { for (f, ctn, candidates) in costs.iter() { for (candidate, cost) in candidates.iter() { let name = match candidate { - Selection::Singular(x) => x.to_string(), - Selection::Split(split) => { - format!( - "{} until n={}, then {}", - split.before, split.threshold, split.after - ) + ContainerSelection::Singular(x) => x.to_string(), + ContainerSelection::Split { + before, + threshold, + after, + } => { + format!("{} until n={}, then {}", before, threshold, after) } + _ => unreachable!(), }; builder.push_record([ ctn.as_str(), @@ -72,7 +73,11 @@ impl State { &assignment .into_iter() .map(|((f, ctn), i)| { - (f.clone(), ctn.clone(), Selection::Singular(i.to_string())) + ( + f.clone(), + ctn.clone(), + ContainerSelection::Singular(i.to_string()), + ) }) .collect(), )?, |