Enum swc_ecma_ast::Prop[][src]

pub enum Prop {
    Shorthand(Ident),
    KeyValue(KeyValueProp),
    Assign(AssignProp),
    Getter(GetterProp),
    Setter(SetterProp),
    Method(MethodProp),
}

Variants

Shorthand(Ident)

a in { a, }

KeyValue(KeyValueProp)

key: value in { key: value, }

Assign(AssignProp)

This is invalid for object literal.

Getter(GetterProp)
Setter(SetterProp)
Method(MethodProp)

Implementations

impl Prop[src]

pub fn is_shorthand(&self) -> bool[src]

Returns true if self is of variant Shorthand.

pub fn expect_shorthand(self) -> Ident where
    Self: Debug
[src]

Unwraps the value, yielding the content of Shorthand.

Panics

Panics if the value is not Shorthand, with a panic message including the content of self.

pub fn shorthand(self) -> Option<Ident>[src]

Returns Some if self is of variant Shorthand, and None otherwise.

pub fn is_key_value(&self) -> bool[src]

Returns true if self is of variant KeyValue.

pub fn expect_key_value(self) -> KeyValueProp where
    Self: Debug
[src]

Unwraps the value, yielding the content of KeyValue.

Panics

Panics if the value is not KeyValue, with a panic message including the content of self.

pub fn key_value(self) -> Option<KeyValueProp>[src]

Returns Some if self is of variant KeyValue, and None otherwise.

pub fn is_assign(&self) -> bool[src]

Returns true if self is of variant Assign.

pub fn expect_assign(self) -> AssignProp where
    Self: Debug
[src]

Unwraps the value, yielding the content of Assign.

Panics

Panics if the value is not Assign, with a panic message including the content of self.

pub fn assign(self) -> Option<AssignProp>[src]

Returns Some if self is of variant Assign, and None otherwise.

pub fn is_getter(&self) -> bool[src]

Returns true if self is of variant Getter.

pub fn expect_getter(self) -> GetterProp where
    Self: Debug
[src]

Unwraps the value, yielding the content of Getter.

Panics

Panics if the value is not Getter, with a panic message including the content of self.

pub fn getter(self) -> Option<GetterProp>[src]

Returns Some if self is of variant Getter, and None otherwise.

pub fn is_setter(&self) -> bool[src]

Returns true if self is of variant Setter.

pub fn expect_setter(self) -> SetterProp where
    Self: Debug
[src]

Unwraps the value, yielding the content of Setter.

Panics

Panics if the value is not Setter, with a panic message including the content of self.

pub fn setter(self) -> Option<SetterProp>[src]

Returns Some if self is of variant Setter, and None otherwise.

pub fn is_method(&self) -> bool[src]

Returns true if self is of variant Method.

pub fn expect_method(self) -> MethodProp where
    Self: Debug
[src]

Unwraps the value, yielding the content of Method.

Panics

Panics if the value is not Method, with a panic message including the content of self.

pub fn method(self) -> Option<MethodProp>[src]

Returns Some if self is of variant Method, and None otherwise.

Trait Implementations

impl Clone for Prop[src]

fn clone(&self) -> Prop[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Prop[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for Prop[src]

fn deserialize<D>(Deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl EqIgnoreSpan for Prop[src]

fn eq_ignore_span(&self, other: &Self) -> bool[src]

impl From<AssignProp> for Prop[src]

fn from(v: AssignProp) -> Self[src]

Performs the conversion.

impl From<GetterProp> for Prop[src]

fn from(v: GetterProp) -> Self[src]

Performs the conversion.

impl From<Ident> for Prop[src]

fn from(v: Ident) -> Self[src]

Performs the conversion.

impl From<KeyValueProp> for Prop[src]

fn from(v: KeyValueProp) -> Self[src]

Performs the conversion.

impl From<MethodProp> for Prop[src]

fn from(v: MethodProp) -> Self[src]

Performs the conversion.

impl From<SetterProp> for Prop[src]

fn from(v: SetterProp) -> Self[src]

Performs the conversion.

impl Hash for Prop[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<Prop> for Prop[src]

fn eq(&self, other: &Prop) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Prop) -> bool[src]

This method tests for !=.

impl Serialize for Prop[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl Spanned for Prop[src]

fn span(&self) -> Span[src]

Get span of self.

impl Eq for Prop[src]

impl StructuralEq for Prop[src]

impl StructuralPartialEq for Prop[src]

Auto Trait Implementations

impl RefUnwindSafe for Prop

impl Send for Prop

impl Sync for Prop

impl Unpin for Prop

impl UnwindSafe for Prop

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Send for T where
    T: ?Sized
[src]

impl<T> Sync for T where
    T: ?Sized
[src]