pub enum VariableField {
Name(VariableIdentifier),
Array {
members: Vec<WithComment<ArrayDestructuringField<VariableField>>>,
spread: Option<SpreadDestructuringField<VariableField>>,
position: Span,
},
Object {
members: Vec<WithComment<ObjectDestructuringField<VariableField>>>,
spread: Option<SpreadDestructuringField<VariableField>>,
position: Span,
},
}
Expand description
A variable declaration name, used in variable declarations and function parameters. See destructuring
Variants§
Name(VariableIdentifier)
x
Array
[x, y, z]
Fields
§
members: Vec<WithComment<ArrayDestructuringField<VariableField>>>
§
spread: Option<SpreadDestructuringField<VariableField>>
Object
{ x, y: z }
.
Fields
§
members: Vec<WithComment<ObjectDestructuringField<VariableField>>>
§
spread: Option<SpreadDestructuringField<VariableField>>
Trait Implementations§
Source§impl ASTNode for VariableField
impl ASTNode for VariableField
fn from_reader( reader: &mut impl TokenReader<TSXToken, TokenStart>, state: &mut ParsingState, options: &ParseOptions, ) -> ParseResult<Self>
fn to_string_from_buffer<T: ToString>( &self, buf: &mut T, options: &ToStringOptions, local: LocalToStringInformation, )
Source§fn get_position(&self) -> Span
fn get_position(&self) -> Span
Returns position of node as span AS IT WAS PARSED. May be
Span::NULL
if AST was doesn’t match anything in sourceSource§fn from_string(script: String, options: ParseOptions) -> ParseResult<Self>
fn from_string(script: String, options: ParseOptions) -> ParseResult<Self>
From string, with default impl to call abstract method
from_reader
fn from_string_with_options( script: String, options: ParseOptions, offset: Option<u32>, ) -> ParseResult<(Self, ParsingState)>
Source§fn to_string(&self, options: &ToStringOptions) -> String
fn to_string(&self, options: &ToStringOptions) -> String
Returns structure as valid string
Source§impl Clone for VariableField
impl Clone for VariableField
Source§fn clone(&self) -> VariableField
fn clone(&self) -> VariableField
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VariableField
impl Debug for VariableField
Source§impl DestructuringFieldInto for VariableField
impl DestructuringFieldInto for VariableField
type TypeAnnotation = Option<TypeAnnotation>
fn type_annotation_from_reader( reader: &mut impl TokenReader<TSXToken, TokenStart>, state: &mut ParsingState, options: &ParseOptions, ) -> ParseResult<Self::TypeAnnotation>
Source§impl PartialEq for VariableField
impl PartialEq for VariableField
Source§impl SelfRustTokenize for VariableField
impl SelfRustTokenize for VariableField
fn append_to_token_stream(&self, token_stream: &mut TokenStream)
Source§fn to_tokens(&self) -> TokenStream
fn to_tokens(&self) -> TokenStream
Returns the tokens used to construct self
Source§impl Serialize for VariableField
impl Serialize for VariableField
Source§impl Visitable for VariableField
For object literals and things with computable or literal keys
impl Visitable for VariableField
For object literals and things with computable or literal keys
fn visit<TData>( &self, visitors: &mut (impl VisitorReceiver<TData> + ?Sized), data: &mut TData, options: &VisitOptions, chain: &mut Annex<'_, Chain>, )
fn visit_mut<TData>( &mut self, visitors: &mut (impl VisitorMutReceiver<TData> + ?Sized), data: &mut TData, options: &VisitOptions, chain: &mut Annex<'_, Chain>, )
impl StructuralPartialEq for VariableField
Auto Trait Implementations§
impl Freeze for VariableField
impl RefUnwindSafe for VariableField
impl Send for VariableField
impl Sync for VariableField
impl Unpin for VariableField
impl UnwindSafe for VariableField
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