1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pub mod message;
pub(crate) mod stdout;
pub mod telegram;
pub use message::{Media, Message};
pub use stdout::Stdout;
pub use telegram::Telegram;
use crate::error::sink::Error as SinkError;
#[derive(Debug)]
pub enum Sink {
Telegram(Telegram),
Stdout(Stdout),
}
impl Sink {
pub async fn send(&self, message: Message, tag: Option<&str>) -> Result<(), SinkError> {
match self {
Self::Telegram(t) => t.send(message, tag).await,
Self::Stdout(s) => s.send(message, tag).await,
}
}
}