Struct WeakRef

#[repr(transparent)]
pub struct WeakRef<T = Object> { /* private fields */ }

Implementations

impl<T> WeakRef<T>

fn new(target: &T) -> WeakRef<T>
where
    T: ErasableGenericBorrow<Object>,
    WeakRef<T>: ErasableGenericOwn<WeakRef<Object>>,

The WeakRef object contains a weak reference to an object. A weak reference to an object is a reference that does not prevent the object from being reclaimed by the garbage collector.

MDN documentation

impl<T> WeakRef<T>

fn deref(&self) -> Option<T>
where
    Option<T>: ErasableGenericOwn<Option<JsValue>>,

Returns the Object this WeakRef points to, or None if the object has been garbage collected.

MDN documentation

Trait Implementations

impl From<JsValue> for WeakRef

fn from(obj: JsValue) -> Self

impl<T> AsRef<JsValue> for WeakRef<T>

fn as_ref(&self) -> &JsValue

impl<T> AsRef<Object> for WeakRef<T>

fn as_ref(&self) -> &Object

impl<T> AsRef<WeakRef<T>> for WeakRef<T>

fn as_ref(&self) -> &WeakRef<T>

impl<T> Deref for WeakRef<T>

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

impl<T> ErasableGeneric for WeakRef<T>

type Repr = JsValue;

impl<T> FromWasmAbi for WeakRef<T>

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

impl<T> IntoJsGeneric for WeakRef<T> where WeakRef<T>: JsGeneric,

type JsCanon = WeakRef<T>;
fn to_js(self) -> WeakRef<T>

impl<T> IntoWasmAbi for WeakRef<T>

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

impl<T> JsCast for WeakRef<T>

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

impl<T> LongRefFromWasmAbi for WeakRef<T>

type Abi = <JsValue as LongRefFromWasmAbi>::Abi;
type Anchor = WeakRef<T>;
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor

impl<T> OptionFromWasmAbi for WeakRef<T>

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

impl<T> OptionIntoWasmAbi for WeakRef<T>

fn none() -> Self::Abi

impl<T> Promising for WeakRef<T>

type Resolution = WeakRef<T>;

impl<T> RefFromWasmAbi for WeakRef<T>

type Abi = <JsValue as RefFromWasmAbi>::Abi;
type Anchor = ManuallyDrop<WeakRef<T>>;
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

impl<T> WasmDescribe for WeakRef<T>

fn describe()

impl<T, __UpcastTarget0> UpcastFrom<WeakRef<T>> for WeakRef<__UpcastTarget0> where __UpcastTarget0: UpcastFrom<T>,

impl<T: Clone> Clone for WeakRef<T>

fn clone(&self) -> Self

impl<T: Debug> Debug for WeakRef<T>

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

impl<T: Eq> Eq for WeakRef<T>

impl<T: PartialEq> PartialEq for WeakRef<T>

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

impl<T: PartialEq> StructuralPartialEq for WeakRef<T>

Auto Trait Implementations

impl<T> Freeze for WeakRef<T> where PhantomData<(T,)>: Freeze,

impl<T> RefUnwindSafe for WeakRef<T> where PhantomData<(T,)>: RefUnwindSafe,

impl<T> Send for WeakRef<T> where PhantomData<(T,)>: Send,

impl<T> Sync for WeakRef<T> where PhantomData<(T,)>: Sync,

impl<T> Unpin for WeakRef<T> where PhantomData<(T,)>: Unpin,

impl<T> UnsafeUnpin for WeakRef<T> where PhantomData<(T,)>: UnsafeUnpin,

impl<T> UnwindSafe for WeakRef<T> where PhantomData<(T,)>: UnwindSafe,

Blanket Implementations

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

impl<S, T> Upcast<T> for WeakRef<T> where T: UpcastFrom<S> + ?Sized, S: ?Sized,

impl<T> Any for WeakRef<T> where T: 'static + ?Sized,

impl<T> Borrow<T> for WeakRef<T> where T: ?Sized,

impl<T> BorrowMut<T> for WeakRef<T> where T: ?Sized,

impl<T> CloneToUninit for WeakRef<T> where T: Clone,

impl<T> From<T> for WeakRef<T>

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

impl<T> ReturnWasmAbi for WeakRef<T> where T: IntoWasmAbi,

impl<T> ToOwned for WeakRef<T> where T: Clone,

impl<T> TryFromJsValue for WeakRef<T> where T: JsCast,

impl<T> VectorFromWasmAbi for WeakRef<T> where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorIntoWasmAbi for WeakRef<T> where T: ErasableGeneric<Repr = JsValue> + WasmDescribe,

impl<T> VectorRefIntoWasmAbi for WeakRef<T> where &'a T: for<'a> Into<JsValue>,

impl<T, U> Into<U> for WeakRef<T> where U: From<T>,

impl<T, U> TryFrom<U> for WeakRef<T> where U: Into<T>,

impl<T, U> TryInto<U> for WeakRef<T> where U: TryFrom<T>,