pub struct Node {
pub markdown_node: MarkdownNode,
pub source_range: Range<usize>,
}Expand description
A node in the Markdown AST.
Each Node contains a MarkdownNode variant representing a specific kind of Markdown
element (paragraph, heading, code block, etc.), along with a source_range indicating where in
the source text this node occurs.
§Examples
use basalt_core::markdown::{Node, MarkdownNode, Range, Text};
let node = Node::new(
MarkdownNode::Paragraph {
text: Text::default(),
},
0..10,
);
assert_eq!(node.markdown_node, MarkdownNode::Paragraph { text: Text::default() });
assert_eq!(node.source_range, Range { start: 0, end: 10 });Fields§
§markdown_node: MarkdownNodeThe specific Markdown node represented by this node.
source_range: Range<usize>The range in the original source text that this node covers.
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(markdown_node: MarkdownNode, source_range: Range<usize>) -> Self
pub fn new(markdown_node: MarkdownNode, source_range: Range<usize>) -> Self
Creates a new Node from the provided MarkdownNode and source range.
Trait Implementations§
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more