pub struct CardMut<'a>(/* private fields */);Expand description
The mutable handle on a card already placed in a Document: every
&mut self verb Card carries, forwarded, and no way to replace the card
itself. Reads arrive through Deref.
Placement is positional — the main card carries $quill and $seed, a
composable card carries neither — and the gates that police it
(Unchecked::insert_card,
Card::store_seed_overlay) run when a card is placed or edited, not when
one is assigned over another. Handing out a &mut Card would make
*doc.card_mut(0).unwrap() = doc.main().clone() a legal write past all of
them, and Document::quill_reference reads the root’s $quill without
re-checking. A card built before placement is an ordinary Card, so the
verbs stay there and this only withholds the assignment.
Implementations§
Source§impl<'a> CardMut<'a>
impl<'a> CardMut<'a>
Sourcepub fn remove_field(
&mut self,
name: &str,
) -> Result<Option<QuillValue>, EditError>
pub fn remove_field( &mut self, name: &str, ) -> Result<Option<QuillValue>, EditError>
Sourcepub fn store_seed_overlay(
&mut self,
card_kind: impl Into<String>,
value: Value,
) -> Result<(), EditError>
pub fn store_seed_overlay( &mut self, card_kind: impl Into<String>, value: Value, ) -> Result<(), EditError>
Sourcepub fn remove_seed_overlay(&mut self, card_kind: &str) -> Option<Value>
pub fn remove_seed_overlay(&mut self, card_kind: &str) -> Option<Value>
Sourcepub fn apply<'o>(
&mut self,
target: Target<'_>,
change: &Change,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn apply<'o>( &mut self, target: Target<'_>, change: &Change, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn revise<'o>(
&mut self,
target: Target<'_>,
markdown: &str,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn revise<'o>( &mut self, target: Target<'_>, markdown: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn replace<'o>(
&mut self,
target: Target<'_>,
content: &Content,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn replace<'o>( &mut self, target: Target<'_>, content: &Content, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn split_block<'o>(
&mut self,
target: Target<'_>,
at: usize,
id: Option<&str>,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn split_block<'o>( &mut self, target: Target<'_>, at: usize, id: Option<&str>, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn join_blocks<'o>(
&mut self,
target: Target<'_>,
id: &str,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn join_blocks<'o>( &mut self, target: Target<'_>, id: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn delete_range<'o>(
&mut self,
target: Target<'_>,
start: usize,
end: usize,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn delete_range<'o>( &mut self, target: Target<'_>, start: usize, end: usize, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn indent<'o>(
&mut self,
target: Target<'_>,
first: &str,
last: &str,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn indent<'o>( &mut self, target: Target<'_>, first: &str, last: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn outdent<'o>(
&mut self,
target: Target<'_>,
first: &str,
last: &str,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn outdent<'o>( &mut self, target: Target<'_>, first: &str, last: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Sourcepub fn wrap<'o>(
&mut self,
target: Target<'_>,
first: &str,
last: &str,
with: Wrap,
opts: impl Into<WriteOptions<'o>>,
) -> Result<Receipt, EditError>
pub fn wrap<'o>( &mut self, target: Target<'_>, first: &str, last: &str, with: Wrap, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>
Methods from Deref<Target = Card>§
Sourcepub fn seed(&self) -> Option<&Map<String, Value>>
pub fn seed(&self) -> Option<&Map<String, Value>>
The raw $seed map (keyed by card-kind), or None. For a parsed,
per-kind overlay, index this map by kind and pass the entry to
crate::document::SeedOverlay::from_json. Only the main card carries
$seed.
Sourcepub fn read<'t>(
&self,
target: impl Into<Target<'t>>,
) -> Result<Content, EditError>
pub fn read<'t>( &self, target: impl Into<Target<'t>>, ) -> Result<Content, EditError>
The value at target.
Sourcepub fn hash_of<'t>(
&self,
target: impl Into<Target<'t>>,
) -> Result<String, EditError>
pub fn hash_of<'t>( &self, target: impl Into<Target<'t>>, ) -> Result<String, EditError>
The hash of the value at target, the base a write to it names.
Sourcepub fn annotated<'t>(
&self,
target: impl Into<Target<'t>>,
) -> Result<Annotated, EditError>
pub fn annotated<'t>( &self, target: impl Into<Target<'t>>, ) -> Result<Annotated, EditError>
The annotated read of the value at target: the scoped read a revise
of it reads back. A field stored under codec: "plain" reads as its literal
text, its anchors listed and no tag spelled.
Sourcepub fn block_at(
&self,
target: Target<'_>,
at: usize,
) -> Result<Located, EditError>
pub fn block_at( &self, target: Target<'_>, at: usize, ) -> Result<Located, EditError>
The block holding offset at of the value at target, its index and
its container path; at a block’s end, that block. Stale where at
is past the text.
pub fn quill(&self) -> Option<&QuillReference>
pub fn kind(&self) -> Option<&str>
Sourcepub fn id(&self) -> Option<&str>
pub fn id(&self) -> Option<&str>
A composable card’s $id: a card id no other
card of its document holds, minted where none was given. None on the
main card, and on a card not yet placed that spells none.
Sourcepub fn ext(&self) -> Option<&Map<String, Value>>
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 backends consume.
Sourcepub fn payload(&self) -> &Payload
pub fn payload(&self) -> &Payload
The card’s card-yaml storage as a read view; writes go through the verbs
Payload names.
Sourcepub fn body(&self) -> &Content
pub fn body(&self) -> &Content
The card body: the stored content value. For the markdown projection
use Card::body_markdown.
Sourcepub fn body_markdown(&self) -> String
pub fn body_markdown(&self) -> String
The card body rendered back to its markdown projection. This is a
derived view (export ∘ body), not stored state; a Document round-trip
therefore canonicalizes the body (e.g. __b__ → **b**).
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for CardMut<'a>
impl<'a> Forget for CardMut<'a>
impl<'a> Freeze for CardMut<'a>
impl<'a> Move for CardMut<'a>
impl<'a> RefUnwindSafe for CardMut<'a>
impl<'a> Send for CardMut<'a>
impl<'a> Sync for CardMut<'a>
impl<'a> Unpin for CardMut<'a>
impl<'a> UnsafeUnpin for CardMut<'a>
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.Source§impl<U, T> ToOwnedTable<U> for Twhere
U: FromTableRef<T>,
impl<U, T> ToOwnedTable<U> for Twhere
U: FromTableRef<T>,
fn to_owned_table(&self) -> U
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more