Zig 0.17.0-dev (Split by item)

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 library itself.

findSentinel

Returns the index of the sentinel value in a sentinel-terminated pointer. Linear search through memory until the sentinel is found.

mem.findSentinel
pub fn findSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]const T) usize

File

lib/std/mem.zig:1138

Code

pub fn findSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]const T) usize {
    var i: usize = 0;
    while (p[i] != sentinel) {
        i += 1;
    }
    return i;
}