vast4/
viewable.rs

1/// The ad server may provide URIs for tracking publisher-determined viewability, for both the
2/// [`InLine`](crate::InLine) ad and any [`Wrapper`](crate::Wrapper)s, using the
3/// `<ViewableImpression>` element.
4///
5/// ```text
6/// <xs:complexType name="ViewableImpression" >
7///   <xs:attribute name="id" type="xs:string" use="optional">
8///   <xs:sequence>
9///     <xs:element name="Viewable" minOccurs="0" maxOccurs="unbounded" type="xs:anyURI">
10///     <xs:element name="NotViewable" minOccurs="0" maxOccurs="unbounded" type="xs:anyURI">
11///     <xs:element name="ViewUndetermined" minOccurs="0" maxOccurs="unbounded" type="xs:anyURI">
12///   </xs:sequence>
13/// </xs:complexType>
14/// ```
15#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
16#[xml(tag = "ViewableImpression", strict(unknown_attribute, unknown_element))]
17pub struct ViewableImpression<'a> {
18    /// An ad server id for the impression. Impression resources of the same id should be requested
19    /// at the same time or as close in time as possible to help prevent discrepancies.
20    #[xml(attr = "id")]
21    pub id: Option<std::borrow::Cow<'a, str>>,
22
23    /// A URI that directs the video player to a tracking resource file that the video player
24    /// should request at the time that criteria is met for a viewable impression. This can occur
25    /// zero to many times.
26    #[xml(flatten_text = "Viewable", cdata, default)]
27    pub viewables: Vec<std::borrow::Cow<'a, str>>,
28    /// A URI that directs the video player to a tracking resource file that the video player
29    /// should request if the ad is executed but never meets criteria for a viewable impression.
30    #[xml(flatten_text = "NotViewable", cdata, default)]
31    pub not_viewables: Vec<std::borrow::Cow<'a, str>>,
32    /// A URI that directs the video player to a tracking resource file that the video player
33    /// should request if the player cannot determine whether criteria is met for a viewable
34    /// impression. This can occur zero to many times.
35    #[xml(flatten_text = "ViewUndetermined", cdata, default)]
36    pub view_undetermineds: Vec<std::borrow::Cow<'a, str>>,
37}