Class Result<OkType, ErrType>

#include <Result.hpp>
template<class OkType = void,class ErrType = std::string>classResult:publicgeode::impl::ResultDataWrapper<OkType,ErrType>{ ... }
No description provided
Examples0
Public static methods0
Public member functions50
geode::Result&operator=()
No description provided
template<class OkType2,class ErrType2>booloperator==()const

Returns true if the Result is equal to another Result

Parameters

other

the Result to compare against
Return value
true if the Results are equal
template<class OkType2>booloperator==()const

Returns true if the Result is equal to an Ok value

Parameters

other

the Ok value to compare against
Return value
true if the Result is Ok and the Ok value is equal
template<class ErrType2>booloperator==()const

Returns true if the Result is equal to an Err value

Parameters

other

the Err value to compare against
Return value
true if the Result is Err and the Err value is equal
template<class OkType2,class ErrType2>booloperator!=()const

Returns true if the Result is not equal to another Result

Parameters

other

the Result to compare against
Return value
true if the Results are not equal
template<class OkType2>booloperator!=()const

Returns true if the Result is not equal to an Ok value

Parameters

other

the Ok value to compare against
Return value
true if the Result is not Ok or the Ok value is not equal
template<class ErrType2>booloperator!=()const

Returns true if the Result is not equal to an Err value

Parameters

other

the Err value to compare against
Return value
true if the Result is not Err or the Err value is not equal
autooperator*()

Unwraps the Ok value from the Result

Return value
the Ok value

ℹ Same behavior as Result::unwrap()

autooperator*()

Unwraps the Ok value from the Result

Return value
the Ok value

ℹ Same behavior as Result::unwrap()

autooperator*()const

Unwraps the Ok value from the Result

Return value
the Ok value

ℹ Same behavior as Result::unwrap()

boolisOkAnd()
No description provided
boolisOkAnd()const
No description provided
boolisErrAnd()
No description provided
boolisErrAnd()const
No description provided
std::optional<OkType>ok()

Returns an std::optional containing the Ok value

Return value
an std::optional containing the Ok value if the Result is Ok, otherwise std::nullopt
std::optional<OkType>ok()const

Returns an std::optional containing the Ok value

Return value
an std::optional containing the Ok value if the Result is Ok, otherwise std::nullopt
std::optional<ErrType>err()

Returns an std::optional containing the Err value

Return value
an std::optional containing the Err value if the Result is Err, otherwise std::nullopt
std::optional<ErrType>err()const

Returns an std::optional containing the Err value

Return value
an std::optional containing the Err value if the Result is Err, otherwise std::nullopt
template<class Operation>geode::Result<std::invoke_result_t<Operation,OkType>,ErrType>map(
Operation&&operation
)

Maps the Ok value to a new Ok value using an operation

Parameters

operation

the operation to map the Ok value with
Return value
a new Result with the mapped Ok value if the Result is Ok, otherwise the Err value
template<class Operation>geode::Result<std::invoke_result_t<Operation,OkType>,ErrType>map(
Operation&&operation
)
const

Maps the Ok value to a new Ok value using an operation

Parameters

operation

the operation to map the Ok value with
Return value
a new Result with the mapped Ok value if the Result is Ok, otherwise the Err value
template<class Operation>geode::Result<std::invoke_result_t<Operation>,ErrType>map(
Operation&&operation
)

Maps the Ok value to a new Ok value using an operation

Parameters

operation

the operation to map the Ok value with
Return value
a new Result with the mapped Ok value if the Result is Ok, otherwise the Err value
template<class Operation>geode::Result<std::invoke_result_t<Operation>,ErrType>map(
Operation&&operation
)
const

Maps the Ok value to a new Ok value using an operation

Parameters

operation

the operation to map the Ok value with
Return value
a new Result with the mapped Ok value if the Result is Ok, otherwise the Err value
template<class OkType2,class Operation>OkType2mapOr(
OkType2&&defaultValue
,
Operation&&operation
)

