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

toOwnedSliceSentinelAssert

Public Function
std.array_list.Aligned.toOwnedSliceSentinelAssert
pub fn toOwnedSliceSentinelAssert(self: *Self, comptime sentinel: T) SentinelSlice(sentinel)

The caller owns the returned memory. ArrayList becomes empty. Asserts what the capacity is equal to the length + 1. Never invalidates element pointers.

Params

  • self: *Self
  • sentinel: T

File

array_list.zig:789
789
790
791
792
793
794
        pub fn toOwnedSliceSentinelAssert(self: *Self, comptime sentinel: T) SentinelSlice(sentinel) {
            std.debug.assert(self.items.len + 1 == self.capacity);
            self.appendAssumeCapacity(sentinel);
            const result = self.toOwnedSliceAssert();
            return result[0 .. result.len - 1 :sentinel];
        }