pub trait IntoNativeHandler {
// Required method
fn into_handler(self) -> Option<NativeHandler>;
}Expand description
add_native 第二个参数的 trait 重载。
既支持按内建名挂载(add_native("local/h", "fight"),查 builtin_native),
也支持直接挂任意 Fn 闭包(add_native("local/h", |msg| { ... }),可带捕获)。
顶层 fn 也会走闭包分支(无捕获闭包)。
Required Methods§
fn into_handler(self) -> Option<NativeHandler>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl IntoNativeHandler for &str
&str:按内建名查找(如 “fight”)。未知名返回 None,add_native 返回 false。
impl IntoNativeHandler for &str
&str:按内建名查找(如 “fight”)。未知名返回 None,add_native 返回 false。