Skip to content

Commit 458aaea

Browse files
committed
Support List(T) passthrough
1 parent f1e5fed commit 458aaea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

capnpc/src/codegen_types.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,17 @@ impl<'a> RustTypeInfo for type_::Reader<'a> {
241241
))
242242
}
243243
type_::AnyPointer(_) => {
244-
Err(Error::failed("List(AnyPointer) is unsupported".to_string()))
244+
// This is actually an AnyList, which means we just return an anypointer and
245+
// let the user cast it appropriately.
246+
match module {
247+
Leaf::Reader(lifetime) => {
248+
Ok(fmt!(ctx, "{capnp}::any_pointer::Reader<{lifetime}>"))
249+
}
250+
Leaf::Builder(lifetime) => {
251+
Ok(fmt!(ctx, "{capnp}::any_pointer::Builder<{lifetime}>"))
252+
}
253+
_ => Ok(fmt!(ctx, "{capnp}::any_pointer::{module}")),
254+
}
245255
}
246256
_ => {
247257
let inner = element_type.type_string(ctx, Leaf::Owned)?;

0 commit comments

Comments
 (0)