Remove Box on callback traits.

This commit is contained in:
Stephen Chung
2022-01-27 23:55:32 +08:00
parent 64de20bcd3
commit e476929597
7 changed files with 66 additions and 53 deletions

View File

@@ -10,18 +10,13 @@ use std::prelude::v1::*;
/// A standard callback function for debugging.
#[cfg(not(feature = "sync"))]
pub type OnDebuggerCallback = Box<
dyn Fn(&mut EvalContext, ASTNode, Option<&str>, Position) -> RhaiResultOf<DebuggerCommand>
+ 'static,
>;
pub type OnDebuggerCallback =
dyn Fn(&mut EvalContext, ASTNode, Option<&str>, Position) -> RhaiResultOf<DebuggerCommand>;
/// A standard callback function for debugging.
#[cfg(feature = "sync")]
pub type OnDebuggerCallback = Box<
dyn Fn(&mut EvalContext, ASTNode, Option<&str>, Position) -> RhaiResultOf<DebuggerCommand>
+ Send
+ Sync
+ 'static,
>;
pub type OnDebuggerCallback = dyn Fn(&mut EvalContext, ASTNode, Option<&str>, Position) -> RhaiResultOf<DebuggerCommand>
+ Send
+ Sync;
/// A command for the debugger on the next iteration.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]

View File

@@ -178,7 +178,7 @@ impl GlobalRuntimeState<'_> {
/// [modules][Module].
#[inline]
#[must_use]
pub fn get_iter(&self, id: TypeId) -> Option<IteratorFn> {
pub fn get_iter(&self, id: TypeId) -> Option<&IteratorFn> {
self.modules
.iter()
.rev()