-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Describe the feature
Adding support of time.After()
and time.Tick()
can be helpful for implementing some GoLang patterns in Scala.
Here is more info about the API in Go: https://pkg.go.dev/time
Both the ticker and timeout can return java.time.Instant
An example code can look like:
import scala.concurrent.duration.{Duration, SECONDS, MILLISECONDS}
import com.github.yruslan.channel._
val channel = Channel.make[Int]
val ticker = TimeTickr(Duration(200, MILLISECONDS)
val timeout = TimeAfter(Duration(2, SECONDS)
select(
channel .recver(n => {
println(s"Received $n")
}),
ticker.recver(tickInstant => {
println(s"Received $tickInstant")
}),
ticker .recver(timeoutInstant => {
println(s"Received $timeoutInstant ")
})
)
Metadata
Metadata
Assignees
Labels
No labels