pub struct Link {
pub href: Url,
pub rel: Option<SmallString>,
pub link_type: Option<MimeType>,
pub title: Option<String>,
pub length: Option<String>,
pub hreflang: Option<SmallString>,
pub thr_count: Option<u32>,
pub thr_updated: Option<DateTime<Utc>>,
}Expand description
Link in feed or entry
Fields§
§href: UrlLink URL
rel: Option<SmallString>Link relationship type (e.g., “alternate”, “enclosure”, “self”) Stored inline as these are typically short (≤24 bytes)
link_type: Option<MimeType>MIME type of the linked resource
title: Option<String>Human-readable link title
length: Option<String>Length of the linked resource in bytes (raw string value, as in Python feedparser)
hreflang: Option<SmallString>Language of the linked resource (stored inline for lang codes ≤24 bytes)
thr_count: Option<u32>RFC 4685 §4: number of replies at the IRI
thr_updated: Option<DateTime<Utc>>RFC 4685 §4: when the reply resource was last modified
Implementations§
Source§impl Link
impl Link
Sourcepub fn new(href: impl Into<Url>, rel: impl AsRef<str>) -> Self
pub fn new(href: impl Into<Url>, rel: impl AsRef<str>) -> Self
Create a new link with just URL and relation type
Sourcepub fn alternate(href: impl Into<Url>) -> Self
pub fn alternate(href: impl Into<Url>) -> Self
Create an alternate link (common for entry URLs)
Sourcepub fn self_link(href: impl Into<Url>, mime_type: impl Into<MimeType>) -> Self
pub fn self_link(href: impl Into<Url>, mime_type: impl Into<MimeType>) -> Self
Create a self link (for feed URLs)
Sourcepub fn enclosure(href: impl Into<Url>, mime_type: Option<MimeType>) -> Self
pub fn enclosure(href: impl Into<Url>, mime_type: Option<MimeType>) -> Self
Create an enclosure link (for media)
Create a related link
Create a banner image link (JSON Feed banner_image, project-internal convention)
Note: rel="banner" is not a standard link relation. It is used here as a project
convention to store JSON Feed banner_image in the existing Link type. Consumers
must search entry.links for rel="banner" to retrieve this field.