Struct v8::Integer

source ·
#[repr(C)]
pub struct Integer(/* private fields */);
Expand description

A JavaScript value representing a signed integer.

Implementations§

source§

impl Integer

source

pub fn new<'s>( scope: &mut HandleScope<'s, ()>, value: i32 ) -> Local<'s, Integer>

source

pub fn new_from_unsigned<'s>( scope: &mut HandleScope<'s, ()>, value: u32 ) -> Local<'s, Integer>

source

pub fn value(&self) -> i64

Methods from Deref<Target = Number>§

source

pub fn value(&self) -> f64

Methods from Deref<Target = Value>§

source

pub fn is_undefined(&self) -> bool

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

source

pub fn is_null(&self) -> bool

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

source

pub fn is_null_or_undefined(&self) -> bool

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

source

pub fn is_true(&self) -> bool

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.

source

pub fn is_false(&self) -> bool

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.

source

pub fn is_name(&self) -> bool

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

source

pub fn is_string(&self) -> bool

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

source

pub fn is_symbol(&self) -> bool

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

source

pub fn is_function(&self) -> bool

Returns true if this value is a function.

source

pub fn is_array(&self) -> bool

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

source

pub fn is_object(&self) -> bool

Returns true if this value is an object.

source

pub fn is_big_int(&self) -> bool

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

source

pub fn is_boolean(&self) -> bool

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

source

pub fn is_number(&self) -> bool

Returns true if this value is a number.

source

pub fn is_external(&self) -> bool

Returns true if this value is an External object.

source

pub fn is_int32(&self) -> bool

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

source

pub fn is_uint32(&self) -> bool

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

source

pub fn is_date(&self) -> bool

Returns true if this value is a Date.

source

pub fn is_arguments_object(&self) -> bool

Returns true if this value is an Arguments object.

source

pub fn is_big_int_object(&self) -> bool

Returns true if this value is a BigInt object.

source

pub fn is_boolean_object(&self) -> bool

Returns true if this value is a Boolean object.

source

pub fn is_number_object(&self) -> bool

Returns true if this value is a Number object.

source

pub fn is_string_object(&self) -> bool

Returns true if this value is a String object.

source

pub fn is_symbol_object(&self) -> bool

Returns true if this value is a Symbol object.

source

pub fn is_native_error(&self) -> bool

Returns true if this value is a NativeError.

source

pub fn is_reg_exp(&self) -> bool

Returns true if this value is a RegExp.

source

pub fn is_async_function(&self) -> bool

Returns true if this value is an async function.

source

pub fn is_generator_function(&self) -> bool

Returns true if this value is a Generator function.

source

pub fn is_promise(&self) -> bool

Returns true if this value is a Promise.

source

pub fn is_map(&self) -> bool

Returns true if this value is a Map.

source

pub fn is_set(&self) -> bool

Returns true if this value is a Set.

source

pub fn is_map_iterator(&self) -> bool

Returns true if this value is a Map Iterator.

source

pub fn is_set_iterator(&self) -> bool

Returns true if this value is a Set Iterator.

source

pub fn is_generator_object(&self) -> bool

Returns true if this value is a Generator Object.

source

pub fn is_weak_map(&self) -> bool

Returns true if this value is a WeakMap.

source

pub fn is_weak_set(&self) -> bool

Returns true if this value is a WeakSet.

source

pub fn is_array_buffer(&self) -> bool

Returns true if this value is an ArrayBuffer.

source

pub fn is_array_buffer_view(&self) -> bool

Returns true if this value is an ArrayBufferView.

source

pub fn is_typed_array(&self) -> bool

Returns true if this value is one of TypedArrays.

source

pub fn is_uint8_array(&self) -> bool

Returns true if this value is an Uint8Array.

source

pub fn is_uint8_clamped_array(&self) -> bool

Returns true if this value is an Uint8ClampedArray.

source

pub fn is_int8_array(&self) -> bool

Returns true if this value is an Int8Array.

source

pub fn is_uint16_array(&self) -> bool

Returns true if this value is an Uint16Array.

source

pub fn is_int16_array(&self) -> bool

Returns true if this value is an Int16Array.

source

pub fn is_uint32_array(&self) -> bool

Returns true if this value is an Uint32Array.

source

pub fn is_int32_array(&self) -> bool

Returns true if this value is an Int32Array.

source

pub fn is_float32_array(&self) -> bool

Returns true if this value is a Float32Array.

source

pub fn is_float64_array(&self) -> bool

Returns true if this value is a Float64Array.

source

pub fn is_big_int64_array(&self) -> bool

Returns true if this value is a BigInt64Array.

source

pub fn is_big_uint64_array(&self) -> bool

Returns true if this value is a BigUint64Array.

