logo
pub enum Const {
    String(Sym),
    Num(f64),
    Int(i32),
    BigInt(Box<BigInt>),
    Bool(bool),
    Null,
    Undefined,
}
Expand description

Literals represent values in JavaScript.

These are fixed values not variables that you literally provide in your script.

More information:

Variants

String(Sym)

A string literal is zero or more characters enclosed in double (") or single (') quotation marks.

A string must be delimited by quotation marks of the same type (that is, either both single quotation marks, or both double quotation marks). You can call any of the String object’s methods on a string literal value. JavaScript automatically converts the string literal to a temporary String object, calls the method, then discards the temporary String object.

More information:

Num(f64)

A floating-point number literal.

The exponent part is an “e” or “E” followed by an integer, which can be signed (preceded by “+” or “-”). A floating-point literal must have at least one digit, and either a decimal point or “e” (or “E”).

More information:

Int(i32)

Integer types can be expressed in decimal (base 10), hexadecimal (base 16), octal (base 8) and binary (base 2).

More information:

BigInt(Box<BigInt>)

BigInt provides a way to represent whole numbers larger than the largest number JavaScript can reliably represent with the Number primitive.

More information:

Bool(bool)

The Boolean type has two literal values: true and false.

The Boolean object is a wrapper around the primitive Boolean data type.

More information:

Null

In JavaScript, null is marked as one of the primitive values, cause it’s behaviour is seemingly primitive.

In computer science, a null value represents a reference that points, generally intentionally, to a nonexistent or invalid object or address. The meaning of a null reference varies among language implementations.

More information:

Undefined

The undefined is a primitive value automatically assigned to variables that have just been declared, or to formal arguments for which there are no actual arguments.

More information:

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Converts a given element to a string using an interner.

Marks all contained Gcs.

Increments the root-count of all contained Gcs.

Decrements the root-count of all contained Gcs.

Runs Finalize::finalize() on this object and all contained subobjects Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert the Rust type which implements NativeObject to a &dyn Any.

Convert the Rust type which implements NativeObject to a &mut dyn Any.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Attempts to convert self into T using TryInto<T>. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.