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_with(
getter: Option<Value>,
setter: Option<Value>,
enumerable: bool,
) -> Property
pub fn accessor_with( getter: Option<Value>, setter: Option<Value>, enumerable: bool, ) -> Property
An accessor property.
An accessor property with explicit enumerable/configurable flags, which is
what Symbol.prototype.description needs: it is enumerable: false in the spec.
Sourcepub fn accessor(getter: Option<Value>, setter: Option<Value>) -> Property
pub fn accessor(getter: Option<Value>, setter: Option<Value>) -> Property
An accessor property with the default enumerable/configurable flags.
Sourcepub fn is_accessor(&self) -> bool
pub fn is_accessor(&self) -> bool
Whether this is an accessor rather than a data property.