use std::fmt;
use serde::{Serialize, Deserialize};
use super::Thumbnail;
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ContentHints {
#[serde(skip_serializing_if = "Option::is_none")]
pub indexable_text: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumbnail: Option<Thumbnail>,
}
impl fmt::Display for ContentHints {
fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
let json = serde_json::to_string_pretty(&self)
.unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
write!(f, "{}", json)
}
}
impl ContentHints {
pub fn new() -> Self {
Self { ..Default::default() }
}
}