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: String
The URI of the referenced resource.
rel: String
The 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)
pub fn set_href<V>(&mut self, href: V)
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)
pub fn set_rel<V>(&mut self, rel: V)
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)
pub fn set_hreflang<V>(&mut self, hreflang: V)
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)
pub fn set_mime_type<V>(&mut self, mime_type: V)
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)
pub fn set_title<V>(&mut self, title: V)
Set the title of the referenced resource.
§Examples
use atom_syndication::Link;
let mut link = Link::default();
link.set_title("Article Title".to_string());
Trait Implementations§
impl StructuralPartialEq for Link
Auto Trait Implementations§
impl Freeze for Link
impl RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl UnwindSafe for Link
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more