pub struct TaskFilter {
pub state: Option<TaskState>,
pub name_pattern: Option<String>,
pub min_duration: Option<Duration>,
pub max_duration: Option<Duration>,
pub min_polls: Option<u64>,
pub max_polls: Option<u64>,
pub parent: Option<TaskId>,
pub root_only: bool,
}Expand description
Filter for querying tasks
Use the builder pattern to construct filters:
use async_inspect::task::{TaskFilter, TaskState};
use std::time::Duration;
let filter = TaskFilter::new()
.with_state(TaskState::Running)
.with_name_pattern("fetch")
.with_min_duration(Duration::from_secs(1));Fields§
§state: Option<TaskState>Filter by task state
name_pattern: Option<String>Filter by name pattern (substring match)
min_duration: Option<Duration>Filter by minimum age/duration
max_duration: Option<Duration>Filter by maximum age/duration
min_polls: Option<u64>Filter by minimum poll count
max_polls: Option<u64>Filter by maximum poll count
parent: Option<TaskId>Filter by parent task
root_only: boolOnly show tasks without a parent (root tasks)
Implementations§
Source§impl TaskFilter
impl TaskFilter
Sourcepub fn with_state(self, state: TaskState) -> Self
pub fn with_state(self, state: TaskState) -> Self
Filter by task state
Sourcepub fn with_name_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_name_pattern(self, pattern: impl Into<String>) -> Self
Filter by name pattern (case-insensitive substring match)
Sourcepub fn with_min_duration(self, duration: Duration) -> Self
pub fn with_min_duration(self, duration: Duration) -> Self
Filter by minimum age/duration
Sourcepub fn with_max_duration(self, duration: Duration) -> Self
pub fn with_max_duration(self, duration: Duration) -> Self
Filter by maximum age/duration
Sourcepub fn with_min_polls(self, count: u64) -> Self
pub fn with_min_polls(self, count: u64) -> Self
Filter by minimum poll count
Sourcepub fn with_max_polls(self, count: u64) -> Self
pub fn with_max_polls(self, count: u64) -> Self
Filter by maximum poll count
Sourcepub fn with_parent(self, parent: TaskId) -> Self
pub fn with_parent(self, parent: TaskId) -> Self
Filter by parent task
Sourcepub fn filter<'a>(
&self,
tasks: impl IntoIterator<Item = &'a TaskInfo>,
) -> Vec<&'a TaskInfo>
pub fn filter<'a>( &self, tasks: impl IntoIterator<Item = &'a TaskInfo>, ) -> Vec<&'a TaskInfo>
Filter a collection of tasks
Sourcepub fn filter_cloned(
&self,
tasks: impl IntoIterator<Item = TaskInfo>,
) -> Vec<TaskInfo>
pub fn filter_cloned( &self, tasks: impl IntoIterator<Item = TaskInfo>, ) -> Vec<TaskInfo>
Filter and clone a collection of tasks
Trait Implementations§
Source§impl Clone for TaskFilter
impl Clone for TaskFilter
Source§fn clone(&self) -> TaskFilter
fn clone(&self) -> TaskFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskFilter
impl Debug for TaskFilter
Source§impl Default for TaskFilter
impl Default for TaskFilter
Source§fn default() -> TaskFilter
fn default() -> TaskFilter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TaskFilter
impl RefUnwindSafe for TaskFilter
impl Send for TaskFilter
impl Sync for TaskFilter
impl Unpin for TaskFilter
impl UnwindSafe for TaskFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more