#[repr(C)]pub struct Boolean(/* private fields */);
Expand description
A primitive boolean value (ECMA-262, 4.3.14). Either the true or false value.
Implementations§
Methods from Deref<Target = Value>§
Sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Returns true if this value is the undefined value. See ECMA-262 4.3.10.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if this value is the null value. See ECMA-262 4.3.11.
Sourcepub fn is_null_or_undefined(&self) -> bool
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
Sourcepub fn is_true(&self) -> bool
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
.
Sourcepub fn is_false(&self) -> bool
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
.
Sourcepub fn is_name(&self) -> bool
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.
Sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if this value is an instance of the String type. See ECMA-262 8.4.
Sourcepub fn is_symbol(&self) -> bool
pub fn is_symbol(&self) -> bool
Returns true if this value is a symbol.
This is equivalent to typeof value === 'symbol'
in JS.
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Returns true if this value is a function.
Sourcepub fn is_array(&self) -> bool
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.
Sourcepub fn is_big_int(&self) -> bool
pub fn is_big_int(&self) -> bool
Returns true if this value is a bigint.
This is equivalent to typeof value === 'bigint'
in JS.
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if this value is boolean.
This is equivalent to typeof value === 'boolean'
in JS.
Sourcepub fn is_external(&self) -> bool
pub fn is_external(&self) -> bool
Returns true if this value is an External
object.
Sourcepub fn is_arguments_object(&self) -> bool
pub fn is_arguments_object(&self) -> bool
Returns true if this value is an Arguments object.
Sourcepub fn is_big_int_object(&self) -> bool
pub fn is_big_int_object(&self) -> bool
Returns true if this value is a BigInt object.
Sourcepub fn is_boolean_object(&self) -> bool
pub fn is_boolean_object(&self) -> bool
Returns true if this value is a Boolean object.
Sourcepub fn is_number_object(&self) -> bool
pub fn is_number_object(&self) -> bool
Returns true if this value is a Number object.
Sourcepub fn is_string_object(&self) -> bool
pub fn is_string_object(&self) -> bool
Returns true if this value is a String object.
Sourcepub fn is_symbol_object(&self) -> bool
pub fn is_symbol_object(&self) -> bool
Returns true if this value is a Symbol object.
Sourcepub fn is_native_error(&self) -> bool
pub fn is_native_error(&self) -> bool
Returns true if this value is a NativeError.
Sourcepub fn is_reg_exp(&self) -> bool
pub fn is_reg_exp(&self) -> bool
Returns true if this value is a RegExp.
Sourcepub fn is_async_function(&self) -> bool
pub fn is_async_function(&self) -> bool
Returns true if this value is an async function.
Sourcepub fn is_generator_function(&self) -> bool
pub fn is_generator_function(&self) -> bool
Returns true if this value is a Generator function.
Sourcepub fn is_promise(&self) -> bool
pub fn is_promise(&self) -> bool
Returns true if this value is a Promise.
Sourcepub fn is_map_iterator(&self) -> bool
pub fn is_map_iterator(&self) -> bool
Returns true if this value is a Map Iterator.
Sourcepub fn is_set_iterator(&self) -> bool
pub fn is_set_iterator(&self) -> bool
Returns true if this value is a Set Iterator.
Sourcepub fn is_weak_map(&self) -> bool
pub fn is_weak_map(&self) -> bool
Returns true if this value is a WeakMap.
Sourcepub fn is_weak_set(&self) -> bool
pub fn is_weak_set(&self) -> bool
Returns true if this value is a WeakSet.
Sourcepub fn is_array_buffer(&self) -> bool
pub fn is_array_buffer(&self) -> bool
Returns true if this value is an ArrayBuffer.
Sourcepub fn is_array_buffer_view(&self) -> bool
pub fn is_array_buffer_view(&self) -> bool
Returns true if this value is an ArrayBufferView.
Sourcepub fn is_typed_array(&self) -> bool
pub fn is_typed_array(&self) -> bool
Returns true if this value is one of TypedArrays.
Sourcepub fn is_uint8_array(&self) -> bool
pub fn is_uint8_array(&self) -> bool
Returns true if this value is an Uint8Array.
Sourcepub fn is_uint8_clamped_array(&self) -> bool
pub fn is_uint8_clamped_array(&self) -> bool
Returns true if this value is an Uint8ClampedArray.
Sourcepub fn is_int8_array(&self) -> bool
pub fn is_int8_array(&self) -> bool
Returns true if this value is an Int8Array.
Sourcepub fn is_uint16_array(&self) -> bool
pub fn is_uint16_array(&self) -> bool
Returns true if this value is an Uint16Array.
Sourcepub fn is_int16_array(&self) -> bool
pub fn is_int16_array(&self) -> bool
Returns true if this value is an Int16Array.
Sourcepub fn is_uint32_array(&self) -> bool
pub fn is_uint32_array(&self) -> bool
Returns true if this value is an Uint32Array.
Sourcepub fn is_int32_array(&self) -> bool
pub fn is_int32_array(&self) -> bool
Returns true if this value is an Int32Array.
Sourcepub fn is_float32_array(&self) -> bool
pub fn is_float32_array(&self) -> bool
Returns true if this value is a Float32Array.
Sourcepub fn is_float64_array(&self) -> bool
pub fn is_float64_array(&self) -> bool
Returns true if this value is a Float64Array.
Sourcepub fn is_big_int64_array(&self) -> bool
pub fn is_big_int64_array(&self) -> bool
Returns true if this value is a BigInt64Array.
Sourcepub fn is_big_uint64_array(&self) -> bool
pub fn is_big_uint64_array(&self) -> bool
Returns true if this value is a BigUint64Array.
Sourcepub fn is_data_view(&self) -> bool
pub fn is_data_view(&self) -> bool
Returns true if this value is a DataView.
Returns true if this value is a SharedArrayBuffer. This is an experimental feature.
Sourcepub fn is_wasm_module_object(&self) -> bool
pub fn is_wasm_module_object(&self) -> bool
Returns true if this value is a WasmModuleObject.
Sourcepub fn is_module_namespace_object(&self) -> bool
pub fn is_module_namespace_object(&self) -> bool
Returns true if the value is a Module Namespace Object.
pub fn strict_equals(&self, that: Local<'_, Value>) -> bool
pub fn same_value(&self, that: Local<'_, Value>) -> bool
Sourcepub fn same_value_zero(&self, that: Local<'_, Value>) -> bool
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 toNaN
(unlikestrict_equals()
). - It considers
-0
equal to0
(unlikesame_value()
).
pub fn to_big_int<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, BigInt>>
pub fn to_number<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Number>>
pub fn to_string<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, String>>
Sourcepub fn to_rust_string_lossy<'s>(&self, scope: &mut HandleScope<'s>) -> String
pub fn to_rust_string_lossy<'s>(&self, scope: &mut HandleScope<'s>) -> String
Convenience function not present in the original V8 API.
pub fn to_detail_string<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, String>>
pub fn to_object<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Object>>
pub fn to_integer<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Integer>>
pub fn to_uint32<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Uint32>>
pub fn to_int32<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Int32>>
Sourcepub fn to_boolean<'s>(
&self,
scope: &mut HandleScope<'s, ()>,
) -> Local<'s, Boolean>
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.
pub fn number_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<f64>
pub fn integer_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<i64>
pub fn uint32_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<u32>
pub fn int32_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<i32>
pub fn boolean_value<'s>(&self, scope: &mut HandleScope<'s, ()>) -> bool
Methods from Deref<Target = Data>§
Sourcepub fn get_hash(&self) -> int
pub fn get_hash(&self) -> int
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.
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true if this data is a Private
.
Sourcepub fn is_object_template(&self) -> bool
pub fn is_object_template(&self) -> bool
Returns true if this data is an ObjectTemplate
Sourcepub fn is_function_template(&self) -> bool
pub fn is_function_template(&self) -> bool
Returns true if this data is a FunctionTemplate.