twilight_model/channel/message/embed/
field.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
4pub struct EmbedField {
5    #[serde(default)]
6    pub inline: bool,
7    pub name: String,
8    pub value: String,
9}
10
11#[cfg(test)]
12mod tests {
13    use super::EmbedField;
14    use serde_test::Token;
15
16    #[test]
17    fn embed_field() {
18        let value = EmbedField {
19            inline: true,
20            name: "name".to_owned(),
21            value: "value".to_owned(),
22        };
23
24        serde_test::assert_tokens(
25            &value,
26            &[
27                Token::Struct {
28                    name: "EmbedField",
29                    len: 3,
30                },
31                Token::Str("inline"),
32                Token::Bool(true),
33                Token::Str("name"),
34                Token::Str("name"),
35                Token::Str("value"),
36                Token::Str("value"),
37                Token::StructEnd,
38            ],
39        );
40    }
41}