pub struct Example {
pub id: String,
pub title: String,
pub rule: String,
pub status: String,
pub sources: Vec<String>,
pub tags: Vec<String>,
pub appendix: Option<String>,
pub setup: Setup,
pub events: Vec<Event>,
pub changes: Vec<ChangeSpec>,
pub expect: Vec<Expect>,
}Expand description
One bookspec example: a setup, its events and changes, and what it expects of the books.
Fields§
§id: StringStable, never reused; the file is named for it.
title: StringWhat the example shows, in words.
rule: StringThe normative sentence the example demonstrates: what MUST (or MUST NOT) hold.
status: StringWhat the expected values rest on: AUTHORITY, CONVENTION or
CHOICE.
sources: Vec<String>Exact citations, non-empty.
Applicability tags, non-empty.
appendix: Option<String>"formats": an interchange format’s example rather than an
accounting rule’s (P13’s appendix of formats); absent otherwise.
setup: SetupThe books before the first event.
events: Vec<Event>The events, in order, counting from 1.
changes: Vec<ChangeSpec>Changes that post no entry, each made after the event it names.
expect: Vec<Expect>What is expected of the books, at least one.
Implementations§
Source§impl Example
impl Example
Sourcepub fn from_toml(text: &str) -> Result<Self, SchemaError>
pub fn from_toml(text: &str) -> Result<Self, SchemaError>
Parse an example from its TOML text and check its shape.
Sourcepub fn validate(&self) -> Result<(), SchemaError>
pub fn validate(&self) -> Result<(), SchemaError>
Check the example’s shape: its closed lists, its dates and amounts, its references and its events’ and expectations’ forms.