Sooth.Statistic (Sooth v0.3.1)

A simple data structure for tracking event counts.

Summary

Types

t()

A Statistic of event/count

Functions

Increment the count of a statistic.

Create a new statistic.

Types

@type t() :: %Sooth.Statistic{count: non_neg_integer(), event: non_neg_integer()}

A Statistic of event/count

Functions

Link to this function

increment(statistic)

@spec increment(t()) :: t()

Increment the count of a statistic.

Examples

iex> Sooth.Statistic.increment(%Sooth.Statistic{event: 0, count: 0})
%Sooth.Statistic{event: 0, count: 1}
Link to this function

new(event, count)

@spec new(non_neg_integer(), non_neg_integer()) :: t()

Create a new statistic.

Examples

iex> Sooth.Statistic.new(0, 0)
%Sooth.Statistic{event: 0, count: 0}