Skip to content

Commit 877a258

Browse files
committed
generate fixed size lists in wit-smith
1 parent 0379389 commit 877a258

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

crates/wit-smith/src/generate.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ impl<'a> InterfaceGenerator<'a> {
716716
Option,
717717
Result,
718718
List,
719+
FixedSizeList,
719720
Stream,
720721
Future,
721722
ErrorContext,
@@ -797,6 +798,16 @@ impl<'a> InterfaceGenerator<'a> {
797798
self.gen_type(u, fuel, dst)?;
798799
dst.push_str(">");
799800
}
801+
Kind::FixedSizeList => {
802+
*fuel = match fuel.checked_sub(1) {
803+
Some(fuel) => fuel,
804+
None => continue,
805+
};
806+
let elements = u.int_in_range(1..=self.config.max_type_parts)?;
807+
dst.push_str("list<");
808+
self.gen_type(u, fuel, dst)?;
809+
dst.push_str(&format!(", {elements}>"));
810+
}
800811
Kind::Result => {
801812
*fuel = match fuel.checked_sub(2) {
802813
Some(fuel) => fuel,

0 commit comments

Comments
 (0)