Skip to content

Commit

Permalink
Adding derive for FromPrimitive to enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Apr 10, 2024
1 parent 3726e1f commit 5b42445
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/renderers/rust/getTypeManifestVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export function getTypeManifestVisitor() {
isNode(definedType.type, 'enumTypeNode') &&
isScalarEnum(definedType.type)
) {
traits.push('PartialOrd', 'Hash');
traits.push('PartialOrd', 'Hash', 'FromPrimitive');
manifest.imports.add([
'num_derive::FromPrimitive',
]);
}
return {
...manifest,
Expand Down

0 comments on commit 5b42445

Please sign in to comment.