Skip to content

Commit

Permalink
release 0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
simerplaha committed Sep 20, 2020
1 parent 0e1c8a0 commit 543df5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ val scala213 = "2.13.3"

val inlining =
Seq(
// "-opt:l:inline",
// "-opt-warnings",
// "-opt-inline-from:swaydb.**",
// "-Yopt-log-inline",
// "_"
"-opt:l:inline",
"-opt-warnings",
"-opt-inline-from:swaydb.**",
"-Yopt-log-inline",
"_"
)

val scalaOptions =
Expand Down
2 changes: 1 addition & 1 deletion data/src/main/scala/swaydb/data/slice/ReaderBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import swaydb.{IO, Pair}

import scala.annotation.tailrec

private[swaydb] trait ReaderBase[B] { self =>
trait ReaderBase[B] { self =>

def byteOps: ByteOps[B]

Expand Down
11 changes: 5 additions & 6 deletions data/src/main/scala/swaydb/data/slice/SliceReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import swaydb.data.util.ByteOps
/**
* http://www.swaydb.io/slice/byte-slice
*/
private[swaydb] case class SliceReader[B](slice: Slice[B],
private var position: Int = 0)(implicit val byteOps: ByteOps[B]) extends Reader[B] {
case class SliceReader[B](slice: Slice[B],
private var position: Int = 0)(implicit val byteOps: ByteOps[B]) extends Reader[B] {

def path = Paths.get(this.productPrefix)

Expand All @@ -42,15 +42,14 @@ private[swaydb] case class SliceReader[B](slice: Slice[B],
def hasAtLeast(size: Long): Boolean =
(slice.size - position) >= size

def read(size: Int): Slice[B] = {
if (size <= 0)
def read(size: Int): Slice[B] =
if (size <= 0) {
Slice.empty
else {
} else {
val bytes = slice.take(position, size)
position += size
bytes
}
}

def moveTo(newPosition: Long): SliceReader[B] = {
position = newPosition.toInt max 0
Expand Down

0 comments on commit 543df5f

Please sign in to comment.