serenade_notifier/
sms_only.rs1use crate::null::validate_for_send;
4use crate::{Channel, Notification, NotifierError, Transport};
5
6#[derive(Clone, Copy, Debug, Default)]
8pub struct SmsOnlyTransport;
9
10impl SmsOnlyTransport {
11 #[must_use]
13 pub const fn new() -> Self {
14 Self
15 }
16}
17
18impl Transport for SmsOnlyTransport {
19 fn supports(&self, channel: Channel) -> bool {
20 matches!(channel, Channel::Sms)
21 }
22
23 fn send(&self, notification: &Notification) -> Result<(), NotifierError> {
24 if !self.supports(notification.channel()) {
25 return Err(NotifierError::UnsupportedChannel {
26 channel: notification.channel().as_str().to_owned(),
27 });
28 }
29 validate_for_send(notification)
30 }
31}