class tree walk can be idiomized with find_map and transpose
This commit is contained in:
parent
726ffeca21
commit
09dd442948
@ -256,15 +256,9 @@ impl mlua::UserData for Instance{
|
|||||||
database:db,
|
database:db,
|
||||||
descriptor:Some(class),
|
descriptor:Some(class),
|
||||||
};
|
};
|
||||||
Ok(loop{
|
iter.find_map(|class|
|
||||||
match iter.next(){
|
cf.get_or_create_class_function(lua,&class.name,index_str).transpose()
|
||||||
Some(class)=>match cf.get_or_create_class_function(lua,&class.name,index_str)?{
|
).transpose()
|
||||||
Some(function)=>break Some(function),
|
|
||||||
None=>(),
|
|
||||||
},
|
|
||||||
None=>break None,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})?{
|
})?{
|
||||||
return function.into_lua(lua);
|
return function.into_lua(lua);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user