pub trait IntoHostFn<Marker> {
// Required method
fn into_host_fn_parts(
self,
) -> (Rc<dyn Fn(&[Value]) -> Result<Value, HostError>>, Vec<HostType>, HostType);
}Expand description
Adapts a Rust closure into a registered host function.
The Marker type parameter disambiguates the blanket impls by arity (and,
for &str, by borrow), the same trick rhai/bevy use to make
register_fn accept closures of many shapes without annotations.
Required Methods§
Sourcefn into_host_fn_parts(
self,
) -> (Rc<dyn Fn(&[Value]) -> Result<Value, HostError>>, Vec<HostType>, HostType)
fn into_host_fn_parts( self, ) -> (Rc<dyn Fn(&[Value]) -> Result<Value, HostError>>, Vec<HostType>, HostType)
Internal adapter: yields the erased dispatcher plus the argument and
return type signature derived from the closure. Not meant to be called
directly; Engine::register_host_fn drives it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".