CLOVIS
09/10/2024, 1:40 PMProgressive
. Progressive
is a holder for an intermediate value with its associated progress information. This release also adds helpers to capture progress events from flows:
val updates: Flow<Progressive<String>> = captureProgress {
report(loading(0.1))
delay(1000)
report(loading(0.5))
delay(1000)
"End!"
}
Output:
null Loading(10%)
null Loading(50%)
End! Done
Of course, it comes with conversion functions to existing types Outcome
and ProgressiveOutcome
.
The second major feature is the addition of a new module, Pedestal Weak, which provides multiplatform implementations of weak references, weak maps and associated data structures:
val data = WeakMap<Int, String>()
data[5] = "5"
data[6] = "6"
println(data[5]) // Maybe "5", maybe 'null' if the runtime has cleared it
I have needed this many times over the past few years, including for cache implementations that can smartly purge themselves when memory is tight. It's finally here, and I'm searching for feedback 🙂
See the full changelog • Visit the documentation