openrtb_native1/request/
title.rs

1/// 4.3 Title Request Object
2///
3/// The Title object is to be used for title element of the Native ad.
4#[derive(serde::Serialize, serde::Deserialize, Default, Debug, PartialEq, Clone)]
5pub struct Title {
6    /// required; integer; -
7    /// Maximum length of the text in the title element. Recommended to be 25, 90, or 140.
8    pub len: i32,
9
10    /// optional; object; -
11    /// This object is a placeholder that may contain custom JSON agreed to by the parties to
12    /// support flexibility beyond the standard defined in this specification.
13    #[serde(default, skip_serializing_if = "Option::is_none")]
14    pub ext: Option<serde_json::Map<String, serde_json::Value>>,
15}
16
17#[cfg(test)]
18mod test {
19    use super::*;
20
21    #[test]
22    fn json() -> serde_json::Result<()> {
23        let json = r#"{"len":0}"#;
24        let o1 = Title::default();
25        assert_eq!(serde_json::to_string(&o1)?, json);
26        assert_eq!(o1, serde_json::from_str::<Title>(json)?);
27
28        Ok(())
29    }
30}