Skip to main content

RtfIndex

Struct RtfIndex 

Source
pub struct RtfIndex {
    pub nodes: Vec<RtfNode>,
    pub host_index: usize,
}
Expand description

One result-tree fragment indexed for XPath navigation. Built complete-then-frozen — once a RtfIndex is pushed into the host elsa::FrozenVec, its nodes table never mutates.

Fields§

§nodes: Vec<RtfNode>

LOCAL ids — node 0 is the synthetic Document node, the rest are its descendants in document order. Callers outside this module always see the IDs encoded with the RTF_BASE marker (via encode_rtf_id); the local Vec is the implementation detail.

§host_index: usize

Self-index inside the host DocIndex::rtfs vector, captured at registration time so accessors can re-encode child / parent ids back to the marker form callers expect.

Implementations§

Source§

impl RtfIndex

Source

pub fn children(&self, local_id: NodeId) -> &[NodeId]

Children of local_id — already-encoded global ids so the outer dispatcher can return the slice directly.

Source

pub fn parent(&self, local_id: NodeId) -> Option<NodeId>

Parent of local_id, globally encoded. Returns None for the document root (LOCAL id 0).

Source

pub fn attr_range(&self, local_id: NodeId) -> Range<NodeId>

Source

pub fn ns_range(&self, local_id: NodeId) -> Range<NodeId>

Source

pub fn kind(&self, local_id: NodeId) -> XPathNodeKind

Source

pub fn pi_target(&self, local_id: NodeId) -> &str

Source

pub fn node_name(&self, local_id: NodeId) -> &str

Source

pub fn local_name(&self, local_id: NodeId) -> &str

Source

pub fn namespace_uri(&self, local_id: NodeId) -> &str

Source

pub fn namespace_prefix(&self, local_id: NodeId) -> Option<&str>

Source

pub fn string_value(&self, local_id: NodeId) -> String

Recursive descendant text concatenation — XPath 1.0 §5 string-value semantics for element / document nodes. Atomic kinds return their stored content directly.

Trait Implementations§

Source§

impl Debug for RtfIndex

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

type Output = T

Should always be Self
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.