gimo v0.1.0
Loading...
Searching...
No Matches
gimo Namespace Reference

Classes

class  BasicAlgorithm
 The basic building block for every monadic operation. More...
 
class  Pipeline
 A composite object representing a sequence of monadic operations. More...
 
struct  traits
 The central customization point for the library. More...
 
struct  traits< std::expected< Value, Error > >
 
struct  traits< std::optional< T > >
 
struct  traits< std::shared_ptr< T > >
 
struct  traits< std::unique_ptr< T, Deleter > >
 
struct  traits< T * >
 

Concepts

concept  applicable_to
 Evaluates whether a Nullable type is compatible with the specific Algorithm.
 
concept  null_for
 Concept describing the relationship between a Nullable type and its null state.
 
concept  nullable
 Concept describing a type that can be used as a monad in the pipeline.
 
concept  constructible_from_value
 Concept determining whether the Nullable is constructible with the specified argument.
 
concept  rebindable_value_to
 Concept determining whether the Nullable type supports rebinding its value-type.
 
concept  expected_like
 Concept describing a type that acts like std::expected (has both a value and an error channel).
 
concept  constructible_from_error
 Concept determining whether the Expected type supports rebinding its error-type.
 
concept  rebindable_error_to
 Concept determining whether the Expected type supports rebinding its error-type.
 
concept  pipeline
 Checks whether the given type is a specialization of gimo::Pipeline.
 
concept  processable_by
 Evaluates whether a Nullable type can be processed by the entire pipeline.
 

Typedefs

template<nullable Nullable, typename Value>
using rebind_value_t = typename traits<std::remove_cvref_t<Nullable>>::template rebind_value<Value>
 Helper alias to obtain the Nullable type with the rebound Value type.
 
template<expected_like Expected, typename Error>
using rebind_error_t = typename traits<std::remove_cvref_t<Expected>>::template rebind_error<std::remove_cvref_t<Error>>
 Helper alias to obtain the Expected type with the rebound Error type.
 

Functions

template<typename Action>
constexpr auto and_then (Action &&action)
 Creates a pipeline step that applies a function returning a nullable type.
 
template<typename Action>
constexpr auto or_else (Action &&action)
 Creates a pipeline step that handles the null/error case.
 
template<typename Action>
constexpr auto transform (Action &&action)
 Creates a pipeline step that transforms the underlying value.
 
template<typename Action>
constexpr auto transform_error (Action &&action)
 Creates a pipeline step that transforms the error of an expected-like type.
 
template<nullable Nullable, typename Arg>
requires constructible_from_value<Nullable, Arg&&>
constexpr Nullable construct_from_value (Arg &&arg) noexcept(detail::nothrow_constructible_from_value< Nullable, Arg && >)
 Constructs the specified Nullable with the provided value.
 
template<nullable Nullable, pipeline Pipeline>
constexpr auto apply (Nullable &&opt, Pipeline &&steps)
 Applies nullable input on the pipeline.
 

Variables

template<nullable Nullable>
constexpr auto null_v {traits<std::remove_cvref_t<Nullable>>::null}
 Helper to obtain the null value for a specific Nullable type.
 

Typedef Documentation

◆ rebind_error_t

template<expected_like Expected, typename Error>
using gimo::rebind_error_t = typename traits<std::remove_cvref_t<Expected>>::template rebind_error<std::remove_cvref_t<Error>>

Helper alias to obtain the Expected type with the rebound Error type.

Template Parameters
ExpectedThe source-expected type to adapt the new error-type.
ErrorThe new error-type to rebind to.

◆ rebind_value_t

template<nullable Nullable, typename Value>
using gimo::rebind_value_t = typename traits<std::remove_cvref_t<Nullable>>::template rebind_value<Value>

Helper alias to obtain the Nullable type with the rebound Value type.

Template Parameters
NullableThe source-nullable type to adapt the new value-type.
ValueThe new value-type to rebind to.

Function Documentation

◆ construct_from_value()

template<nullable Nullable, typename Arg>
requires constructible_from_value<Nullable, Arg&&>
Nullable gimo::construct_from_value ( Arg && arg)
constexprnoexcept

Constructs the specified Nullable with the provided value.

Template Parameters
NullableThe target-nullable type.
ArgThe construction argument type to forward.
Parameters
argThe argument forwarded to the actual construction strategy.
Returns
A newly created Nullable instance in a non-null state.
Note
The exception specification matches the underlying construction strategy.

The construction strategy is selected based on the following precedence:

  • Priority 1: gimo::traits<Nullable>::from_value
  • Priority 2: Direct initialization

Variable Documentation

◆ null_v

template<nullable Nullable>
auto gimo::null_v {traits<std::remove_cvref_t<Nullable>>::null}
inlineconstexpr

Helper to obtain the null value for a specific Nullable type.

Template Parameters
NullableThe type for which to retrieve the null value.