pub struct LiteralTable { /* private fields */ }Expand description
A literal table in Luau.
Table literals follow the syntax { entry1, entry2, key = value }.
Implementations§
Source§impl LiteralTable
impl LiteralTable
Sourcepub fn from_entries(entries: Vec<LiteralTableEntry>) -> Self
pub fn from_entries(entries: Vec<LiteralTableEntry>) -> Self
Creates a new literal table from a vector of entries.
Sourcepub fn with_entry(self, entry: impl Into<LiteralTableEntry>) -> Self
pub fn with_entry(self, entry: impl Into<LiteralTableEntry>) -> Self
Adds an entry to this table.
Sourcepub fn append_entry(&mut self, entry: impl Into<LiteralTableEntry>)
pub fn append_entry(&mut self, entry: impl Into<LiteralTableEntry>)
Appends an entry to this table.
Sourcepub fn append_field(
&mut self,
field: Identifier,
value: impl Into<LiteralExpression>,
)
pub fn append_field( &mut self, field: Identifier, value: impl Into<LiteralExpression>, )
Appends a field entry to this table.
Sourcepub fn append_array_value(&mut self, value: impl Into<LiteralExpression>)
pub fn append_array_value(&mut self, value: impl Into<LiteralExpression>)
Appends an array value entry to this table.
Sourcepub fn iter_entries(&self) -> impl Iterator<Item = &LiteralTableEntry>
pub fn iter_entries(&self) -> impl Iterator<Item = &LiteralTableEntry>
Returns an iterator over the table entries.
Sourcepub fn iter_mut_entries(
&mut self,
) -> impl Iterator<Item = &mut LiteralTableEntry>
pub fn iter_mut_entries( &mut self, ) -> impl Iterator<Item = &mut LiteralTableEntry>
Returns a mutable iterator over the table entries.
Sourcepub fn with_tokens(self, tokens: TableTokens) -> Self
pub fn with_tokens(self, tokens: TableTokens) -> Self
Attaches tokens to this table.
Sourcepub fn set_tokens(&mut self, tokens: TableTokens)
pub fn set_tokens(&mut self, tokens: TableTokens)
Sets the tokens for this table.
Sourcepub fn get_tokens(&self) -> Option<&TableTokens>
pub fn get_tokens(&self) -> Option<&TableTokens>
Returns the tokens for this table, if any.
Sourcepub fn clear_comments(&mut self)
pub fn clear_comments(&mut self)
Clears all comments from the tokens in this node.
Sourcepub fn clear_whitespaces(&mut self)
pub fn clear_whitespaces(&mut self)
Clears all whitespaces information from the tokens in this node.
Trait Implementations§
Source§impl Clone for LiteralTable
impl Clone for LiteralTable
Source§fn clone(&self) -> LiteralTable
fn clone(&self) -> LiteralTable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LiteralTable
impl Debug for LiteralTable
Source§impl Default for LiteralTable
impl Default for LiteralTable
Source§fn default() -> LiteralTable
fn default() -> LiteralTable
Returns the “default value” for a type. Read more
Source§impl From<LiteralTable> for AttributeArguments
impl From<LiteralTable> for AttributeArguments
Source§fn from(v: LiteralTable) -> Self
fn from(v: LiteralTable) -> Self
Converts to this type from the input type.
Source§impl From<LiteralTable> for LiteralExpression
impl From<LiteralTable> for LiteralExpression
Source§fn from(v: LiteralTable) -> Self
fn from(v: LiteralTable) -> Self
Converts to this type from the input type.
Source§impl From<LiteralTable> for TableExpression
impl From<LiteralTable> for TableExpression
Source§fn from(literal_table: LiteralTable) -> Self
fn from(literal_table: LiteralTable) -> Self
Converts to this type from the input type.
Source§impl PartialEq for LiteralTable
impl PartialEq for LiteralTable
impl Eq for LiteralTable
impl StructuralPartialEq for LiteralTable
Auto Trait Implementations§
impl Freeze for LiteralTable
impl RefUnwindSafe for LiteralTable
impl Send for LiteralTable
impl Sync for LiteralTable
impl Unpin for LiteralTable
impl UnsafeUnpin for LiteralTable
impl UnwindSafe for LiteralTable
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more