Skip to content

Commit

Permalink
Merge pull request #79 from vigoo/zio2-final
Browse files Browse the repository at this point in the history
ZIO 2.0.0 final
  • Loading branch information
vigoo authored Jun 26, 2022
2 parents c19892a + fa1b59f commit bc77503
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
fail-fast: false
matrix:
java: ['adopt@1.8', 'adopt@1.11']
scala: ['2.12.15', '2.13.8', '3.1.1']
scala: ['2.12.15', '2.13.8', '3.1.3']
platform: ['JVM', 'JS', 'Native']
steps:
- name: Checkout current branch
Expand Down
11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ addCommandAlias(
";zioParserNative/test"
)

val zioVersion = "2.0.0-RC6"
val zioVersion = "2.0.0"

lazy val root = (project in file("."))
.aggregate(
Expand Down Expand Up @@ -74,11 +74,10 @@ lazy val zioParser = crossProject(JSPlatform, JVMPlatform, NativePlatform)
)
}),
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"com.github.ghostdogpr" %% "caliban" % "1.4.1",
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package zio.parser.target

import zio.parser.internal.Stack
import zio.stream.ZStream
import zio.{ChunkBuilder, Queue, Runtime, UIO, ZIO}
import zio.{ChunkBuilder, Queue, Runtime, UIO, Unsafe, ZIO}

class ZStreamTarget[R, Output](runtime: Runtime[R]) extends Target[Output] {
private val queue: Queue[Output] = runtime.unsafeRun(Queue.unbounded[Output])
private val queue: Queue[Output] = Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(Queue.unbounded[Output]).getOrThrowFiberFailure()
}

val stream: ZStream[Any, Nothing, Output] = ZStream.fromQueue(queue)

Expand All @@ -16,7 +18,9 @@ class ZStreamTarget[R, Output](runtime: Runtime[R]) extends Target[Output] {

override def write(value: Output): Unit =
if (currentBuilder == null) {
runtime.unsafeRun(queue.offer(value).unit)
Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(queue.offer(value).unit).getOrThrowFiberFailure()
}
} else {
currentBuilder += value
()
Expand All @@ -40,7 +44,9 @@ class ZStreamTarget[R, Output](runtime: Runtime[R]) extends Target[Output] {
()
} else {
currentBuilder = null
runtime.unsafeRun(queue.offerAll(capture.subBuilder.result()).unit)
Unsafe.unsafeCompat { implicit u =>
runtime.unsafe.run(queue.offerAll(capture.subBuilder.result()).unit).getOrThrowFiberFailure()
}
}
}

Expand Down

0 comments on commit bc77503

Please sign in to comment.