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.
13pub fn std_reg() -> ExtensionRegistry {
14    let reg = ExtensionRegistry::new([
15        crate::extension::prelude::PRELUDE.clone(),
16        arithmetic::int_ops::EXTENSION.to_owned(),
17        arithmetic::int_types::EXTENSION.to_owned(),
18        arithmetic::conversions::EXTENSION.to_owned(),
19        arithmetic::float_ops::EXTENSION.to_owned(),
20        arithmetic::float_types::EXTENSION.to_owned(),
21        collections::array::EXTENSION.to_owned(),
22        collections::list::EXTENSION.to_owned(),
23        collections::static_array::EXTENSION.to_owned(),
24        logic::EXTENSION.to_owned(),
25        ptr::EXTENSION.to_owned(),
26    ]);
27    reg.validate()
28        .expect("Standard extension registry is valid");
29    reg
30}
31
32lazy_static::lazy_static! {
33    /// Standard extension registry.
34    pub static ref STD_REG: ExtensionRegistry = std_reg();
35}