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
/// 3.2.17 Object: Producer
///
/// This object defines the producer of the content in which the ad will be shown. This is
/// particularly useful when the content is syndicated and may be distributed through different
/// publishers and thus when the producer and publisher are not necessarily the same entity.
#[derive(serde::Serialize, serde::Deserialize, Default, Debug, PartialEq, Clone)]
pub struct Producer<'a> {
/// string
/// Content producer or originator ID. Useful if content is syndicated and may be posted on a
/// site using embed tags.
#[serde(borrow, default, skip_serializing_if = "Option::is_none")]
pub id: Option<std::borrow::Cow<'a, str>>,
/// string
/// Content producer or originator name (e.g., “Warner Bros”).
#[serde(borrow, default, skip_serializing_if = "Option::is_none")]
pub name: Option<std::borrow::Cow<'a, str>>,
/// string array
/// Array of IAB content categories that describe the content producer. Refer to List 5.1.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cat: Option<Vec<crate::ContentCategory>>,
/// string
/// Highest level domain of the content producer (e.g., “producer.com”).
#[serde(borrow, default, skip_serializing_if = "Option::is_none")]
pub domain: Option<std::borrow::Cow<'a, str>>,
/// object
/// Placeholder for exchange-specific extensions to OpenRTB.
#[serde(borrow, default, skip_serializing_if = "Option::is_none")]
pub ext: Option<json_ext::Object<'a>>,
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn json() -> serde_json::Result<()> {
let json = "{}";
let o1 = Producer::default();
assert_eq!(serde_json::to_string(&o1)?, json);
assert_eq!(o1, serde_json::from_str::<Producer>(json)?);
Ok(())
}
}