[][src]Struct hyperx::header::Link

pub struct Link { /* fields omitted */ }

The Link header, defined in RFC5988

ABNF

Link           = "Link" ":" #link-value
link-value     = "<" URI-Reference ">" *( ";" link-param )
link-param     = ( ( "rel" "=" relation-types )
               | ( "anchor" "=" <"> URI-Reference <"> )
               | ( "rev" "=" relation-types )
               | ( "hreflang" "=" Language-Tag )
               | ( "media" "=" ( MediaDesc | ( <"> MediaDesc <"> ) ) )
               | ( "title" "=" quoted-string )
               | ( "title*" "=" ext-value )
               | ( "type" "=" ( media-type | quoted-mt ) )
               | ( link-extension ) )
link-extension = ( parmname [ "=" ( ptoken | quoted-string ) ] )
               | ( ext-name-star "=" ext-value )
ext-name-star  = parmname "*" ; reserved for RFC2231-profiled
; extensions.  Whitespace NOT
; allowed in between.
ptoken         = 1*ptokenchar
ptokenchar     = "!" | "#" | "$" | "%" | "&" | "'" | "("
               | ")" | "*" | "+" | "-" | "." | "/" | DIGIT
               | ":" | "<" | "=" | ">" | "?" | "@" | ALPHA
               | "[" | "]" | "^" | "_" | "`" | "{" | "|"
               | "}" | "~"
media-type     = type-name "/" subtype-name
quoted-mt      = <"> media-type <">
relation-types = relation-type
               | <"> relation-type *( 1*SP relation-type ) <">
relation-type  = reg-rel-type | ext-rel-type
reg-rel-type   = LOALPHA *( LOALPHA | DIGIT | "." | "-" )
ext-rel-type   = URI

Example values

Link: <http://example.com/TheBook/chapter2>; rel="previous"; title="previous chapter"

Link: </TheBook/chapter2>; rel="previous"; title*=UTF-8'de'letztes%20Kapitel, </TheBook/chapter4>; rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel

Examples

use hyperx::header::{Headers, Link, LinkValue, RelationType};

let link_value = LinkValue::new("http://example.com/TheBook/chapter2")
    .push_rel(RelationType::Previous)
    .set_title("previous chapter");

let mut headers = Headers::new();
headers.set(
    Link::new(vec![link_value])
);

Methods

impl Link[src]

pub fn new(link_values: Vec<LinkValue>) -> Link[src]

Create Link from a Vec<LinkValue>.

pub fn values(&self) -> &[LinkValue][src]

Get the Link header's LinkValues.

pub fn push_value(&mut self, link_value: LinkValue)[src]

Add a LinkValue instance to the Link header's values.

Trait Implementations

impl StandardHeader for Link[src]

impl Header for Link[src]

impl Clone for Link[src]

impl PartialEq<Link> for Link[src]

impl Display for Link[src]

impl Debug for Link[src]

impl FromStr for Link[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Link

impl Unpin for Link

impl Sync for Link

impl RefUnwindSafe for Link

impl UnwindSafe for Link

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]