Эх сурвалжийг харах

Don’t mention the query_encoding in top-level crate docs. It’s very niche.

Simon Sapin 9 жил өмнө
parent
commit
2bd16791e1
2 өөрчлөгдсөн 8 нэмэгдсэн , 16 устгасан
  1. 3 1
      src/form_urlencoded.rs
  2. 5 15
      src/lib.rs

+ 3 - 1
src/form_urlencoded.rs

@@ -40,12 +40,14 @@ pub fn parse(input: &[u8]) -> Parse {
 ///
 /// Use `parse(input.as_bytes())` to parse a `&str` string.
 ///
-/// This function is only available if the `query_encoding` Cargo feature is enabled.
+/// This function is only available if the `query_encoding`
+/// [feature](http://doc.crates.io/manifest.html#the-features-section]) is enabled.
 ///
 /// Arguments:
 ///
 /// * `encoding_override`: The character encoding each name and values is decoded as
 ///    after percent-decoding. Defaults to UTF-8.
+///    `EncodingRef` is defined in [rust-encoding](https://github.com/lifthrasiir/rust-encoding).
 /// * `use_charset`: The *use _charset_ flag*. If in doubt, set to `false`.
 #[cfg(feature = "query_encoding")]
 pub fn parse_with_encoding<'a>(input: &'a [u8],

+ 5 - 15
src/lib.rs

@@ -19,21 +19,6 @@ To use it in your project, add this to your `Cargo.toml` file:
 git = "https://github.com/servo/rust-url"
 ```
 
-Supporting encodings other than UTF-8 in query strings is an optional feature
-that requires [rust-encoding](https://github.com/lifthrasiir/rust-encoding)
-and is off by default.
-You can enable it with
-[Cargo’s *features* mechanism](http://doc.crates.io/manifest.html#the-[features]-section):
-
-```Cargo
-[dependencies.url]
-git = "https://github.com/servo/rust-url"
-features = ["query_encoding"]
-```
-
-… or by passing `--cfg 'feature="query_encoding"'` to rustc.
-
-
 # URL parsing and data structures
 
 First, URL parsing may fail for various reasons and therefore returns a `Result`.
@@ -204,6 +189,11 @@ impl<'a> ParseOptions<'a> {
 
     /// Override the character encoding of query strings.
     /// This is a legacy concept only relevant for HTML.
+    ///
+    /// `EncodingRef` is defined in [rust-encoding](https://github.com/lifthrasiir/rust-encoding).
+    ///
+    /// This method is only available if the `query_encoding`
+    /// [feature](http://doc.crates.io/manifest.html#the-features-section]) is enabled.
     #[cfg(feature = "query_encoding")]
     pub fn encoding_override(mut self, new: Option<encoding::EncodingRef>) -> Self {
         self.encoding_override = EncodingOverride::from_opt_encoding(new).to_output_encoding();