Skip to main content

JsFnOutput

Trait JsFnOutput 

pub trait JsFnOutput<M>: Send + 'static {
    // Required method
    fn into_js_fn_output(self) -> Result<JsValue, JsError>;
}
Available on crate features js and std only.
Expand description

A value a host function can return: either a plain value convertible Into<JsValue>, or a Result thereof with an error convertible Into<JsError> (thrown inside the script).

The M parameter is an inference marker; ignore it.

Required Methods§

fn into_js_fn_output(self) -> Result<JsValue, JsError>

Convert into the raw host function output.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl<T, E> JsFnOutput<ResultOutput> for Result<T, E>
where T: Into<JsValue> + Send + 'static, E: Into<JsError> + Send + 'static,

§

impl<T> JsFnOutput<SerdeOutput> for Serde<T>
where T: Serialize + Send + 'static,

§

impl<T> JsFnOutput<ValueOutput> for T
where T: Into<JsValue> + Send + 'static,