diff --git a/src/html.rs b/src/html.rs index 639a0c9..c22330e 100644 --- a/src/html.rs +++ b/src/html.rs @@ -11,6 +11,9 @@ const ICON_SELECTOR: &str = "link[rel~='icon'], link[rel~='apple-touch-icon'], link[rel~='apple-touch-icon-precomposed']"; const MANIFEST_SELECTOR: &str = "link[rel~='manifest']"; +/// Represents useful data scraped from HTML. +/// +/// To obtain, use [`HTML::scan_html`]. pub struct HTML { pub icons: Vec, pub manifest: Option, diff --git a/src/icon.rs b/src/icon.rs index c2bb062..2084e43 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -5,18 +5,30 @@ use url::Url; use crate::Error; +/// The source of a scraped icon. +/// +/// More sources may be added in the future. #[non_exhaustive] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum IconKind { + /// Discovered through checking a hardcoded URL path, like `/favicon.ico` HardcodedURL, + /// Discovered through parsing the HTML for ``s (or similar) LinkedInHTML, + /// Discovered through parsing the Web App Manifest linked in the HTML in `` LinkedInManifest, } +/// A scraped icon. +/// +/// To obtain, use [`crate::scrape`], [`crate::html::HTML::scan_html`], or [`crate::manifest::scan_manifest`]. #[derive(Debug, Clone)] pub struct Icon { + /// Describes how the icon was discovered pub kind: IconKind, + /// The source URL of the scraped icon, with redirects resolved pub url: Url, + /// The size of the scraped icon, in pixels pub size: ImageSize, }