Skip to main content

BurndownState

Struct BurndownState 

Source
pub struct BurndownState {
    pub choices: Vec<AnalyticsScope>,
    pub choice: usize,
    pub period: BurndownPeriod,
    pub mode: Mode,
    pub units: Vec<String>,
    pub unit: usize,
    pub forecast: bool,
    pub origin_back: usize,
    pub cursor: usize,
    pub document: Option<ChartExport>,
    pub problem: Option<String>,
}
Expand description

The F7 Stats page’s Burndown tab session state (T029–T032).

Every selection lives here and nowhere else: the scope, the period source, the mode, the unit, whether the forecast is asked for, and the forecast’s origin. Nothing is persisted (a session default is not a preference), nothing is a total, and the tab’s one read — the shared ChartExport — is rebuilt when the tab is opened and after every control, never during a render.

The origin is held as a count of days back from the series’ last covered day, so a refresh cannot leave it pointing at a day the fold no longer holds: the projection’s own refusal for an uncovered day is a statement the tab should never have to make.

Fields§

§choices: Vec<AnalyticsScope>

The scopes the record offers, resolved through the crate’s own scope resolver.

§choice: usize

Which choice is selected, as an index into Self::choices.

§period: BurndownPeriod

Which period source the series is folded over.

§mode: Mode

How the series counts.

§units: Vec<String>

The units the project declares a conversion for (crate::analytics::units::declared_units).

§unit: usize

Which unit is selected, as an index into Self::units. Remembered in count mode, where the fold ignores it, so switching back does not lose the reader’s choice.

§forecast: bool

Whether the forecast is asked for.

§origin_back: usize

The forecast origin: how many covered days back from the series’ last covered day.

§cursor: usize

Which daily row the cursor is on, as an index into the series’ points.

§document: Option<ChartExport>

The document the tab is showing, None when no fold has produced one.

§problem: Option<String>

Why the last fold produced no document — a read that failed, or a request the record cannot carry. An explicit state, never a blank pane.

Implementations§

Source§

impl BurndownState

Source

pub fn new(choices: Vec<AnalyticsScope>, units: Vec<String>) -> Self

A fresh tab over choices, with the scope’s own period, count mode, unit 0, no forecast, the origin on the series’ last covered day and the cursor on the first row.

Source

pub fn selected(&self) -> Option<&AnalyticsScope>

The selected choice, when the record offers one.

Source

pub fn scope(&self) -> Option<AnalyticsScope>

The scope the fold is asked for: the selection with Self::period applied.

The closed-snapshot binding travels with the choice (the record’s close evidence), so it survives the period change — a snapshot-bound scope stays bound whatever period the reader looks through, which is what C-006 requires of a historical view.

Source

pub fn unit(&self) -> Option<&str>

The unit the fold is asked for: the selection, and only in estimate mode — a count is unitless, which is what the CLI’s --unit does too.

Source

pub fn days(&self) -> usize

The covered days the current document holds.

Source

pub fn origin(&self) -> Option<&DailyPoint>

The forecast origin: the covered day Self::origin_back days back from the last one.

Source

pub fn projection(&self) -> Option<(String, String)>

The forecast to ask the document for, as (as_of, end_date) — the same pair the CLI passes as --as-of and the scope’s planning end.

None when the forecast is off, when there is no covered day to stand on, or when the effective period declares no end: the caller renders each of those states explicitly rather than asking for a forecast the record cannot bound.

Source

pub fn shift_scope(&mut self, delta: isize)

Switch to the scope delta steps away, wrapping — so one key reaches every scope from either side, exactly as the page’s tab strip does.

Source

pub fn cycle_period(&mut self)

The other period source (T030).

Source

pub fn cycle_mode(&mut self)

The other mode: count ↔ estimate (T030).

Source

pub fn cycle_unit(&mut self)

The next unit the project declares, wrapping; inert when it declares none.

Source

pub fn toggle_forecast(&mut self)

Ask for the forecast, or stop asking for it.

Source

pub fn origin_earlier(&mut self)

Move the forecast origin one covered day earlier, to the series’ first day at most.

Source

pub fn origin_later(&mut self)

Move the forecast origin one covered day later, to the series’ last day at most.

Source

pub fn move_cursor(&mut self, delta: isize)

Move the daily cursor delta rows, clamped into the days the document holds.

Source

pub fn clamp(&mut self)

Keep every index inside the list it indexes (called after every read, so a control cannot leave a cursor past the end of a document the fold just shrank).

Trait Implementations§

Source§

impl Clone for BurndownState

Source§

fn clone(&self) -> Self

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 BurndownState

Source§

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

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

impl PartialEq for BurndownState

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BurndownState

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.