Monday, 14 February 2022

pycapnp: Reading and Writing a List

I have read through the pycapnp quickstart and docs, and I see no mention for how to read and write basic list objects (like a list of floats).

In particular, I am aware that if I write a custom type in a capnp file, then I can read an object of that type using something like

addressbook_capnp.Person.from_bytes(encoded_message)

What I would like to know is the syntax for reading a list of floats like this. I imagine that it would look something like

capnp.List.Float64.from_bytes(encoded_message)

But I simply can't find the correct syntax. Furthermore, since Capn Proto does not export aliases from the .capnp file, I cannot just define a list of floats there (or so it seems).

Can somebody please tell me the correct syntax for reading, writing, and creating lists of basic objects in pycapnp?



from pycapnp: Reading and Writing a List

No comments:

Post a Comment