Skip to content

SentierValues

sealed interface SentierValues

Combines multiple SentierValue instances.

This interface behaves as an immutable typed map, similarly to kotlin.coroutines.CoroutineContext.

If the same value is added multiple times, only the last value is kept.

Example

val values = SentierValues
    .with(Message) { "Create user" }
    .with(EventTime) { Clock.System.now() }

See also

Inheritors

Types

Empty

object Empty : SentierValues

The empty SentierValues instance.

Functions

fold

abstract fun <T> fold(seed: T, action: (T, SentierValue<*>, Any?) -> T): T

Combines all the values into a single value.

This is useful to convert the data out of this data structure.

get

abstract operator fun <T> get(value: SentierValue<T>): T?

Queries this value to see if it is present.

If it is present, its computed value is returned.

If it is not present, null is returned.

with

inline fun <T> SentierValues.with(spec: SentierValue<T>, value: () -> T): SentierValues

Appends a new value corresponding to spec.

If the same value is added multiple times, only the last value is kept.

Example

val values = SentierValues
    .with(Message) { "Create user" }
    .with(EventTime) { Clock.System.now() }