pub struct PushNotificationSink { /* private fields */ }Expand description
Push notification sink
Receives payloads from the deliver operator and sends push
notifications to all registered device tokens for the recipient.
§Preferences
If a NotificationPreferencesStore is attached via with_preferences,
the sink checks user preferences before sending. Disabled notification
types are silently dropped (same pattern as InAppNotificationSink).
§Stale token cleanup
When a push provider returns PermanentError (e.g., DeviceNotRegistered),
the corresponding device token is automatically unregistered from the store.
Implementations§
Source§impl PushNotificationSink
impl PushNotificationSink
Sourcepub fn with_provider(
device_tokens: Arc<DeviceTokenStore>,
provider: Arc<dyn PushProvider>,
) -> Self
pub fn with_provider( device_tokens: Arc<DeviceTokenStore>, provider: Arc<dyn PushProvider>, ) -> Self
Create with a custom push provider
Sourcepub fn with_config(
device_tokens: Arc<DeviceTokenStore>,
provider: Arc<dyn PushProvider>,
retry_config: RetryConfig,
) -> Self
pub fn with_config( device_tokens: Arc<DeviceTokenStore>, provider: Arc<dyn PushProvider>, retry_config: RetryConfig, ) -> Self
Create with custom provider and retry config
Sourcepub fn with_preferences(
self,
preferences: Arc<NotificationPreferencesStore>,
) -> Self
pub fn with_preferences( self, preferences: Arc<NotificationPreferencesStore>, ) -> Self
Attach a preferences store to check before sending
When set, the sink checks is_enabled(recipient, notification_type)
before sending. Disabled types are silently dropped.
Trait Implementations§
Source§impl Debug for PushNotificationSink
impl Debug for PushNotificationSink
Source§impl Sink for PushNotificationSink
impl Sink for PushNotificationSink
Source§fn deliver<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
payload: Value,
recipient_id: Option<&'life1 str>,
context_vars: &'life2 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn deliver<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
payload: Value,
recipient_id: Option<&'life1 str>,
context_vars: &'life2 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Deliver a payload to this sink Read more
Auto Trait Implementations§
impl Freeze for PushNotificationSink
impl !RefUnwindSafe for PushNotificationSink
impl Send for PushNotificationSink
impl Sync for PushNotificationSink
impl Unpin for PushNotificationSink
impl UnsafeUnpin for PushNotificationSink
impl !UnwindSafe for PushNotificationSink
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