Skip to content

Commit d33abcb

Browse files
bors[bot]zyansheepcuviper
authored
Merge #110
110: add rkyv support r=cuviper a=zyansheep For some reason github closed the old PR while I was trying to merge master into the old pr. Should've used rebase! Co-authored-by: zyansheep <zyansheep@protonmail.com> Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents 0c5e422 + dd3a23f commit d33abcb

File tree

6 files changed

+27
-3
lines changed

6 files changed

+27
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
rust: [
1616
1.31.0, # 2018!
1717
1.36.0, # rand
18+
1.54.0, # rkyv
1819
stable,
1920
beta,
2021
nightly

Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exclude = ["/bors.toml", "/ci/*", "/.github/*"]
1414
edition = "2018"
1515

1616
[package.metadata.docs.rs]
17-
features = ["bytemuck", "std", "serde", "rand"]
17+
features = ["bytemuck", "std", "serde", "rkyv/size_64", "bytecheck", "rand"]
1818

1919
[dependencies]
2020

@@ -32,6 +32,16 @@ optional = true
3232
version = "1.0"
3333
default-features = false
3434

35+
[dependencies.rkyv]
36+
optional = true
37+
version = "0.7"
38+
default-features = false
39+
40+
[dependencies.bytecheck]
41+
optional = true
42+
version = "0.6"
43+
default-features = false
44+
3545
[dependencies.rand]
3646
optional = true
3747
version = "0.8"

bors.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
status = [
22
"Test (1.31.0)",
33
"Test (1.36.0)",
4+
"Test (1.54.0)",
45
"Test (stable)",
56
"Test (beta)",
67
"Test (nightly)",

ci/rustup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
set -ex
66

77
ci=$(dirname $0)
8-
for version in 1.31.0 1.36.0 stable beta nightly; do
8+
for version in 1.31.0 1.36.0 1.54.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

ci/test_full.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -e
44

@@ -30,8 +30,14 @@ fi
3030
FEATURES=(libm serde)
3131
check_version 1.34 && FEATURES+=(bytemuck)
3232
check_version 1.36 && FEATURES+=(rand)
33+
check_version 1.54 && FEATURES+=(rkyv/size_64 bytecheck)
3334
echo "Testing supported features: ${FEATURES[*]}"
3435

36+
cargo generate-lockfile
37+
38+
# libm 0.2.6 started using {float}::EPSILON
39+
check_version 1.43 || cargo update -p libm --precise 0.2.5
40+
3541
set -x
3642

3743
# test the default

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ pub use crate::crand::ComplexDistribution;
7979
/// ```
8080
#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug, Default)]
8181
#[repr(C)]
82+
#[cfg_attr(
83+
feature = "rkyv",
84+
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
85+
)]
86+
#[cfg_attr(feature = "rkyv", archive(as = "Complex<T::Archived>"))]
87+
#[cfg_attr(feature = "bytecheck", derive(bytecheck::CheckBytes))]
8288
pub struct Complex<T> {
8389
/// Real portion of the complex number
8490
pub re: T,

0 commit comments

Comments
 (0)