Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If layout allows provide a slice view into primitive list #76

Closed
mmacedoeu opened this issue Jul 24, 2017 · 3 comments
Closed

If layout allows provide a slice view into primitive list #76

mmacedoeu opened this issue Jul 24, 2017 · 3 comments

Comments

@mmacedoeu
Copy link

As I could see to get a memory aligned [u64] in capnproto you must use a primitive list with T = u64/UInt64 but them it is unclear how to get access to a slice of it

@dwrensha
Copy link
Member

Correct, there is currently no way to get a slice into the data, for a couple of reasons:

  1. Endianness. The data will always be encoded in little-endian order, but the library needs to also work on big-endian systems. I suppose maybe we could conditionally omit the hypothetical to_slice() function on big-endian systems?
  2. List upgrades (discussed here). Primitive lists are permitted to be upgraded to struct lists, so primitive_list::Reader needs to be able to deal with cases where the elements are not tightly packed. I suppose a hypothetical to_slice() function could return an error if the elements are tightly packed?

@dwrensha
Copy link
Member

dwrensha commented Aug 4, 2018

See related discussion on #97.

@dwrensha
Copy link
Member

dwrensha commented Sep 1, 2019

capnp::raw::get_list_bytes() was added in 6683d7a

@dwrensha dwrensha closed this as completed Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants