Skip to main content

Card

Struct Card 

Source
pub struct Card { /* private fields */ }
Expand description

A single card-yaml block (root or composable). body is "" when no content follows the closing fence; check card.body().is_empty().

Implementations§

Source§

impl Card

Source

pub fn new(kind: impl Into<String>) -> Result<Self, EditError>

Create a composable card with the given kind, no fields, and an empty body.

Source

pub fn set_field( &mut self, name: &str, value: QuillValue, ) -> Result<(), EditError>

Set a payload field, clearing any !fill marker on that key.

Returns EditError::InvalidFieldName when name does not match [a-z_][a-z0-9_]*.

Source

pub fn set_fill( &mut self, name: &str, value: QuillValue, ) -> Result<(), EditError>

Set a payload field and mark it as a !fill placeholder. Null emits as key: !fill; scalars/sequences as key: !fill <value>. Same validation as Card::set_field.

Source

pub fn remove_field( &mut self, name: &str, ) -> Result<Option<QuillValue>, EditError>

Remove a payload field; returns Ok(None) if the name is absent. Same validation as Card::set_field.

Source

pub fn replace_body(&mut self, body: impl Into<String>)

Source§

impl Card

Source

pub fn from_parts(payload: Payload, body: String) -> Self

Create a Card from its parts without validation. For user-facing construction of composable cards use Card::new.

Source

pub fn quill(&self) -> Option<&QuillReference>

Source

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

Source

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

Source

pub fn ext(&self) -> Option<&Map<String, Value>>

Opaque $ext map for out-of-band extension data (UI editor state, agent annotations, …). Carried through Markdown and storage DTO round-trips; never emitted into the plate JSON consumed by backends.

Source

pub fn payload(&self) -> &Payload

Source

pub fn payload_mut(&mut self) -> &mut Payload

Source

pub fn body(&self) -> &str

Trait Implementations§

Source§

impl Clone for Card

Source§

fn clone(&self) -> Card

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Card

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Card> for CardV0_82_0

Source§

fn from(card: &Card) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Card

Source§

fn eq(&self, other: &Card) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<CardV0_82_0> for Card

Source§

type Error = StorageError

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

fn try_from(card: CardV0_82_0) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for Card

Auto Trait Implementations§

§

impl Freeze for Card

§

impl RefUnwindSafe for Card

§

impl Send for Card

§

impl Sync for Card

§

impl Unpin for Card

§

impl UnsafeUnpin for Card

§

impl UnwindSafe for Card

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.