Skip to main content

MarkKind

Enum MarkKind 

Source
#[non_exhaustive]
pub enum MarkKind { Strong, Emph, Underline, Strike, Code, Link { url: String, }, Anchor { id: String, }, Unknown { tag: String, attrs: Value, }, }
Expand description

The mark set, open: an unknown kind round-trips as MarkKind::Unknown, absorbed as a new type, never a changed semantics of a known one. Two algebra classes: formatting is a property of a range (two coincident are redundant); identity is a handle (two over the same range are two things).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Strong

§

Emph

§

Underline

§

Strike

§

Code

Fields

§

Anchor

A comment thread or stable anchor, carried by id and rebased across edits like any position. The id is caller-supplied, unique per Content, opaque and invariant while the mark lives; positions rebase, the id never does, and moved-and-rewritten text drops the mark whole (DOCUMENT_STORAGE.md § Anchor-id identity). No markdown projection (omitted on export; survives via diff-rebase).

Fields

§

Unknown

Fields

§attrs: Value

Implementations§

Source§

impl MarkKind

Source

pub fn is_formatting(&self) -> bool

Formatting marks are a property of a range and union when coincident; identity/unknown marks are handles and never merge (Spike-A rules).

Class membership is stored meaning, not presentation: promoting an open-set tag into this class starts unioning adjacent runs that round-tripped as two marks, so the promotion moves the canonical bytes of documents nobody edited (DOCUMENT_STORAGE.md § Promoting a vocabulary member).

Source

pub fn ord(&self) -> u8

Total order over kinds for the canonical sort tie-break, after (start, end). Stable across releases: part of the freeze.

A new variant takes the slot immediately before MarkKind::Unknown, pushing Unknown up by one. That is the only placement where a build that knows the type and a build that reads it as Unknown order it identically against every built-in; anywhere else is two canonical forms for one document, one per reader (DOCUMENT_STORAGE.md § Promoting a vocabulary member). The block axes sort by nothing, so the rule is the mark axis’ alone.

Source

pub fn attrs_key(&self) -> String

Attribute tie-break string, appended after ord in the canonical sort so two marks that differ only in attrs order deterministically. Also the grouping key for same-kind union (two formatting marks union only when this matches; e.g. two links union only at the same url).

Trait Implementations§

Source§

impl Clone for MarkKind

Source§

fn clone(&self) -> MarkKind

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 MarkKind

Source§

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

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

impl PartialEq for MarkKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MarkKind

Auto Trait Implementations§

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.