forked from 1b-agent/fieldcraft-upstream
model: suppress datums and partitions: kept, but left out of the model (#291)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
dcf03e3378
commit
5189554a6a
11 files changed
+183
-34
No files matched your search
+10
-1
@@ -52,7 +52,7 @@ pub mod steps;
|
||||
pub mod tie;
|
||||
pub mod units;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -152,6 +152,9 @@ pub struct Model {
|
||||
/// In the order they cut.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
partitions: Vec<Partition>,
|
||||
/// Datums kept but left out of the model ([`Model::datum_suppressed`]).
|
||||
#[serde(skip_serializing_if = "BTreeSet::is_empty")]
|
||||
suppressed_datums: BTreeSet<String>,
|
||||
/// Edge seeds, sorted by edge.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
seeds: Vec<Seed>,
|
||||
@@ -200,6 +203,8 @@ struct ModelData {
|
||||
#[serde(default)]
|
||||
partitions: Vec<Partition>,
|
||||
#[serde(default)]
|
||||
suppressed_datums: BTreeSet<String>,
|
||||
#[serde(default)]
|
||||
seeds: Vec<Seed>,
|
||||
}
|
||||
|
||||
@@ -275,6 +280,9 @@ impl TryFrom<ModelData> for Model {
|
||||
for (n, v) in d.datums {
|
||||
m.add_datum(&n, v)?;
|
||||
}
|
||||
for n in d.suppressed_datums {
|
||||
m.set_datum_suppressed(&n, true)?;
|
||||
}
|
||||
for p in d.partitions {
|
||||
m.add_partition(p)?;
|
||||
}
|
||||
@@ -408,6 +416,7 @@ impl Model {
|
||||
steps: self.steps.clone(),
|
||||
datums: self.datums.clone(),
|
||||
partitions: self.partitions.clone(),
|
||||
suppressed_datums: self.suppressed_datums.clone(),
|
||||
seeds: self.seeds.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user