Skip to main content

Tree

Struct Tree 

Source
pub struct Tree { /* private fields */ }

Implementations§

Source§

impl Tree

Source

pub fn new() -> Self

Source

pub fn push( &mut self, parent: Option<NodeId>, name: impl Into<String>, is_container: bool, action: ActionValues, ) -> NodeId

Source

pub fn push_with_detail( &mut self, parent: Option<NodeId>, name: impl Into<String>, detail: Option<String>, is_container: bool, action: ActionValues, ) -> NodeId

Source

pub fn fully_indexed(&self) -> bool

True once every node’s children are loaded and every span validated; the jump picker requires this.

Source

pub fn pending(&self) -> usize

Nodes whose children/validation are still pending (progress display).

Source

pub fn errors(&self) -> &[String]

Messages for spans that failed to scan, in discovery order.

Source

pub fn name(&self, id: NodeId) -> String

The node’s display name.

Source

pub fn detail(&self, id: NodeId) -> Option<String>

Optional secondary text rendered after the name.

Source

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

Source

pub fn depth(&self, id: NodeId) -> usize

0 for roots.

Source

pub fn is_container(&self, id: NodeId) -> bool

Whether the node represents a container, including an empty one.

Source

pub fn children_of(&self, id: NodeId) -> &[NodeId]

The node’s children, in display order.

Source

pub fn output(&self, id: NodeId) -> OsString

Text written to stdout when the node is accepted.

Source

pub fn alternate_output(&self, id: NodeId) -> OsString

Text written to stdout by the alternate accept action.

Source

pub fn path(&self, id: NodeId) -> OsString

Value exported to shell bindings as $path.

Source

pub fn filesystem_path(&self, id: NodeId) -> Option<OsString>

The node’s location in the host filesystem, when it has one. JSON nodes are addressed by pointer within a document, so nothing outside ite can open them.

Source

pub fn relpath(&self, id: NodeId) -> OsString

Value exported to shell bindings as $relpath: the address within the source’s natural unit — the scan root for directories, the document for JSON, the containing record for JSONL (the record itself is “”).

Source

pub fn jump_key(&self, id: NodeId) -> String

The text the jump picker matches and displays: the node’s document-global address. Coincides with relpath for directory scans and JSON documents; JSONL diverges, since a record-relative relpath repeats across records.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn root_ids(&self) -> &[NodeId]

Source

pub fn is_leaf(&self, id: NodeId) -> bool

True when the node cannot be expanded. Containers are never leaves: an empty directory is still a directory and {}/[] are still containers — they simply open to nothing.

Source

pub fn branches(&self) -> impl Iterator<Item = (NodeId, Option<NodeId>)> + '_

All expandable nodes as (id, parent) pairs, in tree order.

Trait Implementations§

Source§

impl Debug for Tree

Source§

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

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

impl Default for Tree

Source§

fn default() -> Tree

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

impl TreeModel for Tree

Source§

type Id = usize

The node identifier type.
Source§

fn roots(&self) -> impl Iterator<Item = NodeId> + '_

Returns forest roots in deterministic order.
Source§

fn children(&self, id: NodeId) -> TreeChildren<'_, NodeId>

Returns the node’s child state and loaded children.
Source§

fn revision(&self) -> TreeRevision

Returns the revision of the model structure and display data.
Source§

fn size_hint(&self) -> usize

Returns an approximate number of available nodes.

Auto Trait Implementations§

§

impl Freeze for Tree

§

impl RefUnwindSafe for Tree

§

impl Send for Tree

§

impl Sync for Tree

§

impl Unpin for Tree

§

impl UnsafeUnpin for Tree

§

impl UnwindSafe for Tree

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.