pub struct Payload { /* private fields */ }Expand description
Ordered, comment-preserving payload of a card-yaml block: a read view onto card-yaml storage.
Contains the block’s $ entries, user fields, and comments interleaved
in source order. See the module docs for the full design.
Mutation is crate-internal. The invariants an edit must hold — at most one
$quill / $kind / $ext / $seed, no duplicate field keys, every field
name matching [A-Za-z_][A-Za-z0-9_]* — are not all expressible in the
mutators’ signatures, so out-of-crate authoring goes through the verbs that
do enforce them: Card::store_field / store_ext / store_seed_overlay,
Document::set_quill_ref, and TypedWriter.
Implementations§
Source§impl Payload
impl Payload
Sourcepub fn items(&self) -> &[PayloadItem]
pub fn items(&self) -> &[PayloadItem]
Ordered iterator over raw items ($ entries, fields, comments).
Sourcepub fn quill(&self) -> Option<&QuillReference>
pub fn quill(&self) -> Option<&QuillReference>
The $quill reference, if declared.
Sourcepub fn ext(&self) -> Option<&JsonMap<String, JsonValue>>
pub fn ext(&self) -> Option<&JsonMap<String, JsonValue>>
The $ext map, if declared. The map is opaque: Quillmark does not
interpret its contents and never emits them into the plate JSON.
Sourcepub fn seed(&self) -> Option<&JsonMap<String, JsonValue>>
pub fn seed(&self) -> Option<&JsonMap<String, JsonValue>>
The raw $seed map (keyed by card-kind), if declared. The seeding
layer interprets it; it never reaches the plate JSON. For a parsed,
per-kind overlay, index this map by kind and pass the entry to
crate::SeedOverlay::from_json.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &QuillValue)> + '_
pub fn iter(&self) -> impl Iterator<Item = (&String, &QuillValue)> + '_
Iterator over user (key, &value) pairs. Excludes $ entries and
comments; preserves source order.
Sourcepub fn get(&self, key: &str) -> Option<&QuillValue>
pub fn get(&self, key: &str) -> Option<&QuillValue>
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
true if a user field with this key is present.
Sourcepub fn is_fill(&self, key: &str) -> bool
pub fn is_fill(&self, key: &str) -> bool
true if a user field with this key is marked !must_fill.
Sourcepub fn to_index_map(&self) -> IndexMap<String, QuillValue>
pub fn to_index_map(&self) -> IndexMap<String, QuillValue>
Project the user-field portion into an IndexMap<String, QuillValue>.
Comments, fill markers, and $ entries are dropped. Preserves order.