hugr_core/
std_extensions.rs

1//! Experiments for `Extension` definitions.
2//!
3//! These may be moved to other crates in the future, or dropped altogether.
4
5use crate::extension::ExtensionRegistry;
6
7pub mod arithmetic;
8pub mod collections;
9pub mod logic;
10pub mod ptr;
11
12/// Extension registry with all standard extensions and prelude.
13#[must_use]
14pub fn std_reg() -> ExtensionRegistry {
15    let reg = ExtensionRegistry::new([
16        crate::extension::prelude::PRELUDE.clone(),
17        arithmetic::int_ops::EXTENSION.to_owned(),
18        arithmetic::int_types::EXTENSION.to_owned(),
19        arithmetic::conversions::EXTENSION.to_owned(),
20        arithmetic::float_ops::EXTENSION.to_owned(),
21        arithmetic::float_types::EXTENSION.to_owned(),
22        collections::array::EXTENSION.to_owned(),
23        collections::list::EXTENSION.to_owned(),
24        collections::borrow_array::EXTENSION.to_owned(),
25        collections::static_array::EXTENSION.to_owned(),
26        collections::value_array::EXTENSION.to_owned(),
27        logic::EXTENSION.to_owned(),
28        ptr::EXTENSION.to_owned(),
29    ]);
30    reg.validate()
31        .expect("Standard extension registry is valid");
32    reg
33}
34
35lazy_static::lazy_static! {
36    /// Standard extension registry.
37    pub static ref STD_REG: ExtensionRegistry = std_reg();
38}