structstd.heap.arena_allocator.ArenaAllocator.State[src]

Inner state of ArenaAllocator. Can be stored rather than the entire ArenaAllocator as a memory-saving optimization.

Fields

buffer_list: std.SinglyLinkedList(usize) = .{}
end_index: usize = 0

Functions

Functionpromote[src]

pub fn promote(self: State, child_allocator: Allocator) ArenaAllocator

Parameters

self: State
child_allocator: Allocator

Source Code

Source code
pub fn promote(self: State, child_allocator: Allocator) ArenaAllocator {
    return .{
        .child_allocator = child_allocator,
        .state = self,
    };
}

Source Code

Source code
pub const State = struct {
    buffer_list: std.SinglyLinkedList(usize) = .{},
    end_index: usize = 0,

    pub fn promote(self: State, child_allocator: Allocator) ArenaAllocator {
        return .{
            .child_allocator = child_allocator,
            .state = self,
        };
    }
}