Whiff.Extractor behaviour (whiff v0.1.0)

Copy Markdown View Source

Behaviour for Elixir-written extractors ("Whiffers").

Callbacks run in BEAM processes outside the NIF — never as Rust plugin callbacks. Prefer supports?/2 using Whiff.Input descriptors (and optional limited header probes) rather than loading entire large files.

Summary

Types

native_report()

@type native_report() :: map()

Callbacks

extract(t, native_report)

@callback extract(Whiff.Input.t(), native_report()) ::
  {:ok, map()} | {:error, Whiff.Error.t()}

id()

@callback id() :: String.t()

supports?(t, native_report)

@callback supports?(Whiff.Input.t(), native_report()) :: boolean()

version()

@callback version() :: pos_integer()