pub struct Property {
pub value: Option<Value>,
pub getter: Option<Value>,
pub setter: Option<Value>,
pub writable: bool,
pub enumerable: bool,
pub configurable: bool,
}Expand description
A property of an object.
Fields§
§value: Option<Value>The value of a data property.
getter: Option<Value>The getter of an accessor property.
setter: Option<Value>The setter of an accessor property.
writable: boolWhether the value can be replaced.
enumerable: boolWhether for/Object.keys sees the property.
configurable: boolWhether the property can be deleted or redefined.
Implementations§
Source§impl Property
impl Property
Sourcepub fn data(value: Value) -> Property
pub fn data(value: Value) -> Property
A writable, enumerable, configurable data property.
This is what a plain assignment or an object literal creates, and the
attributes only differ for built-ins and Object.defineProperty.
Sourcepub fn with_attributes(
value: Value,
writable: bool,
enumerable: bool,
) -> Property
pub fn with_attributes( value: Value, writable: bool, enumerable: bool, ) -> Property
A data property with explicit attributes.
Sourcepub fn accessor(getter: Option<Value>, setter: Option<Value>) -> Property
pub fn accessor(getter: Option<Value>, setter: Option<Value>) -> Property
An accessor property.
Sourcepub fn is_accessor(&self) -> bool
pub fn is_accessor(&self) -> bool
Whether this is an accessor rather than a data property.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Property
impl !Send for Property
impl !Sync for Property
impl !UnwindSafe for Property
impl Forget for Property
impl Freeze for Property
impl Move for Property
impl Unpin for Property
impl UnsafeUnpin for Property
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
Mutably borrows from an owned value. Read more