Skip to main content

Notifier

Trait Notifier 

Source
pub trait Notifier: Send + Sync {
    // Required method
    fn send(&self, notification: Notification) -> Result<(), NotifyError>;
}
Expand description

通知发送器 trait — 对齐 PHP think\notify\Notifier

抽象通知发送行为,业务方实现具体发送逻辑(Slack Webhook / 短信 API / 日志等)。

§PHP 对齐

// PHP think\notify\Notifier 接口
interface Notifier {
    public function send(Message $message): bool;
}

Required Methods§

Source

fn send(&self, notification: Notification) -> Result<(), NotifyError>

发送通知

§参数
  • notification: 通知消息
§返回

成功返回 Ok(()),失败返回 NotifyError

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§