pub struct Root { /* private fields */ }
Expand description
The top-level of the progress tree.
Implementations§
source§impl Root
impl Root
sourcepub fn new() -> Arc<Root>
pub fn new() -> Arc<Root>
Create a new tree with default configuration.
As opposed to Item instances, this type can be closed and sent safely across threads.
sourcepub fn messages_capacity(&self) -> usize
pub fn messages_capacity(&self) -> usize
Returns the maximum amount of messages we can keep before overwriting older ones.
sourcepub fn num_tasks(&self) -> usize
pub fn num_tasks(&self) -> usize
Returns the current amount of Item
s stored in the tree.
Note that this is at most a guess as tasks can be added and removed in parallel.
sourcepub fn add_child(&self, name: impl Into<String>) -> Item
pub fn add_child(&self, name: impl Into<String>) -> Item
Adds a new child tree::Item
, whose parent is this instance, with the given name
.
This builds a hierarchy of tree::Item
s, each having their own progress.
Use this method to track progress of your first tasks.
sourcepub fn add_child_with_id(&self, name: impl Into<String>, id: Id) -> Item
pub fn add_child_with_id(&self, name: impl Into<String>, id: Id) -> Item
Adds a new child tree::Item
, whose parent is this instance, with the given name
and id
.
This builds a hierarchy of tree::Item
s, each having their own progress.
Use this method to track progress of your first tasks.
sourcepub fn sorted_snapshot(&self, out: &mut Vec<(Key, Task)>)
pub fn sorted_snapshot(&self, out: &mut Vec<(Key, Task)>)
Copy the entire progress tree into the given out
vector, so that
it can be traversed from beginning to end in order of hierarchy.
sourcepub fn copy_messages(&self, out: &mut Vec<Message>)
pub fn copy_messages(&self, out: &mut Vec<Message>)
Copy all messages from the internal ring buffer into the given out
vector. Messages are ordered from oldest to newest.
sourcepub fn copy_new_messages(
&self,
out: &mut Vec<Message>,
prev: Option<MessageCopyState>
) -> MessageCopyState
pub fn copy_new_messages( &self, out: &mut Vec<Message>, prev: Option<MessageCopyState> ) -> MessageCopyState
Copy only new messages from the internal ring buffer into the given out
vector. Messages are ordered from oldest to newest.
sourcepub fn deep_clone(&self) -> Arc<Root>
pub fn deep_clone(&self) -> Arc<Root>
Duplicate all content and return it.
This is an expensive operation, whereas clone()
is not as it is shallow.