Skip to content

Commit

Permalink
Fix deprecation from Rustler
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Feb 6, 2025
1 parent 2c23e78 commit d12e235
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions native/vt_nif/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use avt::Vt;
use rustler::{Atom, Binary, Encoder, Env, Error, NifResult, ResourceArc, Term};
use rustler::{Atom, Binary, Encoder, Env, Error, NifResult, Resource, ResourceArc, Term};
use std::str;
use std::{ops::RangeInclusive, sync::RwLock};

Expand All @@ -20,10 +20,10 @@ pub struct VtResource {
vt: RwLock<Vt>,
}

fn load(env: Env, _info: Term) -> bool {
rustler::resource!(VtResource, env);
impl Resource for VtResource {}

true
fn load(env: Env, _term: Term) -> bool {
env.register::<VtResource>().is_ok()
}

#[rustler::nif]
Expand Down Expand Up @@ -202,8 +202,4 @@ fn convert_err<T, E>(result: Result<T, E>, error: &'static str) -> Result<T, Err
}
}

rustler::init!(
"Elixir.Asciinema.Vt",
[new, feed, resize, dump, dump_screen, text],
load = load
);
rustler::init!("Elixir.Asciinema.Vt", load = load);

0 comments on commit d12e235

Please sign in to comment.