drive_v3/objects/
content_hints.rs

1use std::fmt;
2use serde::{Serialize, Deserialize};
3
4use super::Thumbnail;
5
6/// Additional information about the content of the file.
7#[derive(Default, Debug, Clone, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct ContentHints {
10    /// Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML
11    /// elements.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub indexable_text: Option<String>,
14
15    /// A thumbnail for the file. This will only be used if Google Drive cannot generate a standard thumbnail.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub thumbnail: Option<Thumbnail>,
18}
19
20impl fmt::Display for ContentHints {
21    fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
22        let json = serde_json::to_string_pretty(&self)
23            .unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
24
25        write!(f, "{}", json)
26    }
27}
28
29impl ContentHints {
30    /// Creates a new, empty instance of this struct.
31    pub fn new() -> Self {
32        Self { ..Default::default() }
33    }
34}