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

putMove

Public Function
std.process.Environ.Map.putMove
pub fn putMove(self: *Map, key: []u8, value: []u8) Allocator.Error!void

Same as put but the key and value become owned by the Map rather than being copied. If putMove fails, the ownership of key and value does not transfer.

Asserts that key is valid:

  • It cannot contain a NUL ('\x00') byte.
  • It must have a length > 0.
  • It cannot contain =, except on Windows where only the first code point is allowed to be =.
  • On Windows, it must be valid WTF-8.

Params

  • self: *Map
  • key: []u8
  • value: []u8

File

process/Environ.zig:238
238
239
240
241
242
243
244
245
246
247
248
    pub fn putMove(self: *Map, key: []u8, value: []u8) Allocator.Error!void {
        assert(validateKeyForPut(key));
        const gpa = self.allocator;
        const get_or_put = try self.array_hash_map.getOrPut(gpa, key);
        if (get_or_put.found_existing) {
            gpa.free(get_or_put.key_ptr.*);
            gpa.free(get_or_put.value_ptr.*);
            get_or_put.key_ptr.* = key;
        }
        get_or_put.value_ptr.* = value;
    }