Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

pushBackSliceAssumeCapacity

Public Function
std.deque.Deque.pushBackSliceAssumeCapacity
pub fn pushBackSliceAssumeCapacity(deque: *Self, items: []const T) void

Add items to the back of the deque. This is equivalent to iterating items in order and calling pushBack on every single entry.

Never invalidates element pointers.

Asserts that the deque can hold the additional items.

Params

  • deque: *Self
  • items: []const T

File

deque.zig:250
250
251
252
253
254
255
256
257
258
259
260
        pub fn pushBackSliceAssumeCapacity(deque: *Self, items: []const T) void {
            assert(deque.buffer.len - deque.len >= items.len);
            const trailing_buffer = deque.buffer[deque.bufferIndex(deque.len)..];
            if (trailing_buffer.len < items.len) {
                @memcpy(trailing_buffer, items[0..trailing_buffer.len]);
                @memcpy(deque.buffer.ptr, items[trailing_buffer.len..]);
            } else {
                @memcpy(trailing_buffer[0..items.len], items);
            }
            deque.len += items.len;
        }