implicit final class SourceFs2Ops[A] extends AnyVal
Since Source is a synchronous-only encoding of the Resource pattern, it can
be converted to a cats.effect.Resource by suspending its open and close
operations in a Sync effect type F, yielding an Iterator[A] as its value.
This can be taken a step further by lifting that Resource to a fs2.Stream
and wrapping the provided Iterator as a stream, to treat the whole Source[A]
as a fs2.Stream[F, A]
- Source
- package.scala
- Alphabetic
- By Inheritance
- SourceFs2Ops
- AnyVal
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##: Int
- Definition Classes
- Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toany2stringadd[SourceFs2Ops[A]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (SourceFs2Ops[A], B)
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toArrowAssoc[SourceFs2Ops[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def ensuring(cond: (SourceFs2Ops[A]) => Boolean, msg: => Any): SourceFs2Ops[A]
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (SourceFs2Ops[A]) => Boolean): SourceFs2Ops[A]
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): SourceFs2Ops[A]
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): SourceFs2Ops[A]
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def toResource[F[_]](implicit arg0: Sync[F]): Resource[F, Iterator[A]]
Upgrades this
Sourceto a cats-effectResourceof the given effect typeF.Upgrades this
Sourceto a cats-effectResourceof the given effect typeF. The open and close operations of the underlying source are assumed to be blocking, so they are wrapped withSync[F].blocking { ... }.- F
The effect type
- returns
A new Resource which delegates to this Source's
openmethod
- def toStream[F[_]](chunkSize: Int = 32)(implicit F: Sync[F], FM: MonadCancel[F, _]): Stream[F, A]
Converts this
Sourceto an fs2Streamin the given effect typeF.Converts this
Sourceto an fs2Streamin the given effect typeF.Uses toResource to encapsulate the underlying open/close operation, and uses
Stream.fromBlockingIteratorto wrap the underlying Iterator provided by the Source. The underlying Iterator is assumed to use blocking operations internally since typically the Iterator would be backed by something like ajava.io.InputStream.- F
The effect type
- chunkSize
The number of times the underlying Iterator's
nextshould be called, per blocking step- F
Sync[F] typeclass instance
- FM
MonadCancel[F, _] typeclass instance
- returns
A Stream over the data provided by the underlying Source
- def toString(): String
- Definition Classes
- Any
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toStringFormat[SourceFs2Ops[A]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)instead ofvalue.formatted(formatString), or use thef""string interpolator. In Java 15 and later,formattedresolves to the new method in String which has reversed parameters.
- def →[B](y: B): (SourceFs2Ops[A], B)
- Implicit
- This member is added by an implicit conversion from SourceFs2Ops[A] toArrowAssoc[SourceFs2Ops[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.