Skip to main content

Node

Enum Node 

Source
pub enum Node {
Show 33 variants Blockquote(Blockquote), Break(Break), Definition(Definition), Delete(Delete), Heading(Heading), Emphasis(Emphasis), Footnote(Footnote), FootnoteRef(FootnoteRef), Html(Html), Yaml(Yaml), Toml(Toml), Image(Image), ImageRef(ImageRef), CodeInline(CodeInline), MathInline(MathInline), Link(Link), LinkRef(LinkRef), Math(Math), List(List), TableAlign(TableAlign), TableRow(TableRow), TableCell(TableCell), Code(Code), Strong(Strong), HorizontalRule(HorizontalRule), MdxFlowExpression(MdxFlowExpression), MdxJsxFlowElement(MdxJsxFlowElement), MdxJsxTextElement(MdxJsxTextElement), MdxTextExpression(MdxTextExpression), MdxJsEsm(MdxJsEsm), Text(Text), Fragment(Fragment), Empty,
}

Variants§

§

Blockquote(Blockquote)

§

Break(Break)

§

Definition(Definition)

§

Delete(Delete)

§

Heading(Heading)

§

Emphasis(Emphasis)

§

Footnote(Footnote)

§

FootnoteRef(FootnoteRef)

§

Html(Html)

§

Yaml(Yaml)

§

Toml(Toml)

§

Image(Image)

§

ImageRef(ImageRef)

§

CodeInline(CodeInline)

§

MathInline(MathInline)

§

LinkRef(LinkRef)

§

Math(Math)

§

List(List)

§

TableAlign(TableAlign)

§

TableRow(TableRow)

§

TableCell(TableCell)

§

Code(Code)

§

Strong(Strong)

§

HorizontalRule(HorizontalRule)

§

MdxFlowExpression(MdxFlowExpression)

§

MdxJsxFlowElement(MdxJsxFlowElement)

§

MdxJsxTextElement(MdxJsxTextElement)

§

MdxTextExpression(MdxTextExpression)

§

MdxJsEsm(MdxJsEsm)

§

Text(Text)

§

Fragment(Fragment)

§

Empty

Implementations§

Source§

impl Node

Source

pub fn map_values<E, F>(&self, f: &mut F) -> Result<Node, E>
where E: Error, F: FnMut(&Node) -> Result<Node, E>,

Source

pub fn to_fragment(&self) -> Node

Source

pub fn apply_fragment(&mut self, fragment: Node)

Source

pub fn to_string_with(&self, options: &RenderOptions) -> String

Source

pub fn node_values(&self) -> Vec<Node>

Source

pub fn find_at_index(&self, index: usize) -> Option<Node>

Source

pub fn value(&self) -> String

Source

pub fn name(&self) -> SmolStr

Source

pub fn children(&self) -> Vec<Node>

Get the children nodes of the current node.

Source

pub fn set_position(&mut self, pos: Option<Position>)

Source

pub fn position(&self) -> Option<Position>

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_fragment(&self) -> bool

Source

pub fn is_empty_fragment(&self) -> bool

Source

pub fn is_inline_code(&self) -> bool

Source

pub fn is_inline_math(&self) -> bool

Source

pub fn is_strong(&self) -> bool

Source

pub fn is_list(&self) -> bool

Source

pub fn is_emphasis(&self) -> bool

Source

pub fn is_delete(&self) -> bool

Source

pub fn is_text(&self) -> bool

Source

pub fn is_image(&self) -> bool

Source

pub fn is_horizontal_rule(&self) -> bool

Source

pub fn is_blockquote(&self) -> bool

Source

pub fn is_html(&self) -> bool

Source

pub fn is_footnote(&self) -> bool

Source

pub fn is_mdx_jsx_flow_element(&self) -> bool

Source

pub fn is_mdx_js_esm(&self) -> bool

Source

pub fn is_toml(&self) -> bool

Source

pub fn is_yaml(&self) -> bool

Source

pub fn is_break(&self) -> bool

Source

pub fn is_mdx_text_expression(&self) -> bool

Source

pub fn is_footnote_ref(&self) -> bool

Source

pub fn is_image_ref(&self) -> bool

Source

pub fn is_mdx_jsx_text_element(&self) -> bool

Source

pub fn is_math(&self) -> bool

Source

pub fn is_mdx_flow_expression(&self) -> bool

Source

pub fn is_definition(&self) -> bool

Source

pub fn is_table_align(&self) -> bool

Source

pub fn is_code(&self, lang: Option<SmolStr>) -> bool

Source

pub fn is_heading(&self, depth: Option<u8>) -> bool

Source

pub fn with_value(&self, value: &str) -> Self

Source

pub fn with_children_value(&self, value: &str, index: usize) -> Self

Source

pub fn attr(&self, attr: &str) -> Option<AttrValue>

Returns the value of the specified attribute, if present.

Source

pub fn set_attr(&mut self, attr: &str, value: impl Into<AttrValue>)

Sets the value of the specified attribute for the node, if supported.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

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 Node

Source§

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

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

impl Display for Node

Source§

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

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

impl From<&str> for Node

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Node

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Node

Source§

fn eq(&self, other: &Self) -> 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 PartialOrd for Node

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

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> 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> 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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.