Skip to main content

PivotGrid

Struct PivotGrid 

Source
pub struct PivotGrid {
    pub filter_rows: Vec<(String, String)>,
    pub header_rows: Vec<Vec<String>>,
    pub body_rows: Vec<PivotBodyRow>,
    pub width: usize,
    pub row_axis: Vec<PivotAxisItem>,
    pub col_axis: Vec<PivotAxisItem>,
}
Expand description

A fully computed pivot result, ready to be materialized into a sheet: filter_rows (if any) come first, then a blank spacer row, then header_rows, then one entry of body_rows per output row – mirroring Excel’s own report-filter placement (verified against real Excel: it always reserves one row per filter field plus a blank spacer above the row/column header grid, and captions each with a “(All)”/“(Multiple Items)” state – never a specific value’s name, since that’s specific to the classic single-select page-field mode Excel no longer defaults to).

Fields§

§filter_rows: Vec<(String, String)>

One (field name, "(All)" | "(Multiple Items)") pair per filter field, in the order they were added.

§header_rows: Vec<Vec<String>>

The column-header block above the body: one row per column field, plus a value-field row when there is more than one value field.

§body_rows: Vec<PivotBodyRow>

The body, one entry per output row, subtotal and grand-total rows included.

§width: usize

Total width in columns (row-label columns + data columns), used by the caller to know how large a range to clear/allocate. Always >= 2, so filter_rows’ two columns (name, state) always fit within it.

§row_axis: Vec<PivotAxisItem>

The flattened row/column axis groups underlying body_rows/the data columns, exposed (independent of display formatting) so an xlsx exporter can reconstruct a native pivotTableDefinition’s rowItems/colItems without re-deriving the grouping itself.

§col_axis: Vec<PivotAxisItem>

Column half of that axis pair; see PivotGrid::row_axis.

Implementations§

Source§

impl PivotGrid

Source

pub fn grid_row_offset(&self) -> usize

Row offset from the pivot’s dest_row anchor to where the row/col header + data grid actually begins: 0 with no filter fields, else one row per filter field plus a blank spacer row.

Source

pub fn height(&self) -> usize

Total height in rows, filter rows and spacer included – what the caller needs to allocate or clear at the pivot’s dest_row anchor.

Trait Implementations§

Source§

impl Clone for PivotGrid

Source§

fn clone(&self) -> PivotGrid

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PivotGrid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V