1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Type-safe metadata definition for hugr nodes.
//!
//! See [HugrView::get_metadata][crate::hugr::HugrView::get_metadata] and
//! [HugrMut::set_metadata][crate::hugr::HugrMut::set_metadata] for more
//! information on how to use this API.
//!
//! # Examples
//!
//! ```
//! use hugr::hugr::{Hugr, HugrView};
//! use hugr::hugr::hugrmut::HugrMut;
//! use hugr::metadata::Metadata;
//!
//! struct SomeMetadata;
//! impl Metadata for SomeMetadata {
//! type Type<'hugr> = &'hugr str;
//! const KEY: &'static str = "custom.metadata";
//! }
//!
//! let mut hugr = Hugr::new();
//! hugr.set_metadata::<SomeMetadata>(hugr.module_root(), "payload");
//! let payload = hugr.get_metadata::<SomeMetadata>(hugr.module_root());
//! assert_eq!(payload, Some("payload"));
//! ```
//
// When adding new metadata keys, they should be re-exported by the python bindings.
// See hugr-py/rust/metadata.rs
/// Arbitrary metadata entry for a node.
///
/// Each entry is associated to a string key.
pub type RawMetadataValue = Value;
/// A type-safe metadata entry
///
/// Marker structs implementing this trait
// -------- Core metadata entries
/// Metadata storing the name of the generator that produced the Hugr envelope.
///
/// This value is only valid when set at the module root node.
;
/// Metadata storing the list of extensions required to define the Hugr.
///
/// This list may contain additional extensions that are no longer present in
/// the Hugr.
///
/// This value is only valid when set at the module root node.
;