winget_types/locale/documentation/
mod.rs

1mod label;
2
3pub use label::DocumentLabel;
4use url::Url;
5
6#[derive(Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[cfg_attr(feature = "serde", serde(rename_all = "PascalCase"))]
9pub struct Documentation {
10    /// The label of the documentation for providing software guides such as manuals and
11    /// troubleshooting URLs.
12    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
13    pub document_label: Option<DocumentLabel>,
14
15    /// The URL for a documentation.
16    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
17    pub document_url: Option<Url>,
18}
19
20impl Documentation {
21    /// Returns `true` if all fields of the `Documentation` are empty.
22    ///
23    /// # Examples
24    ///
25    /// ```
26    /// use winget_types::locale::{Documentation, DocumentLabel};
27    ///
28    /// let mut documentation = Documentation::default();
29    /// assert!(documentation.is_empty());
30    ///
31    /// documentation.document_label = Some(DocumentLabel::new("Label").unwrap());
32    /// assert!(!documentation.is_empty());
33    #[must_use]
34    pub const fn is_empty(&self) -> bool {
35        self.document_label.is_none() && self.document_url.is_none()
36    }
37}