pub enum PropertyDefinition {
IdentifierReference(Box<str>),
Property(PropertyName, Node),
MethodDefinition(MethodDefinitionKind, PropertyName, FunctionExpr),
SpreadObject(Node),
}
Expand description
A JavaScript property is a characteristic of an object, often describing attributes associated with a data structure.
A property has a name (a string) and a value (primitive, method, or object reference). Note that when we say that “a property holds an object”, that is shorthand for “a property holds an object reference”. This distinction matters because the original referenced object remains unchanged when you change the property’s value.
More information:
Variants
IdentifierReference(Box<str>)
Property(PropertyName, Node)
Binds a property name to a JavaScript value.
More information:
MethodDefinition(MethodDefinitionKind, PropertyName, FunctionExpr)
A property of an object can also refer to a function or a getter or setter method.
More information:
SpreadObject(Node)
The Rest/Spread Properties for ECMAScript proposal (stage 4) adds spread properties to object literals. It copies own enumerable properties from a provided object onto a new object.
Shallow-cloning (excluding prototype
) or merging objects is now possible using a shorter syntax than Object.assign()
.
More information:
Implementations
sourceimpl PropertyDefinition
impl PropertyDefinition
sourcepub fn identifier_reference<I>(ident: I) -> Selfwhere
I: Into<Box<str>>,
pub fn identifier_reference<I>(ident: I) -> Selfwhere
I: Into<Box<str>>,
Creates an IdentifierReference
property definition.
sourcepub fn property<N, V>(name: N, value: V) -> Selfwhere
N: Into<PropertyName>,
V: Into<Node>,
pub fn property<N, V>(name: N, value: V) -> Selfwhere
N: Into<PropertyName>,
V: Into<Node>,
Creates a Property
definition.
sourcepub fn method_definition<N>(
kind: MethodDefinitionKind,
name: N,
body: FunctionExpr
) -> Selfwhere
N: Into<PropertyName>,
pub fn method_definition<N>(
kind: MethodDefinitionKind,
name: N,
body: FunctionExpr
) -> Selfwhere
N: Into<PropertyName>,
Creates a MethodDefinition
.
sourcepub fn spread_object<O>(obj: O) -> Selfwhere
O: Into<Node>,
pub fn spread_object<O>(obj: O) -> Selfwhere
O: Into<Node>,
Creates a SpreadObject
.
Trait Implementations
sourceimpl Clone for PropertyDefinition
impl Clone for PropertyDefinition
sourcefn clone(&self) -> PropertyDefinition
fn clone(&self) -> PropertyDefinition
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more