0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
Commit graph

4 commits

Author SHA1 Message Date
Rue04
117fd40fbf add std.BitStackUnmanaged (#35660)
The unmanaged variant does not rely on `std.ArrayList`, because a slice can perform the same function here while saving a `usize`.
The managed implementation is marked *deprecated*. The `*WithState*` functions have been moved into a separate namespace, `std.BitStack.buffer`.

Upgrade guide:

```zig
var stack = try BitStack.init(allocator);
// ->
var stack: BitStackUnmanaged = .empty;

stack.deinit();
// ->
stack.deinit(allocator);

try stack.push(bit);
// ->
try stack.push(allocator, bit);

_ = stack.pop();
// ->
_ = stack.pop().?;

_ = stack.peek();
// ->
_ = stack.peek().?;

try stack.ensureTotalCapacity(size);
// ->
try stack.ensureTotalCapacity(allocator, size);

BitStack.pushWithStateAssumeCapacity(buf, &bit_len, bit);
// ->
BitStack.buffer.pushAssumeCapacity(buf, &bit_len, bit);

_ = BitStack.popWithState(buf, &bit_len);
// ->
_ = BitStack.buffer.pop(buf, &bit_len).?;

_ = BitStack.peekWithState(buf, bit_len);
// ->
_ = BitStack.buffer.peek(buf, bit_len).?;
```

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35660
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
2026-11-03 04:49:21 +01:00
Andrew Kelley
749f10af49 std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
Jora Troosh
13070448f5
std: fix typos (#20560) 2024-07-09 14:25:42 -07:00
Josh Wolfe
8924f81d8c
std.json: Unify stringify and writeStream (#16405) 2023-07-21 19:56:46 -04:00