Make ValFromJSON return zeek::expected instead of a variant

This commit is contained in:
Tim Wojtulewicz 2025-04-02 14:44:47 -07:00
parent e545fe8256
commit 201d4508e6
6 changed files with 64 additions and 60 deletions

View file

@ -1774,8 +1774,8 @@ namespace detail {
//
// The *key_func* parameter is a Zeek script function called for every JSON key
// for normalization. If Func::nil is passed, no normalization happens.
extern std::variant<ValPtr, std::string> ValFromJSON(std::string_view json_str, const TypePtr& t,
const FuncPtr& key_func);
extern zeek::expected<ValPtr, std::string> ValFromJSON(std::string_view json_str, const TypePtr& t,
const FuncPtr& key_func);
// If the given vector is an empty vector-of-any ("unspecified"),
// concretizes it to the given type. *v* gives the vector and *t* the