Skip to main content

Table

Struct Table 

Source
pub struct Table { /* private fields */ }
Expand description

Non-owning identity of a VM table record.

§Safety model for unsafe methods

The table and referenced storage must remain live in its owning VM. Keys, values, nodes, and indices must match the current allocation; resize or free operations invalidate derived cursors and views. Mutation must preserve hashing, readonly, metatable-cache, and GC barrier invariants.

Implementations§

Source§

impl Table

Source

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

Source

pub unsafe fn node(&self, index: i32) -> LuaNode

Source

pub unsafe fn node_mut(&mut self, index: i32) -> LuaNode

Source

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

Source

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

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 invalidate_tm_cache(&self)

Source

pub unsafe fn set_node(&self, node_cursor: LuaNodeCursor)

Source

pub unsafe fn set_array(&self, array_cursor: TValueCursor)

Source

pub unsafe fn has_dummy_node(&self) -> bool

Source

pub unsafe fn node_index(&self, node_cursor: LuaNodeCursor) -> i32

Source

pub unsafe fn value_slot_unchecked(&self, value: TValue) -> i32

gval2slot

§Safety

value must be a value pointer produced by luaH_get or luaH_setslot for this table.

Source

pub unsafe fn node_cursor(&self) -> LuaNodeCursor

Source

pub unsafe fn array_cursor(&self) -> TValueCursor

Source

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

Source

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

Source

pub unsafe fn node_count(&self) -> usize

Source

pub unsafe fn hash_mask(&self) -> usize

Source

pub unsafe fn node_mask_8(&self) -> usize

Source

pub unsafe fn array_storage_size(&self) -> usize

Source

pub unsafe fn node_storage_size(&self) -> usize

Source

pub unsafe fn allocation_size(&self) -> usize

Source

pub unsafe fn gc_work_size(&self, count_dummy_node: bool) -> usize

Source

pub unsafe fn init_empty_storage(&self)

Source

pub unsafe fn free_storage(&self, thread: &Thread)

Source

pub unsafe fn maybe_set_aboundary(&self, value: i32)

Source

pub unsafe fn get_aboundary(&self) -> i32

Source§

impl Table

Source

pub fn dummy_node_cursor() -> LuaNodeCursor

Source

pub fn dummy_node() -> LuaNode

Source

pub fn dummy_node_ptr() -> *mut RawLuaNode

Source

pub fn array_index(key: f64) -> Option<i32>

arrayindex

Source

pub unsafe fn main_position(&self, key: TValue) -> LuaNodeCursor

mainposition

Source

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

Source

pub unsafe fn get_str_node(self, key: TString) -> Option<LuaNodeCursor>

Source§

impl Table

Source

pub unsafe fn get_num(&self, key: i32) -> TValue

luaH_getnum

Source

pub unsafe fn get_str(&self, key: TString) -> TValue

luaH_getstr

Source

pub unsafe fn get(&self, key: TValue) -> TValue

luaH_get

Source

pub unsafe fn getp(&self, key: *mut (), tag: i32) -> TValue

luaH_getp

Source

pub unsafe fn getn(self) -> i32

luaH_getn

Source

pub unsafe fn get_tm( &self, event: TmEvent, event_name: TString, ) -> Option<TValue>

luaT_gettm

Source§

impl Table

Source

pub unsafe fn clear(&self)

luaH_clear

§Safety

The table must be a live record owned by the active VM and exclusively mutable for the duration of the call. Any outstanding element or node cursors must not be used after their slots are cleared.

Trait Implementations§

Source§

impl AsRef<Table> for Table

Source§

fn as_ref(&self) -> &Table

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

impl Clone for Table

Source§

fn clone(&self) -> Table

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 Table

Source§

impl Eq for Table

Source§

impl From<Table> for GcObject

Source§

fn from(value: Table) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Table

Source§

fn eq(&self, other: &Table) -> 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 Table

Source§

type Raw = RawLuaTable

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 Table

Auto Trait Implementations§

§

impl !Send for Table

§

impl !Sync for Table

§

impl Freeze for Table

§

impl RefUnwindSafe for Table

§

impl Unpin for Table

§

impl UnsafeUnpin for Table

§

impl UnwindSafe for Table

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.