pub enum LiteralNode {
String(String),
Number(i32),
Float(String),
Boolean(bool),
}
Expand description
Represents a type of literal.
Variants§
String(String)
A string literal.
Number(i32)
A number literal.
Float(String)
A floating point number literal (represented in GS2 as a string).
Boolean(bool)
A boolean literal.
Implementations§
Source§impl LiteralNode
impl LiteralNode
Sourcepub fn new_string<S: Into<String>>(s: S) -> Self
pub fn new_string<S: Into<String>>(s: S) -> Self
Creates a new LiteralNode
from a string.
Sourcepub fn new_number(n: i32) -> Self
pub fn new_number(n: i32) -> Self
Creates a new LiteralNode
from a number.
Sourcepub fn new_float<S: Into<String>>(s: S) -> Self
pub fn new_float<S: Into<String>>(s: S) -> Self
Creates a new LiteralNode
from a floating point number.
Sourcepub fn new_boolean(b: bool) -> Self
pub fn new_boolean(b: bool) -> Self
Creates a new LiteralNode
from a boolean.
Trait Implementations§
Source§impl AstVisitable for LiteralNode
impl AstVisitable for LiteralNode
Source§impl Clone for LiteralNode
impl Clone for LiteralNode
Source§fn clone(&self) -> LiteralNode
fn clone(&self) -> LiteralNode
Returns a copy 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 LiteralNode
impl Debug for LiteralNode
Source§impl<'de> Deserialize<'de> for LiteralNode
impl<'de> Deserialize<'de> for LiteralNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<LiteralNode> for AstKind
impl From<LiteralNode> for AstKind
Source§fn from(id: LiteralNode) -> Self
fn from(id: LiteralNode) -> Self
Converts to this type from the input type.
Source§impl From<LiteralNode> for Box<AstKind>
impl From<LiteralNode> for Box<AstKind>
Source§fn from(id: LiteralNode) -> Self
fn from(id: LiteralNode) -> Self
Converts to this type from the input type.
Source§impl From<LiteralNode> for Box<ExprKind>
impl From<LiteralNode> for Box<ExprKind>
Source§fn from(id: LiteralNode) -> Self
fn from(id: LiteralNode) -> Self
Converts to this type from the input type.
Source§impl From<LiteralNode> for ExprKind
impl From<LiteralNode> for ExprKind
Source§fn from(id: LiteralNode) -> Self
fn from(id: LiteralNode) -> Self
Converts to this type from the input type.
Source§impl Hash for LiteralNode
impl Hash for LiteralNode
Source§impl PartialEq for LiteralNode
impl PartialEq for LiteralNode
Source§impl Serialize for LiteralNode
impl Serialize for LiteralNode
impl Eq for LiteralNode
impl StructuralPartialEq for LiteralNode
Auto Trait Implementations§
impl Freeze for LiteralNode
impl RefUnwindSafe for LiteralNode
impl Send for LiteralNode
impl Sync for LiteralNode
impl Unpin for LiteralNode
impl UnwindSafe for LiteralNode
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.