pub enum Atom {
Int(i64),
Bool(bool),
Char(char),
Null,
List(List),
Function(Function),
Object(Object),
}Variants§
Implementations§
Source§impl Atom
impl Atom
pub const INT_TY_ID: i64 = 0
pub const BOOL_TY_ID: i64 = 1
pub const CHAR_TY_ID: i64 = 2
pub const NULL_TY_ID: i64 = 3
pub const LIST_TY_ID: i64 = 4
pub const FUNCTION_TY_ID: i64 = 5
pub const MIN_OBJECT_TY_ID: i64 = 6
pub const fn ty_id(&self) -> i64
Sourcepub fn new_string(s: &str) -> Self
pub fn new_string(s: &str) -> Self
Constructs a new string, represented as a List of Chars.
Sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this is a List in which all elements are Chars,
this concatenates them into a String and returns it.
Otherwise, it returns None.
Sourcepub fn new_object(data: HashMap<String, Self>) -> Self
pub fn new_object(data: HashMap<String, Self>) -> Self
Contructs an object with the type id i64::MAX directly.
Useful for (singleton) objects added from outside the language.
pub fn stringify(&self) -> String
Trait Implementations§
Source§impl PartialOrd for Atom
impl PartialOrd for Atom
impl StructuralPartialEq for Atom
Auto Trait Implementations§
impl !RefUnwindSafe for Atom
impl !Send for Atom
impl !Sync for Atom
impl !UnwindSafe for Atom
impl Freeze for Atom
impl Unpin for Atom
impl UnsafeUnpin for Atom
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