[src]

Struct url::Url

pub struct Url {
    scheme: ~str,
    user: Option<UserInfo>,
    host: ~str,
    port: Option<~str>,
    path: ~str,
    query: Query,
    fragment: Option<~str>,
}

A Uniform Resource Locator (URL). A URL is a form of URI (Uniform Resource Identifier) that includes network location information, such as hostname or port number.

Example

use url::{Url, UserInfo};

let url = Url { scheme: ~"https",
                user: Some(UserInfo { user: ~"username", pass: None }),
                host: ~"example.com",
                port: Some(~"8080"),
                path: ~"/foo/bar",
                query: vec!((~"baz", ~"qux")),
                fragment: Some(~"quz") };
// https://username@example.com:8080/foo/bar?baz=qux#quz

Fields

scheme

The scheme part of a URL, such as https in the above example.

user

A URL subcomponent for user authentication. username in the above example.

host

A domain name or IP address. For example, example.com.

port

A TCP port number, for example 8080.

path

The path component of a URL, for example /foo/bar.

query

The query component of a URL. vec!((~"baz", ~"qux")) represents the fragment baz=qux in the above example.

fragment

The fragment component, such as quz. Doesn't include the leading # character.

Methods

impl Url

fn new(scheme: ~str, user: Option<UserInfo>, host: ~str, port: Option<~str>, path: ~str, query: Query, fragment: Option<~str>) -> Url

Trait Implementations

impl FromStr for Url

fn from_str(s: &str) -> Option<Url>

impl Show for Url

fn fmt(&self, f: &mut Formatter) -> Result

Converts a URL from Url to string representation.

Arguments

url - a URL.

Returns

A string that contains the formatted URL. Note that this will usually be an inverse of from_str but might strip out unneeded separators; for example, "http://somehost.com?", when parsed and formatted, will result in just "http://somehost.com".

impl<S: Writer> Hash<S> for Url

fn hash(&self, state: &mut S)

Derived Implementations

impl TotalEq for Url

fn assert_receiver_is_total_eq(&self)

impl Eq for Url

fn eq(&self, __arg_0: &Url) -> bool

fn ne(&self, __arg_0: &Url) -> bool

impl Clone for Url

fn clone(&self) -> Url