Skip to content

Commit

Permalink
Adding derive for FromPrimitive to enums. (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus authored Apr 10, 2024
1 parent 75f5f91 commit dc85f39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-suits-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@metaplex-foundation/kinobi": patch
---

Adding derive for FromPrimitive to enums.
3 changes: 2 additions & 1 deletion src/renderers/rust/getTypeManifestVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ 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 dc85f39

Please sign in to comment.