Skip to main content

Node

Struct Node 

Source
#[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] — NodeType discriminant (4 bits)
  • Bits [7:4] — property flags (HAS_ATTRIBUTE, HAS_CHILDREN, IS_COMPLEX_TYPE, HAS_NMSP_DECLS)
  • Bit [8] — IS_NIL flag (xsi:nil=“true”)
  • Bits [11:9] — reserved (must be 0)
  • Bits [31:12] — 20-bit binding index into BindingRemapTable (0 = unbound)

Fields§

§next_sibling: u32

Index of the next sibling node, or NULL.

§parent: u32

Index of the parent node, or NULL.

§props_type: u32

Packed field: node type (4 bits) | flags (4 bits) | type_index (24 bits).

§value: u32

Interpretation depends on node type (QNameAtom index, string index, etc.).

Implementations§

Source§

impl Node

Source

pub const HAS_ATTRIBUTE: u32 = 0x10

Element has attribute children.

Source

pub const HAS_CHILDREN: u32 = 0x20

Element/Root has content children.

Source

pub const IS_COMPLEX_TYPE: u32 = 0x40

binding_index references a complex type in the remap table.

Source

pub const HAS_NMSP_DECLS: u32 = 0x80

Element declares namespace bindings.

Source

pub const IS_NIL: u32 = 0x100

Element has xsi:nil=“true”.

Source

pub fn node_type(self) -> NodeType

Returns the NodeType stored in the low 4 bits.

Source

pub fn flags(self) -> u32

Returns the raw flag nibble (bits [7:4]).

Source

pub fn binding_index(self) -> u32

Returns the 20-bit binding index (bits [31:12]).

Source

pub fn set_node_type(&mut self, nt: NodeType)

Overwrites the NodeType in bits [3:0], preserving other fields.

Source

pub fn set_flag(&mut self, flag: u32)

Sets a flag bit (e.g. HAS_ATTRIBUTE).

Source

pub fn clear_flag(&mut self, flag: u32)

Clears a flag bit.

Source

pub fn has_flag(self, flag: u32) -> bool

Tests whether a flag bit is set.

Source

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).

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Node

Source§

impl Debug for Node

Source§

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

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

impl Default for Node

Source§

fn default() -> Node

Returns the “default value” for a type. Read more
Source§

impl Eq for Node

Source§

impl PartialEq for Node

Source§

fn eq(&self, other: &Node) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 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 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> ErasedDestructor for T
where T: 'static,

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> MaybeSendSync for T

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, 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.