Packages

c

fs2.Segment

SingleChunk

final case class SingleChunk[O](chunk: Chunk[O]) extends Segment[O, Unit] with Product with Serializable

Source
Segment.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SingleChunk
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Segment
  7. AnyRef
  8. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SingleChunk(chunk: Chunk[O])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to any2stringadd[SingleChunk[O]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. final def ++[O2 >: O, R2 >: Unit](s2: Segment[O2, R2]): Segment[O2, R2]

    Concatenates this segment with s2.

    Concatenates this segment with s2.

    Definition Classes
    Segment
    Example:
    1. scala> (Segment(1,2,3) ++ Segment(4,5,6)).force.toVector
      res0: Vector[Int] = Vector(1, 2, 3, 4, 5, 6)
  5. def ->[B](y: B): (SingleChunk[O], B)
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to ArrowAssoc[SingleChunk[O]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. final def append[O2 >: O, R2](s2: Segment[O2, R2]): Segment[O2, (Unit, R2)]

    Like ++ but allows the result type of s2 to differ from R.

    Like ++ but allows the result type of s2 to differ from R.

    Definition Classes
    Segment
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. final def asResult[R2](r2: R2): Segment[O, R2]

    Alias for mapResult( => r2).

    Alias for mapResult( => r2).

    Definition Classes
    Segment
  10. val chunk: Chunk[O]
  11. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  12. final def collect[O2](pf: PartialFunction[O, O2]): Segment[O2, Unit]

    Filters and maps simultaneously.

    Filters and maps simultaneously.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(Some(1), None, Some(2)).collect { case Some(i) => i }.force.toVector
      res0: Vector[Int] = Vector(1, 2)
  13. final def cons[O2 >: O](o2: O2): Segment[O2, Unit]

    Equivalent to Segment.singleton(o2) ++ this.

    Equivalent to Segment.singleton(o2) ++ this.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3).cons(0).force.toVector
      res0: Vector[Int] = Vector(0, 1, 2, 3)
  14. final def drain: Segment[Nothing, Unit]

    Returns a segment that suppresses all output and returns the result of this segment when run.

    Returns a segment that suppresses all output and returns the result of this segment when run.

    Definition Classes
    Segment
    Example:
    1. scala> Segment.from(0).take(3).drain.force.run.toOption.get.take(5).force.toVector
      res0: Vector[Long] = Vector(3, 4, 5, 6, 7)
  15. def ensuring(cond: (SingleChunk[O]) ⇒ Boolean, msg: ⇒ Any): SingleChunk[O]
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to Ensuring[SingleChunk[O]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: (SingleChunk[O]) ⇒ Boolean): SingleChunk[O]
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to Ensuring[SingleChunk[O]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: Boolean, msg: ⇒ Any): SingleChunk[O]
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to Ensuring[SingleChunk[O]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean): SingleChunk[O]
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to Ensuring[SingleChunk[O]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def filter[O2](p: (O) ⇒ Boolean): Segment[O, Unit]

    Filters output elements of this segment with the supplied predicate.

    Filters output elements of this segment with the supplied predicate.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1,2,3,4,5).filter(_ % 2 == 0).force.toVector
      res0: Vector[Int] = Vector(2, 4)
  21. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def flatMap[O2, R2](f: (O) ⇒ Segment[O2, R2]): Segment[O2, (Unit, Option[R2])]

    List-like flatMap, which applies f to each element of the segment and concatenates the results.

    List-like flatMap, which applies f to each element of the segment and concatenates the results.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3).flatMap(i => Segment.seq(List.fill(i)(i))).force.toVector
      res0: Vector[Int] = Vector(1, 2, 2, 3, 3, 3)
  23. final def flatMapAccumulate[S, O2](init: S)(f: (S, O) ⇒ Segment[O2, S]): Segment[O2, (Unit, S)]

    Stateful version of flatMap, where the function depends on a state value initialized to init and updated upon each output.

    Stateful version of flatMap, where the function depends on a state value initialized to init and updated upon each output.

    The final state is returned in the result, paired with the result of the source stream.

    Definition Classes
    Segment
    Example:
    1. scala> val src = Segment("Hello", "World", "\n", "From", "Mars").flatMapAccumulate(0)((l,s) =>
           |   if (s == "\n") Segment.empty.asResult(0) else Segment((l,s)).asResult(l + s.length))
      scala> src.force.toVector
      res0: Vector[(Int,String)] = Vector((0,Hello), (5,World), (0,From), (4,Mars))
      scala> src.drain.force.run
      res1: (Unit,Int) = ((),8)
  24. final def flatMapResult[O2 >: O, R2](f: (Unit) ⇒ Segment[O2, R2]): Segment[O2, R2]

    Like append but allows to use result to continue the segment.

    Like append but allows to use result to continue the segment.

    Definition Classes
    Segment
  25. final def flatten[O2, R2 >: Unit](implicit ev: <:<[O, Segment[O2, R2]]): Segment[O2, R2]

    Flattens a Segment[Segment[O2,R],R] in to a Segment[O2,R].

    Flattens a Segment[Segment[O2,R],R] in to a Segment[O2,R].

    Definition Classes
    Segment
    Example:
    1. scala> Segment(Segment(1, 2), Segment(3, 4, 5)).flatten.force.toVector
      res0: Vector[Int] = Vector(1, 2, 3, 4, 5)
  26. final def flattenChunks[O2](implicit ev: <:<[O, Chunk[O2]]): Segment[O2, Unit]

    Flattens a Segment[Chunk[O2],R] in to a Segment[O2,R].

    Flattens a Segment[Chunk[O2],R] in to a Segment[O2,R].

    Definition Classes
    Segment
    Example:
    1. scala> Segment(Chunk(1, 2), Chunk(3, 4, 5)).flattenChunks.force.toVector
      res0: Vector[Int] = Vector(1, 2, 3, 4, 5)
  27. final def fold[B](z: B)(f: (B, O) ⇒ B): Segment[Nothing, (Unit, B)]

    Folds the output elements of this segment and returns the result as the result of the returned segment.

    Folds the output elements of this segment and returns the result as the result of the returned segment.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1,2,3,4,5).fold(0)(_ + _).force.run
      res0: (Unit, Int) = ((),15)
  28. def force: Force[O, Unit]

    Provides access to operations which force evaluation of some or all elements of this segment.

    Provides access to operations which force evaluation of some or all elements of this segment.

    Definition Classes
    Segment
  29. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to StringFormat[SingleChunk[O]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  30. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  32. def last: Segment[O, (Unit, Option[O])]

    Returns a segment that outputs all but the last element from the original segment, returning the last element as part of the result.

    Returns a segment that outputs all but the last element from the original segment, returning the last element as part of the result.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1,2,3).last.drain.force.run
      res0: (Unit, Option[Int]) = ((),Some(3))
      scala> Segment(1,2,3).last.force.toList
      res1: List[Int] = List(1, 2)
  33. def map[O2](f: (O) ⇒ O2): Segment[O2, Unit]

    Returns a segment that maps each output using the supplied function.

    Returns a segment that maps each output using the supplied function.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1,2,3).map(_ + 1).force.toVector
      res0: Vector[Int] = Vector(2, 3, 4)
  34. def mapAccumulate[S, O2](init: S)(f: (S, O) ⇒ (S, O2)): Segment[O2, (Unit, S)]

    Stateful version of map, where the map function depends on a state value initialized to init and updated upon each output value.

    Stateful version of map, where the map function depends on a state value initialized to init and updated upon each output value.

    The final state is returned in the result, paired with the result of the source stream.

    Definition Classes
    Segment
    Example:
    1. scala> val src = Segment("Hello", "World").mapAccumulate(0)((l,s) => (l + s.length, (l, s)))
      scala> src.force.toVector
      res0: Vector[(Int,String)] = Vector((0,Hello), (5,World))
      scala> src.drain.force.run
      res1: (Unit,Int) = ((),10)
  35. final def mapConcat[O2](f: (O) ⇒ Chunk[O2]): Segment[O2, Unit]

    Returns a segment that maps each output using the supplied function and concatenates all the results.

    Returns a segment that maps each output using the supplied function and concatenates all the results.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1,2,3).mapConcat(o => Chunk.seq(List.range(0, o))).force.toVector
      res0: Vector[Int] = Vector(0, 0, 1, 0, 1, 2)
  36. final def mapResult[R2](f: (Unit) ⇒ R2): Segment[O, R2]

    Maps the supplied function over the result of this segment.

    Maps the supplied function over the result of this segment.

    Definition Classes
    Segment
    Example:
    1. scala> Segment('a', 'b', 'c').withSize.mapResult { case (_, size) => size }.drain.force.run
      res0: Long = 3
  37. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  38. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  39. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final def prepend[O2 >: O](c: Segment[O2, Any]): Segment[O2, Unit]

    Equivalent to s2 ++ this.

    Equivalent to s2 ++ this.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3).prepend(Segment(-1, 0)).force.toVector
      res0: Vector[Int] = Vector(-1, 0, 1, 2, 3)
  41. final def scan[B](z: B, emitFinal: Boolean = true)(f: (B, O) ⇒ B): Segment[B, (Unit, B)]

    Like fold but outputs intermediate results.

    Like fold but outputs intermediate results. If emitFinal is true, upon reaching the end of the stream, the accumulated value is output. If emitFinal is false, the accumulated output is not output. Regardless, the accumulated value is returned as the result of the segment.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3, 4, 5).scan(0)(_+_).force.toVector
      res0: Vector[Int] = Vector(0, 1, 3, 6, 10, 15)
  42. final def sum[N >: O](implicit N: Numeric[N]): Segment[Nothing, N]

    Sums the elements of this segment and returns the sum as the segment result.

    Sums the elements of this segment and returns the sum as the segment result.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3, 4, 5).sum.force.run
      res0: Int = 15
  43. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  44. final def take(n: Long): Segment[O, Either[(Unit, Long), Segment[O, Unit]]]

    Lazily takes n elements from this segment.

    Lazily takes n elements from this segment. The result of the returned segment is either a left containing the result of the original segment and the number of elements remaining to take when the end of the source segment was reached, or a right containing the remainder of the source segment after n elements are taken.

    Definition Classes
    Segment
    Example:
    1. scala> Segment.from(0).take(3).force.toVector
      res0: Vector[Long] = Vector(0, 1, 2)
      scala> Segment.from(0).take(3).drain.force.run.toOption.get.take(5).force.toVector
      res1: Vector[Long] = Vector(3, 4, 5, 6, 7)
      scala> Segment(1, 2, 3).take(5).drain.force.run
      res2: Either[(Unit, Long),Segment[Int,Unit]] = Left(((),2))
  45. final def takeWhile(p: (O) ⇒ Boolean, takeFailure: Boolean = false): Segment[O, Either[Unit, Segment[O, Unit]]]

    Returns a segment that outputs elements while p is true.

    Returns a segment that outputs elements while p is true.

    The result of the returned segment is either the result of the original stream, if the end was reached and the predicate was still passing, or the remaining stream, if the predicate failed. If takeFailure is true, the last element output is the first element which failed the predicate. If takeFailure is false, the first element of the remainder is the first element which failed the predicate.

    Definition Classes
    Segment
    Example:
    1. scala> Segment.from(0).takeWhile(_ < 3).force.toVector
      res0: Vector[Long] = Vector(0, 1, 2)
      scala> Segment.from(0).takeWhile(_ < 3, takeFailure = true).force.toVector
      res1: Vector[Long] = Vector(0, 1, 2, 3)
      scala> Segment.from(0).takeWhile(_ < 3).drain.force.run.toOption.get.take(5).force.toVector
      res2: Vector[Long] = Vector(3, 4, 5, 6, 7)
  46. def toString(): String
    Definition Classes
    SingleChunk → AnyRef → Any
  47. final def void: Segment[Unit, Unit]

    Alias for map(_ => ()).

    Alias for map(_ => ()).

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3).void.force.toList
      res0: List[Unit] = List((), (), ())
  48. final def voidResult: Segment[O, Unit]

    Returns a new segment which discards the result and replaces it with unit.

    Returns a new segment which discards the result and replaces it with unit.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3).take(2).voidResult
      res0: Segment[Int,Unit] = ((Chunk(1, 2, 3)).take(2)).mapResult(<f1>)
  49. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  52. def withSize: Segment[O, (Unit, Long)]

    Returns a new segment which includes the number of elements output in the result.

    Returns a new segment which includes the number of elements output in the result.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1, 2, 3).withSize.drain.force.run
      res0: (Unit,Long) = ((),3)
  53. def zipWith[O2, R2, O3](that: Segment[O2, R2])(f: (O, O2) ⇒ O3): Segment[O3, Either[(Unit, Segment[O2, R2]), (R2, Segment[O, Unit])]]

    Zips this segment with another segment using the supplied function to combine elements from this and that.

    Zips this segment with another segment using the supplied function to combine elements from this and that. Terminates when either segment terminates.

    Definition Classes
    Segment
    Example:
    1. scala> Segment(1,2,3).zipWith(Segment(4,5,6,7))(_+_).force.toList
      res0: List[Int] = List(5, 7, 9)
  54. def [B](y: B): (SingleChunk[O], B)
    Implicit
    This member is added by an implicit conversion from SingleChunk[O] to ArrowAssoc[SingleChunk[O]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Segment[O, Unit]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from SingleChunk[O] to any2stringadd[SingleChunk[O]]

Inherited by implicit conversion StringFormat from SingleChunk[O] to StringFormat[SingleChunk[O]]

Inherited by implicit conversion Ensuring from SingleChunk[O] to Ensuring[SingleChunk[O]]

Inherited by implicit conversion ArrowAssoc from SingleChunk[O] to ArrowAssoc[SingleChunk[O]]

Ungrouped