pub struct InboundRegistry { /* private fields */ }Expand description
A runtime registry that maps provider names to InboundWebhook
implementations.
Used by the generic webhook processor to look up the right handler at request time without compile-time knowledge of which providers are registered.
§Example
ⓘ
use sms_core::InboundRegistry;
use std::sync::Arc;
let registry = InboundRegistry::new()
.with(Arc::new(plivo_client))
.with(Arc::new(sns_client));
// Later, in a request handler:
if let Some(hook) = registry.get("plivo") {
let msg = hook.parse_inbound(&headers, &body)?;
}Implementations§
Source§impl InboundRegistry
impl InboundRegistry
Sourcepub fn with(self, hook: Arc<dyn InboundWebhook>) -> Self
pub fn with(self, hook: Arc<dyn InboundWebhook>) -> Self
Register a provider. The provider’s InboundWebhook::provider()
return value is used as the lookup key.
Trait Implementations§
Source§impl Clone for InboundRegistry
impl Clone for InboundRegistry
Source§fn clone(&self) -> InboundRegistry
fn clone(&self) -> InboundRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for InboundRegistry
impl Default for InboundRegistry
Source§fn default() -> InboundRegistry
fn default() -> InboundRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InboundRegistry
impl !RefUnwindSafe for InboundRegistry
impl Send for InboundRegistry
impl Sync for InboundRegistry
impl Unpin for InboundRegistry
impl UnsafeUnpin for InboundRegistry
impl !UnwindSafe for InboundRegistry
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