File tree 4 files changed +25
-10
lines changed
4 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ edition = "2018"
11
11
[lib ]
12
12
doctest = false
13
13
14
+ [features ]
15
+ default = [" std" ]
16
+ std = []
17
+
14
18
[[test ]]
15
19
name = " tests"
16
20
harness = false
@@ -25,9 +29,9 @@ rustc-test = "0.3"
25
29
serde_json = " 1.0"
26
30
27
31
[dependencies ]
28
- unicode-bidi = " 0.3"
29
- unicode-normalization = " 0.1.17"
30
- matches = " 0.1"
32
+ unicode-bidi = { version = " 0.3.6 " , default-features = false }
33
+ unicode-normalization = { version = " 0.1.17" , default-features = false }
34
+ matches = " 0.1.9 "
31
35
32
36
[[bench ]]
33
37
name = " all"
Original file line number Diff line number Diff line change 32
32
//! > that minimizes the impact of this transition for client software,
33
33
//! > allowing client software to access domains that are valid under either system.
34
34
35
+ #![ no_std]
36
+ extern crate alloc;
37
+ #[ cfg( feature = "std" ) ]
38
+ extern crate std;
39
+
35
40
#[ macro_use]
36
41
extern crate matches;
37
42
43
+ use alloc:: string:: String ;
44
+
38
45
pub mod punycode;
39
46
mod uts46;
40
47
Original file line number Diff line number Diff line change 13
13
//! `encode_str` and `decode_to_string` provide convenience wrappers
14
14
//! that convert from and to Rust’s UTF-8 based `str` and `String` types.
15
15
16
- use std:: char;
17
- use std:: u32;
16
+ use alloc:: { string:: String , vec:: Vec } ;
17
+ use core:: char;
18
+ use core:: u32;
18
19
19
20
// Bootstring parameters for Punycode
20
21
static BASE : u32 = 36 ;
@@ -168,7 +169,7 @@ impl Decoder {
168
169
}
169
170
170
171
pub ( crate ) struct Decode < ' a > {
171
- base : std :: str:: Chars < ' a > ,
172
+ base : core :: str:: Chars < ' a > ,
172
173
pub ( crate ) insertions : & ' a [ ( usize , char ) ] ,
173
174
inserted : usize ,
174
175
position : usize ,
Original file line number Diff line number Diff line change 11
11
12
12
use self :: Mapping :: * ;
13
13
use crate :: punycode;
14
- use std:: { error:: Error as StdError , fmt} ;
14
+
15
+ use alloc:: string:: String ;
16
+ use core:: fmt;
15
17
use unicode_bidi:: { bidi_class, BidiClass } ;
16
18
use unicode_normalization:: char:: is_combining_mark;
17
19
use unicode_normalization:: { is_nfc, UnicodeNormalization } ;
@@ -70,10 +72,10 @@ fn find_char(codepoint: char) -> &'static Mapping {
70
72
}
71
73
72
74
struct Mapper < ' a > {
73
- chars : std :: str:: Chars < ' a > ,
75
+ chars : core :: str:: Chars < ' a > ,
74
76
config : Config ,
75
77
errors : & ' a mut Errors ,
76
- slice : Option < std :: str:: Chars < ' static > > ,
78
+ slice : Option < core :: str:: Chars < ' static > > ,
77
79
}
78
80
79
81
impl < ' a > Iterator for Mapper < ' a > {
@@ -698,7 +700,8 @@ impl From<Errors> for Result<(), Errors> {
698
700
}
699
701
}
700
702
701
- impl StdError for Errors { }
703
+ #[ cfg( feature = "std" ) ]
704
+ impl std:: error:: Error for Errors { }
702
705
703
706
impl fmt:: Display for Errors {
704
707
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
You can’t perform that action at this time.
0 commit comments