[−][src]Struct hyper::header::Link
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 hyper::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 LinkValue
s.
pub fn push_value(&mut self, link_value: LinkValue)
[src]
Add a LinkValue
instance to the Link
header's values.
Trait Implementations
impl Clone for Link
[src]
impl Debug for Link
[src]
impl Display for Link
[src]
impl FromStr for Link
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Link>
[src]
impl Header for Link
[src]
fn header_name() -> &'static str
[src]
fn parse_header(raw: &Raw) -> Result<Link>
[src]
fn fmt_header(&self, f: &mut Formatter) -> Result
[src]
impl PartialEq<Link> for Link
[src]
impl StructuralPartialEq for Link
[src]
Auto Trait Implementations
impl RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl UnwindSafe for Link
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,