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;
6use std::sync::LazyLock;
7
8pub mod arithmetic;
9pub mod collections;
10pub mod logic;
11pub mod ptr;
12
13/// Extension registry with all standard extensions and prelude.
14#[must_use]
15pub fn std_reg() -> ExtensionRegistry {
16    let reg = ExtensionRegistry::new([
17        crate::extension::prelude::PRELUDE.clone(),
18        arithmetic::int_ops::EXTENSION.to_owned(),
19        arithmetic::int_types::EXTENSION.to_owned(),
20        arithmetic::conversions::EXTENSION.to_owned(),
21        arithmetic::float_ops::EXTENSION.to_owned(),
22        arithmetic::float_types::EXTENSION.to_owned(),
23        collections::array::EXTENSION.to_owned(),
24        collections::list::EXTENSION.to_owned(),
25        collections::borrow_array::EXTENSION.to_owned(),
26        collections::static_array::EXTENSION.to_owned(),
27        collections::value_array::EXTENSION.to_owned(),
28        logic::EXTENSION.to_owned(),
29        ptr::EXTENSION.to_owned(),
30    ]);
31    reg.validate()
32        .expect("Standard extension registry is valid");
33    reg
34}
35
36/// Standard extension registry.
37pub static STD_REG: LazyLock<ExtensionRegistry> = LazyLock::new(std_reg);