20#include "pw_allocator/allocator.h"
21#include "pw_bytes/span.h"
22#include "pw_multibuf/chunk.h"
23#include "pw_multibuf/config.h"
25namespace pw::multibuf {
45 if (tracker ==
nullptr) {
49 if (!chunk.has_value()) {
67 allocator::Layout::Of<HeaderChunkRegionTracker>().Extend(size);
77 ByteSpan
Region() const final {
return region_; }
82 std::byte* ptr =
reinterpret_cast<std::byte*
>(
this);
84 std::destroy_at(
this);
85 alloc->Deallocate(ptr);
89 return alloc_->Allocate(allocator::Layout::Of<Chunk>());
101 : region_(region), alloc_(&alloc) {}
Definition: allocator.h:34
void * Allocate(Layout layout)
Definition: allocator.h:42
std::optional< OwnedChunk > CreateFirstChunk()