pub struct WorkerContext {
pub id: WorkerId,
pub consecutive_failures: u32,
pub last_action: Option<String>,
pub last_success: Option<bool>,
pub history_len: usize,
pub has_escalation: bool,
pub candidates: Vec<String>,
pub metadata: HashMap<String, Value>,
}Expand description
Worker固有のコンテキスト
Fields§
§id: WorkerIdWorker ID
consecutive_failures: u32連続失敗数
last_action: Option<String>最新アクション名
last_success: Option<bool>最新アクションの成功/失敗
history_len: usize履歴の長さ
has_escalation: boolEscalation 中かどうか
candidates: Vec<String>このWorkerに適用可能なAction候補
metadata: HashMap<String, Value>Worker固有メタデータ
Implementations§
Source§impl WorkerContext
impl WorkerContext
pub fn new(id: WorkerId) -> Self
pub fn with_failures(self, count: u32) -> Self
pub fn with_last_action(self, action: impl Into<String>, success: bool) -> Self
pub fn with_history_len(self, len: usize) -> Self
pub fn with_escalation(self, has: bool) -> Self
pub fn with_candidates(self, candidates: Vec<String>) -> Self
Trait Implementations§
Source§impl Clone for WorkerContext
impl Clone for WorkerContext
Source§fn clone(&self) -> WorkerContext
fn clone(&self) -> WorkerContext
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 moreAuto Trait Implementations§
impl Freeze for WorkerContext
impl RefUnwindSafe for WorkerContext
impl Send for WorkerContext
impl Sync for WorkerContext
impl Unpin for WorkerContext
impl UnwindSafe for WorkerContext
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> 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