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

#include <attr-set.hh>

Public Types

using value_type = Attr
using size_type = Bindings::size_type

Public Member Functions

void insert (Symbol name, Value *value, PosIdx pos=noPos)
void insert (const Attr &attr)
void push_back (const Attr &attr)
void layerOnTopOf (const Bindings &base) noexcept
Value & alloc (Symbol name, PosIdx pos=noPos)
Value & alloc (std::string_view name, PosIdx pos=noPos)
const Bindings * finish ()
const Bindings * alreadySorted ()
size_t capacity () const noexcept
void grow (BindingsBuilder newBindings)

Public Attributes

std::reference_wrapper< EvalMemory > mem
std::reference_wrapper< SymbolTable > symbols

Friends

class EvalMemory
struct ExprAttrs

Detailed Description

A wrapper around Bindings that ensures that its always in sorted order at the end. The only way to consume a BindingsBuilder is to call finish(), which sorts the bindings.

Member Function Documentation

◆ layerOnTopOf()

void nix::BindingsBuilder::layerOnTopOf ( const Bindings & base)
inlinenoexcept

"Layer" the newly constructured Bindings on top of another attribute set.

This effectively performs an attribute set merge, while giving preference to attributes from the newly constructed Bindings in case of duplicate attribute names.

This operation amortizes the need to copy over all attributes and allows for efficient implementation of attribute set merges (ExprOpUpdate::eval).


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