Maps the Ok value to a new value using an operation

Parameters

defaultValue

the default value to return if the Result is Err

operation

the operation to map the Ok value with
Return value
the mapped Ok value if the Result is Ok, otherwise the default value
template<class OkType2,class Operation>OkType2mapOr(
OkType2&&defaultValue
,
Operation&&operation
)
const

Maps the Ok value to a new value using an operation

Parameters

defaultValue

the default value to return if the Result is Err

operation

the operation to map the Ok value with
Return value
the mapped Ok value if the Result is Ok, otherwise the default value
template<class OkType2,class Operation>OkType2mapOr(
OkType2&&defaultValue
,
Operation&&operation
)

Maps the Ok value to a new value using an operation

Parameters

defaultValue

the default value to return if the Result is Err

operation

the operation to map the Ok value with
Return value
the mapped Ok value if the Result is Ok, otherwise the default value
template<class DefaultValue,class Operation>std::invoke_result_t<Operation,OkType>mapOrElse(
DefaultValue&&defaultValue
,
Operation&&operation
)

Maps the Ok value to a new value using an operation

Parameters

defaultValue

the operation to perform if the Result is Err

operation

the operation to map the Ok value with
Return value
the mapped Ok value if the Result is Ok, otherwise the result of the operation
template<class DefaultValue,class Operation>std::invoke_result_t<Operation,OkType>mapOrElse(
DefaultValue&&defaultValue
,
Operation&&operation
)
const

Maps the Ok value to a new value using an operation

Parameters

defaultValue

the operation to perform if the Result is Err

operation

the operation to map the Ok value with
Return value
the mapped Ok value if the Result is Ok, otherwise the result of the operation
template<class DefaultValue,class Operation>std::invoke_result_t<Operation>mapOrElse(
DefaultValue&&defaultValue
,
Operation&&operation
)

Maps the Ok value to a new value using an operation

Parameters

defaultValue

the operation to perform if the Result is Err

operation

the operation to map the Ok value with
Return value
the mapped Ok value if the Result is Ok, otherwise the result of the operation
template<class Operation>geode::Result<OkType,std::invoke_result_t<Operation,ErrType>>mapErr(
Operation&&operation
)

Maps the Err value to a new Err value using an operation

Parameters

operation

the operation to map the Err value with
Return value
a new Result with the Ok value if the Result is Ok, otherwise the mapped Err value
template<class Operation>geode::Result<OkType,std::invoke_result_t<Operation,ErrType>>mapErr(
Operation&&operation
)
const

Maps the Err value to a new Err value using an operation

Parameters

operation

the operation to map the Err value with
Return value
a new Result with the Ok value if the Result is Ok, otherwise the mapped Err value
template<class Operation>geode::Result<OkType,std::invoke_result_t<Operation>>mapErr(
Operation&&operation
)

Maps the Err value to a new Err value using an operation

Parameters

operation

the operation to map the Err value with
Return value
a new Result with the Ok value if the Result is Ok, otherwise the mapped Err value
template<class Operation>geode::Result<OkType,std::invoke_result_t<Operation>>mapErr(
Operation&&operation
)
const

Maps the Err value to a new Err value using an operation

Parameters

operation

the operation to map the Err value with
Return value
a new Result with the Ok value if the Result is Ok, otherwise the mapped Err value
template<class Fn>geode::Result<OkType,ErrType>&inspect(
Fn&&operation
)

Inspects the Ok value with an operation

Parameters

operation

the operation to call the Ok value with
Return value
the Result itself
template<class Fn>geode::Result<OkType,ErrType>&inspectErr(
Fn&&operation
)

Inspects the Err value with an operation

Parameters

operation

the operation to call the Err value with
Return value
the Result itself
template<class OkType2>geode::Result<OkType2,ErrType>and_()

Returns the other Result if this Result is Ok, otherwise returns this Result

