use crate::value::OutputValue;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct GroupedRow {
group_key: Vec<OutputValue>,
aggregate_values: Vec<OutputValue>,
}
impl GroupedRow {
#[must_use]
pub fn new<I, J, K, L>(group_key: I, aggregate_values: J) -> Self
where
I: IntoIterator<Item = K>,
J: IntoIterator<Item = L>,
K: Into<OutputValue>,
L: Into<OutputValue>,
{
Self {
group_key: group_key.into_iter().map(Into::into).collect(),
aggregate_values: aggregate_values.into_iter().map(Into::into).collect(),
}
}
#[must_use]
pub const fn group_key(&self) -> &[OutputValue] {
self.group_key.as_slice()
}
#[must_use]
pub const fn aggregate_values(&self) -> &[OutputValue] {
self.aggregate_values.as_slice()
}
}