twilight_model/gateway/connection_info/
mod.rs

1mod bot_connection_info;
2
3pub use self::bot_connection_info::BotConnectionInfo;
4
5use serde::{Deserialize, Serialize};
6
7/// Gateway information containing the URL to connect to.
8#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
9pub struct ConnectionInfo {
10    /// URL to the gateway.
11    pub url: String,
12}
13
14#[cfg(test)]
15mod tests {
16    use super::ConnectionInfo;
17    use serde_test::Token;
18
19    #[test]
20    fn connection_info() {
21        let value = ConnectionInfo {
22            url: "wss://gateway.discord.gg".to_owned(),
23        };
24
25        serde_test::assert_tokens(
26            &value,
27            &[
28                Token::Struct {
29                    name: "ConnectionInfo",
30                    len: 1,
31                },
32                Token::Str("url"),
33                Token::Str("wss://gateway.discord.gg"),
34                Token::StructEnd,
35            ],
36        );
37    }
38}