# `Plushie.Protocol.Keys`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/protocol/keys.ex#L1)

Named keyboard key mappings and validation.

Maps wire-format key name strings (PascalCase, matching iced's
`keyboard::key::Named` debug format) to Elixir atoms. Used by
the protocol decoder to convert key events and by test helpers
to validate key names at call time.

# `parse_key`

```elixir
@spec parse_key(key :: String.t()) :: atom() | String.t()
```

Converts a key name string to an atom for named keys, or returns the string
unchanged for single-character keys.

## Examples

    iex> Plushie.Protocol.Keys.parse_key("Escape")
    :escape

    iex> Plushie.Protocol.Keys.parse_key("a")
    "a"

# `parse_location`

```elixir
@spec parse_location(String.t() | nil) :: :left | :right | :numpad | :standard
```

Parses a key location string to an atom.

# `parse_physical_key`

```elixir
@spec parse_physical_key(term()) :: atom() | String.t() | nil
```

Converts a physical key code string to an atom, or returns the string
unchanged for unknown codes.

---

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