mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 13:58:27 +00:00
document std.heap.StackFallbackAllocator
This commit is contained in:
parent
3ae4931dc1
commit
f98aac9db4
@ -855,6 +855,9 @@ pub const FixedBufferAllocator = struct {
|
||||
|
||||
pub const ThreadSafeFixedBufferAllocator = @compileError("ThreadSafeFixedBufferAllocator has been replaced with `threadSafeAllocator` on FixedBufferAllocator");
|
||||
|
||||
/// Returns a `StackFallbackAllocator` allocating using either a
|
||||
/// `FixedBufferAllocator` on an array of size `size` and falling back to
|
||||
/// `fallback_allocator` if that fails.
|
||||
pub fn stackFallback(comptime size: usize, fallback_allocator: Allocator) StackFallbackAllocator(size) {
|
||||
return StackFallbackAllocator(size){
|
||||
.buffer = undefined,
|
||||
@ -863,6 +866,10 @@ pub fn stackFallback(comptime size: usize, fallback_allocator: Allocator) StackF
|
||||
};
|
||||
}
|
||||
|
||||
/// An allocator that attempts to allocate using a
|
||||
/// `FixedBufferAllocator` using an array of size `size`. If the
|
||||
/// allocation fails, it will fall back to using
|
||||
/// `fallback_allocator`. Easily created with `stackFallback`.
|
||||
pub fn StackFallbackAllocator(comptime size: usize) type {
|
||||
return struct {
|
||||
const Self = @This();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user