Spicy
result.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <hilti/ast/operators/common.h>
6 #include <hilti/ast/types/result.h>
7 
8 namespace hilti::operator_ {
9 
10 STANDARD_OPERATOR_1(result, Deref, operator_::dereferencedType(0), type::constant(type::Result(type::Wildcard())),
11  "Retrieves value stored inside the result instance. Will throw a ``NoResult`` exception if the "
12  "result is in an error state.");
13 
14 BEGIN_METHOD(result, Error)
15  const auto& signature() const {
16  static auto _signature =
17  Signature{.self = type::Result(type::Wildcard()),
18  .result = type::Error(),
19  .id = "error",
20  .args = {},
21  .doc =
22  "Retrieves the error stored inside the result instance. Will throw a ``NoError`` "
23  "exception if the result is not in an error state."};
24  return _signature;
25  }
26 END_METHOD
27 
28 } // namespace hilti::operator_
Definition: operator-registry.h:15