Coverage Report

Created: 2025-08-28 09:57

/src/node/deps/v8/include/v8-maybe.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2021 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef INCLUDE_V8_MAYBE_H_
6
#define INCLUDE_V8_MAYBE_H_
7
8
#include <type_traits>
9
#include <utility>
10
11
#include "v8-internal.h"  // NOLINT(build/include_directory)
12
#include "v8config.h"     // NOLINT(build/include_directory)
13
14
namespace v8 {
15
16
namespace api_internal {
17
// Called when ToChecked is called on an empty Maybe.
18
V8_EXPORT void FromJustIsNothing();
19
}  // namespace api_internal
20
21
/**
22
 * A simple Maybe type, representing an object which may or may not have a
23
 * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
24
 *
25
 * If an API method returns a Maybe<>, the API method can potentially fail
26
 * either because an exception is thrown, or because an exception is pending,
27
 * e.g. because a previous API call threw an exception that hasn't been caught
28
 * yet, or because a TerminateExecution exception was thrown. In that case, a
29
 * "Nothing" value is returned.
30
 */
31
template <class T>
32
class Maybe {
33
 public:
34
24.1M
  V8_INLINE bool IsNothing() const { return !has_value_; }
v8::Maybe<bool>::IsNothing() const
Line
Count
Source
34
24.1M
  V8_INLINE bool IsNothing() const { return !has_value_; }
Unexecuted instantiation: v8::Maybe<node::ExitCode>::IsNothing() const
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::IsNothing() const
Unexecuted instantiation: v8::Maybe<int>::IsNothing() const
Unexecuted instantiation: v8::Maybe<unsigned int>::IsNothing() const
Unexecuted instantiation: v8::Maybe<double>::IsNothing() const
Unexecuted instantiation: v8::Maybe<long>::IsNothing() const
Unexecuted instantiation: v8::Maybe<unsigned long>::IsNothing() const
Unexecuted instantiation: v8::Maybe<node::StreamPipe*>::IsNothing() const
35
142M
  V8_INLINE bool IsJust() const { return has_value_; }
v8::Maybe<bool>::IsJust() const
Line
Count
Source
35
107M
  V8_INLINE bool IsJust() const { return has_value_; }
v8::Maybe<unsigned long>::IsJust() const
Line
Count
Source
35
30.7M
  V8_INLINE bool IsJust() const { return has_value_; }
Unexecuted instantiation: v8::Maybe<node::ExitCode>::IsJust() const
Unexecuted instantiation: v8::Maybe<double>::IsJust() const
v8::Maybe<unsigned int>::IsJust() const
Line
Count
Source
35
64.7k
  V8_INLINE bool IsJust() const { return has_value_; }
v8::Maybe<int>::IsJust() const
Line
Count
Source
35
651k
  V8_INLINE bool IsJust() const { return has_value_; }
v8::Maybe<long>::IsJust() const
Line
Count
Source
35
552k
  V8_INLINE bool IsJust() const { return has_value_; }
Unexecuted instantiation: v8::Maybe<v8::PropertyAttribute>::IsJust() const
v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::IsJust() const
Line
Count
Source
35
2.76M
  V8_INLINE bool IsJust() const { return has_value_; }
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::IsJust() const
v8::Maybe<node::crypto::PKEncodingType>::IsJust() const
Line
Count
Source
35
6
  V8_INLINE bool IsJust() const { return has_value_; }
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::IsJust() const
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::IsJust() const
36
37
  /**
38
   * An alias for |FromJust|. Will crash if the Maybe<> is nothing.
39
   */
40
244k
  V8_INLINE T ToChecked() const { return FromJust(); }
v8::Maybe<bool>::ToChecked() const
Line
Count
Source
40
244k
  V8_INLINE T ToChecked() const { return FromJust(); }
Unexecuted instantiation: v8::Maybe<int>::ToChecked() const
Unexecuted instantiation: v8::Maybe<unsigned int>::ToChecked() const
v8::Maybe<node::crypto::PKEncodingType>::ToChecked() const
Line
Count
Source
40
6
  V8_INLINE T ToChecked() const { return FromJust(); }
v8::Maybe<long>::ToChecked() const
Line
Count
Source
40
13
  V8_INLINE T ToChecked() const { return FromJust(); }
41
42
  /**
43
   * Short-hand for ToChecked(), which doesn't return a value. To be used, where
44
   * the actual value of the Maybe is not needed like Object::Set.
45
   */
46
92.9M
  V8_INLINE void Check() const {
47
92.9M
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
48
92.9M
  }
49
50
  /**
51
   * Converts this Maybe<> to a value of type T. If this Maybe<> is
52
   * nothing (empty), |false| is returned and |out| is left untouched.
53
   */
54
17.0M
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
55
17.0M
    if (V8_LIKELY(IsJust())) *out = value_;
56
17.0M
    return IsJust();
57
17.0M
  }
v8::Maybe<unsigned long>::To(unsigned long*) const
Line
Count
Source
54
15.3M
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
55
15.3M
    if (V8_LIKELY(IsJust())) *out = value_;
56
15.3M
    return IsJust();
57
15.3M
  }
