pub struct Table<'gc>(pub Gc<'gc, RefLock<TableState<'gc>>>);Tuple Fields§
§0: Gc<'gc, RefLock<TableState<'gc>>>Implementations§
Source§impl<'gc> Table<'gc>
impl<'gc> Table<'gc>
pub fn new(mc: &Mutation<'gc>) -> Self
pub fn from(mc: &Mutation<'gc>, table_state: TableState<'gc>) -> Self
pub fn get<K: IntoValue<'gc>>(&self, ctx: Context<'gc>, key: K) -> Value<'gc>
pub fn get_index(&self, index: usize) -> Option<(Value<'gc>, Value<'gc>)>
pub fn set<K: IntoValue<'gc>, V: IntoValue<'gc>>( &self, ctx: Context<'gc>, key: K, value: V, )
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn metatable(&self) -> Option<Table<'gc>>
pub fn set_metatable( &self, mc: &Mutation<'gc>, metatable: Option<Table<'gc>>, ) -> Option<Table<'gc>>
Trait Implementations§
Source§impl<'gc> Collect for Table<'gc>
impl<'gc> Collect for Table<'gc>
Source§fn needs_trace() -> bool
fn needs_trace() -> bool
As an optimization, if this type can never hold a
Gc pointer and trace is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace must be called.Source§fn trace(&self, cc: &Collection)
fn trace(&self, cc: &Collection)
Must call
Collect::trace on all held Gc pointers. If this type holds inner types that
implement Collect, a valid implementation would simply call Collect::trace on all the
held values to ensure this.Source§impl<'gc> Stashable<'gc> for Table<'gc>
impl<'gc> Stashable<'gc> for Table<'gc>
type Stashed = StaticTable
fn stash(self, roots: &DynamicRootSet<'gc>, mc: &Mutation<'gc>) -> Self::Stashed
impl<'gc> Copy for Table<'gc>
impl<'gc> Eq for Table<'gc>
Auto Trait Implementations§
impl<'gc> Freeze for Table<'gc>
impl<'gc> !RefUnwindSafe for Table<'gc>
impl<'gc> !Send for Table<'gc>
impl<'gc> !Sync for Table<'gc>
impl<'gc> Unpin for Table<'gc>
impl<'gc> !UnwindSafe for Table<'gc>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.