pub struct Closure { /* private fields */ }Expand description
Non-owning identity of a VM closure record.
§Safety model for unsafe methods
The closure and referenced environment, proto, upvalues, and GC objects must remain live in the same VM. The native/Luau variant and every index must match the allocated closure layout.
Implementations§
Source§impl Closure
impl Closure
pub const unsafe fn from_raw(raw: NonNull<RawClosure>) -> Self
pub fn size_native_closure(n: usize) -> usize
pub fn size_lua_closure(n: usize) -> usize
pub unsafe fn is_native(&self) -> bool
pub unsafe fn is_lua(&self) -> bool
pub unsafe fn proto(&self) -> Option<Proto>
pub unsafe fn env(&self) -> Table
pub unsafe fn gc_list(&self) -> Option<GcObject>
pub unsafe fn set_gc_list(&self, gc_list: Option<GcObject>)
pub unsafe fn set_env(&self, env: Table)
pub unsafe fn native_data(&self) -> RawNativeClosure
pub unsafe fn native_data_ptr(&self) -> *mut RawNativeClosure
pub unsafe fn set_native_data(&self, data: RawNativeClosure)
pub unsafe fn native_debug_name(&self) -> Option<LuaString>
pub unsafe fn lua_data(&self) -> RawLuaClosure
pub unsafe fn lua_data_ptr(&self) -> *mut RawLuaClosure
pub unsafe fn set_lua_proto(&self, proto: Proto)
pub unsafe fn native_upvalue(&self, index: usize) -> TValue
pub unsafe fn native_upvalues(&self) -> TValueCursor
pub unsafe fn lua_upvalue_ref(&self, index: usize) -> TValue
pub unsafe fn lua_upvalue_refs(&self) -> TValueCursor
Trait Implementations§
impl Copy for Closure
impl Eq for Closure
impl StructuralPartialEq for Closure
Auto Trait Implementations§
impl !Send for Closure
impl !Sync for Closure
impl Freeze for Closure
impl RefUnwindSafe for Closure
impl Unpin for Closure
impl UnsafeUnpin for Closure
impl UnwindSafe for Closure
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