Update DataSetBuilder API

This commit is contained in:
Alexander Nozik 2021-01-31 22:37:32 +03:00
parent 4d19d97c53
commit 11ba116a89

View File

@ -90,19 +90,31 @@ public suspend fun <T : Any> DataSetBuilder<T>.emit(data: NamedData<T>) {
*/
public suspend inline fun <reified T : Any> DataSetBuilder<T>.emitLazy(
name: String,
meta: Meta,
meta: Meta = Meta.EMPTY,
noinline producer: suspend () -> T,
) {
val data = Data(meta, block = producer)
emit(name, data)
}
public suspend inline fun <reified T : Any> DataSetBuilder<T>.emitLazy(
name: Name,
meta: Meta = Meta.EMPTY,
noinline producer: suspend () -> T,
){
val data = Data(meta, block = producer)
emit(name, data)
}
/**
* Emit a static data with the fixed value
*/
public suspend fun <T : Any> DataSetBuilder<T>.emitStatic(name: String, data: T, meta: Meta = Meta.EMPTY): Unit =
emit(name, Data.static(data, meta))
public suspend fun <T : Any> DataSetBuilder<T>.emitStatic(name: Name, data: T, meta: Meta = Meta.EMPTY): Unit =
emit(name, Data.static(data, meta))
public suspend fun <T : Any> DataSetBuilder<T>.emitStatic(
name: String,
data: T,