pub struct CardWriter<'a> { /* private fields */ }Expand description
A single composable card bound to its CardSchema, from
TypedWriter::card. Same set / set_all verbs as TypedWriter.
Implementations§
Source§impl CardWriter<'_>
impl CardWriter<'_>
Sourcepub fn set(
&mut self,
name: &str,
value: impl Into<QuillValue>,
) -> Result<(), EditError>
pub fn set( &mut self, name: &str, value: impl Into<QuillValue>, ) -> Result<(), EditError>
Write a field on this card. Resolves the field against the card’s
CardSchema and strict-commits it; a field the schema does not declare
(or any field when the card kind is unknown) fails with
EditError::UnknownField rather than storing opaquely.
Sourcepub fn revise_body(&mut self, markdown: &str) -> Result<Delta, EditError>
pub fn revise_body(&mut self, markdown: &str) -> Result<Delta, EditError>
Revise this card’s body from markdown (edit semantics), returning the
text Delta: the card twin of TypedWriter::revise_body.
Sourcepub fn revise_field(
&mut self,
name: &str,
text: &str,
) -> Result<Delta, EditError>
pub fn revise_field( &mut self, name: &str, text: &str, ) -> Result<Delta, EditError>
Revise a content field on this card from authored text: typed and
anchor-preserving; the card twin of TypedWriter::revise_field, codec
included (richtext diffs markdown, plaintext the literal text).
Resolves the field against the card’s CardSchema; an undeclared name
(or any field when the card kind is unknown) fails with
EditError::UnknownField.
Sourcepub fn set_all<K, V, I>(
&mut self,
fields: I,
) -> Result<(), Vec<(String, EditError)>>
pub fn set_all<K, V, I>( &mut self, fields: I, ) -> Result<(), Vec<(String, EditError)>>
Write several fields on this card atomically; see
TypedWriter::set_all; an undeclared name aborts the whole batch with
EditError::UnknownField.