Block

Enum Block 

Source
pub enum Block {
    Paragraph(Vec<Inline>),
    Heading(Heading),
    ThematicBreak,
    BlockQuote(Vec<Block>),
    List(List),
    CodeBlock(CodeBlock),
    HtmlBlock(String),
    Definition(LinkDefinition),
    Table(Table),
    FootnoteDefinition(FootnoteDefinition),
    GitHubAlert(GitHubAlert),
    Empty,
}
Expand description

Block‑level constructs in the order they appear in the CommonMark spec.

Variants§

§

Paragraph(Vec<Inline>)

Ordinary paragraph

§

Heading(Heading)

ATX (# Heading) or Setext (===) heading

§

ThematicBreak

Thematic break (horizontal rule)

§

BlockQuote(Vec<Block>)

Block quote

§

List(List)

List (bullet or ordered)

§

CodeBlock(CodeBlock)

Fenced or indented code block

§

HtmlBlock(String)

Raw HTML block

§

Definition(LinkDefinition)

Link reference definition. Preserved for round‑tripping.

§

Table(Table)

Tables

§

FootnoteDefinition(FootnoteDefinition)

Footnote definition

§

GitHubAlert(GitHubAlert)

GitHub alert block (NOTE, TIP, IMPORTANT, WARNING, CAUTION)

§

Empty

Empty block. This is used to represent skipped blocks in the AST.

Trait Implementations§

Source§

impl Clone for Block

Source§

fn clone(&self) -> Block

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Block

Source§

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

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

impl<'de> Deserialize<'de> for Block

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl ExpandWith for Block

Source§

fn expand_with<T: Transformer>(self, transformer: &mut T) -> Vec<Self>

Apply an expandable transformer to this AST node, returning multiple nodes
Source§

impl PartialEq for Block

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Query for Block

Source§

fn find_all_inlines<F>(&self, predicate: F) -> Vec<&Inline>
where F: Fn(&Inline) -> bool,

Find all inline elements matching a predicate
Source§

fn find_all_blocks<F>(&self, predicate: F) -> Vec<&Block>
where F: Fn(&Block) -> bool,

Find all block elements matching a predicate
Source§

fn find_first_inline<F>(&self, predicate: F) -> Option<&Inline>
where F: Fn(&Inline) -> bool,

Find the first inline element matching a predicate
Source§

fn find_first_block<F>(&self, predicate: F) -> Option<&Block>
where F: Fn(&Block) -> bool,

Find the first block element matching a predicate
Source§

fn count_inlines<F>(&self, predicate: F) -> usize
where F: Fn(&Inline) -> bool,

Count inline elements matching a predicate
Source§

fn count_blocks<F>(&self, predicate: F) -> usize
where F: Fn(&Block) -> bool,

Count block elements matching a predicate
Source§

fn any_inline<F>(&self, predicate: F) -> bool
where F: Fn(&Inline) -> bool,

Check if any inline element matches a predicate
Source§

fn any_block<F>(&self, predicate: F) -> bool
where F: Fn(&Block) -> bool,

Check if any block element matches a predicate
Find all links in the document
Source§

fn find_all_images(&self) -> Vec<&Image>

Find all images in the document
Source§

fn find_all_headings(&self) -> Vec<&Heading>

Find all headings in the document
Find all autolinks in the document
Source§

fn find_all_text(&self) -> Vec<&str>

Find all text nodes in the document
Source§

fn find_all_code_spans(&self) -> Vec<&str>

Find all code spans in the document
Source§

fn find_all_code_blocks(&self) -> Vec<&CodeBlock>

Find all code blocks in the document
Source§

fn find_all_tables(&self) -> Vec<&Table>

Find all tables in the document
Source§

fn find_all_lists(&self) -> Vec<&List>

Find all lists in the document
Source§

impl Serialize for Block

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TransformWith for Block

Source§

fn transform_with<T: Transformer>(self, transformer: &mut T) -> Self

Apply a transformer to this AST node
Source§

impl VisitWith for Block

Source§

fn visit_with<V: Visitor>(&self, visitor: &mut V)

Apply a visitor to this AST node
Source§

impl<T: Default> WithData<T> for Block

Source§

type WithDataType = Block<T>

The type with user data attached
Source§

fn with_data(self, data: T) -> Self::WithDataType

Add user data to this AST node
Source§

fn with_default_data(self) -> Self::WithDataType
where T: Default,

Add default user data to this AST node
Source§

impl StructuralPartialEq for Block

Auto Trait Implementations§

§

impl Freeze for Block

§

impl RefUnwindSafe for Block

§

impl Send for Block

§

impl Sync for Block

§

impl Unpin for Block

§

impl UnwindSafe for Block

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,