Simon Sapin 10 lat temu
rodzic
commit
b4bbaaa521
5 zmienionych plików z 11 dodań i 4 usunięć
  1. 1 0
      src/host.rs
  2. 4 3
      src/lib.rs
  3. 2 0
      src/origin.rs
  4. 2 1
      src/parser.rs
  5. 2 0
      src/webidl.rs

+ 1 - 0
src/host.rs

@@ -143,6 +143,7 @@ impl<S: AsRef<str>> ToSocketAddrs for HostAndPort<S> {
     }
 }
 
+/// Socket addresses for an URL.
 pub struct SocketAddrs {
     state: SocketAddrsState
 }

+ 4 - 3
src/lib.rs

@@ -125,8 +125,9 @@ assert_eq!(css_url.as_str(), "http://servo.github.io/rust-url/main.css")
 
 extern crate idna;
 
+use encoding::EncodingOverride;
 use host::HostInternal;
-use parser::{Parser, Context};
+use parser::{Parser, Context, SchemeType, to_u32};
 use percent_encoding::{PATH_SEGMENT_ENCODE_SET, USERINFO_ENCODE_SET,
                        percent_encode, percent_decode, utf8_percent_encode};
 use std::cmp;
@@ -139,10 +140,9 @@ use std::ops::{Range, RangeFrom, RangeTo};
 use std::path::{Path, PathBuf};
 use std::str;
 
-pub use encoding::EncodingOverride;
 pub use origin::{Origin, OpaqueOrigin};
 pub use host::{Host, HostAndPort, SocketAddrs};
-pub use parser::{ParseError, SchemeType, to_u32};
+pub use parser::ParseError;
 pub use slicing::Position;
 pub use webidl::WebIdl;
 
@@ -183,6 +183,7 @@ pub struct Url {
     fragment_start: Option<u32>,  // Before '#', unlike Position::FragmentStart
 }
 
+/// Full configuration for the URL parser.
 #[derive(Copy, Clone)]
 pub struct ParseOptions<'a> {
     base_url: Option<&'a Url>,

+ 2 - 0
src/origin.rs

@@ -52,6 +52,8 @@ impl Origin {
         Origin::Opaque(OpaqueOrigin(Arc::new(0)))
     }
 
+    /// Return whether this origin is a (scheme, host, port) tuple
+    /// (as opposed to an opaque origin).
     pub fn is_tuple(&self) -> bool {
         matches!(*self, Origin::Tuple(..))
     }

+ 2 - 1
src/parser.rs

@@ -10,7 +10,8 @@ use std::ascii::AsciiExt;
 use std::error::Error;
 use std::fmt::{self, Formatter, Write};
 
-use super::{Url, EncodingOverride};
+use Url;
+use encoding::EncodingOverride;
 use host::{Host, HostInternal};
 use percent_encoding::{
     utf8_percent_encode, percent_encode,

+ 2 - 0
src/webidl.rs

@@ -34,10 +34,12 @@ impl WebIdl {
         }
     }
 
+    /// Getter for https://url.spec.whatwg.org/#dom-url-href
     pub fn href(url: &Url) -> &str {
         &url.serialization
     }
 
+    /// Setter for https://url.spec.whatwg.org/#dom-url-href
     pub fn set_href(url: &mut Url, value: &str) -> Result<(), ParseError> {
         *url = try!(Url::parse(value));
         Ok(())