Skip to content

update rkyv to 0.8 + adjust CI #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ name: CI
on: merge_group

jobs:

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [
1.60.0, # MSRV
stable,
beta,
nightly
]
1.60.0, # MSRV
1.81.0, # rkyv
stable,
beta,
nightly
]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand Down
10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ edition = "2021"
rust-version = "1.60"

[package.metadata.docs.rs]
features = ["bytemuck", "std", "serde", "rkyv/size_64", "bytecheck", "rand"]
features = ["bytemuck", "std", "serde", "rkyv", "rand"]

[dependencies]

Expand All @@ -35,13 +35,12 @@ default-features = false

[dependencies.rkyv]
optional = true
version = "0.7"
version = "0.8"
default-features = false

[dependencies.bytecheck]
optional = true
version = "0.6"
default-features = false
version = "0.8"

[dependencies.rand]
optional = true
Expand All @@ -52,8 +51,7 @@ default-features = false
default = ["std"]
std = ["num-traits/std"]
libm = ["num-traits/libm"]
bytecheck = ["dep:bytecheck"]
bytemuck = ["dep:bytemuck"]
rand = ["dep:rand"]
rkyv = ["dep:rkyv"]
rkyv = ["dep:rkyv", "rkyv/bytecheck", "dep:bytecheck"]
serde = ["dep:serde"]
3 changes: 2 additions & 1 deletion ci/test_full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ if ! check_version $MSRV ; then
exit 1
fi

FEATURES=(bytecheck bytemuck libm rand rkyv/size_64 serde)
FEATURES=(bytemuck libm rand serde)
check_version 1.81.0 && FEATURES+=(rkyv)
echo "Testing supported features: ${FEATURES[*]}"

cargo generate-lockfile
Expand Down
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ pub use crate::crand::ComplexDistribution;
#[repr(C)]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, rkyv::Portable, bytecheck::CheckBytes),
rkyv(as = Complex<T::Archived>)
)]
#[cfg_attr(feature = "rkyv", archive(as = "Complex<T::Archived>"))]
#[cfg_attr(feature = "bytecheck", derive(bytecheck::CheckBytes))]
pub struct Complex<T> {
/// Real portion of the complex number
pub re: T,
Expand Down Expand Up @@ -2404,7 +2403,7 @@ pub(crate) mod test {
}

#[test]
fn test_hyperbolic_identites() {
fn test_hyperbolic_identities() {
for &c in all_consts.iter() {
// tanh(z) = sinh(z)/cosh(z)
assert!(close(c.tanh(), c.sinh() / c.cosh()));
Expand Down