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

commonMain.com.steamstreet.MutableLazy.kt Maven / Gradle / Ivy

There is a newer version: 2.0.25
Show newest version
package com.steamstreet

import kotlin.properties.ReadWriteProperty
import kotlin.time.Duration

internal object UninitializedValue

//public expect class MutableLazy(timeout: Duration? = null, initializer: () -> T) : ReadWriteProperty

/**
 * A version of the lazy delegate that also allows the value to be set at any point.
 */
public fun  mutableLazy(initializer: () -> T): ReadWriteProperty =
    cached(Duration.INFINITE, initializer)

/**
 * A lazy delegate with a timeout. Once duration has been met, the initializer will be called
 * again.
 */
public expect fun  cached(timeout: Duration, initializer: () -> T): ReadWriteProperty




© 2015 - 2024 Weber Informatics LLC | Privacy Policy