kernl.data.DataResult.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Kernl.Runtime Show documentation
Show all versions of Kernl.Runtime Show documentation
Kernl: A Kotlin Symbol Processing (KSP) library for automatic repository generation.
package io.github.mattshoe.shoebox.kernl.data
/**
* ### Encapsulates the result of a single data retrieval operation.
*
* Can be either [Success], [Error], or [Invalidated].
*/
sealed interface DataResult {
/**
* Encapsulates the data of a successful data retrieval operation.
*/
data class Success(val data: T): io.github.mattshoe.shoebox.kernl.data.DataResult
/**
* Encapsulates an error encountered by a data retrieval operation.
*/
data class Error(val error: Throwable):
io.github.mattshoe.shoebox.kernl.data.DataResult
/**
* Representation of an invalidated cache. Meaning any previous data
* is invalid.
*/
data class Invalidated(private val data: Unit = Unit): io.github.mattshoe.shoebox.kernl.data.DataResult
}