From 869ad2b7cdfdd50906e7349eab4cd30eb80b67f2 Mon Sep 17 00:00:00 2001 From: Erik McClure Date: Mon, 2 Oct 2023 18:59:46 -0700 Subject: [PATCH] Support List(T) passthrough --- capnpc/src/codegen_types.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/capnpc/src/codegen_types.rs b/capnpc/src/codegen_types.rs index 54a201e7a..9e975ae45 100644 --- a/capnpc/src/codegen_types.rs +++ b/capnpc/src/codegen_types.rs @@ -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)?;