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 |
user | A URL subcomponent for user authentication. |
host | A domain name or IP address. For example, |
port | A TCP port number, for example |
path | The path component of a URL, for example |
query | The query component of a URL. |
fragment | The fragment component, such as |
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
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".