Struct atom_syndication::Link
source · pub struct Link {
pub href: String,
pub rel: String,
pub hreflang: Option<String>,
pub mime_type: Option<String>,
pub title: Option<String>,
pub length: Option<String>,
}Expand description
Represents a link in an Atom feed
Fields§
§href: StringThe URI of the referenced resource.
rel: StringThe link relationship type.
hreflang: Option<String>The language of the resource.
mime_type: Option<String>The MIME type of the resource.
title: Option<String>Human-readable information about the link.
length: Option<String>The length of the resource, in bytes.
Implementations§
source§impl Link
impl Link
sourcepub fn href(&self) -> &str
pub fn href(&self) -> &str
Return the URI the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_href("http://example.com");
assert_eq!(link.href(), "http://example.com");sourcepub fn set_href<V>(&mut self, href: V)where
V: Into<String>,
pub fn set_href<V>(&mut self, href: V)where
V: Into<String>,
Set the URI of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_href("http://example.com");sourcepub fn rel(&self) -> &str
pub fn rel(&self) -> &str
Return the relation type of this link.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_rel("alternate");
assert_eq!(link.rel(), "alternate");sourcepub fn set_rel<V>(&mut self, rel: V)where
V: Into<String>,
pub fn set_rel<V>(&mut self, rel: V)where
V: Into<String>,
Set the relation type of this link.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_rel("alternate");sourcepub fn hreflang(&self) -> Option<&str>
pub fn hreflang(&self) -> Option<&str>
Return the language of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_hreflang("en".to_string());
assert_eq!(link.hreflang(), Some("en"));sourcepub fn set_hreflang<V>(&mut self, hreflang: V)where
V: Into<Option<String>>,
pub fn set_hreflang<V>(&mut self, hreflang: V)where
V: Into<Option<String>>,
Set the language of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_hreflang("en".to_string());sourcepub fn mime_type(&self) -> Option<&str>
pub fn mime_type(&self) -> Option<&str>
Return the MIME type of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_mime_type("text/html".to_string());
assert_eq!(link.mime_type(), Some("text/html"));sourcepub fn set_mime_type<V>(&mut self, mime_type: V)where
V: Into<Option<String>>,
pub fn set_mime_type<V>(&mut self, mime_type: V)where
V: Into<Option<String>>,
Set the MIME type of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_mime_type("text/html".to_string());sourcepub fn title(&self) -> Option<&str>
pub fn title(&self) -> Option<&str>
Return the title of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_title("Article Title".to_string());
assert_eq!(link.title(), Some("Article Title"));sourcepub fn set_title<V>(&mut self, title: V)where
V: Into<Option<String>>,
pub fn set_title<V>(&mut self, title: V)where
V: Into<Option<String>>,
Set the title of the referenced resource.
Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_title("Article Title".to_string());