shell_candy/task/behavior.rs
1/// The type of error that can be returned by log handlers when running tasks.
2type UserDefinedError = Box<dyn std::error::Error + Send + Sync + 'static>;
3
4/// The result that can be returned by log handlers when running tasks.
5type UserDefinedResult<T> = std::result::Result<T, UserDefinedError>;
6
7/// [`ShellTaskBehavior`] allows you to terminate a process
8/// early, or to continue inside your log handler.
9#[derive(Debug)]
10pub enum ShellTaskBehavior<T> {
11 /// When a log handler returns this variant after processing a log line,
12 /// the underlying process is terminated and the underlying [`Result`] is returned.
13 EarlyReturn(UserDefinedResult<T>),
14
15 /// When a log handler returns this variant after processing a log line,
16 /// the process is allowed to continue.
17 Passthrough,
18}