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
impl Tree
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn node(&self, index: usize) -> &Node
pub fn roots(&self) -> &[usize]
pub fn children(&self, index: usize) -> &[usize]
Sourcepub fn path_of(&self, index: usize) -> Vec<&str>
pub fn path_of(&self, index: usize) -> Vec<&str>
Labels from the category row down to index, inclusive.
Sourcepub fn category_of(&self, index: usize) -> &str
pub fn category_of(&self, index: usize) -> &str
The category as the server spells it, for comparing with CATEGORY_*.
Sourcepub fn leaves_under(&self, index: Option<usize>) -> Vec<usize>
pub fn leaves_under(&self, index: Option<usize>) -> Vec<usize>
Every leaf under index, or in the whole tree for None, in display order.
fn collect_leaves(&self, index: usize, leaves: &mut Vec<usize>)
pub(super) fn push(&mut self, node: Node, parent: Option<usize>) -> usize
Source§impl Tree
impl Tree
Sourcepub fn build(
game: &str,
packages: &[PackageInfo],
cached: &[CachedPackage],
installed: &[String],
) -> Tree
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.
fn insert(&mut self, row: Row)
Source§impl Tree
impl Tree
Sourcepub fn check_of(&self, index: usize) -> Check
pub fn check_of(&self, index: usize) -> Check
A leaf’s own checkbox, or a grouping row’s derived from its leaves.
Sourcepub fn set_checked(&mut self, index: usize, checked: bool)
pub fn set_checked(&mut self, index: usize, checked: bool)
Checks or unchecks index and everything under it; the cache is never touched.
Sourcepub fn uncheck_key(&mut self, key: &str)
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.
pub fn checked_leaves(&self) -> Vec<usize>
Sourcepub fn checked_keys(&self) -> Vec<String>
pub fn checked_keys(&self) -> Vec<String>
The keys of every checked leaf, in display order.
Sourcepub fn categories_missing_a_pick(
&self,
choice_categories: &[&str],
) -> Vec<String>
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.
Sourcepub fn categories_not_ready<'a>(
&self,
choice_categories: &[&'a str],
is_cached: &dyn Fn(&str) -> bool,
) -> Vec<&'a str>
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.
Sourcepub fn checked_needing_download(&self) -> Vec<String>
pub fn checked_needing_download(&self) -> Vec<String>
The checked leaves scene 6 fetches, updates included.