Skip to content

Commit c4f51cd

Browse files
Static Lifetime on id method and i8, i16 support (#12)
fix(parser): add i8/i16 support and fix lifetime on id() - Updated `id()` definition to include `'static` lifetime, resolving build issues - Added support for `i8` and `i16` to the generator and parser - Updated relevant tests to cover new types - Added migration doc: parser-lifetime-fix-and-i8-i16-support.md --------- Co-authored-by: CanardMandarin <[email protected]>
1 parent e45ba9e commit c4f51cd

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@codama/renderers-vixen-parser": patch
3+
---
4+
5+
- Resolve build error regarding missing static lifetime on `id` method
6+
- Expand generator support to `i8` and `i16`

public/templates/accountsParserPage.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl yellowstone_vixen_core::Parser for AccountParser {
109109
type Input = yellowstone_vixen_core::AccountUpdate;
110110
type Output = {{ programName | pascalCase }}ProgramState;
111111

112-
fn id(&self) -> std::borrow::Cow<str> {
112+
fn id(&self) -> std::borrow::Cow<'static, str> {
113113
"{{ programName | snakeCase }}::AccountParser".into()
114114
}
115115

public/templates/instructionsParserPage.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl yellowstone_vixen_core::Parser for InstructionParser {
3838
#[cfg(feature = "shared-data")]
3939
type Output = InstructionUpdateOutput<{{ programName | pascalCase }}ProgramIx>;
4040

41-
fn id(&self) -> std::borrow::Cow<str> {
41+
fn id(&self) -> std::borrow::Cow<'static, str> {
4242
"{{ programName | pascalCase }}::InstructionParser".into()
4343
}
4444

src/getRenderMapVisitor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ function getNumberTypeTransform(type: NumberTypeNode) {
134134

135135
case 'u8':
136136
case 'u16':
137+
case 'i8':
138+
case 'i16':
137139
return `.into()`;
138140

139141
default:

test/accountsParserPage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test('it renders accounts parsers', () => {
5050
'impl yellowstone_vixen_core::Parser for AccountParser',
5151
'async fn parse',
5252
'fn prefilter(&self) -> yellowstone_vixen_core::Prefilter',
53-
'fn id(&self) -> std::borrow::Cow<str>',
53+
"fn id(&self) -> std::borrow::Cow<'static, str>",
5454
'type Input = yellowstone_vixen_core::AccountUpdate',
5555
'type Output = TestProgramState',
5656
]);

0 commit comments

Comments
 (0)