pub struct ContextResolver;Expand description
コンテキスト解決器
ContextStore と ContextView から ResolvedContext を生成する。
Implementations§
Source§impl ContextResolver
impl ContextResolver
Sourcepub fn resolve(store: &ContextStore, view: &ContextView) -> ResolvedContext
pub fn resolve(store: &ContextStore, view: &ContextView) -> ResolvedContext
ContextStore + View → ResolvedContext
Sourcepub fn resolve_with_scope(
store: &ContextStore,
worker_id: WorkerId,
scope: &WorkerScope,
) -> ResolvedContext
pub fn resolve_with_scope( store: &ContextStore, worker_id: WorkerId, scope: &WorkerScope, ) -> ResolvedContext
WorkerScope に応じてコンテキストを解決(Worker 向け)
Manager が Guidance で指定した Scope に基づいて、 Worker に渡す情報量を制御する。
§Arguments
store- コンテキストストアworker_id- 対象 Worker IDscope- 情報スコープ
§Example
ⓘ
// Minimal: 自分の last_output のみ
let ctx = ContextResolver::resolve_with_scope(&store, worker_id, &WorkerScope::Minimal);
assert!(ctx.visible_workers.is_empty());
assert!(ctx.self_last_output.is_some());
// SelfDetail: 自分の詳細情報
let ctx = ContextResolver::resolve_with_scope(&store, worker_id, &WorkerScope::SelfDetail);
assert_eq!(ctx.visible_workers.len(), 1);Auto Trait Implementations§
impl Freeze for ContextResolver
impl RefUnwindSafe for ContextResolver
impl Send for ContextResolver
impl Sync for ContextResolver
impl Unpin for ContextResolver
impl UnwindSafe for ContextResolver
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> 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