Skip to content

Commit 964fb73

Browse files
committed
Add std feature to percent_encoding
For future compatibility
1 parent edeaea7 commit 964fb73

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

percent_encoding/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ name = "percent-encoding"
33
version = "2.2.0"
44
authors = ["The rust-url developers"]
55
description = "Percent encoding and decoding"
6+
categories = ["no_std"]
67
repository = "https://github.com/servo/rust-url/"
78
license = "MIT OR Apache-2.0"
89
edition = "2018"
910
rust-version = "1.51"
1011

1112
[features]
12-
default = ["alloc"]
13+
default = ["std"]
14+
std = ["alloc"]
1315
alloc = []

percent_encoding/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
//!
3737
//! assert_eq!(utf8_percent_encode("foo <bar>", FRAGMENT).to_string(), "foo%20%3Cbar%3E");
3838
//! ```
39-
4039
#![no_std]
40+
41+
// For forwards compatibility
42+
#[cfg(feature = "std")]
43+
extern crate std as _;
44+
4145
#[cfg(feature = "alloc")]
4246
extern crate alloc;
4347

0 commit comments

Comments
 (0)