Struct boa_engine::property::PropertyDescriptor
source · pub struct PropertyDescriptor { /* private fields */ }
Expand description
This represents an ECMAScript Property AKA The Property Descriptor.
Property descriptors present in objects come in three main flavors:
- data descriptors
- accessor descriptors
- generic descriptor
A data Property Descriptor is one that includes any fields named either [[Value]] or [[Writable]].
An accessor Property Descriptor is one that includes any fields named either [[Get]] or [[Set]].
A generic Property Descriptor is a Property Descriptor value that is neither a data Property Descriptor nor an accessor Property Descriptor.
More information:
Implementations§
source§impl PropertyDescriptor
impl PropertyDescriptor
sourcepub const fn is_accessor_descriptor(&self) -> bool
pub const fn is_accessor_descriptor(&self) -> bool
An accessor property descriptor is one that includes any fields named either [[Get]]
or [[Set]]
.
More information:
sourcepub const fn is_data_descriptor(&self) -> bool
pub const fn is_data_descriptor(&self) -> bool
A data property descriptor is one that includes any fields named either [[Value]]
or [[Writable]]
.
More information:
sourcepub const fn is_generic_descriptor(&self) -> bool
pub const fn is_generic_descriptor(&self) -> bool
A generic property descriptor is one that is neither a data descriptor nor an accessor descriptor.
More information:
sourcepub const fn enumerable(&self) -> Option<bool>
pub const fn enumerable(&self) -> Option<bool>
Returns if the property descriptor is enumerable.
Returns None
if the enumerable
field is not set.
sourcepub const fn configurable(&self) -> Option<bool>
pub const fn configurable(&self) -> Option<bool>
Returns if the property descriptor is configurable.
Returns None
if the configurable
field is not set.
sourcepub const fn writable(&self) -> Option<bool>
pub const fn writable(&self) -> Option<bool>
Returns if the property descriptor is writable.
Returns None
if the writable
field is not set or the property descriptor is not a data descriptor.
sourcepub const fn value(&self) -> Option<&JsValue>
pub const fn value(&self) -> Option<&JsValue>
Returns the value of the property descriptor.
Returns None
if the value is not set or the property descriptor is not a data descriptor.
sourcepub const fn get(&self) -> Option<&JsValue>
pub const fn get(&self) -> Option<&JsValue>
Returns the getter of the property descriptor.
Returns None
if the getter is not set or the property descriptor is not an accessor descriptor.
sourcepub const fn set(&self) -> Option<&JsValue>
pub const fn set(&self) -> Option<&JsValue>
Returns the setter of the property descriptor.
Returns None
if the setter is not set or the property descriptor is not an accessor descriptor.
sourcepub fn expect_enumerable(&self) -> bool
pub fn expect_enumerable(&self) -> bool
Returns if the property descriptor is enumerable.
§Panics
Panics if the enumerable
field is not set.
sourcepub fn expect_configurable(&self) -> bool
pub fn expect_configurable(&self) -> bool
Returns if the property descriptor is configurable.
§Panics
Panics if the configurable
field is not set.
sourcepub fn expect_writable(&self) -> bool
pub fn expect_writable(&self) -> bool
sourcepub fn expect_value(&self) -> &JsValue
pub fn expect_value(&self) -> &JsValue
sourcepub fn expect_get(&self) -> &JsValue
pub fn expect_get(&self) -> &JsValue
sourcepub fn expect_set(&self) -> &JsValue
pub fn expect_set(&self) -> &JsValue
sourcepub const fn kind(&self) -> &DescriptorKind
pub const fn kind(&self) -> &DescriptorKind
Returns the kind of the property descriptor.
sourcepub fn builder() -> PropertyDescriptorBuilder
pub fn builder() -> PropertyDescriptorBuilder
Creates a new PropertyDescriptorBuilder
.
sourcepub fn into_accessor_defaulted(self) -> Self
pub fn into_accessor_defaulted(self) -> Self
Creates an accessor property descriptor with default values.
sourcepub fn into_data_defaulted(self) -> Self
pub fn into_data_defaulted(self) -> Self
Creates a data property descriptor with default values.
sourcepub fn complete_property_descriptor(self) -> Self
pub fn complete_property_descriptor(self) -> Self
Creates an generic property descriptor with default values.
Trait Implementations§
source§impl Clone for PropertyDescriptor
impl Clone for PropertyDescriptor
source§fn clone(&self) -> PropertyDescriptor
fn clone(&self) -> PropertyDescriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PropertyDescriptor
impl Debug for PropertyDescriptor
source§impl Default for PropertyDescriptor
impl Default for PropertyDescriptor
source§fn default() -> PropertyDescriptor
fn default() -> PropertyDescriptor
source§impl Drop for PropertyDescriptor
impl Drop for PropertyDescriptor
source§impl From<PropertyDescriptorBuilder> for PropertyDescriptor
impl From<PropertyDescriptorBuilder> for PropertyDescriptor
source§fn from(builder: PropertyDescriptorBuilder) -> Self
fn from(builder: PropertyDescriptorBuilder) -> Self
source§impl Trace for PropertyDescriptor
impl Trace for PropertyDescriptor
source§unsafe fn trace_non_roots(&self)
unsafe fn trace_non_roots(&self)
source§fn run_finalizer(&self)
fn run_finalizer(&self)
Finalize::finalize
on this object and all
contained subobjects.Auto Trait Implementations§
impl !RefUnwindSafe for PropertyDescriptor
impl !Send for PropertyDescriptor
impl !Sync for PropertyDescriptor
impl Unpin for PropertyDescriptor
impl !UnwindSafe for PropertyDescriptor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.