# `GgenIgniter.Frontmatter.MatchSpec`
[🔗](https://github.com/seanchatmangpt/ggen_igniter/blob/v26.9.8/lib/ggen_igniter/frontmatter.ex#L365)

Mirrors Rust's `#[serde(untagged)] enum MatchSpec { Literal(String),
Structured(MatchRule) }` (`template.rs:184-187`). An Elixir "untagged enum"
is a tagged tuple here (`{:literal, string}` / `{:structured, match_rule}`)
since Elixir has no untagged-union deserialization primitive to mirror
directly -- the tag is added, not removed, information.

# `t`

```elixir
@type t() ::
  {:literal, String.t()} | {:structured, GgenIgniter.Frontmatter.MatchRule.t()}
```

# `literal`

```elixir
@spec literal(String.t()) :: t()
```

Wraps a literal substring/marker pattern as a `t:t/0`, tagging it `:literal`
the way the real Rust untagged enum's `MatchSpec::Literal(String)` variant
is distinguished from `MatchSpec::Structured(MatchRule)` at the type level.

## Examples

    iex> GgenIgniter.Frontmatter.MatchSpec.literal("ggen:slot")
    {:literal, "ggen:slot"}

# `structured`

```elixir
@spec structured(GgenIgniter.Frontmatter.MatchRule.t()) :: t()
```

Wraps a `GgenIgniter.Frontmatter.MatchRule.t()` as a `t:t/0`, tagging it
`:structured` -- the counterpart to `literal/1` above.

## Examples

    iex> rule = GgenIgniter.Frontmatter.MatchRule.from_map(%{"pattern" => "ggen:slot"})
    iex> GgenIgniter.Frontmatter.MatchSpec.structured(rule)
    {:structured,
     %GgenIgniter.Frontmatter.MatchRule{
       pattern: "ggen:slot",
       matcher: :contains,
       scope: :auto,
       occurrence: :first,
       index: 0,
       case_sensitive: true,
       trim: false
     }}

---

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