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
mod bot_connection_info;

pub use self::bot_connection_info::BotConnectionInfo;

use serde::{Deserialize, Serialize};

/// Gateway information containing the URL to connect to.
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct ConnectionInfo {
    /// URL to the gateway.
    pub url: String,
}

#[cfg(test)]
mod tests {
    use super::ConnectionInfo;
    use serde_test::Token;

    #[test]
    fn test_connection_info() {
        let value = ConnectionInfo {
            url: "wss://gateway.discord.gg".to_owned(),
        };

        serde_test::assert_tokens(
            &value,
            &[
                Token::Struct {
                    name: "ConnectionInfo",
                    len: 1,
                },
                Token::Str("url"),
                Token::Str("wss://gateway.discord.gg"),
                Token::StructEnd,
            ],
        );
    }
}