BaseNode

Trait BaseNode 

Source
pub trait BaseNode {
    // Required methods
    fn is_dead(&self) -> bool;
    fn children_mut(&mut self) -> &mut HashMap<u64, Box<Self>>
       where Self: Sized;
    fn children(&self) -> &HashMap<u64, Box<Self>>
       where Self: Sized;
    fn host_string(&self) -> Option<String>;

    // Provided methods
    fn prune(&mut self) -> usize
       where Self: Sized { ... }
    fn clear(&mut self) -> Vec<String>
       where Self: Sized { ... }
    fn all_hosts(&self) -> HashSet<String>
       where Self: Sized { ... }
}
Expand description

Trait for nodes that can be pruned (base node for radix trees).

Required Methods§

Source

fn is_dead(&self) -> bool

Returns true if the node is dead (no data, no children)

Source

fn children_mut(&mut self) -> &mut HashMap<u64, Box<Self>>
where Self: Sized,

Returns mutable reference to children as a trait object

Source

fn children(&self) -> &HashMap<u64, Box<Self>>
where Self: Sized,

Returns immutable reference to children

Source

fn host_string(&self) -> Option<String>

Returns the host as a string if present

Provided Methods§

Source

fn prune(&mut self) -> usize
where Self: Sized,

Prune dead child nodes recursively, returns number pruned

Source

fn clear(&mut self) -> Vec<String>
where Self: Sized,

Clear all children recursively and return deleted hosts

Source

fn all_hosts(&self) -> HashSet<String>
where Self: Sized,

Get all hosts in this subtree

Implementors§