All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kernl.data.DataResult.kt Maven / Gradle / Ivy

Go to download

Kernl: A Kotlin Symbol Processing (KSP) library for automatic repository generation.

There is a newer version: 0.0.1-beta6
Show newest version
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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy