Skip to content

Commit

Permalink
Make types serde serialisable if serde feature used
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Aug 16, 2024
1 parent 20b1873 commit 14bf9b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
rust-version: ["stable"]
mpi: ['mpich', 'openmpi']
feature-flags: ['--features "strict"', '--features "mpi,strict"']
feature-flags: ['--features "strict"', '--features "mpi,strict"', '--features "serde,strict"']
steps:
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/style-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
feature-flags: ['--features "mpi,strict"', '--features "strict"', '']
feature-flags: ['--features "mpi,strict"', '--features "strict"', '--features "serde,strict"' '']
steps:
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[features]
mpi = ["dep:mpi"]
serde = ["dep:serde"]
strict = []

[package]
Expand Down Expand Up @@ -32,6 +33,7 @@ log = "0.4"
rayon = "1.9"
rand = "0.8.5"
rlst = "0.2.0"
serde = { version = "1", features = ["derive"], optional = true }
thiserror="1.*"

[dev-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use mpi::traits::Equivalence;

/// Continuity type
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
#[repr(u8)]
pub enum Continuity {
Expand All @@ -17,6 +18,7 @@ pub enum Continuity {
}

/// The map type used by an element
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
#[repr(u8)]
pub enum MapType {
Expand All @@ -35,6 +37,7 @@ pub enum MapType {
}

/// The type of a reference cell
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
#[repr(u8)]
pub enum ReferenceCellType {
Expand Down

0 comments on commit 14bf9b7

Please sign in to comment.