Nix  2.93.0-dev
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
types.hh File Reference
#include <list>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <map>
#include <vector>
#include <span>
#include <stdint.h>
Include dependency graph for types.hh:

Go to the source code of this file.

Classes

struct  nix::Explicit< T >
 
struct  nix::MaintainCount< T >
 
struct  nix::overloaded< Ts >
 
struct  nix::NeverAsync
 

Typedefs

typedef std::list< std::string > nix::Strings
 
typedef std::set< std::string > nix::StringSet
 
typedef std::map< std::string, std::string > nix::StringMap
 
typedef std::map< std::string, std::string > nix::StringPairs
 
using nix::Bytes = std::span<const char>
 
typedef std::string nix::Path
 
typedef std::string_view nix::PathView
 
typedef std::list< Pathnix::Paths
 
typedef std::set< Pathnix::PathSet
 
typedef std::vector< std::pair< std::string, std::string > > nix::Headers
 

Functions

template<class T >
const T::mapped_type * nix::get (const T &map, const typename T::key_type &key)
 
template<class T >
T::mapped_type * nix::get (T &map, const typename T::key_type &key)
 
template<class T >
const T::mapped_type & nix::getOr (T &map, const typename T::key_type &key, const typename T::mapped_type &defaultValue)
 
template<class T >
std::optional< typename T::value_type > nix::remove_begin (T &c)
 
template<class T >
std::optional< typename T::value_type > nix::pop (T &c)
 
template<typename T , typename TIter = decltype(std::begin(std::declval<T>())), typename = decltype(std::end(std::declval<T>()))>
constexpr auto nix::enumerate (T &&iterable)
 
template<class... Ts>
 nix::overloaded (Ts...) -> overloaded< Ts... >
 

Variables

constexpr NeverAsync nix::always_progresses
 

Typedef Documentation

◆ Path

typedef std::string nix::Path

Paths are just strings.

Function Documentation

◆ enumerate()

template<typename T , typename TIter = decltype(std::begin(std::declval<T>())), typename = decltype(std::end(std::declval<T>()))>
constexpr auto nix::enumerate ( T && iterable)
constexpr

A Rust/Python-like enumerate() iterator adapter.

Borrowed from http://reedbeta.com/blog/python-like-enumerate-in-cpp17.

FIXME(jade): remove once P2164R9 is implemented in libc++ and replace with std::views::enumerate: https://libcxx.llvm.org/Status/Cxx23.html

◆ get()

template<class T >
const T::mapped_type * nix::get ( const T & map,
const typename T::key_type & key )

Get a value for the specified key from an associate container.

◆ getOr()

template<class T >
const T::mapped_type & nix::getOr ( T & map,
const typename T::key_type & key,
const typename T::mapped_type & defaultValue )

Get a value for the specified key from an associate container, or a default value if the key isn't present.

◆ pop()

template<class T >
std::optional< typename T::value_type > nix::pop ( T & c)

Remove and return the first item from a container.

◆ remove_begin()

template<class T >
std::optional< typename T::value_type > nix::remove_begin ( T & c)

Remove and return the first item from a container.

Variable Documentation

◆ always_progresses

constexpr NeverAsync nix::always_progresses
inlineconstexpr

Escape hatch to allow calling NeverAsync-marked code from functions that aren't themselves NeverAsync. this should only be used when no typelevel proof can be given for a call that's dynamically known to not block. using this is still forbidden in promises since blocking an executor, even on something known to complete, impedes progress.