Skip to main content

Shapes

Struct Shapes 

Source
pub struct Shapes { /* private fields */ }
Expand description

The plan: every formula cell placed on a shape, the order, the cycles.

Implementations§

Source§

impl Shapes

Source

pub fn new() -> Shapes

A plan with nothing in it.

Source

pub fn of( model: &Workbook, sheets: usize, library: &Library, names: &Names, extents: &[Option<((u32, u32), (u32, u32))>], ) -> Shapes

Every formula cell of the sheets 0..sheets placed, the shapes parsed, and the order found. The plan is made in a box: every formula is parsed beneath this frame, the deepest a load reaches, which VLA.1’s limits pin on a stack of 1 MiB, and the plan held here by value would stand on it, 480 bytes since it kept its level ends (KERNEL.30).

Source

pub fn replace( &mut self, model: &Workbook, id: (usize, u32, u32), library: &Library, )

Place one cell after a write: its old place forgotten, and a new one found when it holds a formula. The order waits for Shapes::plan.

Source

pub fn plan( &mut self, model: &Workbook, names: &Names, extents: &[Option<((u32, u32), (u32, u32))>], )

The order found again from the places: every formula cell’s edges read off its shape’s parse at its offset (a defined name’s text read as graph::dependencies reads it), then Tarjan’s components, as graph::plan finds them for a plan of texts.

Each shape’s references are read off its parse once (KERNEL.33, asked by Alonzo’s playtest pass of Sand, whose load spent 341 ms of 491 finding 2.37 million edges a cell at a time): each reference once, one to a sheet holding no formula left out, one every $ holds found once for the whole shape; each cell then moves only the rest. A cell’s vertex is found as reach finds a position, by an array over a sheet whose formulas stand close together, and the edges are one flat array. Every cell’s edges are the ones a walk of its parse at its offset finds, sorted and each once, so the order, its runs and its cycles are the same.

Source

pub fn order(&self) -> &[(usize, u32, u32)]

The formula cells in the order of evaluation, each after everything it reads; the cells of a cycle are not in it.

Source

pub fn cycles(&self) -> &[Vec<(usize, u32, u32)>]

Every cycle, each its cells sorted, the cycles by their first cell.

Source

pub fn formulas(&self) -> usize

How many formula cells are placed.

Source

pub fn shapes(&self) -> usize

How many shapes the formulas make.

Source

pub fn holds(&self, id: (usize, u32, u32)) -> bool

Whether a cell holds a placed formula.

Source

pub fn place(&self, id: (usize, u32, u32)) -> Option<Place>

A formula cell’s place.

Source

pub fn shape(&self, index: usize) -> Option<&Shape>

A shape, by its index.

Source

pub fn census(&self, model: &Workbook, library: &Library) -> String

The plan printed as rows, the census (KERNEL.30): a (plan ...) row of totals, a (readers ...) row for each sheet whose changed cells are checked against readers, then a (shape ...) row for each shape a cell holds, each read named by the path an engine’s machine takes for it (super::census). Every sheet is read as a frame’s own, as a workbook’s are: this is the census of a plan Shapes::of made over a grid with no .last twin, each sheet kept as an array where a machine of the same grid keeps it (KERNEL.31, Shapes::keeps_array). A machine’s, its twins read as it keeps them, is Machine::census. Computed when asked from the plan as it stands, which keeps nothing for it but where each level ends and which sheets a read takes as an array.

Source

pub fn evaluate( &self, env: &dyn Env, library: &Library, id: (usize, u32, u32), ) -> Computed

One formula cell evaluated against the grid as env shows it, the cell being computed being env.here().

Source

pub fn first_refusal( &self, model: &Workbook, only: Option<&[(usize, u32, u32)]>, ) -> Option<((usize, u32, u32), Refusal)>

The first thing that stops the grid from being stepped, in the order super::Calc::first_refusal asks it: a cycle (calc-cycle), the first cell calling a function the library does not hold (calc-function-not-computed), the first cell whose text this version does not read (calc-construct-not-read); with the cell the refusal stands on, for its line. only limits the second and third to the cells a write placed.

Trait Implementations§

Source§

impl Clone for Shapes

Source§

fn clone(&self) -> Shapes

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 Shapes

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Shapes

Source§

fn default() -> Shapes

Returns the “default value” for a type. 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<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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.