serenade-notifier 1.0.0

SMS and push notification channels with Null and in-memory transports
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Sync notifier transport contract.

use crate::{Channel, Notification, NotifierError};

/// Sends a [`Notification`] synchronously.
pub trait Transport: Send + Sync {
    /// Whether this transport handles `channel`.
    fn supports(&self, channel: Channel) -> bool;

    /// Delivers `notification` through this backend.
    ///
    /// # Errors
    ///
    /// Returns [`NotifierError`] when validation or delivery fails.
    fn send(&self, notification: &Notification) -> Result<(), NotifierError>;
}