# `NativeArtifact.Target`
[🔗](https://github.com/gsmlg-dev/native_artifact/blob/main/lib/native_artifact/target.ex#L1)

Explicit platform descriptions for the six proposed v0.1 targets.

`new/1` accepts string-keyed data, never host information or a language-specific
triple. It performs no OS probing, process execution, network requests or atom
creation. An explicit target describes the intended BEAM, which can differ from
the physical machine (for example, an x86_64 BEAM under Rosetta).

These are candidate platform contracts, not a list of certified platforms.
Minimum OS/libc/ERTS versions and system-library requirements live in the
manifest's compatibility record and require later resolver/runtime checks.

# `nif_version`

```elixir
@type nif_version() :: {pos_integer(), non_neg_integer()}
```

# `t`

```elixir
@type t() :: %NativeArtifact.Target{
  arch: :x86_64 | :aarch64,
  cpu_baseline: :x86_64 | :armv8_a,
  endianness: :little,
  libc: :glibc | :musl | :none,
  object_format: :elf | :mach_o,
  os: :linux | :macos,
  pointer_width: 64,
  source: :explicit
}
```

# `new`

```elixir
@spec new(map()) :: {:ok, t()} | {:error, NativeArtifact.Error.t()}
```

Validates an explicit target, deriving only fixed platform invariants.

`os`, `arch` and `libc` are required; unknown libc is never treated as GNU.
Optional invariant fields must match the selected platform exactly.

# `nif_compatible?`

```elixir
@spec nif_compatible?(term(), term()) :: boolean()
```

Tests only the conservative NIF API requirement: same major, required minor
no newer than runtime minor. It does not prove overall artifact compatibility.

# `parse_nif_version`

```elixir
@spec parse_nif_version(term()) ::
  {:ok, nif_version()} | {:error, NativeArtifact.Error.t()}
```

Parses an NIF API version without interpreting it as a decimal number.

---

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