# `ScoutApm.ScoredItemSet`

A capped set type that has a few rules on inclusion.

When you add an item, it must be a tuple of shape: {{:score, integer, key}, item}

Where the key uniquely identifies the item, as a string. The score is a
unitless relative "value" of this item, and then the item itself can be any
structure

Only the highest score of each key is kept, no duplicates, even if the set has "room" for it.

Only the highest scores will be kept when at capacity. Adding a new element
may or may result in the new item evicting an old one, or being simply
dropped, based on the comparison of the scores.

# `key`

```elixir
@type key() :: String.t()
```

# `options`

```elixir
@type options() :: %{max_count: pos_integer()}
```

# `score`

```elixir
@type score() :: {:score, number(), key()}
```

# `scored_item`

```elixir
@type scored_item() :: {score(), any()}
```

# `t`

```elixir
@type t() :: %ScoutApm.ScoredItemSet{
  data: %{required(any()) =&gt; scored_item()},
  options: options()
}
```

# `absorb`

```elixir
@spec absorb(t(), scored_item()) :: t()
```

# `new`

```elixir
@spec new() :: t()
```

# `set_max_count`

```elixir
@spec set_max_count(t(), pos_integer()) :: t()
```

# `size`

```elixir
@spec size(t()) :: non_neg_integer()
```

# `to_list`

```elixir
@spec to_list(t()) :: [scored_item()]
```

# `to_list`

```elixir
@spec to_list(t(), :without_scores) :: [scored_item()]
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
