pub fn containsUnempty(environ: Environ, gpa: Allocator, key: []const u8) ContainsError!bool OutOfMemoryInvalidWtf8On 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.
UnexpectedWASI-only. environ_sizes_get or environ_get failed for an unexpected reason.
578
579
580
581
582
583
584pub 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;
}
On Windows, if
keyis not valid WTF-8, thenerror.InvalidWtf8is returned.See also:
createMapcontainsUnemptyConstantcontains