View Source Sooth.Statistic (Sooth v0.5.0)

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

@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}
@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}