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

containsUnempty

Public Function
std.process.Environ.containsUnempty
pub fn containsUnempty(environ: Environ, gpa: Allocator, key: []const u8) ContainsError!bool

On Windows, if key is not valid WTF-8, then error.InvalidWtf8 is returned.

See also:

Params

Errors

OutOfMemory
InvalidWtf8

On Windows, environment variable keys provided by the user must be valid WTF-8. This error is unreachable if the key is statically known to be valid.

Unexpected

WASI-only. environ_sizes_get or environ_get failed for an unexpected reason.

File

process/Environ.zig:578
578
579
580
581
582
583
584
pub fn containsUnempty(environ: Environ, gpa: Allocator, key: []const u8) ContainsError!bool {
    if (native_os == .windows and !unicode.wtf8ValidateSlice(key)) return error.InvalidWtf8;
    var map = try createMap(environ, gpa);
    defer map.deinit();
    const value = map.get(key) orelse return false;
    return value.len != 0;
}