Caller owns returned memory.
On Windows:
key is not valid WTF-8, then
error.InvalidWtf8 is returned.On other platforms, the value is an opaque sequence of bytes with no particular encoding.
See also:
createMappub fn getAlloc(environ: Environ, gpa: Allocator, key: []const u8) GetAllocError![]u8
pub fn getAlloc(environ: Environ, gpa: Allocator, key: []const u8) GetAllocError![]u8 {
if (native_os == .windows and !unicode.wtf8ValidateSlice(key)) return error.InvalidWtf8;
var map = createMap(environ, gpa) catch return error.OutOfMemory;
defer map.deinit();
const val = map.get(key) orelse return error.EnvironmentVariableMissing;
return gpa.dupe(u8, val);
}