source

pub fn is_data_view(&self) -> bool

Returns true if this value is a DataView.

source

pub fn is_shared_array_buffer(&self) -> bool

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

source

pub fn is_proxy(&self) -> bool

Returns true if this value is a JavaScript Proxy.

source

pub fn is_wasm_memory_object(&self) -> bool

Returns true if this value is a WasmMemoryObject.

source

pub fn is_wasm_module_object(&self) -> bool

Returns true if this value is a WasmModuleObject.

source

pub fn is_module_namespace_object(&self) -> bool

Returns true if the value is a Module Namespace Object.

source

pub fn strict_equals(&self, that: Local<'_, Value>) -> bool

source

pub fn same_value(&self, that: Local<'_, Value>) -> bool

source

pub fn same_value_zero(&self, that: Local<'_, Value>) -> bool

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()).
source

pub fn to_big_int<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, BigInt>>

source

pub fn to_number<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, Number>>

source

pub fn to_string<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, String>>

source

pub fn to_rust_string_lossy(&self, scope: &mut HandleScope<'_>) -> String

Convenience function not present in the original V8 API.

source

pub fn to_detail_string<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, String>>

source

pub fn to_object<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, Object>>

source

pub fn to_integer<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, Integer>>

source

pub fn to_uint32<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, Uint32>>

source

pub fn to_int32<'s>( &self, scope: &mut HandleScope<'s> ) -> Option<Local<'s, Int32>>

source

pub fn to_boolean<'s>( &self, scope: &mut HandleScope<'s, ()> ) -> Local<'s, Boolean>

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

source

pub fn instance_of( &self, scope: &mut HandleScope<'_>, object: Local<'_, Object> ) -> Option<bool>

source

pub fn number_value(&self, scope: &mut HandleScope<'_>) -> Option<f64>

source

pub fn integer_value(&self, scope: &mut HandleScope<'_>) -> Option<i64>

source

pub fn uint32_value(&self, scope: &mut HandleScope<'_>) -> Option<u32>

source

pub fn int32_value(&self, scope: &mut HandleScope<'_>) -> Option<i32>

source

pub fn boolean_value(&self, scope: &mut HandleScope<'_, ()>) -> bool

source

pub fn get_hash(&self) -> NonZeroI32

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.

source

pub fn type_of<'s>(&self, scope: &mut HandleScope<'s, ()>) -> Local<'s, String>

source

pub fn type_repr(&self) -> &'static str

Utility method that returns human readable representation of the underlying value.

Methods from Deref<Target = Data>§

source

pub fn is_big_int(&self) -> bool

Returns true if this data is a BigInt.

source

pub fn is_boolean(&self) -> bool

Returns true if this data is a Boolean.

source

pub fn is_context(&self) -> bool

Returns true if this data is a Context.

source

pub fn is_fixed_array(&self) -> bool

Returns true if this data is a FixedArray.

source

pub fn is_function_template(&self) -> bool

Returns true if this data is a FunctionTemplate.

source

pub fn is_module(&self) -> bool

Returns true if this data is a Module.

source

pub fn is_module_request(&self) -> bool

Returns true if this data is a ModuleRequest.

source

pub fn is_name(&self) -> bool

Returns true if this data is a Name.

source

pub fn is_number(&self) -> bool

Returns true if this data is a Number.

source

pub fn is_object_template(&self) -> bool

Returns true if this data is a ObjectTemplate.

source

pub fn is_primitive(&self) -> bool

Returns true if this data is a Primitive.

source

pub fn is_private(&self) -> bool

Returns true if this data is a Private.

source

pub fn is_string(&self) -> bool

Returns true if this data is a String.

source

pub fn is_symbol(&self) -> bool

Returns true if this data is a Symbol.

source

pub fn is_value(&self) -> bool

Returns true if this data is a Value.

Trait Implementations§

source§

impl Debug for Integer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for Integer

§

type Target = Number

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Hash for Integer

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'s> PartialEq<Int32> for Integer

source§

fn eq(&self, other: &Int32) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Integer> for Int32

source§

fn eq(&self, other: &Integer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Integer> for Number

source§

fn eq(&self, other: &Integer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Integer> for Primitive

source§

fn eq(&self, other: &Integer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Integer> for Uint32

source§

fn eq(&self, other: &Integer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Integer> for Value

source§

fn eq(&self, other: &Integer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Number> for Integer

source§

fn eq(&self, other: &Number) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Primitive> for Integer

source§

fn eq(&self, other: &Primitive) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Uint32> for Integer

source§

fn eq(&self, other: &Uint32) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq<Value> for Integer

source§

fn eq(&self, other: &Value) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> PartialEq for Integer

source§

fn eq(&self, other: &Integer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Integer

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.