Update DataSetBuilder API
This commit is contained in:
parent
4d19d97c53
commit
11ba116a89
@ -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(
|
public suspend inline fun <reified T : Any> DataSetBuilder<T>.emitLazy(
|
||||||
name: String,
|
name: String,
|
||||||
meta: Meta,
|
meta: Meta = Meta.EMPTY,
|
||||||
noinline producer: suspend () -> T,
|
noinline producer: suspend () -> T,
|
||||||
) {
|
) {
|
||||||
val data = Data(meta, block = producer)
|
val data = Data(meta, block = producer)
|
||||||
emit(name, data)
|
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
|
* 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 =
|
public suspend fun <T : Any> DataSetBuilder<T>.emitStatic(name: String, data: T, meta: Meta = Meta.EMPTY): Unit =
|
||||||
emit(name, Data.static(data, meta))
|
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(
|
public suspend fun <T : Any> DataSetBuilder<T>.emitStatic(
|
||||||
name: String,
|
name: String,
|
||||||
data: T,
|
data: T,
|
||||||
|
Loading…
Reference in New Issue
Block a user