#[repr(C)]pub struct ArrayBuffer(/* private fields */);
Expand description
An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
Implementations§
Source§impl ArrayBuffer
impl ArrayBuffer
Sourcepub fn new<'s>(
scope: &mut HandleScope<'s>,
byte_length: usize,
) -> Local<'s, ArrayBuffer>
pub fn new<'s>( scope: &mut HandleScope<'s>, byte_length: usize, ) -> Local<'s, ArrayBuffer>
Create a new ArrayBuffer. Allocate |byte_length| bytes. Allocated memory will be owned by a created ArrayBuffer and will be deallocated when it is garbage-collected, unless the object is externalized.
pub fn with_backing_store<'s>( scope: &mut HandleScope<'s>, backing_store: &SharedRef<BackingStore>, ) -> Local<'s, ArrayBuffer>
Sourcepub fn empty<'s>(scope: &mut HandleScope<'s>) -> Local<'s, ArrayBuffer>
pub fn empty<'s>(scope: &mut HandleScope<'s>) -> Local<'s, ArrayBuffer>
Create a new, empty ArrayBuffer.
Sourcepub fn byte_length(&self) -> usize
pub fn byte_length(&self) -> usize
Data length in bytes.
Sourcepub fn is_detachable(&self) -> bool
pub fn is_detachable(&self) -> bool
Returns true if this ArrayBuffer may be detached.
Sourcepub fn was_detached(&self) -> bool
pub fn was_detached(&self) -> bool
Returns true if this ArrayBuffer was detached.
Sourcepub fn detach(&self, key: Option<Local<'_, Value>>) -> Option<bool>
pub fn detach(&self, key: Option<Local<'_, Value>>) -> Option<bool>
Detaches this ArrayBuffer and all its views (typed arrays).
Detaching sets the byte length of the buffer and all typed arrays to zero,
preventing JavaScript from ever accessing underlying backing store.
ArrayBuffer should have been externalized and must be detachable. Returns
None
if the key didn’t pass the [[ArrayBufferDetachKey]]
check,
and Some(true)
otherwise.
Sourcepub fn set_detach_key(&self, key: Local<'_, Value>)
pub fn set_detach_key(&self, key: Local<'_, Value>)
Sets the [[ArrayBufferDetachKey]]
.
Sourcepub fn data(&self) -> Option<NonNull<c_void>>
pub fn data(&self) -> Option<NonNull<c_void>>
More efficient shortcut for GetBackingStore()->Data(). The returned pointer is valid as long as the ArrayBuffer is alive.
Sourcepub fn get_backing_store(&self) -> SharedRef<BackingStore>
pub fn get_backing_store(&self) -> SharedRef<BackingStore>
Get a shared pointer to the backing store of this array buffer. This pointer coordinates the lifetime management of the internal storage with any live ArrayBuffers on the heap, even across isolates. The embedder should not attempt to manage lifetime of the storage through other means.
Sourcepub fn new_backing_store(
scope: &mut Isolate,
byte_length: usize,
) -> UniqueRef<BackingStore>
pub fn new_backing_store( scope: &mut Isolate, byte_length: usize, ) -> UniqueRef<BackingStore>
Returns a new standalone BackingStore that is allocated using the array buffer allocator of the isolate. The result can be later passed to ArrayBuffer::New.
If the allocator returns nullptr, then the function may cause GCs in the given isolate and re-try the allocation. If GCs do not help, then the function will crash with an out-of-memory error.
Sourcepub fn new_backing_store_from_boxed_slice(
data: Box<[u8]>,
) -> UniqueRef<BackingStore>
pub fn new_backing_store_from_boxed_slice( data: Box<[u8]>, ) -> UniqueRef<BackingStore>
Returns a new standalone BackingStore that takes over the ownership of the given buffer.
The destructor of the BackingStore frees owned buffer memory.
The result can be later passed to ArrayBuffer::New. The raw pointer to the buffer must not be passed again to any V8 API function.
Sourcepub fn new_backing_store_from_vec(data: Vec<u8>) -> UniqueRef<BackingStore>
pub fn new_backing_store_from_vec(data: Vec<u8>) -> UniqueRef<BackingStore>
Returns a new standalone BackingStore that takes over the ownership of the given buffer.
The destructor of the BackingStore frees owned buffer memory.
The result can be later passed to ArrayBuffer::New. The raw pointer to the buffer must not be passed again to any V8 API function.
Sourcepub fn new_backing_store_from_bytes<T, U>(bytes: T) -> UniqueRef<BackingStore>
pub fn new_backing_store_from_bytes<T, U>(bytes: T) -> UniqueRef<BackingStore>
Returns a new standalone BackingStore backed by a container that dereferences to a mutable slice of bytes. The object is dereferenced once, and the resulting slice’s memory is used for the lifetime of the buffer.
This method may be called with most single-ownership containers that implement AsMut<[u8]>
, including
Box<[u8]>
, and Vec<u8>
. This will also support most other mutable bytes containers (including bytes::BytesMut
),
though these buffers will need to be boxed to manage ownership of memory.
// Vector of bytes
let backing_store = v8::ArrayBuffer::new_backing_store_from_bytes(vec![1, 2, 3]);
// Boxes slice of bytes
let boxed_slice: Box<[u8]> = vec![1, 2, 3].into_boxed_slice();
let backing_store = v8::ArrayBuffer::new_backing_store_from_bytes(boxed_slice);
// BytesMut from bytes crate
let backing_store = v8::ArrayBuffer::new_backing_store_from_bytes(Box::new(bytes::BytesMut::new()));
Sourcepub unsafe fn new_backing_store_from_ptr(
data_ptr: *mut c_void,
byte_length: usize,
deleter_callback: BackingStoreDeleterCallback,
deleter_data: *mut c_void,
) -> UniqueRef<BackingStore>
pub unsafe fn new_backing_store_from_ptr( data_ptr: *mut c_void, byte_length: usize, deleter_callback: BackingStoreDeleterCallback, deleter_data: *mut c_void, ) -> UniqueRef<BackingStore>
Returns a new standalone BackingStore backed by given ptr.
SAFETY: This API consumes raw pointers so is inherently unsafe. Usually you should use new_backing_store_from_boxed_slice.
Methods from Deref<Target = Object>§
Sourcepub fn set(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Value>,
value: Local<'_, Value>,
) -> Option<bool>
pub fn set( &self, scope: &mut HandleScope<'_>, key: Local<'_, Value>, value: Local<'_, Value>, ) -> Option<bool>
Set only return Just(true) or Empty(), so if it should never fail, use result.Check().
Sourcepub fn set_with_receiver(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Value>,
value: Local<'_, Value>,
receiver: Local<'_, Object>,
) -> Option<bool>
pub fn set_with_receiver( &self, scope: &mut HandleScope<'_>, key: Local<'_, Value>, value: Local<'_, Value>, receiver: Local<'_, Object>, ) -> Option<bool>
SetWithReceiver only return Just(true) or Empty(), so if it should never fail, use result.Check().
Sourcepub fn set_index(
&self,
scope: &mut HandleScope<'_>,
index: u32,
value: Local<'_, Value>,
) -> Option<bool>
pub fn set_index( &self, scope: &mut HandleScope<'_>, index: u32, value: Local<'_, Value>, ) -> Option<bool>
Set only return Just(true) or Empty(), so if it should never fail, use result.Check().
Sourcepub fn set_prototype(
&self,
scope: &mut HandleScope<'_>,
prototype: Local<'_, Value>,
) -> Option<bool>
pub fn set_prototype( &self, scope: &mut HandleScope<'_>, prototype: Local<'_, Value>, ) -> Option<bool>
Set the prototype object. This does not skip objects marked to be skipped by proto and it does not consult the security handler.
Sourcepub fn get_constructor_name(&self) -> Local<'_, String>
pub fn get_constructor_name(&self) -> Local<'_, String>
Returns the name of the function invoked as a constructor for this object.
Sourcepub fn create_data_property(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Name>,
value: Local<'_, Value>,
) -> Option<bool>
pub fn create_data_property( &self, scope: &mut HandleScope<'_>, key: Local<'_, Name>, value: Local<'_, Value>, ) -> Option<bool>
Implements CreateDataProperty (ECMA-262, 7.3.4).
Defines a configurable, writable, enumerable property with the given value on the object unless the property already exists and is not configurable or the object is not extensible.
Returns true on success.
Sourcepub fn define_own_property(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Name>,
value: Local<'_, Value>,
attr: PropertyAttribute,
) -> Option<bool>
pub fn define_own_property( &self, scope: &mut HandleScope<'_>, key: Local<'_, Name>, value: Local<'_, Value>, attr: PropertyAttribute, ) -> Option<bool>
Implements DefineOwnProperty.
In general, CreateDataProperty will be faster, however, does not allow for specifying attributes.
Returns true on success.
pub fn define_property( &self, scope: &mut HandleScope<'_>, key: Local<'_, Name>, descriptor: &PropertyDescriptor, ) -> Option<bool>
pub fn get<'s>( &self, scope: &mut HandleScope<'s>, key: Local<'_, Value>, ) -> Option<Local<'s, Value>>
pub fn get_with_receiver<'s>( &self, scope: &mut HandleScope<'s>, key: Local<'_, Value>, receiver: Local<'_, Object>, ) -> Option<Local<'s, Value>>
pub fn get_index<'s>( &self, scope: &mut HandleScope<'s>, index: u32, ) -> Option<Local<'s, Value>>
Sourcepub fn get_prototype<'s>(
&self,
scope: &mut HandleScope<'s>,
) -> Option<Local<'s, Value>>
pub fn get_prototype<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Value>>
Get the prototype object. This does not skip objects marked to be skipped by proto and it does not consult the security handler.
Sourcepub fn set_accessor(
&self,
scope: &mut HandleScope<'_>,
name: Local<'_, Name>,
getter: impl for<'s> MapFnTo<AccessorNameGetterCallback<'s>>,
) -> Option<bool>
pub fn set_accessor( &self, scope: &mut HandleScope<'_>, name: Local<'_, Name>, getter: impl for<'s> MapFnTo<AccessorNameGetterCallback<'s>>, ) -> Option<bool>
Note: SideEffectType affects the getter only, not the setter.
pub fn set_accessor_with_setter( &self, scope: &mut HandleScope<'_>, name: Local<'_, Name>, getter: impl for<'s> MapFnTo<AccessorNameGetterCallback<'s>>, setter: impl for<'s> MapFnTo<AccessorNameSetterCallback<'s>>, ) -> Option<bool>
pub fn set_accessor_with_configuration( &self, scope: &mut HandleScope<'_>, name: Local<'_, Name>, configuration: AccessorConfiguration<'_>, ) -> Option<bool>
Sourcepub fn get_identity_hash(&self) -> NonZeroI32
pub fn get_identity_hash(&self) -> NonZeroI32
Returns the V8 hash value for this value. The current implementation uses a hidden property to store the identity hash.
The return value will never be 0. Also, it is not guaranteed to be unique.
Sourcepub fn get_creation_context<'s>(
&self,
scope: &mut HandleScope<'s>,
) -> Option<Local<'s, Context>>
pub fn get_creation_context<'s>( &self, scope: &mut HandleScope<'s>, ) -> Option<Local<'s, Context>>
Returns the context in which the object was created.
Sourcepub fn get_own_property_names<'s>(
&self,
scope: &mut HandleScope<'s>,
args: GetPropertyNamesArgs,
) -> Option<Local<'s, Array>>
pub fn get_own_property_names<'s>( &self, scope: &mut HandleScope<'s>, args: GetPropertyNamesArgs, ) -> Option<Local<'s, Array>>
This function has the same functionality as GetPropertyNames but the returned array doesn’t contain the names of properties from prototype objects.
Sourcepub fn get_property_names<'s>(
&self,
scope: &mut HandleScope<'s>,
args: GetPropertyNamesArgs,
) -> Option<Local<'s, Array>>
pub fn get_property_names<'s>( &self, scope: &mut HandleScope<'s>, args: GetPropertyNamesArgs, ) -> Option<Local<'s, Array>>
Returns an array containing the names of the filtered properties of this object, including properties from prototype objects. The array returned by this method contains the same values as would be enumerated by a for-in statement over this object.
pub fn has( &self, scope: &mut HandleScope<'_>, key: Local<'_, Value>, ) -> Option<bool>
pub fn has_index(&self, scope: &mut HandleScope<'_>, index: u32) -> Option<bool>
Sourcepub fn has_own_property(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Name>,
) -> Option<bool>
pub fn has_own_property( &self, scope: &mut HandleScope<'_>, key: Local<'_, Name>, ) -> Option<bool>
HasOwnProperty() is like JavaScript’s Object.prototype.hasOwnProperty().
pub fn delete( &self, scope: &mut HandleScope<'_>, key: Local<'_, Value>, ) -> Option<bool>
pub fn delete_index( &self, scope: &mut HandleScope<'_>, index: u32, ) -> Option<bool>
Sourcepub fn internal_field_count(&self) -> usize
pub fn internal_field_count(&self) -> usize
Gets the number of internal fields for this Object.
Sourcepub fn get_internal_field<'s>(
&self,
scope: &mut HandleScope<'s>,
index: usize,
) -> Option<Local<'s, Data>>
pub fn get_internal_field<'s>( &self, scope: &mut HandleScope<'s>, index: usize, ) -> Option<Local<'s, Data>>
Gets the data from an internal field.
Sourcepub unsafe fn get_aligned_pointer_from_internal_field(
&self,
index: i32,
) -> *const c_void
pub unsafe fn get_aligned_pointer_from_internal_field( &self, index: i32, ) -> *const c_void
Gets a 2-byte-aligned native pointer from an internal field.
§Safety
This field must have been set by SetAlignedPointerInInternalField, everything else leads to undefined behavior.
Sourcepub fn set_aligned_pointer_in_internal_field(
&self,
index: i32,
value: *const c_void,
)
pub fn set_aligned_pointer_in_internal_field( &self, index: i32, value: *const c_void, )
Sets a 2-byte-aligned native pointer in an internal field. To retrieve such a field, GetAlignedPointerFromInternalField must be used.
Sourcepub fn is_api_wrapper(&self) -> bool
pub fn is_api_wrapper(&self) -> bool
Returns true if this object can be generally used to wrap object objects. This means that the object either follows the convention of using embedder fields to denote type/instance pointers or is using the Wrap()/Unwrap() APIs for the same purpose. Returns false otherwise.
Note that there may be other objects that use embedder fields but are not used as API wrapper objects. E.g., v8::Promise may in certain configuration use embedder fields but promises are not generally supported as API wrappers. The method will return false in those cases.
Sourcepub fn set_integrity_level(
&self,
scope: &mut HandleScope<'_>,
level: IntegrityLevel,
) -> Option<bool>
pub fn set_integrity_level( &self, scope: &mut HandleScope<'_>, level: IntegrityLevel, ) -> Option<bool>
Sets the integrity level of the object.
Sourcepub fn set_internal_field(&self, index: usize, data: Local<'_, Data>) -> bool
pub fn set_internal_field(&self, index: usize, data: Local<'_, Data>) -> bool
Sets the data in an internal field. Returns false when the index is out of bounds, true otherwise.
Sourcepub fn get_private<'s>(
&self,
scope: &mut HandleScope<'s>,
key: Local<'_, Private>,
) -> Option<Local<'s, Value>>
pub fn get_private<'s>( &self, scope: &mut HandleScope<'s>, key: Local<'_, Private>, ) -> Option<Local<'s, Value>>
Functionality for private properties. This is an experimental feature, use at your own risk. Note: Private properties are not inherited. Do not rely on this, since it may change.
Sourcepub fn set_private(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Private>,
value: Local<'_, Value>,
) -> Option<bool>
pub fn set_private( &self, scope: &mut HandleScope<'_>, key: Local<'_, Private>, value: Local<'_, Value>, ) -> Option<bool>
Functionality for private properties. This is an experimental feature, use at your own risk. Note: Private properties are not inherited. Do not rely on this, since it may change.
Sourcepub fn delete_private(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Private>,
) -> Option<bool>
pub fn delete_private( &self, scope: &mut HandleScope<'_>, key: Local<'_, Private>, ) -> Option<bool>
Functionality for private properties. This is an experimental feature, use at your own risk. Note: Private properties are not inherited. Do not rely on this, since it may change.
Sourcepub fn has_private(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Private>,
) -> Option<bool>
pub fn has_private( &self, scope: &mut HandleScope<'_>, key: Local<'_, Private>, ) -> Option<bool>
Functionality for private properties. This is an experimental feature, use at your own risk. Note: Private properties are not inherited. Do not rely on this, since it may change.
Sourcepub fn get_property_attributes(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Value>,
) -> Option<PropertyAttribute>
pub fn get_property_attributes( &self, scope: &mut HandleScope<'_>, key: Local<'_, Value>, ) -> Option<PropertyAttribute>
Gets the property attributes of a property which can be PropertyAttribute::NONE or any combination of PropertyAttribute::READ_ONLY, PropertyAttribute::DONT_ENUM and PropertyAttribute::DONT_DELETE. Returns PropertyAttribute::NONE when the property doesn’t exist.
Sourcepub fn get_own_property_descriptor<'s>(
&self,
scope: &mut HandleScope<'s>,
key: Local<'_, Name>,
) -> Option<Local<'s, Value>>
pub fn get_own_property_descriptor<'s>( &self, scope: &mut HandleScope<'s>, key: Local<'_, Name>, ) -> Option<Local<'s, Value>>
Implements Object.getOwnPropertyDescriptor(O, P), see https://tc39.es/ecma262/#sec-object.getownpropertydescriptor.
Sourcepub fn preview_entries<'s>(
&self,
scope: &mut HandleScope<'s>,
) -> (Option<Local<'s, Array>>, bool)
pub fn preview_entries<'s>( &self, scope: &mut HandleScope<'s>, ) -> (Option<Local<'s, Array>>, bool)
If this object is a Set, Map, WeakSet or WeakMap, this returns a representation of the elements of this object as an array. If this object is a SetIterator or MapIterator, this returns all elements of the underlying collection, starting at the iterator’s current position.
Also returns a boolean, indicating whether the returned array contains key & values (for example when the value is Set.entries()).
Sourcepub fn get_real_named_property<'s>(
&self,
scope: &mut HandleScope<'s>,
key: Local<'_, Name>,
) -> Option<Local<'s, Value>>
pub fn get_real_named_property<'s>( &self, scope: &mut HandleScope<'s>, key: Local<'_, Name>, ) -> Option<Local<'s, Value>>
If result.IsEmpty() no real property was located on the object or in the prototype chain. This means interceptors in the prototype chain are not called.
pub fn has_real_named_property( &self, scope: &mut HandleScope<'_>, key: Local<'_, Name>, ) -> Option<bool>
Sourcepub fn get_real_named_property_attributes(
&self,
scope: &mut HandleScope<'_>,
key: Local<'_, Name>,
) -> Option<PropertyAttribute>
pub fn get_real_named_property_attributes( &self, scope: &mut HandleScope<'_>, key: Local<'_, Name>, ) -> Option<PropertyAttribute>
Gets the property attributes of a real property which can be None or any combination of ReadOnly, DontEnum and DontDelete. Interceptors in the prototype chain are not called.
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_generator_object(&self) -> bool
pub fn is_generator_object(&self) -> bool
Returns true if this value is a Generator Object.
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_memory_object(&self) -> bool
pub fn is_wasm_memory_object(&self) -> bool
Returns true if this value is a WasmMemoryObject.
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(&self, scope: &mut HandleScope<'_>) -> String
pub fn to_rust_string_lossy(&self, scope: &mut HandleScope<'_>) -> 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 instance_of( &self, scope: &mut HandleScope<'_>, object: Local<'_, Object>, ) -> Option<bool>
pub fn number_value(&self, scope: &mut HandleScope<'_>) -> Option<f64>
pub fn integer_value(&self, scope: &mut HandleScope<'_>) -> Option<i64>
pub fn uint32_value(&self, scope: &mut HandleScope<'_>) -> Option<u32>
pub fn int32_value(&self, scope: &mut HandleScope<'_>) -> Option<i32>
pub fn boolean_value(&self, scope: &mut HandleScope<'_, ()>) -> bool
Sourcepub fn get_hash(&self) -> NonZeroI32
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.
pub fn type_of<'s>(&self, scope: &mut HandleScope<'s, ()>) -> Local<'s, String>
Methods from Deref<Target = Data>§
Sourcepub fn is_big_int(&self) -> bool
pub fn is_big_int(&self) -> bool
Returns true if this data is a BigInt
.
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if this data is a Boolean
.
Sourcepub fn is_context(&self) -> bool
pub fn is_context(&self) -> bool
Returns true if this data is a Context
.
Sourcepub fn is_fixed_array(&self) -> bool
pub fn is_fixed_array(&self) -> bool
Returns true if this data is a FixedArray
.
Sourcepub fn is_function_template(&self) -> bool
pub fn is_function_template(&self) -> bool
Returns true if this data is a FunctionTemplate
.
Sourcepub fn is_module_request(&self) -> bool
pub fn is_module_request(&self) -> bool
Returns true if this data is a ModuleRequest
.
Sourcepub fn is_object_template(&self) -> bool
pub fn is_object_template(&self) -> bool
Returns true if this data is a ObjectTemplate
.
Sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Returns true if this data is a Primitive
.
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true if this data is a Private
.