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
#![allow(deprecated)]
use serde_repr::{Deserialize_repr, Serialize_repr};
/// 5.4 Ad Position
///
/// The following table specifies the position of the ad as a relative measure of visibility or
/// prominence. This OpenRTB table has values derived from the Inventory Quality Guidelines (IQG).
/// Practitioners should keep in sync with updates to the IQG values as published on IAB.com. Values
/// “4” - “7” apply to apps per the mobile addendum to IQG version 2.1.
#[derive(Serialize_repr, Deserialize_repr, Debug, PartialEq, Eq, Clone, Copy)]
#[repr(i32)]
pub enum AdPosition {
/// Unknown
Unknown = 0,
/// Above the Fold
AboveTheFold,
/// DEPRECATED - May or may not be initially visible depending on screen size/resolution.
#[deprecated(since = "0.1.0", note = "Please use the BelowTheFold variant instead")]
LikelyBelowTheFold,
/// Below the Fold
BelowTheFold,
/// Header
Header,
/// Footer
Footer,
/// Sidebar
Sidebar,
/// Full Screen
FullScreen,
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn json() -> serde_json::Result<()> {
assert!(serde_json::from_str::<AdPosition>("-1").is_err());
let json = "[0,1]";
let e1: Vec<AdPosition> = serde_json::from_str(json)?;
assert_eq!(e1, vec![AdPosition::Unknown, AdPosition::AboveTheFold]);
assert_eq!(serde_json::to_string(&e1)?, json);
Ok(())
}
}