File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -819,6 +819,27 @@ impl Url {
819
819
self . slice ( ..self . scheme_end )
820
820
}
821
821
822
+ /// Return whether the URL is special (has a special scheme)
823
+ ///
824
+ /// # Examples
825
+ ///
826
+ /// ```
827
+ /// use url::Url;
828
+ /// # use url::ParseError;
829
+ ///
830
+ /// # fn run() -> Result<(), ParseError> {
831
+ /// assert!(Url::parse("http:///tmp/foo")?.is_special());
832
+ /// assert!(Url::parse("file:///tmp/foo")?.is_special());
833
+ /// assert!(!Url::parse("moz:///tmp/foo")?.is_special());
834
+ /// # Ok(())
835
+ /// # }
836
+ /// # run().unwrap();
837
+ /// ```
838
+ pub fn is_special ( & self ) -> bool {
839
+ let scheme_type = SchemeType :: from ( self . scheme ( ) ) ;
840
+ scheme_type. is_special ( )
841
+ }
842
+
822
843
/// Return whether the URL has an 'authority',
823
844
/// which can contain a username, password, host, and port number.
824
845
///
You can’t perform that action at this time.
0 commit comments