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

toOwnedSlice

Public Function
std.crypto.codecs.asn1.der.ArrayListReverse.toOwnedSlice
pub fn toOwnedSlice(self: *ArrayListReverse) Error![]u8

The caller owns the returned memory. Capacity is cleared, making deinit() safe but unnecessary to call.

Params

File

crypto/codecs/asn1/der/ArrayListReverse.zig:72
72
73
74
75
76
77
78
pub fn toOwnedSlice(self: *ArrayListReverse) Error![]u8 {
    const new_memory = try self.allocator.alloc(u8, self.data.len);
    @memcpy(new_memory, self.data);
    @memset(self.data, undefined);
    self.clearAndFree();
    return new_memory;
}