Skip to main content

actionqueue_core/task/
metadata.rs

1//! Task metadata for organizing and prioritizing tasks.
2
3/// Metadata associated with a task for organizational and scheduling purposes.
4#[derive(Debug, Clone, PartialEq, Eq, Default)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct TaskMetadata {
7    /// Optional tags for categorizing tasks.
8    tags: Vec<String>,
9    /// Optional priority hint. Higher values indicate higher priority.
10    priority: i32,
11    /// Optional human-readable description.
12    description: Option<String>,
13}
14
15impl TaskMetadata {
16    /// Creates a new `TaskMetadata` with the given tags, priority, and description.
17    pub fn new(tags: Vec<String>, priority: i32, description: Option<String>) -> Self {
18        Self { tags, priority, description }
19    }
20
21    /// Returns the tags associated with this task.
22    pub fn tags(&self) -> &[String] {
23        &self.tags
24    }
25
26    /// Returns the priority hint for this task.
27    pub fn priority(&self) -> i32 {
28        self.priority
29    }
30
31    /// Returns the optional human-readable description.
32    pub fn description(&self) -> Option<&str> {
33        self.description.as_deref()
34    }
35}