pub struct Node {
    pub children: Vec<Node>,
    pub srcmap: Option<SourcePos>,
    pub env: ErasedSet,
    pub attrs: Vec<(&'static str, String)>,
    pub node_type: TypeKey,
    pub node_value: Box<dyn NodeValue>,
}
Expand description

Single node in the CommonMark AST.

Fields

children: Vec<Node>

Array of child nodes.

srcmap: Option<SourcePos>

Source mapping info.

env: ErasedSet

Custom data specific to this token.

attrs: Vec<(&'static str, String)>

Additional attributes to be added to resulting html.

node_type: TypeKey

Type name, used for debugging.

node_value: Box<dyn NodeValue>

Storage for arbitrary token-specific data.

Implementations

Create a new Node with a custom value.

Return std::any::type_name() of node value.

Check that this node value is of given type.

Downcast node value to specific type.

Downcast node value to specific type.

Render this node to HTML.

Render this node to XHTML, it adds slash to self-closing tags like this: <img />.

This mode exists for compatibility with CommonMark tests.

Replace custom value with another value (this is roughly equivalent to replacing the entire node and copying children and sourcemaps).

Execute function f recursively on every member of AST tree (using preorder deep-first search).

Execute function f recursively on every member of AST tree (using preorder deep-first search).

Trait Implementations

Formats the value using the given formatter. Read more

Create empty Node. Empty node should only be used as placeholder for functions like std::mem::take, and it cannot be rendered.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.