Browse Source

Add Url::serialize_host()

Simon Sapin 12 years ago
parent
commit
fda647f1b8
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/url.rs

+ 8 - 0
src/url.rs

@@ -286,6 +286,14 @@ impl Url {
         }
     }
 
+    #[inline]
+    pub fn serialize_host(&self) -> Option<String> {
+        match self.scheme_data {
+            RelativeSchemeData(ref scheme_data) => Some(scheme_data.host.serialize()),
+            OtherSchemeData(..) => None,
+        }
+    }
+
     #[inline]
     pub fn serialize_path(&self) -> Option<String> {
         match self.scheme_data {