Skip to content

Commit

Permalink
feat: Add From impls for TypeArg
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-q committed May 7, 2024
1 parent acca7bf commit b63595d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hugr/src/types/type_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,30 @@ impl From<Type> for TypeArg {
}
}

impl From<CustomTypeArg> for TypeArg {
fn from(arg: CustomTypeArg) -> Self {
Self::Opaque { arg }
}
}

impl From<TypeArgVariable> for TypeArg {
fn from(v: TypeArgVariable) -> Self {
Self::Variable { v }
}
}

impl From<ExtensionSet> for TypeArg {
fn from(es: ExtensionSet) -> Self {
Self::Extensions { es }
}
}

impl From<Vec<TypeArg>> for TypeArg {
fn from(elems: Vec<TypeArg>) -> Self {
Self::Sequence { elems }
}
}

/// A statically-known argument value to an operation.
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
#[non_exhaustive]
Expand Down

0 comments on commit b63595d

Please sign in to comment.