pub struct Task {
pub id: String,
pub task_type: TaskType,
pub content: String,
pub priority: TaskPriority,
pub target_agent: Option<String>,
pub params: HashMap<String, Value>,
pub metadata: HashMap<String, String>,
pub created_at: u64,
pub timeout_ms: Option<u64>,
}Expand description
任务定义
Fields§
§id: String任务 ID
task_type: TaskType任务类型
content: String任务内容
priority: TaskPriority任务优先级
target_agent: Option<String>目标 Agent ID (可选,如果为空则由协调器选择)
params: HashMap<String, Value>任务参数
metadata: HashMap<String, String>任务元数据
created_at: u64创建时间
timeout_ms: Option<u64>超时时间 (毫秒)
Implementations§
Source§impl Task
impl Task
Sourcepub fn with_priority(self, priority: TaskPriority) -> Self
pub fn with_priority(self, priority: TaskPriority) -> Self
设置优先级
Sourcepub fn with_param(self, key: impl Into<String>, value: Value) -> Self
pub fn with_param(self, key: impl Into<String>, value: Value) -> Self
添加参数
Sourcepub fn with_timeout(self, timeout_ms: u64) -> Self
pub fn with_timeout(self, timeout_ms: u64) -> Self
设置超时
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
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