pub struct NodeSpec {
pub kind: NodeKind,
pub span: SourceSpan,
pub attributes: AttrMap,
}Expand description
The blueprint for a node handed to Document::alloc /
Document::alloc_child. Carries only the fields a caller legitimately
chooses: kind, span, and attributes. The arena supplies the
id, the empty children list, and the content_hash/style_id
placeholders, so an invalid node is unrepresentable at the call site.
Fields§
§kind: NodeKind§span: SourceSpan§attributes: AttrMapImplementations§
Source§impl NodeSpec
impl NodeSpec
Sourcepub fn new(kind: NodeKind, span: SourceSpan) -> Self
pub fn new(kind: NodeKind, span: SourceSpan) -> Self
A spec for a node of kind spanning span, with no attributes.
Sourcepub fn with_attributes(self, attributes: AttrMap) -> Self
pub fn with_attributes(self, attributes: AttrMap) -> Self
Attach attributes to this spec.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeSpec
impl RefUnwindSafe for NodeSpec
impl Send for NodeSpec
impl Sync for NodeSpec
impl Unpin for NodeSpec
impl UnsafeUnpin for NodeSpec
impl UnwindSafe for NodeSpec
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