Open bonsairobo opened 2 years ago
Hey @bonsairobo I'm thinking about allowing Marble::read
to take a generic allocator as an argument, in the same way that the std::collections
do, and in your allocator you can make it a simple pass-through that calls max
on the alignment with your desired minimum alignment before passing it to the default allocator.
@spacejam That sounds good. Although if the container I want to use (e.g. rkyv::AlignedVec
) is not generic over allocators, then it is hard to use this API. Maybe you'd rather like a trait similar to the Buffer
trait I've got here.
@spacejam any chance you would revisit this? I'm also trying to use rkyv with marble (well with any storage layer for that matter)
I guess it would help if I had read this thread first before filing my other issue. Some duplication of conversation here.
FWIW I vote highly for this approach.
I think it would be useful to guarantee some minimum alignment of the buffer returned from
Marble::read
, which would allow the buffer to be used with zero-copy deserialization likerkyv
. I know thatsled
alignsIVec
s to 16 bytes (on the main branch). I hacked this into my fork ofmarble
here.