pub enum AgentState {
Created,
Initializing,
Ready,
Running,
Executing,
Paused,
Interrupted,
ShuttingDown,
Shutdown,
Failed,
Destroyed,
Error(String),
}Expand description
Agent 状态机
Variants§
Created
已创建,未初始化
Initializing
正在初始化
Ready
就绪,可执行
Running
运行中
Executing
正在执行
Paused
已暂停
Interrupted
已中断
ShuttingDown
正在关闭
Shutdown
已终止/关闭
Failed
失败状态
Destroyed
销毁
Error(String)
错误状态 (带消息)
Implementations§
Source§impl AgentState
impl AgentState
Sourcepub fn transition_to(
&self,
target: AgentState,
) -> Result<AgentState, AgentError>
pub fn transition_to( &self, target: AgentState, ) -> Result<AgentState, AgentError>
转换到目标状态
Sourcepub fn can_transition_to(&self, target: &AgentState) -> bool
pub fn can_transition_to(&self, target: &AgentState) -> bool
检查是否可以转换到目标状态
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
是否为终止状态
Trait Implementations§
Source§impl Clone for AgentState
impl Clone for AgentState
Source§fn clone(&self) -> AgentState
fn clone(&self) -> AgentState
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 AgentState
impl Debug for AgentState
Source§impl Default for AgentState
impl Default for AgentState
Source§fn default() -> AgentState
fn default() -> AgentState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AgentState
impl<'de> Deserialize<'de> for AgentState
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
Source§impl Display for AgentState
impl Display for AgentState
Source§impl Hash for AgentState
impl Hash for AgentState
Source§impl PartialEq for AgentState
impl PartialEq for AgentState
Source§impl Serialize for AgentState
impl Serialize for AgentState
impl Eq for AgentState
impl StructuralPartialEq for AgentState
Auto Trait Implementations§
impl Freeze for AgentState
impl RefUnwindSafe for AgentState
impl Send for AgentState
impl Sync for AgentState
impl Unpin for AgentState
impl UnsafeUnpin for AgentState
impl UnwindSafe for AgentState
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