Browse Source

Add a clone_inner method to allow cloning of inner data (#3968)

* Add a clone_inner method to allow cloning of inner data

* oops

* Address comment
pull/3974/head
Hans Larsen 4 months ago committed by GitHub
parent
commit
c57f2310bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      core/interop/src/lib.rs

12
core/interop/src/lib.rs

@ -390,6 +390,18 @@ impl<T: NativeObject> JsClass<T> {
}
}
impl<T: NativeObject + Clone> JsClass<T> {
/// Clones the inner class instance.
///
/// # Panics
///
/// Panics if the inner object is currently borrowed mutably.
#[must_use]
pub fn clone_inner(&self) -> T {
self.inner.borrow().data().clone()
}
}
impl<'a, T: NativeObject + 'static> TryFromJsArgument<'a> for JsClass<T> {
fn try_from_js_argument(
this: &'a JsValue,

Loading…
Cancel
Save