diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..000bb2c --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,22 @@ +name: Rust + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/Cargo.toml b/Cargo.toml index 637df98..1df9bc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,9 @@ [package] name = "unicode-casing" -version = "0.1.0" +version = "0.1.1" +description = "Titlecase helper function on characters." +repository = "https://github.com/RustPython/unicode-casing" +license = "MIT" authors = ["Joey Hain "] edition = "2018" diff --git a/src/lib.rs b/src/lib.rs index a59e7c0..0dfa1ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ +#![no_std] +extern crate alloc; + mod bool_trie; mod tables; @@ -97,6 +100,7 @@ impl Iterator for ToTitlecase { #[cfg(test)] mod tests { use super::*; + use alloc::vec::Vec; #[test] fn test_is_titlecase() { diff --git a/src/tables.rs b/src/tables.rs index cc1f2de..ed56e0d 100644 --- a/src/tables.rs +++ b/src/tables.rs @@ -60,11 +60,9 @@ pub mod general_category { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 - ], - r3: &[ - 0x0000000000000000, 0x1000ff00ff00ff00, 0x1000000000001000 + 0, 0, 0, 0, 0, 0, ], + r3: &[0x0000000000000000, 0x1000ff00ff00ff00, 0x1000000000001000], r4: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -74,32 +72,28 @@ pub mod general_category { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ], r5: &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 - ], - r6: &[ - 0x0000000000000000 + 0, 0, 0, 0, 0, 0, ], + r6: &[0x0000000000000000], }; pub fn Lt(c: char) -> bool { Lt_table.lookup(c) } - } -pub mod derived_property { -} +pub mod derived_property {} pub mod conversions { pub fn to_title(c: char) -> [char; 3] { match bsearch_case_table(c, to_titlecase_table) { - None => [c, '\0', '\0'], - Some(index) => to_titlecase_table[index].1 + None => [c, '\0', '\0'], + Some(index) => to_titlecase_table[index].1, } } @@ -764,6 +758,4 @@ pub mod conversions { ('\u{1e941}', ['\u{1e91f}', '\0', '\0']), ('\u{1e942}', ['\u{1e920}', '\0', '\0']), ('\u{1e943}', ['\u{1e921}', '\0', '\0']) ]; - } -