pub struct Node {
pub id: NodeId,
pub kind: NodeKind,
pub span: SourceSpan,
pub content_hash: ContentHash,
pub style_id: StyleId,
pub children: Vec<NodeId>,
pub attributes: AttrMap,
}Expand description
A semantic document node (manifest §5.1).
§Examples
use std::path::PathBuf;
use mos_core::{AttrMap, ContentHash, Node, NodeId, NodeKind, SourceSpan, StyleId};
let file = PathBuf::from("main.mos");
let node = Node {
id: NodeId(1),
kind: NodeKind::Paragraph,
span: SourceSpan::placeholder(file),
content_hash: ContentHash::default(),
style_id: StyleId::default(),
children: Vec::new(),
attributes: AttrMap::new(),
};
assert_eq!(node.kind, NodeKind::Paragraph);Fields§
§id: NodeId§kind: NodeKind§span: SourceSpan§content_hash: ContentHash§style_id: StyleId§children: Vec<NodeId>§attributes: AttrMapTrait Implementations§
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> 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