scryfall/card/
preview.rs

1//! Struct describing card preview information.
2use chrono::NaiveDate;
3use serde::{Deserialize, Serialize};
4use url::Url;
5
6/// Struct describing card preview information.
7#[derive(Serialize, Deserialize, Clone, Eq, PartialEq, Hash, Debug, Default)]
8#[cfg_attr(test, serde(deny_unknown_fields))]
9pub struct Preview {
10    /// The date this card was previewed.
11    pub previewed_at: Option<NaiveDate>,
12
13    /// A link to the preview for this card.
14    ///
15    /// NOTE: Sometimes this is an empty string, causing the `Url`
16    /// deserialization to fail. If this happens, a `None` variant is used
17    /// instead.
18    #[serde(deserialize_with = "crate::util::deserialize_or_none")]
19    pub source_uri: Option<Url>,
20
21    /// The name of the source that previewed this card.
22    pub source: Option<String>,
23}