logo
pub enum Const {
    String(Box<str>),
    Num(f64),
    Int(i32),
    BigInt(JsBigInt),
    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(Box<str>)

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(JsBigInt)

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
Formats the value using the given formatter. Read more
Executes the destructor for this type. 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.
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 !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
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

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.
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
Converts the given value to a String. 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.