absl::Cord::GetCustomAppendBuffer

Returns a CordBuffer, re-using potential existing capacity in this cord.

Synopsis

Declared in <absl/strings/cord.h>

CordBuffer
GetCustomAppendBuffer(
    size_t block_size,
    size_t capacity,
    size_t min_capacity = 16);

Description

This function is identical to GetAppendBuffer, except that in the case where a new CordBuffer is allocated, it is allocated using the provided custom limit instead of the default limit. GetAppendBuffer will default to CordBuffer::CreateWithDefaultLimit(capacity) whereas this method will default to CordBuffer::CreateWithCustomLimit(block_size, capacity). This method is equivalent to GetAppendBuffer if block_size is zero. See the documentation for CreateWithCustomLimit for more details on the restrictions and legal values for block_size.

Return Value

A CordBuffer reusing spare capacity when available.

Parameters

NameDescription
block_sizeThe custom allocation limit for a newly allocated buffer.
capacityThe desired capacity of the returned buffer.
min_capacityThe minimum extra capacity required to reuse existing spare capacity.