mirror of
https://github.com/NixOS/nix.git
synced 2025-11-30 22:20:59 +01:00
speedup derivation parsing
This commit is contained in:
parent
fd6e383a63
commit
5e94fe5693
3 changed files with 124 additions and 99 deletions
|
|
@ -8,16 +8,14 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
static constexpr std::string_view envVarName = "__json";
|
||||
|
||||
StructuredAttrs StructuredAttrs::parse(const std::string & encoded)
|
||||
StructuredAttrs StructuredAttrs::parse(std::string_view encoded)
|
||||
{
|
||||
try {
|
||||
return StructuredAttrs{
|
||||
.structuredAttrs = nlohmann::json::parse(encoded),
|
||||
};
|
||||
} catch (std::exception & e) {
|
||||
throw Error("cannot process __json attribute: %s", e.what());
|
||||
throw Error("cannot process %s attribute: %s", envVarName, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue