pub struct Registry<P> { /* private fields */ }Expand description
Registry for constructing interceptor chains.
Registry wraps an interceptor chain and allows adding more interceptors
via the with method. The chain can be extracted with build.
§Example
ⓘ
use rtc_interceptor::Registry;
// Create a new registry
let mut registry = Registry::new();
// Add interceptors (can be done in helper functions)
registry = registry
.with(SenderReportBuilder::new().build())
.with(ReceiverReportBuilder::new().build());
// Build the final chain
let chain = registry.build();§Helper Function Pattern
ⓘ
fn register_default_interceptors<P: Interceptor>(
registry: Registry<P>,
) -> Registry<impl Interceptor> {
registry
.with(SenderReportBuilder::new().build())
.with(ReceiverReportBuilder::new().build())
}
let registry = Registry::new();
let registry = register_default_interceptors(registry);
let chain = registry.build();Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Registry<P>where
P: Freeze,
impl<P> RefUnwindSafe for Registry<P>where
P: RefUnwindSafe,
impl<P> Send for Registry<P>where
P: Send,
impl<P> Sync for Registry<P>where
P: Sync,
impl<P> Unpin for Registry<P>where
P: Unpin,
impl<P> UnwindSafe for Registry<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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