Skip to main content

ChartExport

Struct ChartExport 

Source
pub struct ChartExport {
    pub format: String,
    pub schema_version: u32,
    pub scope: ChartScope,
    pub mode: Mode,
    pub unit: Option<String>,
    pub precision: String,
    pub series: ChartSeries,
    pub projection: Option<ChartProjection>,
    pub coverage: CoverageSummary,
    pub formula_version: String,
    pub diagnostics: Vec<ChartDiagnostic>,
    /* private fields */
}
Expand description

Everything a local chart surface knows, in one versioned document (data-model.md §6).

The scope, mode, unit, formula version and coverage are the document’s own top-level metadata — required on every export (NFR-002), so a reader never has to descend into the series to learn the period or the unit — and they are built from the same source as the series’ own fields, so the two cannot disagree.

Fields§

§format: String

The format marker: FORMAT.

§schema_version: u32

The schema version: SCHEMA_VERSION.

§scope: ChartScope

The scope this document describes: its kind, id, period and snapshot binding.

§mode: Mode

How the series counts.

§unit: Option<String>

The unit the values are counted in; null in count mode.

§precision: String

The precision every series value is stated in (precision_of).

§series: ChartSeries

The ordered daily series.

§projection: Option<ChartProjection>

The end-date forecast, when the caller asked for one.

§coverage: CoverageSummary

The aggregate coverage tally of the series’ days.

§formula_version: String

The documented formula the series was folded under.

§diagnostics: Vec<ChartDiagnostic>

The document-level findings (remote targets, version).

Implementations§

Source§

impl ChartExport

Source

pub fn build( series: &BurndownSeries, projection: Option<&Projection>, remote_targets: &[&str], ) -> Self

Build the document for one folded series, with the findings the export adds.

series is the one series shape every surface folds (C-008), so a document’s numbers cannot become a second reading of the repository. projection is the shared projection the caller drew from the same series, when the caller asked for a forecast. remote_targets are the configured remote trackers (gitlab/linear) that cannot carry chart data: one UNSUPPORTED_REMOTE_FIELD finding each, naming the target and the day counts that stay local.

Source

pub fn is_empty(&self) -> bool

Whether this document carries no day at all.

Source

pub fn format(&self) -> &str

The document’s format marker.

Source

pub const fn schema_version(&self) -> u32

The document’s schema version.

Source

pub fn insert_extension(&mut self, key: impl Into<String>, value: Value)

Preserve one document-level key, in the nested extensions object.

The only public write path into the bag, and it cannot produce a document this build cannot read: the key lands in a namespace of its own, so it can never duplicate — or be read in place of — a document field.

Source

pub fn extensions(&self) -> impl Iterator<Item = (&str, &Value)>

The preserved keys this build does not interpret, in canonical (sorted) order.

Source

pub fn unknown(&self) -> &BTreeMap<String, Value>

The keys a newer writer placed directly on the document, preserved verbatim.

The read side of the document’s catch-all channel: empty for a document this build built, and holding whatever a foreign writer’s document carried at its own top level otherwise. There is no write side, and the bag is private, which is what makes a document-level key naming a projected field impossible to produce through this API.

Source

pub fn to_json(&self) -> Result<String>

Serialize the document as compact JSON.

Source

pub fn to_json_pretty(&self) -> Result<String>

Serialize the document as pretty JSON — the export surface’s shape.

Source

pub fn from_json(raw: &str) -> Result<Self>

Read a document back.

The [Marker] is read first: a document that is not a chart document is refused by name (its format marker) rather than by whatever shape error its fields happened to raise — a tix-capacity, tix-time or tix-roadmap payload overlaps structurally and would otherwise produce a misleading field error. A document of another version is read, its own fields kept — every document-level key this build does not project travels in Self::unknown and is re-emitted verbatim — and the mismatch is merged into the diagnostics once, the checked-and-reported third answer between refusing a newer writer and silently dropping its fields.

This build never writes a projected key twice — preserved keys live in their own nested object, and the document-level catch-all is empty on every path that builds a document — so its own output always round-trips: the emitted bytes re-read as a byte fixpoint.

Trait Implementations§

Source§

impl Clone for ChartExport

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 ChartExport

Source§

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

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

impl<'de> Deserialize<'de> for ChartExport

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ChartExport

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 Serialize for ChartExport

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ChartExport

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.