pub struct VocabularyTree {
pub root: VocabularyHeader,
pub children: Vec<VocabularyNode>,
pub project_iri: String,
pub requested_node: Option<String>,
}Expand description
What the CLIENT returns from describe_vocabulary: a faithful,
position-ordered tree plus the facts the wire response carried. Holds NO
rendered-counts and no render decisions — structurally, since it has no
such fields, the client cannot express them even by accident. VocabularyDetail
is where those decisions live (Step 3’s layer-ownership split).
Fields§
§root: VocabularyHeader§children: Vec<VocabularyNode>The WHOLE tree, always — never pruned. Absolute number (D10) and
path (D11) are derived from each node’s ancestor chain, which
pruning would destroy.
project_iri: StringFrom listinfo.projectIri, which a root response ALWAYS carries — so
this is never absent and the cross-project guard never has to fail
open.
requested_node: Option<String>Set when the address that was resolved turned out to be a NODE, not a
root: the client is the layer that saw the Node response shape
(D2), so it is the layer that records this.
Implementations§
Source§impl VocabularyTree
impl VocabularyTree
Sourcepub fn count_and_depth(&self, from: Option<&str>) -> (usize, usize)
pub fn count_and_depth(&self, from: Option<&str>) -> (usize, usize)
Count nodes and measure depth at or below the node named by from
(the whole tree when from is None).
Shared derivation used by BOTH list --count and describe, so one
walk has one implementation — the thing that makes the D15 invariant
hold (node_count equals the rendered data-row count in both modes).
from: None— whole-vocabulary mode. The root itself is never a node, so it is not counted;depthtreats the root’s direct children as level 1.from: Some(iri)— branch mode (--subtree). The addressed node IS included, as the top of its own branch (D14b): a leaf node yields(1, 1)— one node, one level, because the node itself occupies level 1 of the branch, its children level 2, and so on. Ifiridoes not address any node in this tree, returns(0, 0)(the action layer validates that--subtree’s address names a node present in the tree before calling this, so that case should not arise from user input — this is a defensive default, not user-facing behaviour).
This is not on the untrusted-input parse path (that’s
src/client/http.rs, which must walk iteratively) — it walks a tree
that already survived deserialisation, so plain recursion is fine;
real data tops out at 9 levels.
Trait Implementations§
Source§impl Clone for VocabularyTree
impl Clone for VocabularyTree
Source§impl Debug for VocabularyTree
impl Debug for VocabularyTree
impl Eq for VocabularyTree
Source§impl PartialEq for VocabularyTree
impl PartialEq for VocabularyTree
impl StructuralPartialEq for VocabularyTree
Auto Trait Implementations§
impl Freeze for VocabularyTree
impl RefUnwindSafe for VocabularyTree
impl Send for VocabularyTree
impl Sync for VocabularyTree
impl Unpin for VocabularyTree
impl UnsafeUnpin for VocabularyTree
impl UnwindSafe for VocabularyTree
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.