Skip to main content

ClosureFunction

Trait ClosureFunction 

Source
pub trait ClosureFunction:
    Fn(&JsValue, &[JsValue], &mut Context, Captures) -> JsResult<JsValue>
    + DynCopy
    + DynClone
    + 'static { }
Expand description

Trait representing a native built-in closure.

Closures need to have this signature in order to be callable from Javascript, but most of the time the compiler is smart enough to correctly infer the types.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> ClosureFunction for T
where T: Fn(&JsValue, &[JsValue], &mut Context, Captures) -> JsResult<JsValue> + Copy + 'static,