prefer where syntax
This commit is contained in:
parent
406c84dabf
commit
0b09ac03d6
@ -25,7 +25,10 @@ impl Searcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UserData for Searcher {
|
impl UserData for Searcher {
|
||||||
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M>(methods: &mut M)
|
||||||
|
where
|
||||||
|
M: UserDataMethods<'lua, Self>,
|
||||||
|
{
|
||||||
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
||||||
match this.modules.get(&name) {
|
match this.modules.get(&name) {
|
||||||
Some(content) => Ok(Value::Function(
|
Some(content) => Ok(Value::Function(
|
||||||
@ -55,7 +58,10 @@ impl StaticSearcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UserData for StaticSearcher {
|
impl UserData for StaticSearcher {
|
||||||
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M>(methods: &mut M)
|
||||||
|
where
|
||||||
|
M: UserDataMethods<'lua, Self>,
|
||||||
|
{
|
||||||
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
||||||
match this.modules.get(name.as_str()) {
|
match this.modules.get(name.as_str()) {
|
||||||
Some(content) => Ok(Value::Function(
|
Some(content) => Ok(Value::Function(
|
||||||
@ -108,7 +114,10 @@ impl<P> UserData for PathSearcherPoly<P>
|
|||||||
where
|
where
|
||||||
P: 'static + AsRef<Path> + Send,
|
P: 'static + AsRef<Path> + Send,
|
||||||
{
|
{
|
||||||
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M>(methods: &mut M)
|
||||||
|
where
|
||||||
|
M: UserDataMethods<'lua, Self>,
|
||||||
|
{
|
||||||
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
||||||
match this.modules.get(&name) {
|
match this.modules.get(&name) {
|
||||||
Some(ref path) => {
|
Some(ref path) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user