CSPEx v2.0.0-beta CSP.Buffer.Blocking View Source

A buffer that only allows a certain amount of values to be put into it.

Example

iex> buffer = CSP.Buffer.Blocking.new(1)
iex> {:ok, buffer} = CSP.Buffer.put(buffer, :foo)
iex> CSP.Buffer.put(buffer, :bar)
:error
iex> {:ok, value, buffer} = CSP.Buffer.next(buffer)
iex> value
:foo
iex> {:ok, buffer} = CSP.Buffer.put(buffer, :bar)
iex> {:ok, value, buffer} = CSP.Buffer.next(buffer)
iex> value
:bar
iex> CSP.Buffer.next(buffer)
:empty

Link to this section Summary

Functions

Creates a new buffer with the informed size

Link to this section Types

Link to this type t() View Source
t() :: %CSP.Buffer.Blocking{items: term(), size: term()}

Link to this section Functions

Creates a new buffer with the informed size.