Parameters

other

the other Result to return if this Result is Ok
Return value
the other Result if this Result is Ok, otherwise this Result
template<class OkType2>geode::Result<OkType2,ErrType>and_()const

Returns the other Result if this Result is Ok, otherwise returns this Result

Parameters

other

the other Result to return if this Result is Ok
Return value
the other Result if this Result is Ok, otherwise this Result
template<class Operation>std::invoke_result_t<Operation,OkType>andThen(
Operation&&operation
)

Returns the result of an operation if this Result is Ok, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Ok
Return value
the result of the operation if this Result is Ok, otherwise this Result
template<class Operation>std::invoke_result_t<Operation,OkType>andThen(
Operation&&operation
)
const

Returns the result of an operation if this Result is Ok, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Ok
Return value
the result of the operation if this Result is Ok, otherwise this Result
template<class Operation>std::invoke_result_t<Operation>andThen(
Operation&&operation
)

Returns the result of an operation if this Result is Ok, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Ok
Return value
the result of the operation if this Result is Ok, otherwise this Result
template<class Operation>std::invoke_result_t<Operation>andThen(
Operation&&operation
)
const

Returns the result of an operation if this Result is Ok, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Ok
Return value
the result of the operation if this Result is Ok, otherwise this Result
template<class ErrType2>geode::Result<OkType,ErrType2>or_()

Returns the other Result if this Result is Err, otherwise returns this Result

Parameters

other

the other Result to return if this Result is Err
Return value
the other Result if this Result is Err, otherwise this Result
template<class ErrType2>geode::Result<OkType,ErrType2>or_()const

Returns the other Result if this Result is Err, otherwise returns this Result

Parameters

other

the other Result to return if this Result is Err
Return value
the other Result if this Result is Err, otherwise this Result
template<class Operation>std::invoke_result_t<Operation,ErrType>orElse(
Operation&&operation
)

Returns the result of an operation if this Result is Err, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Err
Return value
the result of the operation if this Result is Err, otherwise this Result
template<class Operation>std::invoke_result_t<Operation,ErrType>orElse(
Operation&&operation
)
const

Returns the result of an operation if this Result is Err, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Err
Return value
the result of the operation if this Result is Err, otherwise this Result
template<class Operation>std::invoke_result_t<Operation>orElse(
Operation&&operation
)

Returns the result of an operation if this Result is Err, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Err
Return value
the result of the operation if this Result is Err, otherwise this Result
template<class Operation>std::invoke_result_t<Operation>orElse(
Operation&&operation
)
const

Returns the result of an operation if this Result is Err, otherwise returns this Result

Parameters

operation

the operation to perform if this Result is Err
Return value
the result of the operation if this Result is Err, otherwise this Result
std::optional<geode::Result<geode::impl::OptionalType<OkType>,ErrType>>transpose()

Transposes the Result from Result<std::optional, ErrType> to std::optional<Result<OkType, ErrType>>

Return value
std::nullopt if Ok value is empty, otherwise the Result wrapped in an optional
std::optional<geode::Result<geode::impl::OptionalType<OkType>,ErrType>>transpose()const

Transposes the Result from Result<std::optional, ErrType> to std::optional<Result<OkType, ErrType>>

Return value
std::nullopt if Ok value is empty, otherwise the Result wrapped in an optional
geode::Result<geode::impl::ResultOkType<OkType>,ErrType>flatten()

Flattens the Result from Result<Result<OkType, ErrType>, ErrType> to Result<OkType, ErrType>

Return value
the inner Result if the Result is Ok, otherwise the outer Result
geode::Result<geode::impl::ResultOkType<OkType>,ErrType>flatten()const

Flattens the Result from Result<Result<OkType, ErrType>, ErrType> to Result<OkType, ErrType>

Return value
the inner Result if the Result is Ok, otherwise the outer Result
Fields0
Protected member functions0
Protected fields0