Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

State

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

Default initialization of this struct is deprecated; use init instead.

ArenaAllocator.State
pub const State = struct

File

lib/std/heap/ArenaAllocator.zig:17

Code

pub const State = struct {
    used_list: ?*Node = null,
    free_list: ?*Node = null,

    pub const init: State = .{
        .used_list = null,
        .free_list = null,
    };

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