Module attrs

Source
Expand description

This module implements Nix attribute sets. They have flexible backing implementations, as they are used in very versatile use-cases that are all exposed the same way in the language surface.

Due to this, construction and management of attribute sets has some peculiarities that are encapsulated within this module.

Structsยง

Iter
Iterator over a Nix attribute set.
Keys
NixAttrs
OwnedAttrsIterator
Wrapper type which hides the internal implementation details from users.

Enumsยง

AttrsRep ๐Ÿ”’
IntoIterRepr
Internal representation of an owning attrset iterator
IterKV
Internal helper type to track the iteration status of an iterator over the name/value representation.
KeyValue
Iterator representation over the keys and values of an attribute set.
KeysInner ๐Ÿ”’

Staticsยง

NAME ๐Ÿ”’
VALUE ๐Ÿ”’

Functionsยง

attempt_optimise_kv ๐Ÿ”’
In Nix, name/value attribute pairs are frequently constructed from literals. This particular case should avoid allocation of a map, additional heap values etc. and use the optimised KV variant instead.
set_attr ๐Ÿ”’
Set an attribute on an in-construction attribute set, while checking against duplicate keys.