We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0a8dee commit 1863ee8Copy full SHA for 1863ee8
hugr-core/src/ops/constant.rs
@@ -33,12 +33,19 @@ pub struct Const {
33
/// The [Value] of the constant.
34
#[serde(rename = "v")]
35
pub value: Value,
36
+ /// The external name of the constant for linking, if any
37
+ pub name: Option<String>,
38
}
39
40
impl Const {
- /// Create a new [`Const`] operation.
41
+ /// Create a new [`Const`] operation that cannot be linked against.
42
pub fn new(value: Value) -> Self {
- Self { value }
43
+ Self { value, name: None }
44
+ }
45
+
46
+ /// Create a new [`Const`] operation available for linking
47
+ pub fn new_public(value: Value, name: impl ToString) -> Self {
48
+ Self {value, name: Some(name.to_string()) }
49
50
51
/// The inner value of the [`Const`]
0 commit comments