pub struct PortableCapacityDocument {
pub format: String,
pub version: u32,
pub scopes: Vec<PortableCapacityScope>,
pub snapshots: Vec<PortableCapacitySnapshot>,
pub history: Vec<PortableCapacityHistoryEvent>,
pub diagnostics: Vec<PortableCapacityDiagnostic>,
pub extensions: PortableExtensions,
pub unknown: PortableExtensions,
}Expand description
Everything the local capacity surfaces know, in one versioned document.
Fields§
§format: StringThe format marker: FORMAT.
version: u32The format version: VERSION.
scopes: Vec<PortableCapacityScope>One row per configured scope, in [capacity] declaration order.
snapshots: Vec<PortableCapacitySnapshot>Every closed cycle’s immutable evidence, in snapshot order.
history: Vec<PortableCapacityHistoryEvent>Every capacity lifecycle event, in cycle order then file (append) order.
diagnostics: Vec<PortableCapacityDiagnostic>Document-level findings (preserved metadata, unsupported remote fields, version).
extensions: PortableExtensionsDocument-level keys this build preserved, in a namespace of their own.
unknown: PortableExtensionsKeys a newer writer placed directly on the document, preserved verbatim.
Implementations§
Source§impl PortableCapacityDocument
impl PortableCapacityDocument
Sourcepub fn build(
config: &Config,
root: &Path,
index: &ScheduleIndex,
snapshot: &IssueSnapshot,
) -> Result<Self>
pub fn build( config: &Config, root: &Path, index: &ScheduleIndex, snapshot: &IssueSnapshot, ) -> Result<Self>
Build the whole local capacity document: every configured scope with its calculation, every closed cycle’s evidence, every capacity lifecycle event, and the remote-target diagnostics.
snapshot is the one-pass issue snapshot the caller already built with index (the
same pair tix capacity calculate uses), so a scope’s numbers are the shared
calculation’s and a multi-scope export still indexes the issues once (NFR-001).
The read path touches the snapshot store and the cycle records and writes nothing.
Sourcepub fn build_for_cycle(
config: &Config,
root: &Path,
index: &ScheduleIndex,
snapshot: &IssueSnapshot,
reference: &str,
) -> Result<Self>
pub fn build_for_cycle( config: &Config, root: &Path, index: &ScheduleIndex, snapshot: &IssueSnapshot, reference: &str, ) -> Result<Self>
Build the document for one cycle: the scope that configures it, its immutable evidence and its lifecycle history.
The reference is what the caller wrote — a generated cycle’s name or its stable id —
and it is folded through the same adapter every other surface uses, so the two
spellings select one document (C-003). A reference nothing resolves to is a
not_found, not an empty document.
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 a 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 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 capacity document is
refused by name (its format marker) rather than by whatever shape error its fields
happened to raise — a tix-health or tix-roadmap payload overlaps structurally and
used to produce a misleading field error. A document of another version is read,
its own fields and preserved keys kept, 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.
Trait Implementations§
Source§impl Clone for PortableCapacityDocument
impl Clone for PortableCapacityDocument
Source§impl Debug for PortableCapacityDocument
impl Debug for PortableCapacityDocument
Source§impl<'de> Deserialize<'de> for PortableCapacityDocument
impl<'de> Deserialize<'de> for PortableCapacityDocument
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 PortableCapacityDocument
impl PartialEq for PortableCapacityDocument
Source§impl Serialize for PortableCapacityDocument
impl Serialize for PortableCapacityDocument
impl StructuralPartialEq for PortableCapacityDocument
Auto Trait Implementations§
impl Freeze for PortableCapacityDocument
impl RefUnwindSafe for PortableCapacityDocument
impl Send for PortableCapacityDocument
impl Sync for PortableCapacityDocument
impl Unpin for PortableCapacityDocument
impl UnsafeUnpin for PortableCapacityDocument
impl UnwindSafe for PortableCapacityDocument
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