pub struct ThreadSafeJsValue<T> { /* private fields */ }
Expand description
A wrapper around a value that is intended to be passed between threads.
The main use is to wrap JsValue based objects that are not Send or Sync. There is a small overhead to check if the value is on the current thread.
Implementations§
Source§impl<T> ThreadSafeJsValue<T>
impl<T> ThreadSafeJsValue<T>
Trait Implementations§
Source§impl<T> Clone for ThreadSafeJsValue<T>where
T: Clone,
impl<T> Clone for ThreadSafeJsValue<T>where
T: Clone,
Source§impl<T> Debug for ThreadSafeJsValue<T>where
T: Debug,
impl<T> Debug for ThreadSafeJsValue<T>where
T: Debug,
Source§impl<T> Deref for ThreadSafeJsValue<T>
impl<T> Deref for ThreadSafeJsValue<T>
Source§impl<T> DerefMut for ThreadSafeJsValue<T>
impl<T> DerefMut for ThreadSafeJsValue<T>
Source§impl<T> Display for ThreadSafeJsValue<T>where
T: Display,
impl<T> Display for ThreadSafeJsValue<T>where
T: Display,
Source§impl<T> Drop for ThreadSafeJsValue<T>
impl<T> Drop for ThreadSafeJsValue<T>
Source§impl<T> Hash for ThreadSafeJsValue<T>where
T: Hash,
impl<T> Hash for ThreadSafeJsValue<T>where
T: Hash,
Source§impl<T> Ord for ThreadSafeJsValue<T>where
T: Ord,
impl<T> Ord for ThreadSafeJsValue<T>where
T: Ord,
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Compares the value for ordering.
§Panics
Panics if the ThreadSafeJsValue is not valid for the current thread.
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq for ThreadSafeJsValue<T>where
T: PartialEq,
impl<T> PartialEq for ThreadSafeJsValue<T>where
T: PartialEq,
Source§impl<T> PartialOrd for ThreadSafeJsValue<T>where
T: PartialOrd,
impl<T> PartialOrd for ThreadSafeJsValue<T>where
T: PartialOrd,
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Compares the value for ordering.
§Panics
Panics if the ThreadSafeJsValue is not valid for the current thread.
impl<T> Eq for ThreadSafeJsValue<T>where
T: Eq,
impl<T> Send for ThreadSafeJsValue<T>
§Safety
We assert that the thread_id is the same as the current thread_id when we dereference the value.
impl<T> Sync for ThreadSafeJsValue<T>
§Safety
We assert that the thread_id is the same as the current thread_id when we dereference the value.
Auto Trait Implementations§
impl<T> Freeze for ThreadSafeJsValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for ThreadSafeJsValue<T>where
T: RefUnwindSafe,
impl<T> Unpin for ThreadSafeJsValue<T>where
T: Unpin,
impl<T> UnwindSafe for ThreadSafeJsValue<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.