Skip to content

Commit

Permalink
Support List(T) passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikMcClure committed Oct 3, 2023
1 parent 20741d1 commit 869ad2b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion capnpc/src/codegen_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,17 @@ impl<'a> RustTypeInfo for type_::Reader<'a> {
))
}
type_::AnyPointer(_) => {
Err(Error::failed("List(AnyPointer) is unsupported".to_string()))
// This is actually an AnyList, which means we just return an anypointer and
// let the user cast it appropriately.
match module {
Leaf::Reader(lifetime) => {
Ok(fmt!(ctx, "{capnp}::any_pointer::Reader<{lifetime}>"))
}
Leaf::Builder(lifetime) => {
Ok(fmt!(ctx, "{capnp}::any_pointer::Builder<{lifetime}>"))
}
_ => Ok(fmt!(ctx, "{capnp}::any_pointer::{module}")),
}
}
_ => {
let inner = element_type.type_string(ctx, Leaf::Owned)?;
Expand Down

0 comments on commit 869ad2b

Please sign in to comment.