twilight_model/guild/vanity_url.rs
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
use serde::{Deserialize, Serialize};
/// Information about a guild's vanity URL setting.
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct VanityUrl {
/// Code of the vanity URL.
///
/// For example, in an invite of `discord.gg/applejack`, the code is
/// `applejack`.
pub code: String,
/// Number of times the vanity URL has been used.
pub uses: u64,
}
#[cfg(test)]
mod tests {
use super::VanityUrl;
use serde_test::Token;
#[test]
fn vanity_url() {
let url = VanityUrl {
code: "a".to_owned(),
uses: 12,
};
serde_test::assert_tokens(
&url,
&[
Token::Struct {
name: "VanityUrl",
len: 2,
},
Token::String("code"),
Token::String("a"),
Token::String("uses"),
Token::U64(12),
Token::StructEnd,
],
);
}
}