Struct WeakMap

#[repr(transparent)]
pub struct WeakMap<K = Object, V = JsValue> { /* private fields */ }

Implementations

impl WeakMap

fn new() -> WeakMap

The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced. The keys must be objects and the values can be arbitrary values.

Note: Consider using WeakMap::new_typed to support typing.

MDN documentation

impl<K, V> WeakMap<K, V>

fn get_checked(&self, key: &K) -> Option<V>
where
    K: ErasableGenericBorrow<JsValue>,
    Option<V>: ErasableGenericOwn<Option<JsValue>>,

The get() method returns a specified by key element from a WeakMap object. Returns None if the key is not found.

MDN documentation

impl<K, V> WeakMap<K, V>

fn set(&self, key: &K, value: &V) -> WeakMap<K, V>
where
    K: ErasableGenericBorrow<JsValue>,
    V: ErasableGenericBorrow<JsValue>,
    WeakMap<K, V>: ErasableGenericOwn<WeakMap<JsValue, JsValue>>,

The set() method sets the value for the key in the WeakMap object. Returns the WeakMap object.

MDN documentation

impl<K, V> WeakMap<K, V>

fn get(&self, key: &K) -> V
where
    K: ErasableGenericBorrow<JsValue>,
    V: ErasableGenericOwn<JsValue>,

The get() method returns a specified by key element from a WeakMap object. Returns undefined if the key is not found.

Note: Consider using WeakMap::get_checked to get an Option<V> instead.

MDN documentation

impl<K, V> WeakMap<K, V>

fn has(&self, key: &K) -> bool
where
    K: ErasableGenericBorrow<JsValue>,

The has() method returns a boolean indicating whether an element with the specified key exists in the WeakMap object or not.

MDN documentation

impl<K, V> WeakMap<K, V>

fn delete(&self, key: &K) -> bool
where
    K: ErasableGenericBorrow<JsValue>,

The delete() method removes the specified element from a WeakMap object.

MDN documentation

impl<K, V> WeakMap<K, V> where K: JsGeneric, V: JsGeneric,

fn new_typed() -> WeakMap<K, V>
where
    WeakMap<K, V>: ErasableGenericOwn<WeakMap<Object, Object>>,

The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced. The keys must be objects and the values can be arbitrary values.

MDN documentation

Trait Implementations

impl Default for WeakMap

fn default() -> Self

impl From<JsValue> for WeakMap

fn from(obj: JsValue) -> Self

impl<K, V> AsRef<JsValue> for WeakMap<K, V>

fn as_ref(&self) -> &JsValue

impl<K, V> AsRef<Object> for WeakMap<K, V>

fn as_ref(&self) -> &Object

impl<K, V> AsRef<WeakMap<K, V>> for WeakMap<K, V>

fn as_ref(&self) -> &WeakMap<K, V>

impl<K, V> Deref for WeakMap<K, V>

type Target = Object;
fn deref(&self) -> &Object

impl<K, V> ErasableGeneric for WeakMap<K, V>

type Repr = JsValue;

impl<K, V> FromWasmAbi for WeakMap<K, V>

type Abi = <JsValue as FromWasmAbi>::Abi;
unsafe fn from_abi(js: Self::Abi) -> Self

impl<K, V> IntoJsGeneric for WeakMap<K, V> where WeakMap<K, V>: JsGeneric,

type JsCanon = WeakMap<K, V>;
fn to_js(self) -> WeakMap<K, V>

impl<K, V> IntoWasmAbi for WeakMap<K, V>

type Abi = <JsValue as IntoWasmAbi>::Abi;
fn into_abi(self) -> Self::Abi

impl<K, V> JsCast for WeakMap<K, V>

fn instanceof(val: &JsValue) -> bool
fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self

impl<K, V> LongRefFromWasmAbi for WeakMap<K, V>

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = WeakMap<K, V>;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl<K, V> OptionFromWasmAbi for WeakMap<K, V>

fn is_none(abi: &Self::Abi) -> bool

impl<K, V> OptionIntoWasmAbi for WeakMap<K, V>

fn none() -> Self::Abi

impl<K, V> Promising for WeakMap<K, V>

type Resolution = WeakMap<K, V>;

impl<K, V> RefFromWasmAbi for WeakMap<K, V>

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<WeakMap<K, V>>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl<K, V> WasmDescribe for WeakMap<K, V>

fn describe()

impl<K, V, __UpcastTarget0, __UpcastTarget1> UpcastFrom<WeakMap<K, V>> for WeakMap<__UpcastTarget0, __UpcastTarget1> where __UpcastTarget0: UpcastFrom<K>, __UpcastTarget1: UpcastFrom<V>,

impl<K: Clone, V: Clone> Clone for WeakMap<K, V>

fn clone(&self) -> Self

impl<K: Debug, V: Debug> Debug for WeakMap<K, V>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<K: Eq, V: Eq> Eq for WeakMap<K, V>

impl<K: PartialEq, V: PartialEq> PartialEq for WeakMap<K, V>

fn eq(&self, other: &Self) -> bool

impl<K: PartialEq, V: PartialEq> StructuralPartialEq for WeakMap<K, V>

Auto Trait Implementations

impl<K, V> Freeze for WeakMap<K, V> where PhantomData<(K, V)>: Freeze,

impl<K, V> RefUnwindSafe for WeakMap<K, V> where PhantomData<(K, V)>: RefUnwindSafe,

impl<K, V> Send for WeakMap<K, V> where PhantomData<(K, V)>: Send,

impl<K, V> Sync for WeakMap<K, V> where PhantomData<(K, V)>: Sync,

impl<K, V> Unpin for WeakMap<K, V> where PhantomData<(K, V)>: Unpin,

impl<K, V> UnsafeUnpin for WeakMap<K, V> where PhantomData<(K, V)>: UnsafeUnpin,

impl<K, V> UnwindSafe for WeakMap<K, V> where PhantomData<(K, V)>: UnwindSafe,

Blanket Implementations

impl<P, T> Receiver for WeakMap<K, V> where P: Deref<Target = T> + ?Sized, T: ?Sized,

impl<S, T> Upcast<T> for WeakMap<K, V> where T: UpcastFrom<S> + ?Sized, S: ?Sized,

impl<T> Any for WeakMap<K, V> where T: 'static + ?Sized,

impl<T> Borrow<T> for WeakMap<K, V> where T: ?Sized,

impl<T> BorrowMut<T> for WeakMap<K, V> where T: ?Sized,

impl<T> CloneToUninit for WeakMap<K, V> where T: Clone,

impl<T> From<T> for WeakMap<K, V>

impl<T> JsGeneric for WeakMap<K, V> where T: ErasableGeneric<Repr = JsValue> + UpcastFrom<T> + Upcast<JsValue> + JsCast + 'static,

impl<T> ReturnWasmAbi for WeakMap<K, V> where T: IntoWasmAbi,

impl<T> ToOwned for WeakMap<K, V> where T: Clone,

impl<T> TryFromJsValue for WeakMap<K, V> where T: JsCast,

impl<T> VectorFromWasmAbi for WeakMap<K, V> where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for WeakMap<K, V> where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for WeakMap<K, V> where &'a T: for<'a> Into<JsValue>,

impl<T, U> Into<U> for WeakMap<K, V> where U: From<T>,

impl<T, U> TryFrom<U> for WeakMap<K, V> where U: Into<T>,

impl<T, U> TryInto<U> for WeakMap<K, V> where U: TryFrom<T>,