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: StringThe format marker: FORMAT.
schema_version: u32The schema version: SCHEMA_VERSION.
scope: ChartScopeThe scope this document describes: its kind, id, period and snapshot binding.
mode: ModeHow the series counts.
unit: Option<String>The unit the values are counted in; null in count mode.
precision: StringThe precision every series value is stated in (precision_of).
series: ChartSeriesThe ordered daily series.
projection: Option<ChartProjection>The end-date forecast, when the caller asked for one.
coverage: CoverageSummaryThe aggregate coverage tally of the series’ days.
formula_version: StringThe documented formula the series was folded under.
diagnostics: Vec<ChartDiagnostic>The document-level findings (remote targets, version).
Implementations§
Source§impl ChartExport
impl ChartExport
Sourcepub fn build(
series: &BurndownSeries,
projection: Option<&Projection>,
remote_targets: &[&str],
) -> Self
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.
Sourcepub const fn schema_version(&self) -> u32
pub const fn schema_version(&self) -> u32
The document’s schema version.
Sourcepub fn insert_extension(&mut self, key: impl Into<String>, value: Value)
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.
Sourcepub fn extensions(&self) -> impl Iterator<Item = (&str, &Value)>
pub fn extensions(&self) -> impl Iterator<Item = (&str, &Value)>
The preserved keys this build does not interpret, in canonical (sorted) order.
Sourcepub fn unknown(&self) -> &BTreeMap<String, Value>
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.
Sourcepub fn to_json_pretty(&self) -> Result<String>
pub fn to_json_pretty(&self) -> Result<String>
Serialize the document as pretty JSON — the export surface’s shape.
Sourcepub fn from_json(raw: &str) -> Result<Self>
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
impl Clone for ChartExport
Source§impl Debug for ChartExport
impl Debug for ChartExport
Source§impl<'de> Deserialize<'de> for ChartExport
impl<'de> Deserialize<'de> for ChartExport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ChartExport
impl PartialEq for ChartExport
Source§impl Serialize for ChartExport
impl Serialize for ChartExport
impl StructuralPartialEq for ChartExport
Auto Trait Implementations§
impl Freeze for ChartExport
impl RefUnwindSafe for ChartExport
impl Send for ChartExport
impl Sync for ChartExport
impl Unpin for ChartExport
impl UnsafeUnpin for ChartExport
impl UnwindSafe for ChartExport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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