Skip to content

Commit f1a9af1

Browse files
authored
Add the ability to work in no-std (optionally with alloc) (#132)
By default, the `std` feature is enabled, but with disable-default-features, it can now be either no-std/no-alloc. This did involve a **breaking change** with the serialization traits, to allow no-alloc serialization. Serialize/Deserialize traits were sealed, and most functions were hidden Per [updated guidance][1], it is recommended to commit the Cargo.lock, even for libraries, so this removes it from the gitignore, and adds it. Fixes #131 [1]: https://blog.rust-lang.org/2023/08/29/committing-lockfiles.html
2 parents 457e7c9 + 57ef1a7 commit f1a9af1

33 files changed

+1721
-415
lines changed

.github/workflows/rust.yml

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ on:
88
branches:
99
- master
1010

11-
env:
12-
RUSTFLAGS: -A warnings
13-
1411
jobs:
1512
test:
16-
name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }} with bindgen features '${{ matrix.cargo_features }}'
13+
name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }} with features '${{ matrix.cargo_features }}'
1714
runs-on: ${{ matrix.os }}
1815
strategy:
1916
matrix:
2017
os: [ubuntu-latest, windows-latest, macos-latest]
2118
rust: [stable, nightly]
22-
cargo_features: ['']
19+
cargo_features: ['', 'alloc', 'default']
2320

2421
steps:
2522
- uses: hecrj/setup-rust-action@v2
@@ -44,33 +41,20 @@ jobs:
4441
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'
4542

4643
- name: Cargo clippy
47-
run: cargo +${{ matrix.rust }} clippy --all-targets --workspace --features "${{ matrix.cargo_features }}"
48-
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features != ''
49-
50-
- name: Cargo clippy
51-
run: cargo +${{ matrix.rust }} clippy --all-targets --workspace
52-
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features == ''
53-
54-
- name: Build
55-
run: cargo +${{ matrix.rust }} build --features "${{ matrix.cargo_features }}"
56-
if: matrix.cargo_features != ''
57-
58-
- name: Build
59-
run: cargo +${{ matrix.rust }} build
60-
if: matrix.cargo_features == ''
61-
62-
- name: Test
63-
run: cargo +${{ matrix.rust }} test --features "${{ matrix.cargo_features }}"
64-
if: matrix.cargo_features != ''
44+
run: cargo +${{ matrix.rust }} clippy --all-targets --workspace --no-default-features --features "${{ matrix.cargo_features }}"
45+
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features == 'default'
6546

6647
- name: Test
67-
run: cargo +${{ matrix.rust }} test
68-
if: matrix.cargo_features == ''
48+
run: cargo +${{ matrix.rust }} test --no-default-features --features "${{ matrix.cargo_features }}"
6949

7050
- name: Benchmark
71-
if: matrix.rust == 'nightly'
72-
run: cargo +${{ matrix.rust }} bench
51+
run: cargo +${{ matrix.rust }} bench --no-default-features --features "${{ matrix.cargo_features }}"
52+
if: matrix.rust == 'nightly' && matrix.cargo_features == 'default'
7353

7454
- name: Minimal versions
75-
if: matrix.rust == 'nightly'
76-
run: cargo +${{ matrix.rust }} -Zdirect-minimal-versions test
55+
run: cargo +${{ matrix.rust }} -Zdirect-minimal-versions test --no-default-features --features "${{ matrix.cargo_features }}"
56+
if: matrix.rust == 'nightly' && matrix.cargo_features == 'default'
57+
58+
- name: Updated versions
59+
run: cargo update && cargo +${{ matrix.rust }} test --no-default-features --features "${{ matrix.cargo_features }}"
60+
if: matrix.rust == 'stable' && matrix.cargo_features == 'default'

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
target
2-
Cargo.lock
32
.DS_Store
43
.idea

0 commit comments

Comments
 (0)