Skip to main content

Crate serenade_notifier

Crate serenade_notifier 

Source
Expand description

SMS and push notification channels (Symfony Notifier shaped).

Types: Notification, Channel, SmsMessage, PushMessage. Transports: NullTransport, MemoryTransport, SmsOnlyTransport. DI: RegisterDefaultNotifierPass seeds DEFAULT_NOTIFIER_SERVICE.

§Examples

use serenade_notifier::{MemoryTransport, Notification, Transport};

let transport = MemoryTransport::new();
transport.send(&Notification::sms("+15551212", "hello"))?;
assert_eq!(transport.sent().len(), 1);

Structs§

MemoryTransport
Records every successful send for inspection in tests and local apps.
NotifierService
Newtype so transport trait objects can be stored in the container.
NullTransport
Discards every notification after validation (Symfony NullTransport analogue).
PushMessage
Push payload (device token + title + body).
RegisterDefaultNotifierPass
Seeds DEFAULT_NOTIFIER_SERVICE with a NullTransport when missing.
SmsMessage
SMS payload (phone + body).
SmsOnlyTransport
Rejects push; accepts SMS (useful when only an SMS vendor is wired).

Enums§

Channel
Delivery channel for a crate::Notification.
Notification
Outgoing notification before a transport sends it.
NotifierError
Failure while building or sending a notification.

Constants§

DEFAULT_NOTIFIER_SERVICE
Container id of the default notifier when registered by the pass.
NOTIFIER_TRANSPORT_TAG
Service tag applied to notifier transport definitions.

Traits§

Transport
Sends a Notification synchronously.

Functions§

version
Compile-time crate version for diagnostics.