Mentions légales du service

Skip to content

Draft: Generic BufferPool

RILLING Louis requested to merge dev/generic-buffer-pool into master

This changeset prepares buffer pools to manage different types of buffers like Flat Buffers in !20 (closed), which is useful for #26 (closed). To this end BufferPool becomes BufferPool<T: InnerBuffer> where T is a buffer type and InnerBuffer is the trait defining the methods required by BufferPool to allocate at once a set of buffers (method InnerBuffer::calloc) and by Buffer<T> to Deref / DerefMut to the buffer contents (methods InnerBuffer::as_slice and InnerBuffer::as_mut_slice). The current buffer implementation is moved to the currently only buffer type called BytesBuffer.

Expected short-term evolutions:

  • make Buffer<T> Deref / DerefMut to T::Content instead of [u8]
    • To this end replace InnerBuffer::as_slice/as_mut_slice with InnerBuffer::get/get_mut.
  • add a Flat Buffer buffer type with pre-allocation of all the buffers metadata memory in InnerBuffer::calloc
    • To this end it might be required to provide InnerBuffer::calloc with an initializer Fn.
    • In a simpler alternative the buffer type could define an dedicated initializer trait and take a type parameter implementing this trait to initialize the buffers in InnerBuffer::calloc
Edited by RILLING Louis

Merge request reports