Skip to content

Commit

Permalink
Merge pull request #25 from filmor/use-rustler-serde-support
Browse files Browse the repository at this point in the history
Use rustler's builtin serde support
  • Loading branch information
praveenperera authored Jul 6, 2024
2 parents e79723e + 47a6e42 commit 6fa5882
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 44 deletions.
File renamed without changes.
40 changes: 1 addition & 39 deletions native/fastrss/Cargo.lock

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

3 changes: 1 addition & 2 deletions native/fastrss/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ path = "src/lib.rs"
rss = {version = "2.0", features = ["serde"], default-features = false }
atom_syndication = { version = "0.12", features = ["with-serde"], default-features = false }

rustler = "0.33"
rustler = { version = "0.33", features = ["serde"] }

serde = "1.0"
serde-transcode = "1.1"
serde_json = "1.0"
serde_rustler = { git = "https://github.com/avencera/serde_rustler.git", branch = "master" }
6 changes: 3 additions & 3 deletions native/fastrss/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustler::{Encoder, Env, NifResult, Term};
use rustler::{Encoder, Env, NifResult, Term, serde::Serializer};
use serde_json::json;

mod atoms {
Expand All @@ -15,7 +15,7 @@ fn parse_rss(env: Env, rss_string: String) -> NifResult<Term> {
let channel = rss::Channel::read_from(rss_string.as_bytes())
.map_err(|err| format!("Unable to parse RSS - ({:?})", err));

let ser = serde_rustler::Serializer::from(env);
let ser = Serializer::from(env);
let de = json!(channel);

let encoded =
Expand All @@ -32,7 +32,7 @@ fn parse_atom(env: Env, atom_string: String) -> NifResult<Term> {
let channel = atom_syndication::Feed::read_from(atom_string.as_bytes())
.map_err(|err| format!("Unable to parse Atom - ({:?})", err));

let ser = serde_rustler::Serializer::from(env);
let ser = Serializer::from(env);
let de = json!(channel);

let encoded =
Expand Down

0 comments on commit 6fa5882

Please sign in to comment.