File tree Expand file tree Collapse file tree 4 files changed +25
-10
lines changed Expand file tree Collapse file tree 4 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ edition = "2018"
1111[lib ]
1212doctest = false
1313
14+ [features ]
15+ default = [" std" ]
16+ std = []
17+
1418[[test ]]
1519name = " tests"
1620harness = false
@@ -25,9 +29,9 @@ rustc-test = "0.3"
2529serde_json = " 1.0"
2630
2731[dependencies ]
28- unicode-bidi = " 0.3"
29- unicode-normalization = " 0.1.17"
30- matches = " 0.1"
32+ unicode-bidi = { version = " 0.3.7 " , default-features = false }
33+ unicode-normalization = { version = " 0.1.17" , default-features = false }
34+ matches = " 0.1.9 "
3135
3236[[bench ]]
3337name = " all"
Original file line number Diff line number Diff line change 3232//! > that minimizes the impact of this transition for client software,
3333//! > allowing client software to access domains that are valid under either system.
3434
35+ #![ no_std]
36+ extern crate alloc;
37+ #[ cfg( feature = "std" ) ]
38+ extern crate std;
39+
3540#[ macro_use]
3641extern crate matches;
3742
43+ use alloc:: string:: String ;
44+
3845pub mod punycode;
3946mod uts46;
4047
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 ,
Original file line number Diff line number Diff line change 1111
1212use self :: Mapping :: * ;
1313use crate :: punycode;
14- use std:: { error:: Error as StdError , fmt} ;
14+
15+ use alloc:: string:: String ;
16+ use core:: fmt;
1517use unicode_bidi:: { bidi_class, BidiClass } ;
1618use unicode_normalization:: char:: is_combining_mark;
1719use unicode_normalization:: { is_nfc, UnicodeNormalization } ;
@@ -70,10 +72,10 @@ fn find_char(codepoint: char) -> &'static Mapping {
7072}
7173
7274struct Mapper < ' a > {
73- chars : std :: str:: Chars < ' a > ,
75+ chars : core :: str:: Chars < ' a > ,
7476 config : Config ,
7577 errors : & ' a mut Errors ,
76- slice : Option < std :: str:: Chars < ' static > > ,
78+ slice : Option < core :: str:: Chars < ' static > > ,
7779}
7880
7981impl < ' a > Iterator for Mapper < ' a > {
@@ -698,7 +700,8 @@ impl From<Errors> for Result<(), Errors> {
698700 }
699701}
700702
701- impl StdError for Errors { }
703+ #[ cfg( feature = "std" ) ]
704+ impl std:: error:: Error for Errors { }
702705
703706impl fmt:: Display for Errors {
704707 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
You can’t perform that action at this time.
0 commit comments