Struct markdown_it::Node
source · [−]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: ErasedSetCustom data specific to this token.
attrs: Vec<(&'static str, String)>Additional attributes to be added to resulting html.
node_type: TypeKeyType name, used for debugging.
node_value: Box<dyn NodeValue>Storage for arbitrary token-specific data.
Implementations
sourceimpl Node
impl Node
sourcepub fn cast_mut<T: NodeValue>(&mut self) -> Option<&mut T>
pub fn cast_mut<T: NodeValue>(&mut self) -> Option<&mut T>
Downcast node value to specific type.
sourcepub fn xrender(&self) -> String
pub fn xrender(&self) -> String
Render this node to XHTML, it adds slash to self-closing tags like this: <img />.
This mode exists for compatibility with CommonMark tests.
sourcepub fn replace<T: NodeValue>(&mut self, value: T)
pub fn replace<T: NodeValue>(&mut self, value: T)
Replace custom value with another value (this is roughly equivalent to replacing the entire node and copying children and sourcemaps).
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl !UnwindSafe for Node
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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