[][src]Struct headers::UserAgent

pub struct UserAgent(_);

User-Agent header, defined in RFC7231

The User-Agent header field contains information about the user agent originating the request, which is often used by servers to help identify the scope of reported interoperability problems, to work around or tailor responses to avoid particular user agent limitations, and for analytics regarding browser or operating system use. A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so.

ABNF

User-Agent = product *( RWS ( product / comment ) )
product         = token ["/" product-version]
product-version = token

Example values

  • CERN-LineMode/2.15 libwww/2.17b3
  • Bunnies

Notes

  • The parser does not split the value

Example

use headers::UserAgent;

let ua = UserAgent::from_static("hyper/0.12.2");

Implementations

impl UserAgent[src]

pub fn from_static(src: &'static str) -> UserAgent[src]

Create a UserAgent from a static string.

Panic

Panics if the static string is not a legal header value.

pub fn as_str(&self) -> &str[src]

View this UserAgent as a &str.

Trait Implementations

impl Clone for UserAgent[src]

impl Debug for UserAgent[src]

impl Display for UserAgent[src]

impl Eq for UserAgent[src]

impl FromStr for UserAgent[src]

type Err = InvalidUserAgent

The associated error which can be returned from parsing.

impl Hash for UserAgent[src]

impl Header for UserAgent[src]

impl Ord for UserAgent[src]

impl PartialEq<UserAgent> for UserAgent[src]

impl PartialOrd<UserAgent> for UserAgent[src]

impl StructuralEq for UserAgent[src]

impl StructuralPartialEq for UserAgent[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.