20#include "pw_allocator/allocator.h"
21#include "pw_bytes/span.h"
22#include "pw_multibuf/chunk.h"
24namespace pw::multibuf {
43 if (tracker ==
nullptr) {
47 if (!chunk.has_value()) {
65 allocator::Layout::Of<HeaderChunkRegionTracker>().Extend(size);
75 ByteSpan
Region() const final {
return region_; }
80 std::byte* ptr =
reinterpret_cast<std::byte*
>(
this);
82 std::destroy_at(
this);
83 alloc->Deallocate(ptr);
87 return alloc_->
Allocate(allocator::Layout::Of<Chunk>());
99 : region_(region), alloc_(&alloc) {}
Definition: allocator.h:34
void * Allocate(Layout layout)
Definition: allocator.h:45
void Deallocate(void *ptr)
Definition: deallocator.h:57
std::optional< OwnedChunk > CreateFirstChunk()