pub fn service_fn<C, F, Fut, O>(name: &'static str, run: F) -> FnService<C, F>Expand description
Wraps an async function as a SupervisedService.
This keeps one-off services ergonomic without widening the core trait surface or forcing callers into a monolithic service object pattern.
The resulting service can be registered with
SupervisorBuilder::add or
SupervisorBuilder::add_with_options.
The closure’s Context parameter determines the extracted service
context. With a stateful builder, that usually means:
Context<AppState>when the service wants the full root stateContext<Subset>whenSubset: FromSupervisorState<AppState>