Result

sealed interface Result<TResult>(source)

Represents the outcome of an operation, encapsulating the result state and its associated content.

A Result can either be a successful outcome represented by Success, or a failure represented by Failure. This interface provides utility functions to determine the specific result type and safely access the encapsulated data.

Parameters

TResult

The type of the result data when the operation is successful.

Inheritors

Types

Link copied to clipboard

Represents a failure result in the context of a result model.

Link copied to clipboard
data class Success<TResult>(val result: TResult, val content: String) : SafeToolFromCallable.Result<TResult>

Represents a successful result of an operation.

Properties

Link copied to clipboard
abstract val content: String

Represents the associated content of a Result, which may vary depending on its implementation type.

Functions

Link copied to clipboard

Casts the current Result instance to a Failure type.

Link copied to clipboard

Casts the current Result instance to Success<TResult>.

Link copied to clipboard
open fun isFailure(): Boolean

Checks whether the current instance represents a failure result.

Link copied to clipboard
open fun isSuccessful(): Boolean

Determines whether the current Result instance represents a successful outcome.