Skip to main content

NodeState

Struct NodeState 

Source
pub struct NodeState<'provider> { /* private fields */ }
Expand description

A node of the content tree, addressed by its node record.

Implementations§

Source§

impl<'provider> NodeState<'provider>

Source

pub fn new( provider: &'provider dyn SegmentProvider, record_identifier: RecordIdentifier, ) -> Self

Creates a node state for the node record at record_identifier.

Source

pub fn record_identifier(&self) -> RecordIdentifier

The node record this state reads from.

Source

pub fn template(&self) -> Result<Arc<Template>>

The node’s template.

Source

pub fn stable_identifier(&self) -> Result<String>

The node’s stable identifier: <segment UUID>:<record number>.

The stable identifier survives compaction: slot 0 either marks the node itself (a self-reference) or points at a 20-byte block holding the identifier of the original node record before compaction rewrote it.

Source

pub fn stable_identifier_bytes(&self) -> Result<[u8; 20]>

The node’s 20-byte stable identifier: the serialized (msb, lsb, record number) of the record its identity descends from. When slot 0 is a self reference, this is the node’s own record identifier serialized. Rewriters propagate these bytes so a node keeps its identity across compaction.

Source

pub fn child_node_count(&self) -> Result<u64>

The number of child nodes.

Source

pub fn child_node(&self, name: &str) -> Result<Option<NodeState<'provider>>>

Looks up a child node by name.

Source

pub fn child_node_entries(&self) -> Result<Vec<(String, NodeState<'provider>)>>

All child nodes with their names, in storage order.

Source

pub fn properties(&self) -> Result<Vec<PropertyState>>

All properties, in template order, with jcr:primaryType and jcr:mixinTypes synthesized from the template head first — the same view Oak’s node state API presents.

Source

pub fn stored_properties(&self) -> Result<Vec<PropertyState>>

The node’s stored properties, in template order, without the synthesized jcr:primaryType and jcr:mixinTypes. Rewriting a node must use this together with the template’s primary type and mixin types, never Self::properties filtered by name — a property literally named jcr:primaryType of a non-name type is a real stored property and would otherwise be lost.

Source

pub fn property(&self, name: &str) -> Result<Option<PropertyState>>

Looks up a property by name, including the synthesized jcr:primaryType and jcr:mixinTypes.

When the template head carries no synthetic entry for those names, the lookup falls through to the ordinary property list: a property literally named jcr:primaryType whose type is not a single NAME is stored as an ordinary property, and Java returns it.

Trait Implementations§

Source§

impl<'provider> Clone for NodeState<'provider>

Source§

fn clone(&self) -> NodeState<'provider>

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<'provider> Copy for NodeState<'provider>

Source§

impl Debug for NodeState<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'provider> !RefUnwindSafe for NodeState<'provider>

§

impl<'provider> !Send for NodeState<'provider>

§

impl<'provider> !Sync for NodeState<'provider>

§

impl<'provider> !UnwindSafe for NodeState<'provider>

§

impl<'provider> Freeze for NodeState<'provider>

§

impl<'provider> Unpin for NodeState<'provider>

§

impl<'provider> UnsafeUnpin for NodeState<'provider>

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> 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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.