logo
pub struct WellKnownSymbols { /* private fields */ }
Expand description

A structure that contains the JavaScript well known symbols.

Examples


let iterator = WellKnownSymbols::iterator();
assert_eq!(iterator.description().as_deref(), Some("Symbol.iterator"));

This is equivalent to let iterator = Symbol.iterator in JavaScript.

Implementations

The Symbol.asyncIterator well known symbol.

A method that returns the default AsyncIterator for an object. Called by the semantics of the for-await-of statement.

The Symbol.hasInstance well known symbol.

A method that determines if a constructor object recognizes an object as one of the constructor’s instances. Called by the semantics of the instanceof operator.

The Symbol.isConcatSpreadable well known symbol.

A Boolean valued property that if true indicates that an object should be flattened to its array elements by Array.prototype.concat.

The Symbol.iterator well known symbol.

A method that returns the default Iterator for an object. Called by the semantics of the for-of statement.

The Symbol.match well known symbol.

A regular expression method that matches the regular expression against a string. Called by the String.prototype.match method.

The Symbol.matchAll well known symbol.

A regular expression method that returns an iterator, that yields matches of the regular expression against a string. Called by the String.prototype.matchAll method.

The Symbol.replace well known symbol.

A regular expression method that replaces matched substrings of a string. Called by the String.prototype.replace method.

The Symbol.search well known symbol.

A regular expression method that returns the index within a string that matches the regular expression. Called by the String.prototype.search method.

The Symbol.species well known symbol.

A function valued property that is the constructor function that is used to create derived objects.

The Symbol.split well known symbol.

A regular expression method that splits a string at the indices that match the regular expression. Called by the String.prototype.split method.

The Symbol.toPrimitive well known symbol.

A method that converts an object to a corresponding primitive value. Called by the ToPrimitive (Value::to_primitve) abstract operation.

The Symbol.toStringTag well known symbol.

A String valued property that is used in the creation of the default string description of an object. Accessed by the built-in method Object.prototype.toString.

The Symbol.unscopables well known symbol.

An object valued property whose own and inherited property names are property names that are excluded from the with environment bindings of the associated object.

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

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.

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