Skip to main content

CardMut

Struct CardMut 

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

Source

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

Source

pub fn store_ext(&mut self, value: Map<String, Value>) -> Result<(), EditError>

Source

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

Source

pub fn store_seed_overlay( &mut self, card_kind: impl Into<String>, value: Value, ) -> Result<(), EditError>

Source

pub fn remove_seed_overlay(&mut self, card_kind: &str) -> Option<Value>

Source

pub fn apply<'o>( &mut self, target: Target<'_>, change: &Change, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn revise<'o>( &mut self, target: Target<'_>, markdown: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn replace<'o>( &mut self, target: Target<'_>, content: &Content, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn split_block<'o>( &mut self, target: Target<'_>, at: usize, id: Option<&str>, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn join_blocks<'o>( &mut self, target: Target<'_>, id: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn delete_range<'o>( &mut self, target: Target<'_>, start: usize, end: usize, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn indent<'o>( &mut self, target: Target<'_>, first: &str, last: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn outdent<'o>( &mut self, target: Target<'_>, first: &str, last: &str, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn wrap<'o>( &mut self, target: Target<'_>, first: &str, last: &str, with: Wrap, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn write<'o>( &mut self, target: Target<'_>, edit: Edit<'_>, opts: impl Into<WriteOptions<'o>>, ) -> Result<Receipt, EditError>

Source

pub fn write_in<'o>( &mut self, target: Target<'_>, edit: Edit<'_>, opts: impl Into<WriteOptions<'o>>, u: impl Units, ) -> Result<Receipt, EditError>

Methods from Deref<Target = Card>§

Source

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.

Source

pub fn read<'t>( &self, target: impl Into<Target<'t>>, ) -> Result<Content, EditError>

The value at target.

Source

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.

Source

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.

Source

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.

Source

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

Source

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

Source

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.

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 backends consume.

Source

pub fn payload(&self) -> &Payload

The card’s card-yaml storage as a read view; writes go through the verbs Payload names.

Source

pub fn body(&self) -> &Content

The card body: the stored content value. For the markdown projection use Card::body_markdown.

Source

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§

Source§

impl Deref for CardMut<'_>

Source§

type Target = Card

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Card

Dereferences the value.

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 S
where 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) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T, C> ComponentsInto<C> for T

Source§

fn components_into(self) -> C

Cast this collection of color components into a collection of colors. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
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> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.