v8::Maybe<unsigned int>::To(unsigned int*) const
Line
Count
Source
54
32.0k
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
55
32.0k
    if (V8_LIKELY(IsJust())) *out = value_;
56
32.0k
    return IsJust();
57
32.0k
  }
v8::Maybe<int>::To(int*) const
Line
Count
Source
54
249k
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
55
249k
    if (V8_LIKELY(IsJust())) *out = value_;
56
249k
    return IsJust();
57
249k
  }
v8::Maybe<long>::To(long*) const
Line
Count
Source
54
275k
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
55
275k
    if (V8_LIKELY(IsJust())) *out = value_;
56
275k
    return IsJust();
57
275k
  }
Unexecuted instantiation: v8::Maybe<v8::PropertyAttribute>::To(v8::PropertyAttribute*) const
v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::To(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const
Line
Count
Source
54
1.09M
  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
55
1.09M
    if (V8_LIKELY(IsJust())) *out = value_;
56
1.09M
    return IsJust();
57
1.09M
  }
Unexecuted instantiation: v8::Maybe<bool>::To(bool*) const
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::To(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > >*) const
Unexecuted instantiation: v8::Maybe<double>::To(double*) const
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::To(ngtcp2_cc_algo*) const
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::To(node::quic::Endpoint::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::To(node::quic::Session::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::To(node::quic::SessionTicket*) const
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::To(node::quic::PreferredAddress::Policy*) const
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::To(node::quic::TransportParams::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::To(node::quic::TLSContext::Options*) const
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::To(node::quic::Session::Application_Options*) const
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::To(std::__1::shared_ptr<node::DataQueue>*) const
58
59
  /**
60
   * Converts this Maybe<> to a value of type T. If this Maybe<> is
61
   * nothing (empty), V8 will crash the process.
62
   */
63
520k
  V8_INLINE T FromJust() const& {
64
520k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
65
520k
    return value_;
66
520k
  }
Unexecuted instantiation: v8::Maybe<node::ExitCode>::FromJust() const &
v8::Maybe<bool>::FromJust() const &
Line
Count
Source
63
520k
  V8_INLINE T FromJust() const& {
64
520k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
65
520k
    return value_;
66
520k
  }
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::FromJust() const &
Unexecuted instantiation: v8::Maybe<int>::FromJust() const &
Unexecuted instantiation: v8::Maybe<unsigned int>::FromJust() const &
Unexecuted instantiation: v8::Maybe<double>::FromJust() const &
v8::Maybe<long>::FromJust() const &
Line
Count
Source
63
13
  V8_INLINE T FromJust() const& {
64
13
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
65
13
    return value_;
66
13
  }
Unexecuted instantiation: v8::Maybe<unsigned long>::FromJust() const &
v8::Maybe<node::crypto::PKEncodingType>::FromJust() const &
Line
Count
Source
63
6
  V8_INLINE T FromJust() const& {
64
6
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
65
6
    return value_;
66
6
  }
67
68
  /**
69
   * Converts this Maybe<> to a value of type T. If this Maybe<> is
70
   * nothing (empty), V8 will crash the process.
71
   */
72
14.4M
  V8_INLINE T FromJust() && {
73
14.4M
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
74
14.4M
    return std::move(value_);
75
14.4M
  }
Unexecuted instantiation: v8::Maybe<double>::FromJust() &&
v8::Maybe<bool>::FromJust() &&
Line
Count
Source
72
14.2M
  V8_INLINE T FromJust() && {
73
14.2M
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
74
14.2M
    return std::move(value_);
75
14.2M
  }
v8::Maybe<unsigned int>::FromJust() &&
Line
Count
Source
72
3
  V8_INLINE T FromJust() && {
73
3
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
74
3
    return std::move(value_);
75
3
  }
v8::Maybe<int>::FromJust() &&
Line
Count
Source
72
151k
  V8_INLINE T FromJust() && {
73
151k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
74
151k
    return std::move(value_);
75
151k
  }
v8::Maybe<long>::FromJust() &&
Line
Count
Source
72
1.71k
  V8_INLINE T FromJust() && {
73
1.71k
    if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
74
1.71k
    return std::move(value_);
75
1.71k
  }
76
77
  /**
78
   * Converts this Maybe<> to a value of type T, using a default value if this
79
   * Maybe<> is nothing (empty).
80
   */
81
85.2M
  V8_INLINE T FromMaybe(const T& default_value) const {
82
85.2M
    return has_value_ ? value_ : default_value;
83
85.2M
  }
Unexecuted instantiation: v8::Maybe<node::ExitCode>::FromMaybe(node::ExitCode const&) const
v8::Maybe<bool>::FromMaybe(bool const&) const
Line
Count
Source
81
84.8M
  V8_INLINE T FromMaybe(const T& default_value) const {
82
84.8M
    return has_value_ ? value_ : default_value;
83
84.8M
  }
v8::Maybe<int>::FromMaybe(int const&) const
Line
Count
Source
81
303k
  V8_INLINE T FromMaybe(const T& default_value) const {
82
303k
    return has_value_ ? value_ : default_value;
83
303k
  }
v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::FromMaybe(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const
Line
Count
Source
81
122k
  V8_INLINE T FromMaybe(const T& default_value) const {
82
122k
    return has_value_ ? value_ : default_value;
83
122k
  }
v8::Maybe<long>::FromMaybe(long const&) const
Line
Count
Source
81
757
  V8_INLINE T FromMaybe(const T& default_value) const {
82
757
    return has_value_ ? value_ : default_value;
83
757
  }
Unexecuted instantiation: v8::Maybe<unsigned long>::FromMaybe(unsigned long const&) const
84
85
  V8_INLINE bool operator==(const Maybe& other) const {
86
    return (IsJust() == other.IsJust()) &&
87
           (!IsJust() || FromJust() == other.FromJust());
88
  }
89
90
  V8_INLINE bool operator!=(const Maybe& other) const {
91
    return !operator==(other);
92
  }
93
94
 private:
95
1.67M
  Maybe() : has_value_(false) {}
Unexecuted instantiation: v8::Maybe<bool>::Maybe()
Unexecuted instantiation: v8::Maybe<node::ExitCode>::Maybe()
v8::Maybe<int>::Maybe()
Line
Count
Source
95
6
  Maybe() : has_value_(false) {}
v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Maybe()
Line
Count
Source
95
1.67M
  Maybe() : has_value_(false) {}
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::Maybe()
v8::Maybe<unsigned int>::Maybe()
Line
Count
Source
95
767
  Maybe() : has_value_(false) {}
Unexecuted instantiation: v8::Maybe<node::StreamPipe*>::Maybe()
Unexecuted instantiation: v8::Maybe<unsigned long>::Maybe()
v8::Maybe<node::crypto::PKEncodingType>::Maybe()
Line
Count
Source
95
2.15k
  Maybe() : has_value_(false) {}
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::Maybe()
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::Maybe()
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::Maybe()
96
15.3M
  explicit Maybe(const T& t) : has_value_(true), value_(t) {}
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Maybe(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: v8::Maybe<unsigned int>::Maybe(unsigned int const&)
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::Maybe(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > const&)
Unexecuted instantiation: v8::Maybe<double>::Maybe(double const&)
Unexecuted instantiation: v8::Maybe<int>::Maybe(int const&)
v8::Maybe<unsigned long>::Maybe(unsigned long const&)
Line
Count
Source
96
15.3M
  explicit Maybe(const T& t) : has_value_(true), value_(t) {}
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options>::Maybe(node::quic::Endpoint::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options>::Maybe(node::quic::Session::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options>::Maybe(node::quic::TLSContext::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options>::Maybe(node::quic::TransportParams::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options>::Maybe(node::quic::Session::Application_Options const&)
97
900k
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
v8::Maybe<bool>::Maybe(bool&&)
Line
Count
Source
97
773k
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
Unexecuted instantiation: v8::Maybe<node::ExitCode>::Maybe(node::ExitCode&&)
v8::Maybe<int>::Maybe(int&&)
Line
Count
Source
97
1
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >::Maybe(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > >&&)
v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Maybe(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&)
Line
Count
Source
97
122k
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
Unexecuted instantiation: v8::Maybe<unsigned int>::Maybe(unsigned int&&)
Unexecuted instantiation: v8::Maybe<node::StreamPipe*>::Maybe(node::StreamPipe*&&)
v8::Maybe<unsigned long>::Maybe(unsigned long&&)
Line
Count
Source
97
4.68k
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
v8::Maybe<node::crypto::PKEncodingType>::Maybe(node::crypto::PKEncodingType&&)
Line
Count
Source
97
4
  explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo>::Maybe(ngtcp2_cc_algo&&)
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket>::Maybe(node::quic::SessionTicket&&)
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> >::Maybe(std::__1::shared_ptr<node::DataQueue>&&)
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy>::Maybe(node::quic::PreferredAddress::Policy&&)
98
99
  bool has_value_;
100
  T value_;
101
102
  template <class U>
103
  friend Maybe<U> Nothing();
104
  template <class U>
105
  friend Maybe<U> Just(const U& u);
106
  template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
107
  friend Maybe<U> Just(U&& u);
108
};
109
110
template <class T>
111
1.67M
inline Maybe<T> Nothing() {
112
1.67M
  return Maybe<T>();
113
1.67M
}
Unexecuted instantiation: v8::Maybe<bool> v8::Nothing<bool>()
Unexecuted instantiation: v8::Maybe<node::ExitCode> v8::Nothing<node::ExitCode>()
v8::Maybe<int> v8::Nothing<int>()
Line
Count
Source
111
6
inline Maybe<T> Nothing() {
112
6
  return Maybe<T>();
113
6
}
Unexecuted instantiation: v8::Maybe<void> v8::Nothing<void>()
v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > v8::Nothing<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >()
Line
Count
Source
111
1.67M
inline Maybe<T> Nothing() {
112
1.67M
  return Maybe<T>();
113
1.67M
}
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > > v8::Nothing<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >()
v8::Maybe<unsigned int> v8::Nothing<unsigned int>()
Line
Count
Source
111
767
inline Maybe<T> Nothing() {
112
767
  return Maybe<T>();
113
767
}
Unexecuted instantiation: v8::Maybe<node::StreamPipe*> v8::Nothing<node::StreamPipe*>()
Unexecuted instantiation: v8::Maybe<unsigned long> v8::Nothing<unsigned long>()
v8::Maybe<node::crypto::PKEncodingType> v8::Nothing<node::crypto::PKEncodingType>()
Line
Count
Source
111
2.15k
inline Maybe<T> Nothing() {
112
2.15k
  return Maybe<T>();
113
2.15k
}
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options> v8::Nothing<node::quic::Endpoint::Options>()
Unexecuted instantiation: v8::Maybe<ngtcp2_cc_algo> v8::Nothing<ngtcp2_cc_algo>()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options> v8::Nothing<node::quic::Session::Options>()
Unexecuted instantiation: v8::Maybe<node::quic::SessionTicket> v8::Nothing<node::quic::SessionTicket>()
Unexecuted instantiation: v8::Maybe<std::__1::shared_ptr<node::DataQueue> > v8::Nothing<std::__1::shared_ptr<node::DataQueue> >()
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options> v8::Nothing<node::quic::TLSContext::Options>()
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options> v8::Nothing<node::quic::TransportParams::Options>()
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options> v8::Nothing<node::quic::Session::Application_Options>()
Unexecuted instantiation: v8::Maybe<node::quic::PreferredAddress::Policy> v8::Nothing<node::quic::PreferredAddress::Policy>()
114
115
template <class T>
116
15.3M
inline Maybe<T> Just(const T& t) {
117
15.3M
  return Maybe<T>(t);
118
15.3M
}
Unexecuted instantiation: v8::Maybe<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > v8::Just<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Unexecuted instantiation: v8::Maybe<unsigned int> v8::Just<unsigned int>(unsigned int const&)
Unexecuted instantiation: v8::Maybe<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > > v8::Just<std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > >(std::__1::vector<node::BaseObjectPtrImpl<node::BaseObject, false>, std::__1::allocator<node::BaseObjectPtrImpl<node::BaseObject, false> > > const&)
Unexecuted instantiation: v8::Maybe<double> v8::Just<double>(double const&)
Unexecuted instantiation: v8::Maybe<int> v8::Just<int>(int const&)
v8::Maybe<unsigned long> v8::Just<unsigned long>(unsigned long const&)
Line
Count
Source
116
15.3M
inline Maybe<T> Just(const T& t) {
117
15.3M
  return Maybe<T>(t);
118
15.3M
}
Unexecuted instantiation: v8::Maybe<node::quic::Endpoint::Options> v8::Just<node::quic::Endpoint::Options>(node::quic::Endpoint::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Options> v8::Just<node::quic::Session::Options>(node::quic::Session::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TLSContext::Options> v8::Just<node::quic::TLSContext::Options>(node::quic::TLSContext::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::TransportParams::Options> v8::Just<node::quic::TransportParams::Options>(node::quic::TransportParams::Options const&)
Unexecuted instantiation: v8::Maybe<node::quic::Session::Application_Options> v8::Just<node::quic::Session::Application_Options>(node::quic::Session::Application_Options const&)
119
120
// Don't use forwarding references here but instead use two overloads.
121
// Forwarding references only work when type deduction takes place, which is not
122
// the case for callsites such as Just<Type>(t).
123
template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
124
900k
inline Maybe<T> Just(T&& t) {
125
900k
  return Maybe<T>(std::move(t));
126
900k
}
_ZN2v84JustIbTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Line
Count
Source
124
773k
inline Maybe<T> Just(T&& t) {
125
773k
  return Maybe<T>(std::move(t));
126
773k
}
Unexecuted instantiation: _ZN2v84JustIN4node8ExitCodeETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS5_EEOS5_
_ZN2v84JustIiTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Line
Count
Source
124
1
inline Maybe<T> Just(T&& t) {
125
1
  return Maybe<T>(std::move(t));
126
1
}
Unexecuted instantiation: _ZN2v84JustINSt3__16vectorIN4node17BaseObjectPtrImplINS3_10BaseObjectELb0EEENS1_9allocatorIS6_EEEETnPNS1_9enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeISB_EEOSB_
_ZN2v84JustINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEETnPNS1_9enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS9_EEOS9_
Line
Count
Source
124
122k
inline Maybe<T> Just(T&& t) {
125
122k
  return Maybe<T>(std::move(t));
126
122k
}
Unexecuted instantiation: _ZN2v84JustIjTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Unexecuted instantiation: _ZN2v84JustIPN4node10StreamPipeETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
_ZN2v84JustImTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS3_EEOS3_
Line
Count
Source
124
4.68k
inline Maybe<T> Just(T&& t) {
125
4.68k
  return Maybe<T>(std::move(t));
126
4.68k
}
_ZN2v84JustIN4node6crypto14PKEncodingTypeETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
Line
Count
Source
124
4
inline Maybe<T> Just(T&& t) {
125
4
  return Maybe<T>(std::move(t));
126
4
}
Unexecuted instantiation: _ZN2v84JustI14ngtcp2_cc_algoTnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS4_EEOS4_
Unexecuted instantiation: _ZN2v84JustIN4node4quic13SessionTicketETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS6_EEOS6_
Unexecuted instantiation: _ZN2v84JustINSt3__110shared_ptrIN4node9DataQueueEEETnPNS1_9enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS7_EEOS7_
Unexecuted instantiation: _ZN2v84JustIN4node4quic16PreferredAddress6PolicyETnPNSt3__19enable_ifIXntsr3stdE21is_lvalue_reference_vIT_EEvE4typeELPv0EEENS_5MaybeIS7_EEOS7_
127
128
// A template specialization of Maybe<T> for the case of T = void.
129
template <>
130
class Maybe<void> {
131
 public:
132
5.47k
  V8_INLINE bool IsNothing() const { return !is_valid_; }
133
0
  V8_INLINE bool IsJust() const { return is_valid_; }
134
135
0
  V8_INLINE bool operator==(const Maybe& other) const {
136
0
    return IsJust() == other.IsJust();
137
0
  }
138
139
0
  V8_INLINE bool operator!=(const Maybe& other) const {
140
0
    return !operator==(other);
141
0
  }
142
143
 private:
144
  struct JustTag {};
145
146
0
  Maybe() : is_valid_(false) {}
147
5.46k
  explicit Maybe(JustTag) : is_valid_(true) {}
148
149
  bool is_valid_;
150
151
  template <class U>
152
  friend Maybe<U> Nothing();
153
  friend Maybe<void> JustVoid();
154
};
155
156
5.46k
inline Maybe<void> JustVoid() { return Maybe<void>(Maybe<void>::JustTag()); }
157
158
}  // namespace v8
159
160
#endif  // INCLUDE_V8_MAYBE_H_