Struct TaskTree

Source
pub struct TaskTree { /* private fields */ }

Implementations§

Source§

impl TaskTree

Source

pub fn new() -> Arc<Self>

Source

pub fn set_force_flush(&self, enabled: bool)

Source

pub fn force_flush_enabled(&self) -> bool

Source

pub fn create_task(self: &Arc<Self>, name: &str) -> Task

Source

pub fn add_reporter(&self, reporter: Arc<dyn Reporter>)

Source

pub fn spawn_sync<F, T>( self: &Arc<Self>, name: String, f: F, parent: Option<UniqID>, ) -> Result<T>
where F: FnOnce(Task) -> Result<T>, T: Send,

Source

pub fn create_task_internal<S: Into<String>>( self: &Arc<Self>, name: S, parent: Option<UniqID>, ) -> UniqID

Source

pub fn mark_done(&self, id: UniqID, error_message: Option<String>)

Source

pub fn add_data<S: Into<String>, D: Into<DataValue>>( &self, id: UniqID, key: S, value: D, )

Source

pub fn get_data<S: Into<String>>(&self, id: UniqID, key: S) -> Option<DataValue>

Source

pub fn hide_errors_default_msg<S: Into<String>>(&self, msg: Option<S>)

Reporters can use this flag to choose to not report errors. This is useful for cases where there’s a large task chain and every single task reports a partial errors (that gets built up with each task) It would make sense to report it only once at the top level (thrift request, cli call, etc) and only mark other tasks. If set to Some, the message inside is what would be reported by default instead of reporting errors to avoid confusion (e.g. “error was hidden, see …”)

Source

pub fn attach_transitive_data_to_errors_default(&self, val: bool)

When errors occur, we attach task data to it in the description. If set to false, only task direct data will be attached and not transitive data. This is useful sometimes to remove the noise of transitive data appearing in every error in the chain (e.g. hostname)

Source

pub fn set_error_formatter( &self, error_formatter: Option<Arc<dyn ErrorFormatter>>, )

Add a custom error formatter to change how error messages look in reporters. Unfortunately it is not configurable per reporter, because errors normally don’t implement Clone and it will be almost impossible to add reference counters to all errors in all chains

Source

pub fn add_data_transitive<S: Into<String>, D: Into<DataValue>>( &self, key: S, value: D, )

Add transitive data to the task tree. This transitive data will be added to every task created in this task tree

Source

pub fn task_progress(&self, id: UniqID, done: i64, total: i64)

Source

pub fn maybe_force_flush(&self)

If force_flush set to true, this function will block the thread until everything is reported. Useful for cases when the process exits before all async events are reported and stuff is missing from stdout.

Source

pub fn report_all(&self)

Auto Trait Implementations§

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.

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

Source§

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

Source§

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.