pub struct HostData {
pub class_id: ClassId,
pub class: Rc<ClassDef>,
pub opaque: Opaque,
}Expand description
One instance of a host class: the class id, the class, and the host’s payload.
Boxed inside ObjectKind because every ObjectKind is stored inline in the object
header: an unboxed Rc plus a pointer plus an id would widen every object in the
realm to no purpose.
Fields§
§class_id: ClassIdWhich class this is an instance of.
class: Rc<ClassDef>The class’s shared behaviour.
opaque: OpaqueThe host’s payload. See Opaque.
Trait Implementations§
Source§impl Drop for HostData
impl Drop for HostData
Source§fn drop(&mut self)
fn drop(&mut self)
The finalizer’s one and only call site.
HostData is owned by exactly one ObjectKind, which is owned by exactly one
ObjectData, so this runs exactly once — when the last strong reference goes away
or when the cycle collector reclaims an unreachable object, which is the same two
moments the reference implementation runs JSClassDef::finalizer.
Auto Trait Implementations§
impl !RefUnwindSafe for HostData
impl !Send for HostData
impl !Sync for HostData
impl !UnwindSafe for HostData
impl Forget for HostData
impl Freeze for HostData
impl Move for HostData
impl Unpin for HostData
impl UnsafeUnpin for HostDatawhere
*const RcInner<ClassDef> is !null: UnsafeUnpin,
PhantomData<RcInner<ClassDef>>: UnsafeUnpin,
*mut (): UnsafeUnpin,
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