pub struct JsObject<T:NativeObject =ErasedObjectData> {/* private fields */ }Expand description
Garbage collectedObject.
Implementations§
Source§implJsObject
implJsObject
Sourcepub fndefault(intrinsics: &Intrinsics) -> Self
pub fndefault(intrinsics: &Intrinsics) -> Self
Creates a new ordinary object with its prototype set to theObject prototype.
This is an alias forSelf::with_object_proto.
Sourcepub fnwith_object_proto(intrinsics: &Intrinsics) -> Self
pub fnwith_object_proto(intrinsics: &Intrinsics) -> Self
Creates a new ordinary object with its prototype set to theObject prototype.
This is equivalent to calling the specification’s abstract operationOrdinaryObjectCreate(%Object.prototype%).
Sourcepub fnwith_null_proto() -> Self
pub fnwith_null_proto() -> Self
Creates a new ordinary object, with its prototype set to null.
This is equivalent to calling the specification’s abstract operationOrdinaryObjectCreate(null).
Sourcepub fnfrom_proto_and_data<O:Into<Option<Self>>, T:NativeObject>( prototype: O, data: T,) -> Self
pub fnfrom_proto_and_data<O:Into<Option<Self>>, T:NativeObject>( prototype: O, data: T,) -> Self
Creates a new object with the provided prototype and object data.
This is equivalent to calling the specification’s abstract operationOrdinaryObjectCreate,with the difference that theadditionalInternalSlotsList parameter is determined bythe provideddata.
Sourcepub fndowncast<T:NativeObject>(self) ->Result<JsObject<T>, Self>
pub fndowncast<T:NativeObject>(self) ->Result<JsObject<T>, Self>
Downcasts the object’s inner data if the object is of typeT.
§Panics
Panics if the object is currently mutably borrowed.
Sourcepub unsafe fndowncast_unchecked<T:NativeObject>(self) ->JsObject<T>
pub unsafe fndowncast_unchecked<T:NativeObject>(self) ->JsObject<T>
Downcasts the object’s inner data toT without verifying the inner type ofT.
§Safety
For this cast to be sound,self must contain an instance ofT inside its inner data.
Sourcepub fndowncast_ref<T:NativeObject>(&self) ->Option<Ref<'_, T>>
pub fndowncast_ref<T:NativeObject>(&self) ->Option<Ref<'_, T>>
Downcasts a reference to the object,if the object is of typeT.
§Panics
Panics if the object is currently mutably borrowed.
Sourcepub fndowncast_mut<T:NativeObject>(&self) ->Option<RefMut<'_, T>>
pub fndowncast_mut<T:NativeObject>(&self) ->Option<RefMut<'_, T>>
Downcasts a mutable reference to the object,if the object is type native object typeT.
§Panics
Panics if the object is currently borrowed.
Sourcepub fnis<T:NativeObject>(&self) ->bool
pub fnis<T:NativeObject>(&self) ->bool
Checks if this object is an instance of a certainNativeObject.
§Panics
Panics if the object is currently mutably borrowed.
Sourcepub fnis_ordinary(&self) ->bool
pub fnis_ordinary(&self) ->bool
Sourcepub fndeep_strict_equals( lhs: &Self, rhs: &Self, context: &mutContext,) ->JsResult<bool>
pub fndeep_strict_equals( lhs: &Self, rhs: &Self, context: &mutContext,) ->JsResult<bool>
Checks that all own property keys and values are equal (recursively).
Sourcepub fnto_property_descriptor( &self, context: &mutContext,) ->JsResult<PropertyDescriptor>
pub fnto_property_descriptor( &self, context: &mutContext,) ->JsResult<PropertyDescriptor>
Sourcepub fncopy_data_properties<K>( &self, source: &JsValue, excluded_keys:Vec<K>, context: &mutContext,) ->JsResult<()>where K:Into<PropertyKey>,
pub fncopy_data_properties<K>( &self, source: &JsValue, excluded_keys:Vec<K>, context: &mutContext,) ->JsResult<()>where K:Into<PropertyKey>,
Source§impl<T:NativeObject>JsObject<T>
impl<T:NativeObject>JsObject<T>
Sourcepub fnborrow(&self) ->Ref<'_,Object<T>>
pub fnborrow(&self) ->Ref<'_,Object<T>>
Immutably borrows theObject.
The borrow lasts until the returnedRef exits scope.Multiple immutable borrows can be taken out at the same time.
§Panics
Panics if the object is currently mutably borrowed.
Sourcepub fnborrow_mut(&self) ->RefMut<'_,Object<T>>
pub fnborrow_mut(&self) ->RefMut<'_,Object<T>>
Mutably borrows the Object.
The borrow lasts until the returnedRefMut exits scope.The object cannot be borrowed while this borrow is active.
§Panics
Panics if the object is currently borrowed.
Sourcepub fntry_borrow(&self) ->StdResult<Ref<'_,Object<T>>,BorrowError>
pub fntry_borrow(&self) ->StdResult<Ref<'_,Object<T>>,BorrowError>
Immutably borrows theObject, returning an error if the value is currently mutably borrowed.
The borrow lasts until the returnedGcCellRef exits scope.Multiple immutable borrows can be taken out at the same time.
This is the non-panicking variant ofborrow.
Sourcepub fntry_borrow_mut(&self) ->StdResult<RefMut<'_,Object<T>>,BorrowMutError>
pub fntry_borrow_mut(&self) ->StdResult<RefMut<'_,Object<T>>,BorrowMutError>
Mutably borrows the object, returning an error if the value is currently borrowed.
The borrow lasts until the returnedGcCellRefMut exits scope.The object be borrowed while this borrow is active.
This is the non-panicking variant ofborrow_mut.
Sourcepub fnequals(lhs: &Self, rhs: &Self) ->bool
pub fnequals(lhs: &Self, rhs: &Self) ->bool
Checks if the garbage collected memory is the same.
Sourcepub fnprototype(&self) ->JsPrototype
pub fnprototype(&self) ->JsPrototype
Sourcepub fnset_prototype(&self, prototype:JsPrototype) ->bool
pub fnset_prototype(&self, prototype:JsPrototype) ->bool
Sourcepub fninsert_property<K, P>(&self, key: K, property: P) ->bool
pub fninsert_property<K, P>(&self, key: K, property: P) ->bool
Inserts a field in the objectproperties without checking if it’s writable.
If a field was already in the object with the same name, thantrue is returnedwith that field, otherwisefalse is returned.
Sourcepub fnis_callable(&self) ->bool
pub fnis_callable(&self) ->bool
It determines if Object is a callable function with a[[Call]] internal method.
More information:
Sourcepub fnis_constructor(&self) ->bool
pub fnis_constructor(&self) ->bool
It determines if Object is a function object with a[[Construct]] internal method.
More information:
Source§impl<T:NativeObject>JsObject<T>
impl<T:NativeObject>JsObject<T>
Sourcepub fnnew<O:Into<Option<JsObject>>>( root_shape: &RootShape, prototype: O, data: T,) -> Self
pub fnnew<O:Into<Option<JsObject>>>( root_shape: &RootShape, prototype: O, data: T,) -> Self
Creates a newJsObject from its root shape, prototype, and data.
Note that the returned object will not be erased to be convertible to aJsValue. To erase the pointer, callJsObject::upcast.
Sourcepub fnnew_unique<O:Into<Option<JsObject>>>(prototype: O, data: T) -> Self
pub fnnew_unique<O:Into<Option<JsObject>>>(prototype: O, data: T) -> Self
Creates a newJsObject from prototype, and data.
Note that the returned object will not be erased to be convertible to aJsValue. To erase the pointer, callJsObject::upcast.
Source§implJsObject
implJsObject
Sourcepub fnis_extensible(&self, context: &mutContext) ->JsResult<bool>
pub fnis_extensible(&self, context: &mutContext) ->JsResult<bool>
Sourcepub fnget<K>(&self, key: K, context: &mutContext) ->JsResult<JsValue>where K:Into<PropertyKey>,
pub fnget<K>(&self, key: K, context: &mutContext) ->JsResult<JsValue>where K:Into<PropertyKey>,
Sourcepub fncreate_data_property<K, V>( &self, key: K, value: V, context: &mutContext,) ->JsResult<bool>
pub fncreate_data_property<K, V>( &self, key: K, value: V, context: &mutContext,) ->JsResult<bool>
Sourcepub fncreate_data_property_or_throw<K, V>( &self, key: K, value: V, context: &mutContext,) ->JsResult<bool>
pub fncreate_data_property_or_throw<K, V>( &self, key: K, value: V, context: &mutContext,) ->JsResult<bool>
Sourcepub fndefine_property_or_throw<K, P>( &self, key: K, desc: P, context: &mutContext,) ->JsResult<bool>
pub fndefine_property_or_throw<K, P>( &self, key: K, desc: P, context: &mutContext,) ->JsResult<bool>
Sourcepub fndelete_property_or_throw<K>( &self, key: K, context: &mutContext,) ->JsResult<bool>where K:Into<PropertyKey>,
pub fndelete_property_or_throw<K>( &self, key: K, context: &mutContext,) ->JsResult<bool>where K:Into<PropertyKey>,
Defines the property or throws aTypeError if the operation fails.
More information:
Sourcepub fnhas_property<K>(&self, key: K, context: &mutContext) ->JsResult<bool>where K:Into<PropertyKey>,
pub fnhas_property<K>(&self, key: K, context: &mutContext) ->JsResult<bool>where K:Into<PropertyKey>,
Sourcepub fnhas_own_property<K>( &self, key: K, context: &mutContext,) ->JsResult<bool>where K:Into<PropertyKey>,
pub fnhas_own_property<K>( &self, key: K, context: &mutContext,) ->JsResult<bool>where K:Into<PropertyKey>,
Sourcepub fnown_property_keys( &self, context: &mutContext,) ->JsResult<Vec<PropertyKey>>
pub fnown_property_keys( &self, context: &mutContext,) ->JsResult<Vec<PropertyKey>>
Sourcepub fncall( &self, this: &JsValue, args: &[JsValue], context: &mutContext,) ->JsResult<JsValue>
pub fncall( &self, this: &JsValue, args: &[JsValue], context: &mutContext,) ->JsResult<JsValue>
Call ( F, V [ , argumentsList ] )
§Panics
Panics if the object is currently mutably borrowed.
More information:
Sourcepub fnconstruct( &self, args: &[JsValue], new_target:Option<&Self>, context: &mutContext,) ->JsResult<Self>
pub fnconstruct( &self, args: &[JsValue], new_target:Option<&Self>, context: &mutContext,) ->JsResult<Self>
Construct ( F [ , argumentsList [ , newTarget ] ] )
Construct an instance of this object with the specified arguments.
§Panics
Panics if the object is currently mutably borrowed.
More information:
Sourcepub fnset_integrity_level( &self, level:IntegrityLevel, context: &mutContext,) ->JsResult<bool>
pub fnset_integrity_level( &self, level:IntegrityLevel, context: &mutContext,) ->JsResult<bool>
Sourcepub fntest_integrity_level( &self, level:IntegrityLevel, context: &mutContext,) ->JsResult<bool>
pub fntest_integrity_level( &self, level:IntegrityLevel, context: &mutContext,) ->JsResult<bool>
Trait Implementations§
Source§impl<T:NativeObject>Clone forJsObject<T>
impl<T:NativeObject>Clone forJsObject<T>
Source§impl<T:NativeObject>Debug forJsObject<T>
impl<T:NativeObject>Debug forJsObject<T>
Source§implFrom<JsArrayBuffer> forJsObject
implFrom<JsArrayBuffer> forJsObject
Source§fnfrom(o:JsArrayBuffer) -> Self
fnfrom(o:JsArrayBuffer) -> Self
Source§implFrom<JsArrayBuffer> forJsObject<ArrayBuffer>
implFrom<JsArrayBuffer> forJsObject<ArrayBuffer>
Source§fnfrom(value:JsArrayBuffer) -> Self
fnfrom(value:JsArrayBuffer) -> Self
Source§implFrom<JsBigInt64Array> forJsObject
implFrom<JsBigInt64Array> forJsObject
Source§fnfrom(o:JsBigInt64Array) -> Self
fnfrom(o:JsBigInt64Array) -> Self
Source§implFrom<JsBigUint64Array> forJsObject
implFrom<JsBigUint64Array> forJsObject
Source§fnfrom(o:JsBigUint64Array) -> Self
fnfrom(o:JsBigUint64Array) -> Self
Source§implFrom<JsDataView> forJsObject
implFrom<JsDataView> forJsObject
Source§fnfrom(o:JsDataView) -> Self
fnfrom(o:JsDataView) -> Self
Source§implFrom<JsDataView> forJsObject<DataView>
implFrom<JsDataView> forJsObject<DataView>
Source§fnfrom(value:JsDataView) -> Self
fnfrom(value:JsDataView) -> Self
Source§implFrom<JsFloat16Array> forJsObject
implFrom<JsFloat16Array> forJsObject
Source§fnfrom(o:JsFloat16Array) -> Self
fnfrom(o:JsFloat16Array) -> Self
Source§implFrom<JsFloat32Array> forJsObject
implFrom<JsFloat32Array> forJsObject
Source§fnfrom(o:JsFloat32Array) -> Self
fnfrom(o:JsFloat32Array) -> Self
Source§implFrom<JsFloat64Array> forJsObject
implFrom<JsFloat64Array> forJsObject
Source§fnfrom(o:JsFloat64Array) -> Self
fnfrom(o:JsFloat64Array) -> Self
Source§implFrom<JsFunction> forJsObject
implFrom<JsFunction> forJsObject
Source§fnfrom(o:JsFunction) -> Self
fnfrom(o:JsFunction) -> Self
Source§implFrom<JsGenerator> forJsObject
implFrom<JsGenerator> forJsObject
Source§fnfrom(o:JsGenerator) -> Self
fnfrom(o:JsGenerator) -> Self
Source§implFrom<JsInt16Array> forJsObject
implFrom<JsInt16Array> forJsObject
Source§fnfrom(o:JsInt16Array) -> Self
fnfrom(o:JsInt16Array) -> Self
Source§implFrom<JsInt32Array> forJsObject
implFrom<JsInt32Array> forJsObject
Source§fnfrom(o:JsInt32Array) -> Self
fnfrom(o:JsInt32Array) -> Self
Source§implFrom<JsInt8Array> forJsObject
implFrom<JsInt8Array> forJsObject
Source§fnfrom(o:JsInt8Array) -> Self
fnfrom(o:JsInt8Array) -> Self
Source§implFrom<JsMapIterator> forJsObject
implFrom<JsMapIterator> forJsObject
Source§fnfrom(o:JsMapIterator) -> Self
fnfrom(o:JsMapIterator) -> Self
Source§implFrom<JsObject<ArrayBuffer>> forJsArrayBuffer
implFrom<JsObject<ArrayBuffer>> forJsArrayBuffer
Source§fnfrom(value:JsObject<ArrayBuffer>) -> Self
fnfrom(value:JsObject<ArrayBuffer>) -> Self
Source§implFrom<JsObject<SharedArrayBuffer>> forJsSharedArrayBuffer
implFrom<JsObject<SharedArrayBuffer>> forJsSharedArrayBuffer
Source§fnfrom(value:JsObject<SharedArrayBuffer>) -> Self
fnfrom(value:JsObject<SharedArrayBuffer>) -> Self
Source§implFrom<JsSetIterator> forJsObject
implFrom<JsSetIterator> forJsObject
Source§fnfrom(o:JsSetIterator) -> Self
fnfrom(o:JsSetIterator) -> Self
Source§implFrom<JsSharedArrayBuffer> forJsObject
implFrom<JsSharedArrayBuffer> forJsObject
Source§fnfrom(o:JsSharedArrayBuffer) -> Self
fnfrom(o:JsSharedArrayBuffer) -> Self
Source§implFrom<JsSharedArrayBuffer> forJsObject<SharedArrayBuffer>
implFrom<JsSharedArrayBuffer> forJsObject<SharedArrayBuffer>
Source§fnfrom(value:JsSharedArrayBuffer) -> Self
fnfrom(value:JsSharedArrayBuffer) -> Self
Source§implFrom<JsTypedArray> forJsObject
implFrom<JsTypedArray> forJsObject
Source§fnfrom(o:JsTypedArray) -> Self
fnfrom(o:JsTypedArray) -> Self
Source§implFrom<JsUint16Array> forJsObject
implFrom<JsUint16Array> forJsObject
Source§fnfrom(o:JsUint16Array) -> Self
fnfrom(o:JsUint16Array) -> Self
Source§implFrom<JsUint32Array> forJsObject
implFrom<JsUint32Array> forJsObject
Source§fnfrom(o:JsUint32Array) -> Self
fnfrom(o:JsUint32Array) -> Self
Source§implFrom<JsUint8Array> forJsObject
implFrom<JsUint8Array> forJsObject
Source§fnfrom(o:JsUint8Array) -> Self
fnfrom(o:JsUint8Array) -> Self
Source§implFrom<JsUint8ClampedArray> forJsObject
implFrom<JsUint8ClampedArray> forJsObject
Source§fnfrom(o:JsUint8ClampedArray) -> Self
fnfrom(o:JsUint8ClampedArray) -> Self
Source§impl<T:NativeObject>Hash forJsObject<T>
impl<T:NativeObject>Hash forJsObject<T>
Source§impl<T:NativeObject>PartialEq forJsObject<T>
impl<T:NativeObject>PartialEq forJsObject<T>
Source§impl<T:NativeObject>Trace forJsObject<T>
impl<T:NativeObject>Trace forJsObject<T>
Source§unsafe fntrace_non_roots(&self)
unsafe fntrace_non_roots(&self)
Source§fnrun_finalizer(&self)
fnrun_finalizer(&self)
Finalize::finalize on this object and allcontained subobjects.impl<T:NativeObject>Eq forJsObject<T>
Auto Trait Implementations§
impl<T>Freeze forJsObject<T>
impl<T =ErasedObjectData> !RefUnwindSafe forJsObject<T>
impl<T =ErasedObjectData> !Send forJsObject<T>
impl<T =ErasedObjectData> !Sync forJsObject<T>
impl<T>Unpin forJsObject<T>
impl<T =ErasedObjectData> !UnwindSafe forJsObject<T>
Blanket Implementations§
Source§impl<T>BorrowMut<T> for Twhere T: ?Sized,
impl<T>BorrowMut<T> for Twhere T: ?Sized,
Source§fnborrow_mut(&mut self) ->&mut T
fnborrow_mut(&mut self) ->&mut T
Source§impl<T>CloneToUninit for Twhere T:Clone,
impl<T>CloneToUninit for Twhere T:Clone,
Source§impl<Q, K>Equivalent<K> for Q
impl<Q, K>Equivalent<K> for Q
Source§fnequivalent(&self, key:&K) ->bool
fnequivalent(&self, key:&K) ->bool
key and returntrue if they are equal.Source§impl<Q, K>Equivalent<K> for Q
impl<Q, K>Equivalent<K> for Q
Source§impl<T>IntoEither for T
impl<T>IntoEither for T
Source§fninto_either(self, into_left:bool) ->Either<Self, Self>
fninto_either(self, into_left:bool) ->Either<Self, Self>
self into aLeft variant ofEither<Self, Self>ifinto_left istrue.Convertsself into aRight variant ofEither<Self, Self>otherwise.Read moreSource§fninto_either_with<F>(self, into_left: F) ->Either<Self, Self>
fninto_either_with<F>(self, into_left: F) ->Either<Self, Self>
self into aLeft variant ofEither<Self, Self>ifinto_left(&self) returnstrue.Convertsself into aRight variant ofEither<Self, Self>otherwise.Read moreSource§impl<T>Pipe for Twhere T: ?Sized,
impl<T>Pipe for Twhere T: ?Sized,
Source§fnpipe<R>(self, func: implFnOnce(Self) -> R) -> Rwhere Self:Sized,
fnpipe<R>(self, func: implFnOnce(Self) -> R) -> Rwhere Self:Sized,
Source§fnpipe_ref<'a, R>(&'a self, func: implFnOnce(&'a Self) -> R) -> Rwhere R: 'a,
fnpipe_ref<'a, R>(&'a self, func: implFnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self and passes that borrow into the pipe function.Read moreSource§fnpipe_ref_mut<'a, R>(&'a mut self, func: implFnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
fnpipe_ref_mut<'a, R>(&'a mut self, func: implFnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self and passes that borrow into the pipe function.Read moreSource§fnpipe_borrow<'a, B, R>(&'a self, func: implFnOnce(&'a B) -> R) -> R
fnpipe_borrow<'a, B, R>(&'a self, func: implFnOnce(&'a B) -> R) -> R
Source§fnpipe_borrow_mut<'a, B, R>( &'a mut self, func: implFnOnce(&'a mut B) -> R,) -> R
fnpipe_borrow_mut<'a, B, R>( &'a mut self, func: implFnOnce(&'a mut B) -> R,) -> R
Source§fnpipe_as_ref<'a, U, R>(&'a self, func: implFnOnce(&'a U) -> R) -> R
fnpipe_as_ref<'a, U, R>(&'a self, func: implFnOnce(&'a U) -> R) -> R
self, then passesself.as_ref() into the pipe function.Source§fnpipe_as_mut<'a, U, R>(&'a mut self, func: implFnOnce(&'a mut U) -> R) -> R
fnpipe_as_mut<'a, U, R>(&'a mut self, func: implFnOnce(&'a mut U) -> R) -> R
self, then passesself.as_mut() into the pipefunction.Source§fnpipe_deref<'a, T, R>(&'a self, func: implFnOnce(&'a T) -> R) -> R
fnpipe_deref<'a, T, R>(&'a self, func: implFnOnce(&'a T) -> R) -> R
self, then passesself.deref() into the pipe function.Source§impl<T>Tap for T
impl<T>Tap for T
Source§fntap_borrow<B>(self, func: implFnOnce(&B)) -> Self
fntap_borrow<B>(self, func: implFnOnce(&B)) -> Self
Borrow<B> of a value.Read moreSource§fntap_borrow_mut<B>(self, func: implFnOnce(&mut B)) -> Self
fntap_borrow_mut<B>(self, func: implFnOnce(&mut B)) -> Self
BorrowMut<B> of a value.Read moreSource§fntap_ref<R>(self, func: implFnOnce(&R)) -> Self
fntap_ref<R>(self, func: implFnOnce(&R)) -> Self
AsRef<R> view of a value.Read moreSource§fntap_ref_mut<R>(self, func: implFnOnce(&mut R)) -> Self
fntap_ref_mut<R>(self, func: implFnOnce(&mut R)) -> Self
AsMut<R> view of a value.Read moreSource§fntap_deref<T>(self, func: implFnOnce(&T)) -> Self
fntap_deref<T>(self, func: implFnOnce(&T)) -> Self
Deref::Target of a value.Read moreSource§fntap_deref_mut<T>(self, func: implFnOnce(&mut T)) -> Self
fntap_deref_mut<T>(self, func: implFnOnce(&mut T)) -> Self
Deref::Target of a value.Read moreSource§fntap_dbg(self, func: implFnOnce(&Self)) -> Self
fntap_dbg(self, func: implFnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fntap_mut_dbg(self, func: implFnOnce(&mut Self)) -> Self
fntap_mut_dbg(self, func: implFnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in releasebuilds.Source§fntap_borrow_dbg<B>(self, func: implFnOnce(&B)) -> Self
fntap_borrow_dbg<B>(self, func: implFnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in releasebuilds.Source§fntap_borrow_mut_dbg<B>(self, func: implFnOnce(&mut B)) -> Self
fntap_borrow_mut_dbg<B>(self, func: implFnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in releasebuilds.Source§fntap_ref_dbg<R>(self, func: implFnOnce(&R)) -> Self
fntap_ref_dbg<R>(self, func: implFnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in releasebuilds.Source§fntap_ref_mut_dbg<R>(self, func: implFnOnce(&mut R)) -> Self
fntap_ref_mut_dbg<R>(self, func: implFnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in releasebuilds.Source§fntap_deref_dbg<T>(self, func: implFnOnce(&T)) -> Self
fntap_deref_dbg<T>(self, func: implFnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in releasebuilds.