You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I first learn the Kotlin's Flow api, I think it do has some great elgant.
publicfun interfaceFlowCollector<inT> {
/** * Collects the value emitted by the upstream. * This method is not thread-safe and should not be invoked concurrently.*/publicsuspendfunemit(value:T)
}
Can we get something like it? I think with the AsyncCallback we can.
traitFlowEmitter[T] {
defcomplete():Unitdefemit( nextValue: T):Unit//at most one?defemitMutliValue(nextValues:T.*) //at most one?deffail(ex: Throwable):Unit
}
defhandle[T](f:(Out, FlowEmitter[T]) =>Unit):Repr[T] =???//implement filter with handle deffilter[T](f: Out=>Boolean) = handle((out, emitter) =>{
if(f(out)) {
emitter.emit(out)
}
})
Or something like it, Have not think much deeper about it yet.
The text was updated successfully, but these errors were encountered:
I personally do not like that imperative API style much, but it seems very close to what mapConcat can do in a more functional style, except that it doesn't have a way to complete/cancel without composition (for example emitting some special value that you can takeWhile on downstream).
Perhaps somewhat related to previous discussions a middle ground between custom graph stage and using predefined operators a couple of times before, some discussion and ideas here: #24944
When I first learn the Kotlin's Flow api, I think it do has some great elgant.
Can we get something like it? I think with the
AsyncCallback
we can.Or something like it, Have not think much deeper about it yet.
The text was updated successfully, but these errors were encountered: