Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::Bindings Class Reference

#include <attr-set.hh>

Classes

class  iterator

Public Types

using size_type = uint32_t
using const_iterator = iterator

Public Member Functions

size_type size () const
bool empty () const
void push_back (const Attr &attr)
const Attr * get (Symbol name) const noexcept
bool isLayerListFull () const noexcept
bool isLayered () const noexcept
const_iterator begin () const
const_iterator end () const
Attr & operator[] (size_type pos)
const Attr & operator[] (size_type pos) const
void sort ()
std::vector< const Attr * > lexicographicOrder (const SymbolTable &symbols) const

Public Attributes

PosIdx pos

Static Public Attributes

static const constinit Bindings emptyBindings

Friends

class BindingsBuilder
class EvalMemory

Detailed Description

Bindings contains all the attributes of an attribute set. It is defined by its size and its capacity, the capacity being the number of Attr elements allocated after this structure, while the size corresponds to the number of elements already inserted in this structure.

Bindings can be efficiently //-composed into an intrusive linked list of "layers" that saves on copies and allocations. Each lookup (

See also
Bindings::get) traverses this linked list until a matching attribute is found (thus overlays earlier in the list take precedence). For iteration over the whole Bindings, an on-the-fly k-way merge is performed by Bindings::iterator class.

Member Function Documentation

◆ get()

const Attr * nix::Bindings::get ( Symbol name) const
inlinenoexcept

Get attribute by name or nullptr if no such attribute exists.

◆ isLayered()

bool nix::Bindings::isLayered ( ) const
inlinenoexcept

Test if the length of the linked list of layers is greater than 1.

◆ isLayerListFull()

bool nix::Bindings::isLayerListFull ( ) const
inlinenoexcept

Check if the layer chain is full.

◆ lexicographicOrder()

std::vector< const Attr * > nix::Bindings::lexicographicOrder ( const SymbolTable & symbols) const
inline

Returns the attributes in lexicographically sorted order.

Member Data Documentation

◆ emptyBindings

const constinit Bindings nix::Bindings::emptyBindings
staticconstinit

An instance of bindings objects with 0 attributes. This object must never be modified.


The documentation for this class was generated from the following files:
  • libexpr/include/nix/expr/attr-set.hh
  • libexpr/attr-set.cc