pub enum Literal {
Null,
String(String),
Number(String),
Boolean(bool),
RegEx(RegEx),
Template(TemplateLiteral),
}
Expand description
A literal value
Variants
Null
null
String(String)
"string"
'string'
Number(String)
0
0.0
.0
0.0e1
.0E1
0xf
0o7
0b1
Boolean(bool)
true
false
RegEx(RegEx)
/.+/g
Template(TemplateLiteral)
`I have ${0} apples`
Implementations
sourceimpl Literal
impl Literal
pub fn from_token(token: &Token) -> Option<Self>
pub fn string(string: &str) -> Self
pub fn number(num: &str) -> Self
pub fn regex(pattern: &str, flags: &str) -> Self
pub fn is_valid_property_key(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_boolean(&self) -> bool
Trait Implementations
impl StructuralPartialEq for Literal
Auto Trait Implementations
impl RefUnwindSafe for Literal
impl Send for Literal
impl Sync for Literal
impl Unpin for Literal
impl UnwindSafe for Literal
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more