diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f97cfbd..2f6e55d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,18 +4,24 @@ on: [push] jobs: build: - runs-on: ubuntu-latest - + strategy: + matrix: + rust: + - beta + - nightly steps: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: beta + toolchain: ${{ matrix.rust }} override: true components: rustfmt - name: Build run: cargo build --verbose - name: Run tests run: cargo test + - name: Run benchmarks + run: cargo bench --features bench + if: startsWith(matrix.rust, 'nightly') \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index f13919d..b85a8f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "unicode-script" -version = "0.4.0" +version = "0.5.0" authors = ["Manish Goregaokar "] edition = "2018" @@ -20,9 +20,8 @@ exclude = [ "target/*", "Cargo.lock", "scripts/tmp", "*.txt" ] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -with_std = [] -default_features = ["with_std"] rustc-dep-of-std = ['std', 'core', 'compiler_builtins'] +bench = [] [dependencies] std = { version = "1.0", package = "rustc-std-workspace-std", optional = true } diff --git a/scripts/unicode.py b/scripts/unicode.py index a70e76b..aaaef9d 100644 --- a/scripts/unicode.py +++ b/scripts/unicode.py @@ -35,6 +35,8 @@ // NOTE: The following code was generated by "scripts/unicode.py", do not edit directly #![allow(missing_docs, non_upper_case_globals, non_snake_case)] + +use super::ScriptExtension; ''' UNICODE_VERSION = (12, 0, 0) @@ -183,182 +185,102 @@ def emit_search(f): } """) -def emit_enums(f, script_list, extension_list, longforms, intersections): +def emit_enums(f, script_list, extension_list, longforms): """ Emit the Script and ScriptExtension enums as well as any related utility functions """ + f.write(""" -use core::convert::TryFrom; #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] #[non_exhaustive] #[allow(non_camel_case_types)] -/// A value of the Script property +#[repr(u8)] +/// A value of the `Script` property pub enum Script { /// Unknown script - Unknown, + Unknown = 0xFF, + /// Zyyy + Common = 0xFE, + /// Zinh, + Inherited = 0xFD, """) - for script in script_list: - f.write(" /// %s\n %s,\n" % (script, longforms[script])) - f.write("""} -#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] -#[non_exhaustive] -/// A value for the Script_Extension property -/// -/// Script_Extension is one or more Script -/// -/// This is essentially an optimized version of Vec