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: 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§

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");

Set the URI of the referenced resource.

Examples
use atom_syndication::Link;

let mut link = Link::default();
link.set_href("http://example.com");

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");

Set the relation type of this link.

Examples
use atom_syndication::Link;

let mut link = Link::default();
link.set_rel("alternate");

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"));

Set the language of the referenced resource.

Examples
use atom_syndication::Link;

let mut link = Link::default();
link.set_hreflang("en".to_string());

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"));

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());

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"));

Set the title of the referenced resource.

Examples
use atom_syndication::Link;

let mut link = Link::default();
link.set_title("Article Title".to_string());

Return the content length of the referenced resource in bytes.

Examples
use atom_syndication::Link;

let mut link = Link::default();
link.set_length("1000".to_string());
assert_eq!(link.length(), Some("1000"));

Set the content length of the referenced resource in bytes.

Examples
use atom_syndication::Link;

let mut link = Link::default();
link.set_length("1000".to_string());

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.