Skip to main content

CardWriter

Struct CardWriter 

Source
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<'_>

Source

pub fn kind(&self) -> Option<&str>

The card’s $kind, if any.

Source

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.

Source

pub fn set_body(&mut self, markdown: &str) -> Result<(), EditError>

Revise this card’s body from markdown (edit semantics), discarding the delta — the card twin of TypedWriter::set_body.

Source

pub fn revise_field( &mut self, name: &str, markdown: &str, ) -> Result<Delta, EditError>

Revise a richtext field on this card from markdown — typed and anchor-preserving; the card twin of TypedWriter::revise_field. Resolves the field against the card’s CardSchema; an undeclared name — or any field when the card kind is unknown — fails with EditError::UnknownField.

Source

pub fn set_all<K, V, I>( &mut self, fields: I, ) -> Result<(), Vec<(String, EditError)>>
where K: Into<String>, V: Into<QuillValue>, I: IntoIterator<Item = (K, V)>,

Write several fields on this card atomically — see TypedWriter::set_all; an undeclared name aborts the whole batch with EditError::UnknownField.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for CardWriter<'a>

§

impl<'a> Freeze for CardWriter<'a>

§

impl<'a> RefUnwindSafe for CardWriter<'a>

§

impl<'a> Send for CardWriter<'a>

§

impl<'a> Sync for CardWriter<'a>

§

impl<'a> Unpin for CardWriter<'a>

§

impl<'a> UnsafeUnpin for CardWriter<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.