From 75fc7f27cbea6d680da5f9daa434ae0aefbd3f8c Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 1 Feb 2016 14:27:14 +0100 Subject: [PATCH] Enable doctests and correct nearby documentation. --- src/lib.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 14029c6a..be81b139 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -405,7 +405,8 @@ impl<'a> UrlParser<'a> { /// /// The default scheme type mapper is as follows: /// - /// ```ignore + /// ``` + /// # use url::SchemeType; /// fn whatwg_scheme_type_mapper(scheme: &str) -> SchemeType { /// match scheme { /// "file" => SchemeType::FileLike, @@ -622,13 +623,10 @@ impl Url { /// and may give nonsensical results for other schemes. /// It is the user’s responsibility to check the URL’s scheme before calling this. /// - /// The return type (when `Ok()`) is generic and can be either `std::path::posix::Path` - /// or `std::path::windows::Path`. - /// (Use `std::path::Path` to pick one of them depending on the local system.) - /// If the compiler can not infer the desired type from context, you may have to specify it: - /// - /// ```ignore - /// let path = url.to_file_path::(); + /// ``` + /// # use url::Url; + /// # let url = Url::parse("file:///etc/passwd").unwrap(); + /// let path = url.to_file_path(); /// ``` /// /// Returns `Err` if the host is neither empty nor `"localhost"`, @@ -963,13 +961,10 @@ impl RelativeSchemeData { /// and may give nonsensical results for other schemes. /// It is the user’s responsibility to check the URL’s scheme before calling this. /// - /// The return type (when `Ok()`) is generic and can be either `std::path::posix::Path` - /// or `std::path::windows::Path`. - /// (Use `std::path::Path` to pick one of them depending on the local system.) - /// If the compiler can not infer the desired type from context, you may have to specifiy it: - /// - /// ```ignore - /// let path = url.to_file_path::(); + /// ``` + /// # use url::Url; + /// # let url = Url::parse("file:///etc/passwd").unwrap(); + /// let path = url.to_file_path(); /// ``` /// /// Returns `Err` if the host is neither empty nor `"localhost"`,