Skip to content

Commit

Permalink
feat: add strum EnumVariantNames macro to CoreNode enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Batch21 committed Dec 11, 2023
1 parent 767cfe8 commit 97e69e9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
31 changes: 29 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pywr_schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ serde_json = "1.0"
time = { version = "0.3.14", features = ["serde", "serde-well-known", "serde-human-readable"] }
thiserror = "1.0.44"
pywr-schema-macros = { path = "../pywr-schema-macros" }
strum = "0.25"
strum_macros = "0.25"
3 changes: 2 additions & 1 deletion pywr_schema/src/nodes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub use virtual_storage::{
AnnualVirtualStorageNode, MonthlyVirtualStorageNode, RollingVirtualStorageNode,
SeasonalVirtualStorageNode, VirtualStorageNode,
};
use strum_macros::EnumVariantNames;

#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
pub struct NodePosition {
Expand Down Expand Up @@ -57,7 +58,7 @@ pub struct CustomNode {
pub attributes: HashMap<String, Value>,
}

#[derive(serde::Deserialize, serde::Serialize, Clone)]
#[derive(serde::Deserialize, serde::Serialize, EnumVariantNames, Clone)]
#[serde(tag = "type")]
pub enum CoreNode {
#[serde(alias = "input")]
Expand Down

0 comments on commit 97e69e9

Please sign in to comment.