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:
4747 key : clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
4848 - run : cargo clippy --all --all-targets
4949
50- test :
51- name : test
50+ test-no_std :
51+ name : test-no_std
5252 runs-on : ubuntu-latest
5353 steps :
5454 - uses : actions/checkout@v3
5555 - uses : sfackler/actions/rustup@master
5656 with :
57- version : 1.56 .0
57+ version : 1.81 .0
5858 - run : echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
5959 id : rust-version
6060 - uses : actions/cache@v3
7474 path : target
7575 key : test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y
7676 - 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"
1111unicode-bidi = " 0.3"
1212unicode-normalization = " 0.1"
1313unicode-properties = " 0.1.1"
14+
15+ [features ]
16+ std = []
Original file line number Diff line number Diff line change 11//! An implementation of the "stringprep" algorithm defined in [RFC 3454][].
22//!
33//! [RFC 3454]: https://tools.ietf.org/html/rfc3454
4+ #![ no_std]
45#![ warn( missing_docs) ]
6+ extern crate alloc;
57extern crate unicode_bidi;
68extern crate unicode_normalization;
79extern crate unicode_properties;
810
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;
1117use unicode_normalization:: UnicodeNormalization ;
1218use unicode_properties:: { GeneralCategoryGroup , UnicodeGeneralCategory } ;
1319
@@ -44,7 +50,12 @@ impl fmt::Display for Error {
4450 }
4551}
4652
53+ // This is only needed for Rust versions older than 1.81.0, before core::error::Error got
54+ // stabilized.
55+ #[ cfg( feature = "std" ) ]
4756impl std:: error:: Error for Error { }
57+ #[ cfg( not( feature = "std" ) ) ]
58+ impl core:: error:: Error for Error { }
4859
4960/// Prepares a string with the SASLprep profile of the stringprep algorithm.
5061///
Original file line number Diff line number Diff line change 11//! Character Tables
2- use std :: cmp:: Ordering ;
3- use std :: str:: Chars ;
2+ use core :: cmp:: Ordering ;
3+ use core :: str:: Chars ;
44use unicode_bidi:: { bidi_class, BidiClass } ;
55use unicode_properties:: { GeneralCategoryGroup , UnicodeGeneralCategory } ;
66
You can’t perform that action at this time.
0 commit comments