Skip to main content

Tree

Struct Tree 

Source
pub struct Tree {
    pub(super) nodes: Vec<Node>,
    pub(super) roots: Vec<usize>,
}
Expand description

Nodes in a flat arena, so a node’s index can ride in a tree view item’s lParam.

Fields§

§nodes: Vec<Node>§roots: Vec<usize>

The top-level category rows, in display order.

Implementations§

Source§

impl Tree

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn node(&self, index: usize) -> &Node

Source

pub fn roots(&self) -> &[usize]

Source

pub fn children(&self, index: usize) -> &[usize]

Source

pub fn path_of(&self, index: usize) -> Vec<&str>

Labels from the category row down to index, inclusive.

Source

pub fn category_of(&self, index: usize) -> &str

The category as the server spells it, for comparing with CATEGORY_*.

Source

pub fn leaves_under(&self, index: Option<usize>) -> Vec<usize>

Every leaf under index, or in the whole tree for None, in display order.

Source

fn collect_leaves(&self, index: usize, leaves: &mut Vec<usize>)

Source

pub(super) fn push(&mut self, node: Node, parent: Option<usize>) -> usize

Source§

impl Tree

Source

pub fn build( game: &str, packages: &[PackageInfo], cached: &[CachedPackage], installed: &[String], ) -> Tree

The tree for ONE game: what the server listed, what the cache holds and what the game folder’s ledger has installed. A leaf starts checked when it is installed or cached, because Apply uninstalls what is unchecked.

Source

fn insert(&mut self, row: Row)

Source

fn child_named(&mut self, parent: Option<usize>, label: &str) -> usize

The grouping child of parent with this label, created when missing.

Source§

impl Tree

Source

pub fn check_of(&self, index: usize) -> Check

A leaf’s own checkbox, or a grouping row’s derived from its leaves.

Source

pub fn set_checked(&mut self, index: usize, checked: bool)

Checks or unchecks index and everything under it; the cache is never touched.

Source

pub fn uncheck_key(&mut self, key: &str)

Unchecks the leaf for key, for a package scene 4b could not bring: scene 5 must not offer what the install has no payload for.

Source

pub fn checked_leaves(&self) -> Vec<usize>

Source

pub fn checked_keys(&self) -> Vec<String>

The keys of every checked leaf, in display order.

Source

pub fn categories_missing_a_pick( &self, choice_categories: &[&str], ) -> Vec<String>

The choice categories present in the tree with nothing checked under them; an operator’s new folder must not become a question.

Source

pub fn categories_not_ready<'a>( &self, choice_categories: &[&'a str], is_cached: &dyn Fn(&str) -> bool, ) -> Vec<&'a str>

The choice categories with nothing to configure: no checked leaf whose payload is_cached says is here. Every category the game’s schema asks about counts, present in this tree or not, since scene 5 cannot make a pick from nothing.

Source

pub fn checked_needing_download(&self) -> Vec<String>

The checked leaves scene 6 fetches, updates included.

Trait Implementations§

Source§

impl Clone for Tree

Source§

fn clone(&self) -> Tree

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

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