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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.