pub enum TableKey {
ERROR,
UndefinedNumber(u32),
UndefinedString(SmolStr),
Simple(Token),
Expression(Bracketed<Pointer<Expression>>),
Type(Bracketed<Pointer<TypeValue>>),
}Expand description
A possible key entry in a table. The key is usually a string, but it can be a value (from an expression) in tables or a type in type definitions.
local t = {
-- The normal string key.
foo = "foo",
-- A Value key, it's still a string, but what's inside [] is
-- always counted as an expression, even if simple.
["bar"] = "bar",
}
type T = {
-- The normal string key.
foo: "foo",
-- A Type key, it indicates that the key can be any string, not the word "string".
[string]: number,
}Variants§
ERROR
This TableKey had a syntax error.
UndefinedNumber(u32)
Cases in which a key in a table expression wasn’t provided, it’s guessed as a number in that case.
UndefinedString(SmolStr)
Cases in which a key in a type expression wasn’t provided,
it’s guessed as number. It has no other possible values
than number.
Simple(Token)
Simple key
Expression(Bracketed<Pointer<Expression>>)
An expression, can only be used in definitions and not in types.
Type(Bracketed<Pointer<TypeValue>>)
A type definition, can only be used in other types and not definitions.
Trait Implementations§
Source§impl Ord for TableKey
impl Ord for TableKey
Source§impl Parse<TableAccessKey> for TableKey
impl Parse<TableAccessKey> for TableKey
Source§impl ParseWithArgs<bool> for TableKey
impl ParseWithArgs<bool> for TableKey
Source§impl PartialOrd for TableKey
impl PartialOrd for TableKey
Source§impl Print for TableKey
impl Print for TableKey
Source§fn print_final_trivia(&self) -> String
fn print_final_trivia(&self) -> String
Prints only the very final trivia. Used for the default implementation of
Print::print, which just joins Print::print_without_final_trivia
and this function.Source§fn print_without_final_trivia(&self) -> String
fn print_without_final_trivia(&self) -> String
Prints the whole token including all surrounding trivia, excluding the
very last trailing trivia.
Source§impl TryParse<TableAccessKey> for TableKey
impl TryParse<TableAccessKey> for TableKey
impl Eq for TableKey
impl StructuralPartialEq for TableKey
Auto Trait Implementations§
impl Freeze for TableKey
impl RefUnwindSafe for TableKey
impl !Send for TableKey
impl !Sync for TableKey
impl Unpin for TableKey
impl UnwindSafe for TableKey
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