File tree Expand file tree Collapse file tree 13 files changed +85
-16
lines changed Expand file tree Collapse file tree 13 files changed +85
-16
lines changed Original file line number Diff line number Diff line change 4747 matrix.os == 'windows-latest' &&
4848 matrix.rust == 'nightly'
4949 run : cargo test --test debugger_visualizer --features "url/serde,url/debugger_visualizer" -- --test-threads=1
50+ - name : Test `no_std` support
51+ run : cargo test --no-default-features --features=alloc
5052
5153 WASM :
5254 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -3,12 +3,18 @@ name = "data-url"
33version = " 0.2.0"
44authors = [" Simon Sapin <simon.sapin@exyr.org>" ]
55description = " Processing of data: URL according to WHATWG’s Fetch Standard"
6+ categories = [" no_std" ]
67repository = " https://github.com/servo/rust-url"
78license = " MIT OR Apache-2.0"
89edition = " 2018"
910autotests = false
1011rust-version = " 1.51"
1112
13+ [features ]
14+ default = [" std" ]
15+ std = [" alloc" ]
16+ alloc = []
17+
1218[dev-dependencies ]
1319tester = " 0.9"
1420serde = {version = " 1.0" , features = [" derive" ]}
Original file line number Diff line number Diff line change 11//! <https://infra.spec.whatwg.org/#forgiving-base64-decode>
22
3+ use alloc:: vec:: Vec ;
4+
35#[ derive( Debug ) ]
46pub struct InvalidBase64 ( InvalidBase64Details ) ;
57
Original file line number Diff line number Diff line change 1414//! assert_eq!(body, b"Hello World!");
1515//! assert!(fragment.is_none());
1616//! ```
17+ #![ no_std]
18+
19+ // For forwards compatibility
20+ #[ cfg( feature = "std" ) ]
21+ extern crate std as _;
22+
23+ #[ macro_use]
24+ extern crate alloc;
25+
26+ #[ cfg( not( feature = "alloc" ) ) ]
27+ compile_error ! ( "the `alloc` feature must be enabled" ) ;
28+
29+ use alloc:: { string:: String , vec:: Vec } ;
1730
1831macro_rules! require {
1932 ( $condition: expr) => {
Original file line number Diff line number Diff line change 1- use std:: fmt:: { self , Write } ;
2- use std:: str:: FromStr ;
1+ use alloc:: { borrow:: ToOwned , string:: String , vec:: Vec } ;
2+ use core:: fmt:: { self , Write } ;
3+ use core:: str:: FromStr ;
34
45/// <https://mimesniff.spec.whatwg.org/#mime-type-representation>
56#[ derive( Debug , PartialEq , Eq ) ]
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name = "form_urlencoded"
33version = " 1.1.0"
44authors = [" The rust-url developers" ]
55description = " Parser and serializer for the application/x-www-form-urlencoded syntax, as used by HTML forms."
6+ categories = [" no_std" ]
67repository = " https://github.com/servo/rust-url"
78license = " MIT OR Apache-2.0"
89edition = " 2018"
@@ -11,5 +12,10 @@ rust-version = "1.51"
1112[lib ]
1213test = false
1314
15+ [features ]
16+ default = [" std" ]
17+ std = [" alloc" , " percent-encoding/std" ]
18+ alloc = [" percent-encoding/alloc" ]
19+
1420[dependencies ]
15- percent-encoding = { version = " 2.2.0" , path = " ../percent_encoding" }
21+ percent-encoding = { version = " 2.2.0" , default-features = false , path = " ../percent_encoding" }
Original file line number Diff line number Diff line change 1212//!
1313//! Converts between a string (such as an URL’s query string)
1414//! and a sequence of (name, value) pairs.
15+ #![ no_std]
1516
17+ // For forwards compatibility
18+ #[ cfg( feature = "std" ) ]
19+ extern crate std as _;
20+
21+ extern crate alloc;
22+
23+ #[ cfg( not( feature = "alloc" ) ) ]
24+ compile_error ! ( "the `alloc` feature must currently be enabled" ) ;
25+
26+ use alloc:: borrow:: { Borrow , Cow , ToOwned } ;
27+ use alloc:: string:: String ;
28+ use core:: str;
1629use percent_encoding:: { percent_decode, percent_encode_byte} ;
17- use std:: borrow:: { Borrow , Cow } ;
18- use std:: str;
1930
2031/// Convert a byte string in the `application/x-www-form-urlencoded` syntax
2132/// into a iterator of (name, value) pairs.
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name = "idna"
33version = " 0.3.0"
44authors = [" The rust-url developers" ]
55description = " IDNA (Internationalizing Domain Names in Applications) and Punycode."
6+ categories = [" no_std" ]
67repository = " https://github.com/servo/rust-url/"
78license = " MIT OR Apache-2.0"
89autotests = false
@@ -12,6 +13,11 @@ rust-version = "1.51"
1213[lib ]
1314doctest = false
1415
16+ [features ]
17+ default = [" std" ]
18+ std = [" alloc" , " unicode-bidi/std" , " unicode-normalization/std" ]
19+ alloc = []
20+
1521[[test ]]
1622name = " tests"
1723harness = false
@@ -26,8 +32,8 @@ tester = "0.9"
2632serde_json = " 1.0"
2733
2834[dependencies ]
29- unicode-bidi = " 0.3"
30- unicode-normalization = " 0.1.17 "
35+ unicode-bidi = { version = " 0.3.10 " , default-features = false , features = [ " hardcoded-data " ] }
36+ unicode-normalization = { version = " 0.1.22 " , default-features = false }
3137
3238[[bench ]]
3339name = " all"
Original file line number Diff line number Diff line change 3131//! > This document specifies a mechanism
3232//! > that minimizes the impact of this transition for client software,
3333//! > allowing client software to access domains that are valid under either system.
34+ #![ no_std]
35+
36+ // For forwards compatibility
37+ #[ cfg( feature = "std" ) ]
38+ extern crate std;
39+
40+ extern crate alloc;
41+
42+ #[ cfg( not( feature = "alloc" ) ) ]
43+ compile_error ! ( "the `alloc` feature must be enabled" ) ;
3444
3545#[ cfg( test) ]
3646#[ macro_use]
3747extern crate assert_matches;
3848
49+ use alloc:: string:: String ;
50+
3951pub mod punycode;
4052mod uts46;
4153
Original file line number Diff line number Diff line change 1313//! `encode_str` and `decode_to_string` provide convenience wrappers
1414//! that convert from and to Rust’s UTF-8 based `str` and `String` types.
1515
16- use std:: char;
17- use std:: u32;
16+ use alloc:: { string:: String , vec:: Vec } ;
17+ use core:: char;
18+ use core:: u32;
1819
1920// Bootstring parameters for Punycode
2021static BASE : u32 = 36 ;
@@ -168,7 +169,7 @@ impl Decoder {
168169}
169170
170171pub ( crate ) struct Decode < ' a > {
171- base : std :: str:: Chars < ' a > ,
172+ base : core :: str:: Chars < ' a > ,
172173 pub ( crate ) insertions : & ' a [ ( usize , char ) ] ,
173174 inserted : usize ,
174175 position : usize ,
You can’t perform that action at this time.
0 commit comments