Function setName [src]
Thread-safe. Bytes after '0' in new_name are ignored.
Prototype
pub fn setName(n: Node, new_name: []const u8) void Parameters
n: Nodenew_name: []const u8 Source
pub fn setName(n: Node, new_name: []const u8) void {
const index = n.index.unwrap() orelse return;
const storage = storageByIndex(index);
const name_len = @min(max_name_len, std.mem.indexOfScalar(u8, new_name, 0) orelse new_name.len);
copyAtomicStore(storage.name[0..name_len], new_name[0..name_len]);
if (name_len < storage.name.len)
@atomicStore(u8, &storage.name[name_len], 0, .monotonic);
}