Skip to content

Commit

Permalink
Replace serde_rustler with rustler::serde (#36)
Browse files Browse the repository at this point in the history
* Replace serde_rustler with rustler::serde

Ref rusterlium/rustler#586
  • Loading branch information
leandrocp authored Apr 17, 2024
1 parent ca431b1 commit 7bdd764
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 85 deletions.
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule MDEx.MixProject do
use Mix.Project

@source_url "https://github.com/leandrocp/mdex"
@version "0.1.15"
@version "0.1.16-dev"
@dev? String.ends_with?(@version, "-dev")
@force_build? System.get_env("MDEX_BUILD") in ["1", "true"]

Expand Down Expand Up @@ -69,7 +69,7 @@ defmodule MDEx.MixProject do

defp deps do
[
{:rustler, "~> 0.32.0", optional: not (@dev? or @force_build?)},
{:rustler, "~> 0.32", optional: not (@dev? or @force_build?)},
{:rustler_precompiled, "~> 0.7"},
{:ex_doc, "~> 0.29", only: :dev}
]
Expand Down
40 changes: 17 additions & 23 deletions native/comrak_nif/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 60 additions & 57 deletions native/comrak_nif/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,72 @@ path = "src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
rustler = "0.29"
rustler = { version = "0.32", features = [
"derive",
"nif_version_2_15",
"serde",
] }
serde = "1.0"
serde_rustler = { git = "https://github.com/avencera/serde_rustler.git", branch = "rustler-0-29" }
comrak = "0.20"
comrak = "0.22"
ammonia = "3.3"
phf = { version = "0.11", features = ["macros"] }
tree-sitter = "0.20"
tree-sitter-highlight = "0.20"
v_htmlescape = "0.15"
inkjet = { version = "0.10.4" , default-features = false, features = [
"html",
"language-bash",
"language-c",
"language-c-sharp",
"language-clojure",
"language-commonlisp",
"language-cpp",
"language-css",
"language-diff",
"language-dockerfile",
"language-eex",
"language-elisp",
"language-elixir",
"language-elm",
"language-erlang",
"language-gleam",
"language-go",
"language-haskell",
"language-hcl",
"language-heex",
"language-html",
"language-iex",
"language-java",
"language-javascript",
"language-json",
"language-jsx",
"language-kotlin",
"language-latex",
"language-llvm",
"language-lua",
"language-make",
"language-ocaml",
"language-ocaml-interface",
"language-pascal",
"language-php",
"language-plaintext",
"language-proto",
"language-python",
"language-r",
"language-regex",
"language-ruby",
"language-rust",
"language-scala",
"language-scss",
"language-sql",
"language-svelte",
"language-swift",
"language-toml",
"language-typescript",
"language-tsx",
"language-vim",
"language-yaml",
"language-zig",
inkjet = { version = "0.10.4", default-features = false, features = [
"html",
"language-bash",
"language-c",
"language-c-sharp",
"language-clojure",
"language-commonlisp",
"language-cpp",
"language-css",
"language-diff",
"language-dockerfile",
"language-eex",
"language-elisp",
"language-elixir",
"language-elm",
"language-erlang",
"language-gleam",
"language-go",
"language-haskell",
"language-hcl",
"language-heex",
"language-html",
"language-iex",
"language-java",
"language-javascript",
"language-json",
"language-jsx",
"language-kotlin",
"language-latex",
"language-llvm",
"language-lua",
"language-make",
"language-ocaml",
"language-ocaml-interface",
"language-pascal",
"language-php",
"language-plaintext",
"language-proto",
"language-python",
"language-r",
"language-regex",
"language-ruby",
"language-rust",
"language-scala",
"language-scss",
"language-sql",
"language-svelte",
"language-swift",
"language-toml",
"language-typescript",
"language-tsx",
"language-vim",
"language-yaml",
"language-zig",
] }
autumn = { path = "vendor/autumn" }

Expand Down
1 change: 0 additions & 1 deletion native/comrak_nif/Cross.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[build.env]
passthrough = [
"RUSTLER_NIF_VERSION",
"RUSTFLAGS"
]
3 changes: 1 addition & 2 deletions native/comrak_nif/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use comrak::{
};
use inkjet_adapter::InkjetAdapter;
use rustler::{Env, NifResult, Term};
use serde_rustler::to_term;
use types::options::*;

rustler::init!("Elixir.MDEx.Native", [to_html, to_html_with_options]);
Expand Down Expand Up @@ -95,5 +94,5 @@ fn render(env: Env, unsafe_html: String, sanitize: bool) -> NifResult<Term> {
false => unsafe_html,
};

to_term(env, html).map_err(|err| err.into())
rustler::serde::to_term(env, html).map_err(|err| err.into())
}

0 comments on commit 7bdd764

Please sign in to comment.