Skip to content
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

refactor(hugr-core)!: declarative module behind optional feature flag #1341

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion hugr-core/Cargo.toml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add the feature to hugr/Cargo.toml

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ workspace = true

[features]
extension_inference = []
declarative = ["serde_yaml"]

[dependencies]
portgraph = { workspace = true, features = ["serde", "petgraph"] }
Expand All @@ -28,7 +29,7 @@ num-rational = { workspace = true, features = ["serde"] }
downcast-rs = { workspace = true }
# Rc used here for Extension, but unfortunately we must turn the feature on globally
serde = { workspace = true, features = ["derive", "rc"] }
serde_yaml = { workspace = true }
serde_yaml = { workspace = true, optional = true }
typetag = { workspace = true }
smol_str = { workspace = true, features = ["serde"] }
derive_more = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions hugr-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Please read the [API documentation here][].
Experimental feature which allows automatic inference of extension usages and
requirements in a HUGR and validation that extensions are correctly specified.
Not enabled by default.
- `declarative`:
Experimental support for declaring extensions in YAML files, support is limited.

## Recent Changes

Expand Down
1 change: 1 addition & 0 deletions hugr-core/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub mod simple_op;
pub use const_fold::{ConstFold, ConstFoldResult, Folder};
pub use prelude::{PRELUDE, PRELUDE_REGISTRY};

#[cfg(feature = "declarative")]
pub mod declarative;

/// Extension Registries store extensions to be looked up e.g. during validation.
Expand Down
1 change: 1 addition & 0 deletions hugr-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn try_collect_array<const N: usize, T>(
/// ```
///
/// From https://github.com/serde-rs/serde/issues/818.
#[allow(dead_code)]
pub(crate) fn is_default<T: Default + PartialEq>(t: &T) -> bool {
*t == Default::default()
}
Expand Down
2 changes: 2 additions & 0 deletions hugr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Please read the [API documentation here][].
Experimental feature which allows automatic inference of extension usages and
requirements in a HUGR and validation that extensions are correctly specified.
Not enabled by default.
- `declarative`:
Experimental support for declaring extensions in YAML files, support is limited.

## Recent Changes

Expand Down
Loading