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

A buffer that starts dropping new values once it reaches it’s maximum size.

Example

iex> buffer = CSP.Buffer.Dropping.new(2)
iex> {:ok, buffer} = CSP.Buffer.put(buffer, :foo)
iex> {:ok, buffer} = CSP.Buffer.put(buffer, :bar)
iex> {:ok, buffer} = CSP.Buffer.put(buffer, :baz)
iex> {:ok, value, buffer} = CSP.Buffer.next(buffer)
iex> value
:foo
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.Dropping{items: term(), size: term()}

Link to this section Functions

Creates a new buffer with the informed size.