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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
mod badge;
mod color;
mod emotes;
use std::sync::atomic::{AtomicUsize, Ordering};
pub use self::badge::{Badge, BadgeKind};
pub use self::color::{twitch_colors as colors, Twitch as TwitchColor, RGB};
pub use self::emotes::Emotes;
pub mod commands;
mod capability;
pub use self::capability::Capability;
mod error;
pub use self::error::Error;
mod client;
pub use self::client::Client;
mod writer;
pub use self::writer::Writer;
mod extension;
pub use self::extension::WriterExt;
mod channel;
pub use self::channel::Channel;
mod mutex;
pub(crate) use self::mutex::mutex_wrapper::MutexWrapper;
#[doc(hidden)]
pub mod userconfig;
pub use self::userconfig::UserConfig;
pub use self::userconfig::UserConfigBuilder;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct LocalUser {
pub user_id: u64,
pub display_name: Option<String>,
pub color: Option<TwitchColor>,
pub badges: Vec<Badge>,
pub emote_sets: Vec<u64>,
pub caps: Vec<Capability>,
}
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Message {
Irc(crate::irc::types::Message),
Join(commands::Join),
Part(commands::Part),
PrivMsg(commands::PrivMsg),
Mode(commands::Mode),
NamesStart(commands::NamesStart),
NamesEnd(commands::NamesEnd),
ClearChat(commands::ClearChat),
ClearMsg(commands::ClearMsg),
HostTargetStart(commands::HostTargetStart),
HostTargetEnd(commands::HostTargetEnd),
Notice(commands::Notice),
Reconnect(commands::Reconnect),
RoomState(commands::RoomState),
UserNotice(commands::UserNotice),
UserState(commands::UserState),
GlobalUserState(commands::GlobalUserState),
}
pub(crate) mod filter;
mod handler;
pub use handler::Handler;
#[derive(Copy, Clone, PartialEq)]
pub struct Token(pub(super) usize);
impl std::fmt::Display for Token {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
#[derive(Default)]
pub(crate) struct TokenGen(AtomicUsize);
impl TokenGen {
pub fn next(&mut self) -> Token {
Token(self.0.fetch_add(1, Ordering::Relaxed))
}
}