Skip to content

Commit

Permalink
fix: remove deprecated rhai funcitons
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
  • Loading branch information
fabriziosestito committed Feb 3, 2024
1 parent bf1a3d1 commit b803dad
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 68 deletions.
52 changes: 26 additions & 26 deletions native/rhai_rustler/Cargo.lock

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

4 changes: 2 additions & 2 deletions native/rhai_rustler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod error;
mod scope;
mod types;

use rhai::config::hashing::set_ahash_seed;
use rhai::config::hashing::set_hashing_seed;
use rustler::{Env, Term};

use crate::ast::*;
Expand All @@ -13,7 +13,7 @@ use crate::scope::*;

fn load(env: Env, _: Term) -> bool {
// Set dylib ahash seed
if let Err(value) = set_ahash_seed(Some([1, 3, 3, 7])) {
if let Err(value) = set_hashing_seed(Some([1, 3, 3, 7])) {
eprintln!(
"Failed to set ahash seed, ahash seed already set: {:?}",
value
Expand Down
64 changes: 32 additions & 32 deletions native/test_dylib_module/Cargo.lock

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

8 changes: 2 additions & 6 deletions native/test_dylib_module/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use rhai_dylib::rhai::plugin::{
mem, Dynamic, FnAccess, FnNamespace, ImmutableString, NativeCallContext, PluginFunction,
RhaiResult, TypeId,
};

use rhai_dylib::rhai::plugin::*;
use rhai_dylib::rhai::{Map, Module, INT};

#[derive(Clone)]
Expand All @@ -11,7 +7,7 @@ pub struct MyPluginObjectInner {
}

// The plugin API from rhai can be used to create your plugin API.
#[rhai_dylib::rhai::plugin::export_module]
#[rhai_dylib::rhai::export_module]
pub mod my_plugin_api {

// Implement a custom type.
Expand Down
4 changes: 2 additions & 2 deletions native/test_dylib_module/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pub mod api;

use rhai_dylib::rhai::{config::hashing::set_ahash_seed, exported_module, Module, Shared};
use rhai_dylib::rhai::{config::hashing::set_hashing_seed, exported_module, Module, Shared};

#[allow(improper_ctypes_definitions)]
#[no_mangle]
pub extern "C" fn module_entrypoint() -> Shared<Module> {
if let Err(value) = set_ahash_seed(Some([1, 3, 3, 7])) {
if let Err(value) = set_hashing_seed(Some([1, 3, 3, 7])) {
if value != Some([1, 3, 3, 7]) {
panic!("ahash seed was already set with value: {value:?}");
}
Expand Down

0 comments on commit b803dad

Please sign in to comment.