pub struct Class { /* private fields */ }Expand description
Non-owning identity of a VM class record.
§Safety model for unsafe methods
The class and every referenced handle must be live and belong to the same VM. Member indices and offsets must be in bounds. Mutation must preserve class layout, metatable cache, and GC barrier invariants.
Implementations§
Source§impl Class
impl Class
pub const unsafe fn from_raw(raw: NonNull<RawLuauClass>) -> Self
pub unsafe fn name(&self) -> TString
pub unsafe fn members_to_offset(&self) -> Table
pub unsafe fn offset_to_member(&self, index: usize) -> TString
pub unsafe fn static_member(&self, index: usize) -> TValue
pub fn static_member_count(&self) -> usize
pub fn member_count(&self) -> usize
pub unsafe fn allocation_size(&self) -> usize
pub unsafe fn gc_list(&self) -> Option<GcObject>
pub unsafe fn set_gc_list(&self, gc_list: Option<GcObject>)
pub unsafe fn metatable(&self) -> Option<Table>
pub unsafe fn set_metatable(&self, metatable: Option<Table>)
pub unsafe fn instance_metatable(&self) -> Option<Table>
pub unsafe fn set_instance_metatable(&self, metatable: Option<Table>)
pub unsafe fn member_offset(&self, key: TValue) -> Option<u32>
pub unsafe fn member_offset_str(&self, key: TString) -> Option<u32>
pub unsafe fn lookup_static_member(&self, key: TValue) -> Option<TValue>
Sourcepub unsafe fn add_class_member(
&self,
thread: &Thread,
name: TString,
method: TValue,
) -> VmErrorResult
pub unsafe fn add_class_member( &self, thread: &Thread, name: TString, method: TValue, ) -> VmErrorResult
luaR_addclassmember
Trait Implementations§
impl Copy for Class
impl Eq for Class
impl StructuralPartialEq for Class
Auto Trait Implementations§
impl !Send for Class
impl !Sync for Class
impl Freeze for Class
impl RefUnwindSafe for Class
impl Unpin for Class
impl UnsafeUnpin for Class
impl UnwindSafe for Class
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