pub struct ExtensionAwareWorker { /* private fields */ }Expand description
Extension を活用する Worker
SwarmState.shared.extensions から動的リソースを取得して使用。
§使用例
ⓘ
// Extension として設定された共有リソース
struct SharedCounter(AtomicUsize);
let worker = ExtensionAwareWorker::new(0);
// Orchestrator に Extension を登録
let orchestrator = OrchestratorBuilder::new()
.add_worker(worker)
.extension(SharedCounter(AtomicUsize::new(0)))
.build(runtime);Implementations§
Source§impl ExtensionAwareWorker
impl ExtensionAwareWorker
pub fn new(id: usize) -> ExtensionAwareWorker
pub fn with_name(self, name: impl Into<String>) -> ExtensionAwareWorker
Trait Implementations§
Source§impl WorkerAgent for ExtensionAwareWorker
impl WorkerAgent for ExtensionAwareWorker
Auto Trait Implementations§
impl Freeze for ExtensionAwareWorker
impl RefUnwindSafe for ExtensionAwareWorker
impl Send for ExtensionAwareWorker
impl Sync for ExtensionAwareWorker
impl Unpin for ExtensionAwareWorker
impl UnwindSafe for ExtensionAwareWorker
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