Skip to content

Commit

Permalink
Add Url::into_string
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Mar 30, 2016
1 parent 5da6a91 commit a6d71ee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,22 @@ impl Url {
}.parse_url(input)
}

/// Return the serialization of this URL.
///
/// This is fast since that serialization is already stored in the `Url` struct.
#[inline]
pub fn as_str(&self) -> &str {
&self.serialization
}

/// Return the serialization of this URL.
///
/// This consumes the `Url` and takes ownership of the `String` stored in it.
#[inline]
pub fn into_string(self) -> String {
self.serialization
}

/// Return the scheme of this URL, lower-cased, as an ASCII string without the ':' delimiter.
#[inline]
pub fn scheme(&self) -> &str {
Expand Down

0 comments on commit a6d71ee

Please sign in to comment.