ClosureSearcher.modules HashMap<String, ...>
This commit is contained in:
parent
f816aeaf6b
commit
9d6faef3d3
@ -153,7 +153,7 @@ pub struct ClosureSearcher {
|
|||||||
/// Closures must return an `rlua::Result`-wrapped `Function`. This `Function`
|
/// Closures must return an `rlua::Result`-wrapped `Function`. This `Function`
|
||||||
/// acts as the module loader.
|
/// acts as the module loader.
|
||||||
modules: HashMap<
|
modules: HashMap<
|
||||||
&'static str,
|
String,
|
||||||
Box<
|
Box<
|
||||||
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
||||||
+ Send,
|
+ Send,
|
||||||
@ -166,7 +166,7 @@ pub struct ClosureSearcher {
|
|||||||
impl ClosureSearcher {
|
impl ClosureSearcher {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
modules: HashMap<
|
modules: HashMap<
|
||||||
&'static str,
|
String,
|
||||||
Box<
|
Box<
|
||||||
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
||||||
+ Send,
|
+ Send,
|
||||||
@ -232,7 +232,7 @@ pub trait AddSearcher {
|
|||||||
fn add_closure_searcher(
|
fn add_closure_searcher(
|
||||||
&self,
|
&self,
|
||||||
modules: HashMap<
|
modules: HashMap<
|
||||||
&'static str,
|
String,
|
||||||
Box<
|
Box<
|
||||||
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
||||||
+ Send,
|
+ Send,
|
||||||
@ -297,7 +297,7 @@ impl<'a> AddSearcher for Context<'a> {
|
|||||||
fn add_closure_searcher(
|
fn add_closure_searcher(
|
||||||
&self,
|
&self,
|
||||||
modules: HashMap<
|
modules: HashMap<
|
||||||
&'static str,
|
String,
|
||||||
Box<
|
Box<
|
||||||
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
||||||
+ Send,
|
+ Send,
|
||||||
|
@ -165,7 +165,7 @@ fn add_closure_searcher_works() {
|
|||||||
let lua = Lua::new();
|
let lua = Lua::new();
|
||||||
|
|
||||||
let mut modules: HashMap<
|
let mut modules: HashMap<
|
||||||
&'static str,
|
String,
|
||||||
Box<
|
Box<
|
||||||
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
dyn for<'ctx> Fn(Context<'ctx>, Table<'ctx>, &str) -> rlua::Result<Function<'ctx>>
|
||||||
+ Send,
|
+ Send,
|
||||||
@ -189,7 +189,7 @@ fn add_closure_searcher_works() {
|
|||||||
.into_function()?)
|
.into_function()?)
|
||||||
});
|
});
|
||||||
|
|
||||||
modules.insert("instrument", instrument_loader);
|
modules.insert("instrument".to_string(), instrument_loader);
|
||||||
|
|
||||||
let sound = lua
|
let sound = lua
|
||||||
.context::<_, Result<String>>(|lua_ctx| {
|
.context::<_, Result<String>>(|lua_ctx| {
|
||||||
|
Loading…
Reference in New Issue
Block a user