Struct prodash::tree::Root

source ·
pub struct Root { /* private fields */ }
Expand description

The top-level of the progress tree.

Implementations§

source§

impl Root

source

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.

source

pub fn messages_capacity(&self) -> usize

Returns the maximum amount of messages we can keep before overwriting older ones.

source

pub fn num_tasks(&self) -> usize

Returns the current amount of Items stored in the tree. Note that this is at most a guess as tasks can be added and removed in parallel.

source

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::Items, each having their own progress. Use this method to track progress of your first tasks.

source

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::Items, each having their own progress. Use this method to track progress of your first tasks.

source

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.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl Debug for Root

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Options> for Root

source§

fn from(_: Options) -> Self

Converts to this type from the input type.

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§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more