pub struct RequestPipeline { /* private fields */ }Expand description
Sequential runner for a chain of ContextServices. The pipeline
owns the services and threads a Context through them one after
another, short-circuiting on the first error.
This replaces the legacy MiddlewareRegistry::process loop.
Implementations§
Source§impl RequestPipeline
impl RequestPipeline
Sourcepub const fn from_services(services: Vec<ContextService>) -> Self
pub const fn from_services(services: Vec<ContextService>) -> Self
Build a pipeline from a vec of services.
Sourcepub fn push(&mut self, svc: ContextService)
pub fn push(&mut self, svc: ContextService)
Push a service onto the end of the pipeline.
Sourcepub async fn run(&mut self, ctx: Context) -> Result<Context>
pub async fn run(&mut self, ctx: Context) -> Result<Context>
Run every service in registration order, threading the Context
through. Returns the final Context once the chain completes,
or the first YetiError.
§Errors
Surfaces the first Err returned by any registered service.
Subsequent services are skipped.
Sourcepub fn services(&self) -> &[ContextService] ⓘ
pub fn services(&self) -> &[ContextService] ⓘ
Borrow the underlying service vector (for snapshots / cloning).
Sourcepub fn into_composed(self) -> ContextService
pub fn into_composed(self) -> ContextService
Compose every registered service into a single ContextService.
Per-request the host clones the composed service (one Arc
bump) and calls it once — versus the unfrozen path which clones
every service per request and allocates a Vec. Used by the
router’s freeze_middleware to build the hot-path snapshot.