# `Cadmpeg.Native`
[🔗](https://github.com/d-led/ex.cadmpeg/blob/main/lib/cadmpeg/native.ex#L1)

The Rust engine, one function per operation it has.

Nothing here is meant to be called directly: `Cadmpeg` and `Cadmpeg.Document`
decode the answers, refuse with `Cadmpeg.Error` and keep the handle opaque. An
operation is listed here, in `native/cadmpeg_nif/src/lib.rs` and in the test
that calls every one of them, or it does not exist.

# `available`

```elixir
@spec available() :: boolean()
```

Whether the engine is built and loaded in this VM.

# `from_json`

```elixir
@spec from_json(binary()) :: {:ok, reference()} | {:error, {String.t(), String.t()}}
```

A handle from the document's own JSON.

# `inputs`

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

The input formats this build reads, as JSON.

# `loaded?`

```elixir
@spec loaded?() :: boolean()
```

# `open`

```elixir
@spec open(String.t()) ::
  {:ok, {reference(), String.t()}} | {:error, {String.t(), String.t()}}
```

A file opened into a document handle, with its decode report as JSON.

# `outputs`

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

The output formats this build writes, as JSON.

# `to_json`

```elixir
@spec to_json(reference()) :: {:ok, String.t()} | {:error, {String.t(), String.t()}}
```

The document as its versioned JSON.

# `vocabulary`

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

The words an output format can be named by.

# `write`

```elixir
@spec write(reference(), String.t(), String.t(), String.t()) ::
  {:ok, String.t()} | {:error, {String.t(), String.t()}}
```

Writes the document in `format` to `path`, answering the export report as JSON.

---

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