pub struct AgentSpawnerFn(pub Box<dyn Fn(AgentConfig) -> Pin<Box<dyn Future<Output = Result<SpawnedAgent, SpawnError>> + Send>> + Send + Sync>);Expand description
Phase 81.32 c6 — sized newtype wrapping the type-erased
spawner closure stored by
crate::config_reload::ConfigReloadCoordinator.
ArcSwapOption<T> requires T: Sized so we wrap the unsized
dyn Fn(…) in a Box and the newtype around the Box. The
coordinator stores ArcSwapOption<AgentSpawnerFn> and invokes
via spawner.0(cfg).
Boxed-future return because async fn in a trait/closure
produces an opaque future type the coordinator can’t name
without GATs.
Lives in spawn (vs config_reload) so the field type on
ConfigReloadCoordinator doesn’t pull every per-agent dep
the closure captures into the coordinator’s API surface.
Tuple Fields§
§0: Box<dyn Fn(AgentConfig) -> Pin<Box<dyn Future<Output = Result<SpawnedAgent, SpawnError>> + Send>> + Send + Sync>Implementations§
Source§impl AgentSpawnerFn
impl AgentSpawnerFn
Sourcepub fn call(
&self,
cfg: AgentConfig,
) -> Pin<Box<dyn Future<Output = Result<SpawnedAgent, SpawnError>> + Send>>
pub fn call( &self, cfg: AgentConfig, ) -> Pin<Box<dyn Future<Output = Result<SpawnedAgent, SpawnError>> + Send>>
Convenience: invoke the wrapped closure directly without
touching the .0 field at every call site.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentSpawnerFn
impl !UnwindSafe for AgentSpawnerFn
impl Freeze for AgentSpawnerFn
impl Send for AgentSpawnerFn
impl Sync for AgentSpawnerFn
impl Unpin for AgentSpawnerFn
impl UnsafeUnpin for AgentSpawnerFn
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