Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nlohmann::adl_serializer< std::optional< T > > Struct Template Reference

#include <json-utils.hh>

Static Public Member Functions

static void from_json (const json &json, std::optional< T > &t)
 Convert a JSON type to an optional<T> treating null as std::nullopt.
 
static void to_json (json &json, const std::optional< T > &t)
 Convert an optional type to a JSON type treating std::nullopt as null.
 

Detailed Description

template<typename T>
struct nlohmann::adl_serializer< std::optional< T > >

This "instance" is widely requested, see https://github.com/nlohmann/json/issues/1749, but momentum has stalled out. Writing there here in Nix as a stop-gap.

We need to make sure the underlying type does not use null for this to round trip. We do that with a static assert.


The documentation for this struct was generated from the following file: