pub struct NativeObjectBox { /* private fields */ }Expand description
A type-erased wrapper around Box<dyn NativeObject>.
This is what GcPtr actually points to inside Value::NativeObject.
The wrapper exists because GcPtr<dyn NativeObject> would require
unsized coercions; a concrete struct is simpler.
Implementations§
Source§impl NativeObjectBox
impl NativeObjectBox
Sourcepub fn new(obj: impl NativeObject) -> Self
pub fn new(obj: impl NativeObject) -> Self
Wrap a concrete NativeObject implementor.
Sourcepub fn downcast_ref<T: NativeObject>(&self) -> Option<&T>
pub fn downcast_ref<T: NativeObject>(&self) -> Option<&T>
Downcast to a concrete type.
Sourcepub fn inner(&self) -> &dyn NativeObject
pub fn inner(&self) -> &dyn NativeObject
Access the inner trait object.
Trait Implementations§
Source§impl Debug for NativeObjectBox
impl Debug for NativeObjectBox
Source§impl Trace for NativeObjectBox
impl Trace for NativeObjectBox
fn trace(&self, visitor: &mut MarkVisitor)
fn gc_size_extra(&self) -> usize
Auto Trait Implementations§
impl !RefUnwindSafe for NativeObjectBox
impl !Send for NativeObjectBox
impl !Sync for NativeObjectBox
impl !UnwindSafe for NativeObjectBox
impl Freeze for NativeObjectBox
impl Unpin for NativeObjectBox
impl UnsafeUnpin for NativeObjectBox
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