Enum pling::Notifier [−][src]
pub enum Notifier {
Command(Command),
Desktop(Desktop),
Email(Email),
Matrix(Matrix),
Slack(Slack),
Telegram(Telegram),
Webhook(Webhook),
}
Expand description
Notifiers which can be used to provide easily configurable notifications for your application.
Examples
Loading configuration from environment variables is relatively easy.
let notifiers = pling::Notifier::from_env();
for notifier in notifiers {
notifier.send_sync("Hello from env!");
}
With the serde-derive
feature you can also load a config via Serde like YAML, TOML or JSON.
let yaml = r#"---
- Telegram:
bot_token: 123:ABC
target_chat: 1234
"#;
let notifiers: Vec<pling::Notifier> = serde_yaml::from_str(yaml)?;
for notifier in notifiers {
notifier.send_sync("Hello from yaml!");
}
Variants
Command(Command)
Tuple Fields of Command
0: Command
Desktop(Desktop)
Tuple Fields of Desktop
0: Desktop
Email(Email)
Tuple Fields of Email
0: Email
Matrix(Matrix)
Tuple Fields of Matrix
0: Matrix
Slack(Slack)
Tuple Fields of Slack
0: Slack
Telegram(Telegram)
Tuple Fields of Telegram
0: Telegram
Webhook(Webhook)
Tuple Fields of Webhook
0: Webhook
Implementations
Send the notification synchronously.
Errors
Check the documentation of the given notification implementation errors for more details.
Panics
When this crate is built with only some features not everything is implemented.
For example it won’t work to Telegram::send_sync
when the feature http-sync
isn’t enabled.
Send the notification asynchronously.
Errors
Check the documentation of the given notification implementation errors for more details.
Panics
When this crate is built with only some features not everything is implemented.
For example it won’t work to Telegram::send_async
when the feature http-async
isn’t enabled.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Notifier
impl UnwindSafe for Notifier
Blanket Implementations
Mutably borrows from an owned value. Read more