Skip to main content

Class

Struct Class 

Source
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

Source

pub const unsafe fn from_raw(raw: NonNull<RawLuauClass>) -> Self

Source

pub unsafe fn name(&self) -> TString

Source

pub unsafe fn members_to_offset(&self) -> Table

Source

pub unsafe fn offset_to_member(&self, index: usize) -> TString

Source

pub unsafe fn static_member(&self, index: usize) -> TValue

Source

pub fn static_member_count(&self) -> usize

Source

pub fn member_count(&self) -> usize

Source

pub unsafe fn allocation_size(&self) -> usize

Source

pub unsafe fn gc_list(&self) -> Option<GcObject>

Source

pub unsafe fn set_gc_list(&self, gc_list: Option<GcObject>)

Source

pub unsafe fn metatable(&self) -> Option<Table>

Source

pub unsafe fn set_metatable(&self, metatable: Option<Table>)

Source

pub unsafe fn instance_metatable(&self) -> Option<Table>

Source

pub unsafe fn set_instance_metatable(&self, metatable: Option<Table>)

Source

pub unsafe fn member_offset(&self, key: TValue) -> Option<u32>

Source

pub unsafe fn member_offset_str(&self, key: TString) -> Option<u32>

Source

pub unsafe fn lookup_static_member(&self, key: TValue) -> Option<TValue>

Source

pub unsafe fn add_class_member( &self, thread: &Thread, name: TString, method: TValue, ) -> VmErrorResult

luaR_addclassmember

Trait Implementations§

Source§

impl AsRef<Class> for Class

Source§

fn as_ref(&self) -> &Class

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Class

Source§

fn clone(&self) -> Class

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Class

Source§

impl Eq for Class

Source§

impl From<Class> for GcObject

Source§

fn from(value: Class) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Class

Source§

fn eq(&self, other: &Class) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl RawHandle for Class

Source§

type Raw = RawLuauClass

Raw VM record addressed by this handle.
Source§

fn as_ptr(&self) -> *mut Self::Raw

Returns the record address without dereferencing it.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.