#[repr(C)]pub struct Node {
pub next_sibling: u32,
pub parent: u32,
pub props_type: u32,
pub value: u32,
}Expand description
16-byte flat node in the BufferDocument node array.
Layout of props_type (32 bits):
- Bits [3:0] —
NodeTypediscriminant (4 bits) - Bits [7:4] — property flags (
HAS_ATTRIBUTE,HAS_CHILDREN,IS_COMPLEX_TYPE,HAS_NMSP_DECLS) - Bit [8] —
IS_NILflag (xsi:nil=“true”) - Bits [11:9] — reserved (must be 0)
- Bits [31:12] — 20-bit binding index into
BindingRemapTable(0 = unbound)
Fields§
§next_sibling: u32Index of the next sibling node, or NULL.
parent: u32Index of the parent node, or NULL.
props_type: u32Packed field: node type (4 bits) | flags (4 bits) | type_index (24 bits).
value: u32Interpretation depends on node type (QNameAtom index, string index, etc.).
Implementations§
Source§impl Node
impl Node
Sourcepub const HAS_ATTRIBUTE: u32 = 0x10
pub const HAS_ATTRIBUTE: u32 = 0x10
Element has attribute children.
Sourcepub const HAS_CHILDREN: u32 = 0x20
pub const HAS_CHILDREN: u32 = 0x20
Element/Root has content children.
Sourcepub const IS_COMPLEX_TYPE: u32 = 0x40
pub const IS_COMPLEX_TYPE: u32 = 0x40
binding_index references a complex type in the remap table.
Sourcepub const HAS_NMSP_DECLS: u32 = 0x80
pub const HAS_NMSP_DECLS: u32 = 0x80
Element declares namespace bindings.
Sourcepub fn binding_index(self) -> u32
pub fn binding_index(self) -> u32
Returns the 20-bit binding index (bits [31:12]).
Sourcepub fn set_node_type(&mut self, nt: NodeType)
pub fn set_node_type(&mut self, nt: NodeType)
Overwrites the NodeType in bits [3:0], preserving other fields.
Sourcepub fn set_flag(&mut self, flag: u32)
pub fn set_flag(&mut self, flag: u32)
Sets a flag bit (e.g. HAS_ATTRIBUTE).
Sourcepub fn clear_flag(&mut self, flag: u32)
pub fn clear_flag(&mut self, flag: u32)
Clears a flag bit.
Sourcepub fn set_binding_index(&mut self, idx: u32)
pub fn set_binding_index(&mut self, idx: u32)
Sets the 20-bit binding index in bits [31:12].
Preserves bits [11:0] (node type, flags, and IS_NIL).
§Panics (debug only)
Panics if idx exceeds 20 bits (>= 0x10_0000).