Răsfoiți Sursa

Add `std` feature to `percent_encoding`

For future compatibility
Mads Marquart 3 ani în urmă
părinte
comite
964fb73ebf
2 a modificat fișierele cu 8 adăugiri și 2 ștergeri
  1. 3 1
      percent_encoding/Cargo.toml
  2. 5 1
      percent_encoding/src/lib.rs

+ 3 - 1
percent_encoding/Cargo.toml

@@ -3,11 +3,13 @@ name = "percent-encoding"
 version = "2.2.0"
 version = "2.2.0"
 authors = ["The rust-url developers"]
 authors = ["The rust-url developers"]
 description = "Percent encoding and decoding"
 description = "Percent encoding and decoding"
+categories = ["no_std"]
 repository = "https://github.com/servo/rust-url/"
 repository = "https://github.com/servo/rust-url/"
 license = "MIT OR Apache-2.0"
 license = "MIT OR Apache-2.0"
 edition = "2018"
 edition = "2018"
 rust-version = "1.51"
 rust-version = "1.51"
 
 
 [features]
 [features]
-default = ["alloc"]
+default = ["std"]
+std = ["alloc"]
 alloc = []
 alloc = []

+ 5 - 1
percent_encoding/src/lib.rs

@@ -36,8 +36,12 @@
 //!
 //!
 //! assert_eq!(utf8_percent_encode("foo <bar>", FRAGMENT).to_string(), "foo%20%3Cbar%3E");
 //! assert_eq!(utf8_percent_encode("foo <bar>", FRAGMENT).to_string(), "foo%20%3Cbar%3E");
 //! ```
 //! ```
-
 #![no_std]
 #![no_std]
+
+// For forwards compatibility
+#[cfg(feature = "std")]
+extern crate std as _;
+
 #[cfg(feature = "alloc")]
 #[cfg(feature = "alloc")]
 extern crate alloc;
 extern crate alloc;