pub struct Root { /* private fields */ }
Expand description
The top-level of the progress tree.
Implementations
sourceimpl Root
impl Root
sourcepub fn new() -> Root
pub fn new() -> 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 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) -> Root
pub fn deep_clone(&self) -> Root
Duplicate all content and return it.
This is an expensive operation, whereas clone()
is not as it is shallow.
Trait Implementations
sourceimpl Root for Root
impl Root for Root
sourcefn messages_capacity(&self) -> usize
fn messages_capacity(&self) -> usize
Returns the maximum amount of messages we can keep before overwriting older ones.
sourcefn num_tasks(&self) -> usize
fn num_tasks(&self) -> usize
Returns the current amount of tasks underneath the root, transitively. Note that this is at most a guess as tasks can be added and removed in parallel. Read more
sourcefn sorted_snapshot(&self, out: &mut Vec<(Key, Task)>)
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.
The out
vec will be cleared automatically. Read more
sourcefn copy_messages(&self, out: &mut Vec<Message>)
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. Read more
sourcefn copy_new_messages(
&self,
out: &mut Vec<Message>,
prev: Option<MessageCopyState>
) -> MessageCopyState
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. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Root
impl Send for Root
impl Sync for Root
impl Unpin for Root
impl !UnwindSafe for Root
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more