Queue

object Queue
Companion
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def bounded[F[_], A](capacity: Int)(implicit F: GenConcurrent[F, _]): F[Queue[F, A]]

Constructs an empty, bounded queue holding up to capacity elements for F data types that are cats.effect.kernel.GenConcurrent. When the queue is full (contains exactly capacity elements), every next Queue#offer will be backpressured (i.e. the Queue#offer blocks semantically).

Constructs an empty, bounded queue holding up to capacity elements for F data types that are cats.effect.kernel.GenConcurrent. When the queue is full (contains exactly capacity elements), every next Queue#offer will be backpressured (i.e. the Queue#offer blocks semantically).

Value Params
capacity

the maximum capacity of the queue

Returns

an empty, bounded queue

def circularBuffer[F[_], A](capacity: Int)(implicit F: GenConcurrent[F, _]): F[Queue[F, A]]

Constructs an empty, bounded, circular buffer queue holding up to capacity elements for F data types that are cats.effect.kernel.GenConcurrent. The queue always keeps at most capacity number of elements, with the oldest element in the queue always being dropped in favor of a new elements arriving in the queue, and the offer effect itself will not semantically block.

Constructs an empty, bounded, circular buffer queue holding up to capacity elements for F data types that are cats.effect.kernel.GenConcurrent. The queue always keeps at most capacity number of elements, with the oldest element in the queue always being dropped in favor of a new elements arriving in the queue, and the offer effect itself will not semantically block.

Value Params
capacity

the maximum capacity of the queue

Returns

an empty, bounded, sliding queue

def dropping[F[_], A](capacity: Int)(implicit F: GenConcurrent[F, _]): F[Queue[F, A]]

Constructs an empty, bounded, dropping queue holding up to capacity elements for F data types that are cats.effect.kernel.GenConcurrent. When the queue is full (contains exactly capacity elements), every next Queue#offer will be ignored, i.e. no other elements can be enqueued until there is sufficient capacity in the queue, and the offer effect itself will not semantically block.

Constructs an empty, bounded, dropping queue holding up to capacity elements for F data types that are cats.effect.kernel.GenConcurrent. When the queue is full (contains exactly capacity elements), every next Queue#offer will be ignored, i.e. no other elements can be enqueued until there is sufficient capacity in the queue, and the offer effect itself will not semantically block.

Value Params
capacity

the maximum capacity of the queue

Returns

an empty, bounded, dropping queue

def synchronous[F[_], A](implicit F: GenConcurrent[F, _]): F[Queue[F, A]]

Constructs a queue through which a single element can pass only in the case when there are at least one taking fiber and at least one offering fiber for F data types that are cats.effect.kernel.GenConcurrent. Both Queue#offer and Queue#take semantically block until there is a fiber executing the opposite action, at which point both fibers are freed.

Constructs a queue through which a single element can pass only in the case when there are at least one taking fiber and at least one offering fiber for F data types that are cats.effect.kernel.GenConcurrent. Both Queue#offer and Queue#take semantically block until there is a fiber executing the opposite action, at which point both fibers are freed.

Returns

a synchronous queue

def unbounded[F[_], A](implicit F: GenConcurrent[F, _]): F[Queue[F, A]]

Constructs an empty, unbounded queue for F data types that are cats.effect.kernel.GenConcurrent. Queue#offer never blocks semantically, as there is always spare capacity in the queue.

Constructs an empty, unbounded queue for F data types that are cats.effect.kernel.GenConcurrent. Queue#offer never blocks semantically, as there is always spare capacity in the queue.

Returns

an empty, unbounded queue

Implicits

Implicits

implicit def catsInvariantForQueue[F[_]](implicit evidence$1: Functor[F]): Invariant[[_] =>> Queue[F, _$21]]