superui_boa_engine 0.2.2

Fork of boa_engine (boa 0.21.1) vendored for superui so the boa_parser stack-growth patch is publishable; also carries a relaxed icu_normalizer pin. See docs/fork-patches.md. Upstream: https://github.com/boa-dev/boa
//! Declare implementations of [`TryIntoJsResult`] trait for various types.

use crate::value::TryIntoJs;
use crate::{Context, JsResult, JsValue, TryIntoJsResult};

impl<T> TryIntoJsResult for T
where
    T: TryIntoJs,
{
    fn try_into_js_result(self, ctx: &mut Context) -> JsResult<JsValue> {
        self.try_into_js(ctx)
    }
}

impl<T> TryIntoJsResult for JsResult<T>
where
    T: TryIntoJsResult,
{
    fn try_into_js_result(self, cx: &mut Context) -> JsResult<JsValue> {
        self.and_then(|value| value.try_into_js_result(cx))
    }
}