pub struct ObjectGcGuard(/* private fields */);Expand description
RAII style guard that ensures that an object survives the GC Useful for native function that allocate multiple objects, potentially triggering GC
Implementations§
Source§impl ObjectGcGuard
impl ObjectGcGuard
pub fn new(obj: NonNull<CaoLangObject>) -> Self
pub fn into_inner(self) -> NonNull<CaoLangObject>
Methods from Deref<Target = CaoLangObject>§
pub fn type_name(&self) -> &'static str
pub fn as_table(&self) -> Option<&CaoLangTable>
pub fn as_table_mut(&mut self) -> Option<&mut CaoLangTable>
pub fn as_str(&self) -> Option<&str>
pub fn as_function(&self) -> Option<&CaoLangFunction>
pub fn as_closure(&self) -> Option<&CaoLangClosure>
pub fn as_upvalue(&self) -> Option<&CaoLangUpvalue>
pub fn as_upvalue_mut(&mut self) -> Option<&mut CaoLangUpvalue>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Deref for ObjectGcGuard
impl Deref for ObjectGcGuard
Source§impl DerefMut for ObjectGcGuard
impl DerefMut for ObjectGcGuard
Source§impl Drop for ObjectGcGuard
impl Drop for ObjectGcGuard
Source§impl From<ObjectGcGuard> for Value
impl From<ObjectGcGuard> for Value
Source§fn from(value: ObjectGcGuard) -> Self
fn from(value: ObjectGcGuard) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ObjectGcGuard
impl !RefUnwindSafe for ObjectGcGuard
impl !Send for ObjectGcGuard
impl !Sync for ObjectGcGuard
impl Unpin for ObjectGcGuard
impl !UnwindSafe for ObjectGcGuard
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