pub struct InterceptorChain { /* private fields */ }Expand description
拦截器链 — 按顺序执行多个拦截器(非泛型,支持异构拦截器混合)
Implementations§
Source§impl InterceptorChain
impl InterceptorChain
pub fn new() -> Self
Sourcepub fn push<I: Interceptor>(&mut self, interceptor: I)
pub fn push<I: Interceptor>(&mut self, interceptor: I)
添加拦截器(按值,自动 Arc<dyn Interceptor>)
Sourcepub fn push_arc(&mut self, interceptor: Arc<dyn Interceptor>)
pub fn push_arc(&mut self, interceptor: Arc<dyn Interceptor>)
添加已 Arc 包装的拦截器
Sourcepub fn before_all(&self, ctx: &CallContext) -> RIE<()>
pub fn before_all(&self, ctx: &CallContext) -> RIE<()>
before_all — 顺序执行,任一 Err 即停止
Sourcepub fn after_all(&self, ctx: &CallContext, result: &mut CallResult)
pub fn after_all(&self, ctx: &CallContext, result: &mut CallResult)
after_all — 逆序执行,可传递可变 CallResult 让拦截器加工
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for InterceptorChain
impl !UnwindSafe for InterceptorChain
impl Freeze for InterceptorChain
impl Send for InterceptorChain
impl Sync for InterceptorChain
impl Unpin for InterceptorChain
impl UnsafeUnpin for InterceptorChain
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