philomena/native/furbooru_markdown
2021-09-11 23:03:40 +02:00
..
.cargo markdown test 2021-09-11 23:03:40 +02:00
src markdown test 2021-09-11 23:03:40 +02:00
Cargo.lock markdown test 2021-09-11 23:03:40 +02:00
Cargo.toml markdown test 2021-09-11 23:03:40 +02:00
README.md markdown test 2021-09-11 23:03:40 +02:00

NIF for Elixir.Furbooru.Markdown

To build the NIF module:

  • Make sure your projects mix.exs has the :rustler compiler listed in the project function: compilers: [:rustler] ++ Mix.compilers() If there already is a :compilers list, you should append :rustler to it.
  • Add your crate to the rustler_crates attribute in the `project function. See here.
  • Your NIF will now build along with your project.

To load the NIF:

defmodule Furbooru.Markdown do
    use Rustler, otp_app: <otp-app>, crate: "furbooru_markdown"

    # When your NIF is loaded, it will override this function.
    def add(_a, _b), do: :erlang.nif_error(:nif_not_loaded)
end

Examples

This is a complete example of a NIF written in Rust.