Bläddra i källkod

Add `std` feature to `percent_encoding`

For future compatibility
Mads Marquart 3 år sedan
förälder
incheckning
964fb73ebf
2 ändrade filer med 8 tillägg och 2 borttagningar
  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"
 authors = ["The rust-url developers"]
 description = "Percent encoding and decoding"
+categories = ["no_std"]
 repository = "https://github.com/servo/rust-url/"
 license = "MIT OR Apache-2.0"
 edition = "2018"
 rust-version = "1.51"
 
 [features]
-default = ["alloc"]
+default = ["std"]
+std = ["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");
 //! ```
-
 #![no_std]
+
+// For forwards compatibility
+#[cfg(feature = "std")]
+extern crate std as _;
+
 #[cfg(feature = "alloc")]
 extern crate alloc;