twilight_model/voice/voice_region.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 42 43 44 45 46 47 48 49 50 51 52 53 54
use serde::{Deserialize, Serialize};
/// Geographically based collection of voice servers.
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct VoiceRegion {
/// Whether this is a custom voice region, used for e.g. events.
pub custom: bool,
/// Whether this is a deprecated voice region (avoid switching to these).
pub deprecated: bool,
/// Unique region identifier.
pub id: String,
/// Name of the region.
pub name: String,
/// Whether this is the closest region to the current user's client.
pub optimal: bool,
}
#[cfg(test)]
mod tests {
use super::VoiceRegion;
use serde_test::Token;
#[test]
fn voice_region() {
let value = VoiceRegion {
custom: false,
deprecated: false,
id: "region".to_owned(),
name: "Region".to_owned(),
optimal: false,
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "VoiceRegion",
len: 5,
},
Token::Str("custom"),
Token::Bool(false),
Token::Str("deprecated"),
Token::Bool(false),
Token::Str("id"),
Token::Str("region"),
Token::Str("name"),
Token::Str("Region"),
Token::Str("optimal"),
Token::Bool(false),
Token::StructEnd,
],
);
}
}