mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
Fix JSON_IMPL macro to avoid extraneous copies
Should take the thing we're serializing by reference.
This commit is contained in:
parent
d9de675357
commit
af71a9dbd9
7 changed files with 17 additions and 17 deletions
|
|
@ -356,7 +356,7 @@ DerivationOptions adl_serializer<DerivationOptions>::from_json(const json & json
|
|||
};
|
||||
}
|
||||
|
||||
void adl_serializer<DerivationOptions>::to_json(json & json, DerivationOptions o)
|
||||
void adl_serializer<DerivationOptions>::to_json(json & json, const DerivationOptions & o)
|
||||
{
|
||||
json["outputChecks"] = std::visit(
|
||||
overloaded{
|
||||
|
|
@ -398,7 +398,7 @@ DerivationOptions::OutputChecks adl_serializer<DerivationOptions::OutputChecks>:
|
|||
};
|
||||
}
|
||||
|
||||
void adl_serializer<DerivationOptions::OutputChecks>::to_json(json & json, DerivationOptions::OutputChecks c)
|
||||
void adl_serializer<DerivationOptions::OutputChecks>::to_json(json & json, const DerivationOptions::OutputChecks & c)
|
||||
{
|
||||
json["ignoreSelfRefs"] = c.ignoreSelfRefs;
|
||||
json["allowedReferences"] = c.allowedReferences;
|
||||
|
|
|
|||
|
|
@ -1494,7 +1494,7 @@ Derivation adl_serializer<Derivation>::from_json(const json & json)
|
|||
return Derivation::fromJSON(json);
|
||||
}
|
||||
|
||||
void adl_serializer<Derivation>::to_json(json & json, Derivation c)
|
||||
void adl_serializer<Derivation>::to_json(json & json, const Derivation & c)
|
||||
{
|
||||
json = c.toJSON();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ OutputsSpec adl_serializer<OutputsSpec>::from_json(const json & json)
|
|||
return OutputsSpec::Names{std::move(names)};
|
||||
}
|
||||
|
||||
void adl_serializer<OutputsSpec>::to_json(json & json, OutputsSpec t)
|
||||
void adl_serializer<OutputsSpec>::to_json(json & json, const OutputsSpec & t)
|
||||
{
|
||||
std::visit(
|
||||
overloaded{
|
||||
|
|
@ -169,7 +169,7 @@ ExtendedOutputsSpec adl_serializer<ExtendedOutputsSpec>::from_json(const json &
|
|||
}
|
||||
}
|
||||
|
||||
void adl_serializer<ExtendedOutputsSpec>::to_json(json & json, ExtendedOutputsSpec t)
|
||||
void adl_serializer<ExtendedOutputsSpec>::to_json(json & json, const ExtendedOutputsSpec & t)
|
||||
{
|
||||
std::visit(
|
||||
overloaded{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ StorePath adl_serializer<StorePath>::from_json(const json & json)
|
|||
return StorePath{getString(json)};
|
||||
}
|
||||
|
||||
void adl_serializer<StorePath>::to_json(json & json, StorePath storePath)
|
||||
void adl_serializer<StorePath>::to_json(json & json, const StorePath & storePath)
|
||||
{
|
||||
json = storePath.to_string();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ Realisation adl_serializer<Realisation>::from_json(const json & json0)
|
|||
};
|
||||
}
|
||||
|
||||
void adl_serializer<Realisation>::to_json(json & json, Realisation r)
|
||||
void adl_serializer<Realisation>::to_json(json & json, const Realisation & r)
|
||||
{
|
||||
auto jsonDependentRealisations = nlohmann::json::object();
|
||||
for (auto & [depId, depOutPath] : r.dependentRealisations)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue