Struct v8::BigInt

source ·
#[repr(C)]
pub struct BigInt(_);
Expand description

A JavaScript BigInt value (https://tc39.github.io/proposal-bigint)

Implementations§

Creates a new BigInt object using a specified sign bit and a specified list of digits/words. The resulting number is calculated as:

(-1)^sign_bit * (words[0] * (2^64)^0 + words[1] * (2^64)^1 + …)

Returns the value of this BigInt as an unsigned 64-bit integer, and a bool indicating whether the return value was truncated was truncated or wrapped around. In particular, it will be false if this BigInt is negative.

Returns the value of this BigInt as a signed 64-bit integer, and a bool indicating whether this BigInt was truncated or not.

Returns the number of 64-bit words needed to store the result of to_words_array.

Converts this BigInt to a (sign_bit, words) pair. sign_bit will be true if this BigInt is negative. If words has too few elements, the result will be truncated to fit.

Methods from Deref<Target = Value>§

Returns true if this value is the undefined value. See ECMA-262 4.3.10.

Returns true if this value is the null value. See ECMA-262 4.3.11.

Returns true if this value is either the null or the undefined value. See ECMA-262 4.3.11. and 4.3.12

Returns true if this value is true. This is not the same as BooleanValue(). The latter performs a conversion to boolean, i.e. the result of Boolean(value) in JS, whereas this checks value === true.

Returns true if this value is false. This is not the same as !BooleanValue(). The latter performs a conversion to boolean, i.e. the result of !Boolean(value) in JS, whereas this checks value === false.

Returns true if this value is a symbol or a string. This is equivalent to typeof value === 'string' || typeof value === 'symbol' in JS.

Returns true if this value is an instance of the String type. See ECMA-262 8.4.

Returns true if this value is a symbol. This is equivalent to typeof value === 'symbol' in JS.

Returns true if this value is a function.

Returns true if this value is an array. Note that it will return false for an Proxy for an array.

Returns true if this value is an object.

Returns true if this value is a bigint. This is equivalent to typeof value === 'bigint' in JS.

Returns true if this value is boolean. This is equivalent to typeof value === 'boolean' in JS.

Returns true if this value is a number.

Returns true if this value is an External object.

Returns true if this value is a 32-bit signed integer.

Returns true if this value is a 32-bit unsigned integer.

Returns true if this value is a Date.

Returns true if this value is an Arguments object.

Returns true if this value is a BigInt object.

Returns true if this value is a Boolean object.

Returns true if this value is a Number object.

Returns true if this value is a String object.

Returns true if this value is a Symbol object.

Returns true if this value is a NativeError.

Returns true if this value is a RegExp.

Returns true if this value is an async function.

Returns true if this value is a Generator function.

Returns true if this value is a Promise.

Returns true if this value is a Map.

Returns true if this value is a Set.

Returns true if this value is a Map Iterator.

Returns true if this value is a Set Iterator.

Returns true if this value is a WeakMap.

Returns true if this value is a WeakSet.

Returns true if this value is an ArrayBuffer.

Returns true if this value is an ArrayBufferView.

Returns true if this value is one of TypedArrays.

Returns true if this value is an Uint8Array.

Returns true if this value is an Uint8ClampedArray.

Returns true if this value is an Int8Array.

Returns true if this value is an Uint16Array.

Returns true if this value is an Int16Array.

Returns true if this value is an Uint32Array.

Returns true if this value is an Int32Array.

Returns true if this value is a Float32Array.

Returns true if this value is a Float64Array.

Returns true if this value is a BigInt64Array.

Returns true if this value is a BigUint64Array.

Returns true if this value is a DataView.

Returns true if this value is a SharedArrayBuffer. This is an experimental feature.

Returns true if this value is a JavaScript Proxy.

Returns true if this value is a WasmMemoryObject.

Returns true if this value is a WasmModuleObject.

Returns true if the value is a Module Namespace Object.

Implements the the abstract operation SameValueZero, which is defined in ECMA-262 6th edition § 7.2.10 (http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero).

This operation is used to compare values for the purpose of insertion into a Set, or determining whether Map keys are equivalent. Its semantics are almost the same as strict_equals() and same_value(), with the following important distinctions:

  • It considers NaN equal to NaN (unlike strict_equals()).
  • It considers -0 equal to 0 (unlike same_value()).

Convenience function not present in the original V8 API.

Perform the equivalent of Boolean(value) in JS. This can never fail.

Returns the V8 hash value for this value. The current implementation uses a hidden property to store the identity hash on some object types.

The return value will never be 0. Also, it is not guaranteed to be unique.

Methods from Deref<Target = Data>§

Returns true if this data is a BigInt.

Returns true if this data is a Boolean.

Returns true if this data is a Context.

Returns true if this data is a FixedArray.

Returns true if this data is a FunctionTemplate.

Returns true if this data is a Module.

Returns true if this data is a ModuleRequest.

Returns true if this data is a Name.

Returns true if this data is a Number.

Returns true if this data is a ObjectTemplate.

Returns true if this data is a Primitive.

Returns true if this data is a Private.

Returns true if this data is a String.

Returns true if this data is a Symbol.

Returns true if this data is a Value.

Trait Implementations§

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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