scala - 新版本的 fs2 (0.10.x) 中的 fs2.Scheduler 等效于什么

标签 scala scala-cats fs2 cats-effect

我正在将 fs2 0.10.x 版本迁移到 1.0.0 版本。

我们的代码使用 fs2.Scheduler来自 fs2 版本 0.10.x。

我不知道更新的 fs2 版本 1.0.0 中有什么等价物。

我浏览了迁移指南 here但找不到 0.10.x 到 1.0.0 或任何类似的迁移指南。

提前致谢。

最佳答案

我认为您需要 migration guide from 0.10 to 1.0而不是您指向的 0.10。相关部分说:

The new cats.effect.Timer type was introduced in cats-effect 0.10. This type provides much of the same functionality as the fs2.Scheduler type with the added functionality of supporting cancelation of sleeps. Hence, fs2.Scheduler has been removed and all of the stream-specific methods have been moved to the fs2.Stream companion. A Timer[IO] instance is available implicitly for both the JVM and Scala.js, meaning there's no need to allocate and shutdown a timer. Timer instances for other effect types can either be defined manually or derived from the Timer[IO] instance via Timer.derive[F].

然后还有一个表格,用于说明什么映射到哪里的具体示例。

关于scala - 新版本的 fs2 (0.10.x) 中的 fs2.Scheduler 等效于什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54079391/

相关文章:

Scala新手: recursion and stackoverflow error

scala - Fs2 Stream.Compiler 未找到(找不到隐含值 Compiler[[x]F[x],G])

scala - 使用 fs2.Stream 分组事件

scala - FS2 的对象池模式

scala - 使用 json4s 在 under_score 和 camelCase 格式之间进行选择

scala - 从 RDD 访问 KafkaOffset 时出现异常

ruby - 如何同时使用 scala 和 rails 中的 memcached(Amazon elasticache)?

scala - 导入 FlatMap 实例会破坏应用构建器语法

scala - 如何在 Scala 中组合 ADT?

scala - 幺半群如何泛化类型