pub struct PipelineBuilder { /* private fields */ }Expand description
Pipeline builder structure that holds the list of added middleware as well as providing ways of interacting with that list
Implementations§
Source§impl PipelineBuilder
impl PipelineBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new PipelineBuilder object
Sourcepub fn with(
&mut self,
middleware: fn(&mut dyn PipelineContext, Pipeline) -> Result<(), Box<dyn Error>>,
)
pub fn with( &mut self, middleware: fn(&mut dyn PipelineContext, Pipeline) -> Result<(), Box<dyn Error>>, )
Adds a new [MiddlewareThunk] to the pipeline. This can be a free standing fn or an inline closure
Sourcepub fn when(
&mut self,
predicate: fn(&mut dyn PipelineContext) -> bool,
builder: fn(&mut PipelineBuilder),
)
pub fn when( &mut self, predicate: fn(&mut dyn PipelineContext) -> bool, builder: fn(&mut PipelineBuilder), )
Branches the Pipeline based on the result of the given [PredicateThunk] with the new set of PipelineBuilder instructions
Sourcepub fn assemble(self) -> Pipeline
pub fn assemble(self) -> Pipeline
Assembles the pipeline giving a single entrypoint to pass a PipelineContext in.
The resulting Pipeline object can be cached and run multiple times with different contexts
Auto Trait Implementations§
impl Freeze for PipelineBuilder
impl !RefUnwindSafe for PipelineBuilder
impl !Send for PipelineBuilder
impl !Sync for PipelineBuilder
impl Unpin for PipelineBuilder
impl !UnwindSafe for PipelineBuilder
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