diff --git a/json/src/main/scala-2.12/fs2/data/package.scala b/json/src/main/scala-2.12/fs2/data/package.scala new file mode 100644 index 000000000..236521db3 --- /dev/null +++ b/json/src/main/scala-2.12/fs2/data/package.scala @@ -0,0 +1,32 @@ +/* + * Copyright 2023 Lucas Satabin + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package fs2 + +import scala.collection.immutable.VectorBuilder +import scala.collection.mutable.ListBuffer + +package object data { + + implicit class VectorBuilderOps[T](val builder: VectorBuilder[T]) extends AnyVal { + def addOne(t: T) = builder += t + } + + implicit class ListBufferOps[T](val buffer: ListBuffer[T]) extends AnyVal { + def addOne(t: T) = buffer += t + } + +} diff --git a/json/src/main/scala/fs2/data/json/internal/ChunkAccumulator.scala b/json/src/main/scala/fs2/data/json/internal/ChunkAccumulator.scala index 381584c40..71bec0375 100644 --- a/json/src/main/scala/fs2/data/json/internal/ChunkAccumulator.scala +++ b/json/src/main/scala/fs2/data/json/internal/ChunkAccumulator.scala @@ -27,7 +27,7 @@ package internals * chunk under construction, but results still being built are kept. * This allows to accumulate values acros upstream chunk boundaries. */ -private[internals] trait ChunkAccumulator[Res] { +private[json] trait ChunkAccumulator[Res] { def startObject(): this.type diff --git a/json/src/main/scala/fs2/data/json/internal/LegacyTokenParser.scala b/json/src/main/scala/fs2/data/json/internal/LegacyTokenParser.scala index ff6aed95b..8dd201769 100644 --- a/json/src/main/scala/fs2/data/json/internal/LegacyTokenParser.scala +++ b/json/src/main/scala/fs2/data/json/internal/LegacyTokenParser.scala @@ -194,7 +194,7 @@ private[json] class LegacyTokenParser[F[_], T, Res](s: Stream[F, T])(implicit number_(context, state, acc, chunkAcc) case None => if (NumberState.isFinal(state)) - Pull.pure(T.create(Stream.empty), chunkAcc.numberValue(acc.result())) + Pull.pure((T.create(Stream.empty), chunkAcc.numberValue(acc.result()))) else Pull.raiseError[F](new JsonException("unexpected end of input")) }