Cadmpeg.Native (ExCadmpeg v0.1.0)

Copy Markdown View Source

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.

Summary

Functions

Whether the engine is built and loaded in this VM.

A handle from the document's own JSON.

The input formats this build reads, as JSON.

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

The output formats this build writes, as JSON.

The document as its versioned JSON.

The words an output format can be named by.

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

Functions

available()

@spec available() :: boolean()

Whether the engine is built and loaded in this VM.

from_json(json)

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

A handle from the document's own JSON.

inputs()

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

The input formats this build reads, as JSON.

loaded?()

@spec loaded?() :: boolean()

open(path)

@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()

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

The output formats this build writes, as JSON.

to_json(document)

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

The document as its versioned JSON.

vocabulary()

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

The words an output format can be named by.

write(document, format, path, target)

@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.