v8  4.5.103 (node 4.8.7)
V8 is Google's open source JavaScript engine
Maybe< T > Class Template Reference

#include <v8.h>

Public Member Functions

V8_INLINE bool IsNothing () const
 
V8_INLINE bool IsJust () const
 
V8_INLINEFromJust () const
 
V8_INLINEFromMaybe (const T &default_value) const
 
V8_INLINE bool operator== (const Maybe &other) const
 
V8_INLINE bool operator!= (const Maybe &other) const
 

Friends

template<class U >
Maybe< U > Nothing ()
 
template<class U >
Maybe< U > Just (const U &u)
 

Detailed Description

template<class T>
class v8::Maybe< T >

A simple Maybe type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.

If an API method returns a Maybe<>, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a TerminateExecution exception was thrown. In that case, a "Nothing" value is returned.

Definition at line 6315 of file v8.h.

Member Function Documentation

◆ FromJust()

V8_INLINE T FromJust ( ) const
inline

Definition at line 6321 of file v8.h.

References Maybe< T >::IsJust().

Referenced by Maybe< T >::operator==().

◆ FromMaybe()

V8_INLINE T FromMaybe ( const T &  default_value) const
inline

Definition at line 6326 of file v8.h.

◆ IsJust()

V8_INLINE bool IsJust ( ) const
inline

Definition at line 6318 of file v8.h.

Referenced by Maybe< T >::FromJust(), and Maybe< T >::operator==().

◆ IsNothing()

V8_INLINE bool IsNothing ( ) const
inline

Definition at line 6317 of file v8.h.

◆ operator!=()

V8_INLINE bool operator!= ( const Maybe< T > &  other) const
inline

Definition at line 6335 of file v8.h.

References Maybe< T >::operator==().

◆ operator==()

V8_INLINE bool operator== ( const Maybe< T > &  other) const
inline

Definition at line 6330 of file v8.h.

References Maybe< T >::FromJust(), and Maybe< T >::IsJust().

Referenced by Maybe< T >::operator!=().

Friends And Related Function Documentation

◆ Just

Maybe<U> Just ( const U &  u)
friend

◆ Nothing

Maybe<U> Nothing ( )
friend

Definition at line 6354 of file v8.h.


The documentation for this class was generated from the following file: