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
impl Card
Sourcepub fn new(kind: impl Into<String>) -> Result<Self, EditError>
pub fn new(kind: impl Into<String>) -> Result<Self, EditError>
Create a composable card with the given kind, no fields, and an empty body.
Sourcepub fn set_field(
&mut self,
name: &str,
value: QuillValue,
) -> Result<(), EditError>
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::ReservedName or EditError::InvalidFieldName.
Sourcepub fn set_fill(
&mut self,
name: &str,
value: QuillValue,
) -> Result<(), EditError>
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.
Sourcepub fn remove_field(
&mut self,
name: &str,
) -> Result<Option<QuillValue>, EditError>
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.
pub fn replace_body(&mut self, body: impl Into<String>)
Source§impl Card
impl Card
Sourcepub fn from_parts(payload: Payload, body: String) -> Self
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.
pub fn quill(&self) -> Option<&QuillReference>
pub fn kind(&self) -> Option<&str>
pub fn id(&self) -> Option<&str>
pub fn payload(&self) -> &Payload
pub fn payload_mut(&mut self) -> &mut Payload
pub fn body(&self) -> &str
Trait Implementations§
Source§impl From<&Card> for CardV0_82_0
impl From<&Card> for CardV0_82_0
Source§impl TryFrom<CardV0_82_0> for Card
impl TryFrom<CardV0_82_0> for Card
Source§type Error = StorageError
type Error = StorageError
The type returned in the event of a conversion error.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more