Skip to content

Commit b9660e6

Browse files
authored
feat!: Allow compiling with stable toolchain (#64)
* remove associated type defaults * add MSRV check to CI
1 parent 30fc8e2 commit b9660e6

File tree

17 files changed

+60
-27
lines changed

17 files changed

+60
-27
lines changed

.github/workflows/CI.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,17 @@ jobs:
4444
steps:
4545
- uses: actions/checkout@v4
4646
- uses: EmbarkStudios/cargo-deny-action@v1
47+
48+
msrv:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@master
52+
- name: Get MSRV from Cargo.toml
53+
run: |
54+
MSRV=$(grep 'rust-version' Cargo.toml | sed 's/.*= *"\(.*\)".*/\1/')
55+
echo "MSRV=$MSRV" >> $GITHUB_ENV
56+
- uses: dtolnay/rust-toolchain@master
57+
with:
58+
toolchain: ${{ env.MSRV }}
59+
- uses: taiki-e/install-action@cargo-no-dev-deps
60+
- run: cargo no-dev-deps check --all

Cargo.toml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
[package]
2-
name = "arithmetic-coding"
3-
description = "fast and flexible arithmetic coding library"
4-
version = "0.3.1"
1+
[workspace]
2+
members = [".", "arithmetic-coding-core", "fenwick-model"]
3+
4+
[workspace.package]
5+
rust-version = "1.79.0"
56
edition = "2021"
67
license = "MIT"
78
keywords = ["compression", "encoding", "arithmetic-coding", "lossless"]
89
categories = ["compression", "encoding", "parsing"]
910
repository = "https://github.com/danieleades/arithmetic-coding"
1011

11-
[workspace]
12-
members = [".", "arithmetic-coding-core", "fenwick-model"]
13-
1412
[workspace.dependencies]
1513
thiserror = "1.0.30"
1614

@@ -20,6 +18,17 @@ all = "deny"
2018
nursery = "warn"
2119
pedantic = "warn"
2220

21+
[package]
22+
name = "arithmetic-coding"
23+
description = "fast and flexible arithmetic coding library"
24+
version = "0.3.1"
25+
edition.workspace = true
26+
license.workspace = true
27+
keywords.workspace = true
28+
categories.workspace = true
29+
repository.workspace = true
30+
rust-version.workspace = true
31+
2332
[dependencies]
2433
arithmetic-coding-core = { path = "./arithmetic-coding-core", version = "0.3.0" }
2534
bitstream-io = "2.0.0"

arithmetic-coding-core/Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
name = "arithmetic-coding-core"
33
description = "core traits for the 'arithmetic-coding' crate"
44
version = "0.3.0"
5-
edition = "2021"
6-
license = "MIT"
7-
keywords = ["compression", "encoding", "arithmetic-coding", "lossless"]
8-
categories = ["compression", "encoding", "parsing"]
9-
repository = "https://github.com/danieleades/arithmetic-coding"
10-
11-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
5+
edition.workspace = true
6+
license.workspace = true
7+
keywords.workspace = true
8+
categories.workspace = true
9+
repository.workspace = true
10+
rust-version.workspace = true
1211

1312
[dependencies]
1413
thiserror = { workspace = true }

arithmetic-coding-core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Core traits for the [`arithmetic-coding`](https://github.com/danieleades/arithmetic-coding) crate
22
33
#![deny(missing_docs, missing_debug_implementations)]
4-
#![feature(associated_type_defaults)]
54

65
mod bitstore;
76
pub use bitstore::BitStore;

arithmetic-coding-core/src/model.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub mod one_shot;
3030
/// pub struct MyModel;
3131
///
3232
/// impl Model for MyModel {
33+
/// type B = u32;
3334
/// type Symbol = Symbol;
3435
/// type ValueError = !;
3536
///
@@ -65,7 +66,7 @@ pub trait Model {
6566
type ValueError: Error;
6667

6768
/// The internal representation to use for storing integers
68-
type B: BitStore = u32;
69+
type B: BitStore;
6970

7071
/// Given a symbol, return an interval representing the probability of that
7172
/// symbol occurring.

arithmetic-coding-core/src/model/fixed_length.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use crate::BitStore;
2020
/// # Example
2121
///
2222
/// ```
23-
/// #![feature(exclusive_range_pattern)]
2423
/// #![feature(never_type)]
2524
/// # use std::ops::Range;
2625
/// #
@@ -35,6 +34,7 @@ use crate::BitStore;
3534
/// pub struct MyModel;
3635
///
3736
/// impl fixed_length::Model for MyModel {
37+
/// type B = u32;
3838
/// type Symbol = Symbol;
3939
/// type ValueError = !;
4040
///
@@ -72,7 +72,7 @@ pub trait Model {
7272
type ValueError: std::error::Error;
7373

7474
/// The internal representation to use for storing integers
75-
type B: BitStore = u32;
75+
type B: BitStore;
7676

7777
/// Given a symbol, return an interval representing the probability of that
7878
/// symbol occurring.

arithmetic-coding-core/src/model/max_length.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::BitStore;
2222
/// # Example
2323
///
2424
/// ```
25-
/// #![feature(exclusive_range_pattern)]
2625
/// #![feature(never_type)]
2726
/// # use std::ops::Range;
2827
/// #
@@ -37,6 +36,7 @@ use crate::BitStore;
3736
/// pub struct MyModel;
3837
///
3938
/// impl max_length::Model for MyModel {
39+
/// type B = u32;
4040
/// type Symbol = Symbol;
4141
/// type ValueError = !;
4242
///
@@ -76,7 +76,7 @@ pub trait Model {
7676
type ValueError: std::error::Error;
7777

7878
/// The internal representation to use for storing integers
79-
type B: BitStore = u32;
79+
type B: BitStore;
8080

8181
/// Given a symbol, return an interval representing the probability of that
8282
/// symbol occurring.

arithmetic-coding-core/src/model/one_shot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use crate::{fixed_length, BitStore};
2323
/// # Example
2424
///
2525
/// ```
26-
/// #![feature(exclusive_range_pattern)]
2726
/// #![feature(never_type)]
2827
/// # use std::ops::Range;
2928
/// #
@@ -38,6 +37,7 @@ use crate::{fixed_length, BitStore};
3837
/// pub struct MyModel;
3938
///
4039
/// impl one_shot::Model for MyModel {
40+
/// type B = u32;
4141
/// type Symbol = Symbol;
4242
/// type ValueError = !;
4343
///
@@ -71,7 +71,7 @@ pub trait Model {
7171
type ValueError: std::error::Error;
7272

7373
/// The internal representation to use for storing integers
74-
type B: BitStore = u32;
74+
type B: BitStore;
7575

7676
/// Given a symbol, return an interval representing the probability of that
7777
/// symbol occurring.

examples/concatenated.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mod integer {
1616
pub struct Error(u8);
1717

1818
impl arithmetic_coding::Model for Model {
19+
type B = u32;
1920
type Symbol = u8;
2021
type ValueError = Error;
2122

@@ -58,6 +59,7 @@ mod symbolic {
5859
pub struct Model;
5960

6061
impl arithmetic_coding::Model for Model {
62+
type B = u32;
6163
type Symbol = Symbol;
6264
type ValueError = !;
6365

examples/fixed_length.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub enum Symbol {
1717
pub struct MyModel;
1818

1919
impl fixed_length::Model for MyModel {
20+
type B = u32;
2021
type Symbol = Symbol;
2122
type ValueError = !;
2223

0 commit comments

Comments
 (0)