pub struct PluginChain { /* private fields */ }Expand description
An ordered sequence of StagePlugins that run at a single
PluginPosition.
Created by PluginRegistry::chain_for and executed by calling
PluginChain::run. An empty chain is a no-op: run returns
PluginOutput::passthrough(input) immediately.
§Execution Model
Plugins run serially in insertion order. If any plugin returns a
non-Continue status, execution halts and that output is returned
immediately without running the remaining plugins.
This matches the common middleware short-circuit pattern and keeps plugin authors free from reasoning about concurrent modifications.
Implementations§
Source§impl PluginChain
impl PluginChain
Sourcepub fn new(position: PluginPosition) -> Self
pub fn new(position: PluginPosition) -> Self
Sourcepub fn push(&mut self, plugin: Arc<dyn StagePlugin>)
pub fn push(&mut self, plugin: Arc<dyn StagePlugin>)
Append a plugin to the end of the chain.
Plugins execute in the order they were added.
§Panics
This function does not panic.
Sourcepub async fn run(&self, input: PluginInput) -> PluginOutput
pub async fn run(&self, input: PluginInput) -> PluginOutput
Execute all plugins in order, stopping early on Abort or Error.
Returns the final PluginOutput after all plugins have run (or the
first non-Continue output). If the chain is empty, returns
PluginOutput::passthrough(input) immediately.
§Panics
This function does not panic (plugin panics are the caller’s bug).
Trait Implementations§
Source§impl Clone for PluginChain
impl Clone for PluginChain
Source§fn clone(&self) -> PluginChain
fn clone(&self) -> PluginChain
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for PluginChain
impl Default for PluginChain
Source§fn default() -> PluginChain
fn default() -> PluginChain
Auto Trait Implementations§
impl !RefUnwindSafe for PluginChain
impl !UnwindSafe for PluginChain
impl Freeze for PluginChain
impl Send for PluginChain
impl Sync for PluginChain
impl Unpin for PluginChain
impl UnsafeUnpin for PluginChain
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request