diff options
Diffstat (limited to 'serde_v8/magic')
-rw-r--r-- | serde_v8/magic/buffer.rs | 6 | ||||
-rw-r--r-- | serde_v8/magic/bytestring.rs | 2 | ||||
-rw-r--r-- | serde_v8/magic/detached_buffer.rs | 2 | ||||
-rw-r--r-- | serde_v8/magic/global.rs | 2 | ||||
-rw-r--r-- | serde_v8/magic/string_or_buffer.rs | 2 | ||||
-rw-r--r-- | serde_v8/magic/transl8.rs | 4 | ||||
-rw-r--r-- | serde_v8/magic/u16string.rs | 2 | ||||
-rw-r--r-- | serde_v8/magic/value.rs | 2 |
8 files changed, 12 insertions, 10 deletions
diff --git a/serde_v8/magic/buffer.rs b/serde_v8/magic/buffer.rs index db50e3896..eec027e17 100644 --- a/serde_v8/magic/buffer.rs +++ b/serde_v8/magic/buffer.rs @@ -103,7 +103,7 @@ impl From<Vec<u8>> for ZeroCopyBuf { impl ToV8 for ZeroCopyBuf { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { let buf: Box<[u8]> = match self { @@ -112,7 +112,9 @@ impl ToV8 for ZeroCopyBuf { value.into() } Self::Temp(_) => unreachable!(), - Self::ToV8(x) => x.lock().unwrap().take().expect("ZeroCopyBuf was empty"), + Self::ToV8(x) => { + x.get_mut().unwrap().take().expect("ZeroCopyBuf was empty") + } }; if buf.is_empty() { diff --git a/serde_v8/magic/bytestring.rs b/serde_v8/magic/bytestring.rs index 5580fdced..ebf96031f 100644 --- a/serde_v8/magic/bytestring.rs +++ b/serde_v8/magic/bytestring.rs @@ -32,7 +32,7 @@ const _: () = impl ToV8 for ByteString { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { let v = diff --git a/serde_v8/magic/detached_buffer.rs b/serde_v8/magic/detached_buffer.rs index 4e33de32c..b35d4f66d 100644 --- a/serde_v8/magic/detached_buffer.rs +++ b/serde_v8/magic/detached_buffer.rs @@ -41,7 +41,7 @@ impl DerefMut for DetachedBuffer { impl ToV8 for DetachedBuffer { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { let buffer = v8::ArrayBuffer::with_backing_store(scope, &self.0.store); diff --git a/serde_v8/magic/global.rs b/serde_v8/magic/global.rs index 942394067..4f7b70fdf 100644 --- a/serde_v8/magic/global.rs +++ b/serde_v8/magic/global.rs @@ -23,7 +23,7 @@ impl From<Global> for v8::Global<v8::Value> { impl ToV8 for Global { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { Ok(v8::Local::new(scope, self.v8_value.clone())) diff --git a/serde_v8/magic/string_or_buffer.rs b/serde_v8/magic/string_or_buffer.rs index 78954e60c..aa7e26d2b 100644 --- a/serde_v8/magic/string_or_buffer.rs +++ b/serde_v8/magic/string_or_buffer.rs @@ -25,7 +25,7 @@ impl Deref for StringOrBuffer { impl ToV8 for StringOrBuffer { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { match self { diff --git a/serde_v8/magic/transl8.rs b/serde_v8/magic/transl8.rs index 2336b5b27..9beb9eade 100644 --- a/serde_v8/magic/transl8.rs +++ b/serde_v8/magic/transl8.rs @@ -14,7 +14,7 @@ pub(crate) trait MagicType { pub(crate) trait ToV8 { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error>; } @@ -104,7 +104,7 @@ pub(crate) unsafe fn opaque_recv<T: ?Sized>(ptr: &T) -> u64 { } /// Transmutes an "opaque" ptr back into a reference -pub(crate) unsafe fn opaque_deref<'a, T>(ptr: u64) -> &'a T { +pub(crate) unsafe fn opaque_deref_mut<'a, T>(ptr: u64) -> &'a mut T { std::mem::transmute(ptr as usize) } diff --git a/serde_v8/magic/u16string.rs b/serde_v8/magic/u16string.rs index 1e36879a4..22868ccfb 100644 --- a/serde_v8/magic/u16string.rs +++ b/serde_v8/magic/u16string.rs @@ -8,7 +8,7 @@ impl_magic!(U16String); impl ToV8 for U16String { fn to_v8<'a>( - &self, + &mut self, scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { let maybe_v = diff --git a/serde_v8/magic/value.rs b/serde_v8/magic/value.rs index 5d844fbda..651e75263 100644 --- a/serde_v8/magic/value.rs +++ b/serde_v8/magic/value.rs @@ -29,7 +29,7 @@ impl<'s> From<Value<'s>> for v8::Local<'s, v8::Value> { impl ToV8 for Value<'_> { fn to_v8<'a>( - &self, + &mut self, _scope: &mut v8::HandleScope<'a>, ) -> Result<v8::Local<'a, v8::Value>, crate::Error> { // SAFETY: not fully safe, since lifetimes are detached from original scope |