logo
pub enum CompOp {
    Equal,
    NotEqual,
    StrictEqual,
    StrictNotEqual,
    GreaterThan,
    GreaterThanOrEqual,
    LessThan,
    LessThanOrEqual,
    In,
    InstanceOf,
}
Expand description

A comparison operator compares its operands and returns a logical value based on whether the comparison is true.

The operands can be numerical, string, logical, or object values. Strings are compared based on standard lexicographical ordering, using Unicode values. In most cases, if the two operands are not of the same type, JavaScript attempts to convert them to an appropriate type for the comparison. This behavior generally results in comparing the operands numerically. The sole exceptions to type conversion within comparisons involve the === and !== operators, which perform strict equality and inequality comparisons. These operators do not attempt to convert the operands to compatible types before checking equality.

More information:

Variants

Equal

The equality operator converts the operands if they are not of the same type, then applies strict comparison.

Syntax: y == y

If both operands are objects, then JavaScript compares internal references which are equal when operands refer to the same object in memory.

More information:

NotEqual

The inequality operator returns true if the operands are not equal.

Syntax: x != y

If the two operands are not of the same type, JavaScript attempts to convert the operands to an appropriate type for the comparison. If both operands are objects, then JavaScript compares internal references which are not equal when operands refer to different objects in memory.

More information:

StrictEqual

The identity operator returns true if the operands are strictly equal with no type conversion.

Syntax: x === y

Returns true if the operands are equal and of the same type.

More information:

StrictNotEqual

The non-identity operator returns true if the operands are not equal and/or not of the same type.

Syntax: x !== y

Returns true if the operands are of the same type but not equal, or are of different type.

More information:

GreaterThan

The greater than operator returns true if the left operand is greater than the right operand.

Syntax: x > y

Returns true if the left operand is greater than the right operand.

More information:

GreaterThanOrEqual

The greater than or equal operator returns true if the left operand is greater than or equal to the right operand.

Syntax: x >= y

Returns true if the left operand is greater than the right operand.

More information:

LessThan

The less than operator returns true if the left operand is less than the right operand.

Syntax: x < y

Returns true if the left operand is less than the right operand.

More information:

LessThanOrEqual

The less than or equal operator returns true if the left operand is less than or equal to the right operand.

Syntax: x <= y

Returns true if the left operand is less than or equal to the right operand.

More information:

In

The in operator returns true if the specified property is in the specified object or its prototype chain.

Syntax: prop in object

Returns true the specified property is in the specified object or its prototype chain.

More information:

InstanceOf

The instanceof operator returns true if the specified object is an instance of the right hand side object.

Syntax: obj instanceof Object

Returns true the prototype property of the right hand side constructor appears anywhere in the prototype chain of the object.

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
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.