Browse Source

Add support for Trace, Finalize and JsData for Convert<> (#3970)

pull/3991/head
Hans Larsen 2 months ago committed by GitHub
parent
commit
4778780073
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      core/engine/src/value/conversions/convert.rs

5
core/engine/src/value/conversions/convert.rs

@ -7,9 +7,10 @@
//! if necessary). //! if necessary).
use boa_engine::JsNativeError; use boa_engine::JsNativeError;
use boa_gc::{Finalize, Trace};
use crate::value::TryFromJs; use crate::value::TryFromJs;
use crate::{Context, JsResult, JsString, JsValue}; use crate::{Context, JsData, JsResult, JsString, JsValue};
/// A wrapper type that allows converting a `JsValue` to a specific type. /// A wrapper type that allows converting a `JsValue` to a specific type.
/// This is useful when you want to convert a `JsValue` to a Rust type. /// This is useful when you want to convert a `JsValue` to a Rust type.
@ -42,7 +43,7 @@ use crate::{Context, JsResult, JsString, JsValue};
/// assert_eq!(conv5, true); /// assert_eq!(conv5, true);
/// assert_eq!(conv_nan, false); /// assert_eq!(conv_nan, false);
/// ``` /// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq, Trace, Finalize, JsData)]
pub struct Convert<T: TryFromJs>(pub T); pub struct Convert<T: TryFromJs>(pub T);
impl<T: TryFromJs> From<T> for Convert<T> { impl<T: TryFromJs> From<T> for Convert<T> {

Loading…
Cancel
Save