From: Ben Pfaff Date: Mon, 11 Aug 2025 20:32:57 +0000 (-0700) Subject: work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e9eedbadc016dfb7404b411d315495aaf69446b;p=pspp work --- diff --git a/rust/pspp/src/dictionary.rs b/rust/pspp/src/dictionary.rs index 4798f55795..a1f35907fb 100644 --- a/rust/pspp/src/dictionary.rs +++ b/rust/pspp/src/dictionary.rs @@ -897,17 +897,21 @@ impl<'a> OutputVariableSets<'a> { } variable_sets.push(group); } - let mut pt = PivotTable::new([ - (Axis3::Y, Dimension::new(variable_sets)), - ( - Axis3::X, - Dimension::new(Group::new("Attributes").with("Variable")), + Some( + PivotTable::new([ + (Axis3::Y, Dimension::new(variable_sets)), + ( + Axis3::X, + Dimension::new(Group::new("Attributes").with("Variable")), + ), + ]) + .with_title("Variable Sets") + .with_data( + data.into_iter() + .enumerate() + .map(|(row, datum)| ([row, 0], datum)), ), - ]); - for (row, datum) in data.into_iter().enumerate() { - pt.insert(&[row, 0], datum); - } - Some(pt) + ) } } @@ -1034,7 +1038,8 @@ impl<'a> OutputAttributes<'a> { let mut pt = PivotTable::new([ (Axis3::X, Dimension::new(values)), (Axis3::Y, Dimension::new(variables)), - ]).with_title("Data File and Variable Attributes"); + ]) + .with_title("Data File and Variable Attributes"); for (row, datum) in data.into_iter().enumerate() { pt.insert(&[0, row], datum); } diff --git a/rust/pspp/src/sys/testdata/variable_sets.expected b/rust/pspp/src/sys/testdata/variable_sets.expected index f257f41e7e..4832fda179 100644 --- a/rust/pspp/src/sys/testdata/variable_sets.expected +++ b/rust/pspp/src/sys/testdata/variable_sets.expected @@ -29,6 +29,7 @@ │j │ 10│ │Nominal │Input│ 4│Left │A4 │A4 │ │ ╰──┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯ + Variable Sets ╭─────────────────────────────┬────────╮ │Variable Set and Position │Variable│ ├─────────────────────────────┼────────┤ diff --git a/rust/pspp/src/sys/testdata/variable_sets_unknown_variable.expected b/rust/pspp/src/sys/testdata/variable_sets_unknown_variable.expected index 1a86dade44..48f024822e 100644 --- a/rust/pspp/src/sys/testdata/variable_sets_unknown_variable.expected +++ b/rust/pspp/src/sys/testdata/variable_sets_unknown_variable.expected @@ -33,6 +33,7 @@ Variable set "vs2" includes unknown variable foo. │j │ 10│ │Nominal │Input│ 4│Left │A4 │A4 │ │ ╰──┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯ + Variable Sets ╭───────────────────────────┬────────╮ │Variable Set and Position │Variable│ ├───────────────────────────┼────────┤