File tree Expand file tree Collapse file tree 4 files changed +49
-7
lines changed Expand file tree Collapse file tree 4 files changed +49
-7
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ jobs:
47
47
key : clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
48
48
- run : cargo clippy --all --all-targets
49
49
50
- test :
51
- name : test
50
+ test-no_std :
51
+ name : test-no_std
52
52
runs-on : ubuntu-latest
53
53
steps :
54
54
- uses : actions/checkout@v3
55
55
- uses : sfackler/actions/rustup@master
56
56
with :
57
- version : 1.56 .0
57
+ version : 1.81 .0
58
58
- run : echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
59
59
id : rust-version
60
60
- uses : actions/cache@v3
74
74
path : target
75
75
key : test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
76
76
- run : cargo test --all
77
+
78
+ test-std :
79
+ name : test-std
80
+ runs-on : ubuntu-latest
81
+ steps :
82
+ - uses : actions/checkout@v3
83
+ - uses : sfackler/actions/rustup@master
84
+ with :
85
+ version : 1.56.0
86
+ - run : echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
87
+ id : rust-version
88
+ - uses : actions/cache@v3
89
+ with :
90
+ path : ~/.cargo/registry/index
91
+ key : index-${{ runner.os }}-${{ github.run_number }}
92
+ restore-keys : |
93
+ index-${{ runner.os }}-
94
+ - run : cargo generate-lockfile
95
+ - uses : actions/cache@v3
96
+ with :
97
+ path : ~/.cargo/registry/cache
98
+ key : registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
99
+ - run : cargo fetch
100
+ - uses : actions/cache@v3
101
+ with :
102
+ path : target
103
+ key : test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
104
+ - run : cargo test --all --features=std
Original file line number Diff line number Diff line change @@ -11,3 +11,6 @@ readme = "README.md"
11
11
unicode-bidi = " 0.3"
12
12
unicode-normalization = " 0.1"
13
13
unicode-properties = " 0.1.1"
14
+
15
+ [features ]
16
+ std = []
Original file line number Diff line number Diff line change 1
1
//! An implementation of the "stringprep" algorithm defined in [RFC 3454][].
2
2
//!
3
3
//! [RFC 3454]: https://tools.ietf.org/html/rfc3454
4
+ #![ no_std]
4
5
#![ warn( missing_docs) ]
6
+ extern crate alloc;
5
7
extern crate unicode_bidi;
6
8
extern crate unicode_normalization;
7
9
extern crate unicode_properties;
8
10
9
- use std:: borrow:: Cow ;
10
- use std:: fmt;
11
+ #[ cfg( feature = "std" ) ]
12
+ extern crate std;
13
+
14
+ use alloc:: borrow:: Cow ;
15
+ use alloc:: string:: String ;
16
+ use core:: fmt;
11
17
use unicode_normalization:: UnicodeNormalization ;
12
18
use unicode_properties:: { GeneralCategoryGroup , UnicodeGeneralCategory } ;
13
19
@@ -44,7 +50,12 @@ impl fmt::Display for Error {
44
50
}
45
51
}
46
52
53
+ // This is only needed for Rust versions older than 1.81.0, before core::error::Error got
54
+ // stabilized.
55
+ #[ cfg( feature = "std" ) ]
47
56
impl std:: error:: Error for Error { }
57
+ #[ cfg( not( feature = "std" ) ) ]
58
+ impl core:: error:: Error for Error { }
48
59
49
60
/// Prepares a string with the SASLprep profile of the stringprep algorithm.
50
61
///
Original file line number Diff line number Diff line change 1
1
//! Character Tables
2
- use std :: cmp:: Ordering ;
3
- use std :: str:: Chars ;
2
+ use core :: cmp:: Ordering ;
3
+ use core :: str:: Chars ;
4
4
use unicode_bidi:: { bidi_class, BidiClass } ;
5
5
use unicode_properties:: { GeneralCategoryGroup , UnicodeGeneralCategory } ;
6
6
You can’t perform that action at this time.
0 commit comments