core / pragma / PragmaResult /
PragmaResult #
sealed class PragmaResult<out TSuccess, out TFailure>
A discriminated union that encapsulates a successful outcome with a value of type TSuccess or a failure with of type TFailure. Similar to kotlin.Result, but with non-exception failures.
Constructors #
PragmaResult | protected fun PragmaResult() |
Functions #
Name | Summary |
---|---|
Returns the held value if this is a failure, or null if not. | |
Returns the result of onSuccess for the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated TFailure if it is failure. | |
Returns the held value if this is a success, or null if not. | |
Returns the held value if this is a success, or throws an IllegalStateException if not. | |
Performs the given action on the encapsulated value if this instance represents failure. Returns the original PragmaResult unchanged. | |
Performs the given action on the encapsulated value if this instance represents success. Returns the original PragmaResult unchanged. |
Extensions #
Name | Summary |
---|---|
Returns the result of the given onSuccess function applied to the encapsulated TSuccess if this instance represents success or the original encapsulated value if it is failure. | |
Returns the encapsulated value if this instance represents failure or the result of onFailure function for the encapsulated TSuccess if it is success. | |
Returns the encapsulated value if this instance represents success or the result of if it is failure. | |
Returns the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated TFailure if it is failure. | |
Returns the result of the given transform function applied to the encapsulated value if this instance represents success or the original encapsulated TFailure value if it is failure. | |
Returns the result of the given onFailure function applied to the encapsulated TFailure if this instance represents failure or the original encapsulated value if it is success. | |
Returns the result of the given transform function applied to the encapsulated TFailure if this instance represents failure or the original encapsulated value if it is success. |