#[non_exhaustive]#[repr(C)]pub struct AssignmentPattern<'a> {
pub span: Span,
pub node_id: Cell<NodeId>,
pub left: BindingPattern<'a>,
pub right: Expression<'a>,
}Expand description
x = 1 in const {x = 1} = obj;.
See other examples in docs for BindingPattern.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.span: Span§node_id: Cell<NodeId>§left: BindingPattern<'a>§right: Expression<'a>Implementations§
Source§impl<'a> AssignmentPattern<'a>
impl<'a> AssignmentPattern<'a>
Sourcepub fn new(
span: Span,
left: BindingPattern<'a>,
right: Expression<'a>,
builder: &impl GetAstBuilder<'a>,
) -> AssignmentPattern<'a>
pub fn new( span: Span, left: BindingPattern<'a>, right: Expression<'a>, builder: &impl GetAstBuilder<'a>, ) -> AssignmentPattern<'a>
Build an AssignmentPattern.
If you want the built node to be allocated in the memory arena,
use AssignmentPattern::boxed instead.
§Parameters
span: TheSpancovering this nodeleftright
Sourcepub fn boxed(
span: Span,
left: BindingPattern<'a>,
right: Expression<'a>,
builder: &impl GetAstBuilder<'a>,
) -> Box<'a, AssignmentPattern<'a>>
pub fn boxed( span: Span, left: BindingPattern<'a>, right: Expression<'a>, builder: &impl GetAstBuilder<'a>, ) -> Box<'a, AssignmentPattern<'a>>
Build an AssignmentPattern, and store it in the memory arena.
Returns a Box containing the newly-allocated node.
If you want a stack-allocated node, use AssignmentPattern::new instead.
§Parameters
span: TheSpancovering this nodeleftright
Source§impl AssignmentPattern<'_>
impl AssignmentPattern<'_>
Sourcepub fn node_id(&self) -> NodeId
pub fn node_id(&self) -> NodeId
Get NodeId of AssignmentPattern.
Only use this method on a post-semantic AST where NodeIds are always defined.
Sourcepub fn set_node_id(&self, node_id: NodeId)
pub fn set_node_id(&self, node_id: NodeId)
Set NodeId of AssignmentPattern.
Trait Implementations§
Source§impl<'a> BoundNames<'a> for AssignmentPattern<'a>
impl<'a> BoundNames<'a> for AssignmentPattern<'a>
fn bound_names<F>(&self, f: &mut F)where
F: FnMut(&BindingIdentifier<'a>),
Source§impl<'new_alloc> CloneIn<'new_alloc> for AssignmentPattern<'_>
impl<'new_alloc> CloneIn<'new_alloc> for AssignmentPattern<'_>
Source§type Cloned = AssignmentPattern<'new_alloc>
type Cloned = AssignmentPattern<'new_alloc>
The type of the cloned object. Read more
Source§fn clone_in_impl(
&self,
with_semantic_ids: CloneInSemanticIds,
allocator: &'new_alloc Allocator,
) -> <AssignmentPattern<'_> as CloneIn<'new_alloc>>::Cloned
fn clone_in_impl( &self, with_semantic_ids: CloneInSemanticIds, allocator: &'new_alloc Allocator, ) -> <AssignmentPattern<'_> as CloneIn<'new_alloc>>::Cloned
Clone
self into allocator, threading whether semantic ids should be preserved as a
runtime with_semantic_ids flag rather than as two separate methods. Read moreSource§fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned
fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned
Clone
self into the given allocator. allocator may be the same one
that self is already in.Source§fn clone_in_with_semantic_ids(
&self,
allocator: &'new_alloc Allocator,
) -> Self::Cloned
fn clone_in_with_semantic_ids( &self, allocator: &'new_alloc Allocator, ) -> Self::Cloned
Almost identical as
clone_in, but for some special type, it will also clone the semantic ids.
Please use this method only if you make sure semantic info is synced with the ast node.Source§impl ContentEq for AssignmentPattern<'_>
impl ContentEq for AssignmentPattern<'_>
Source§fn content_eq(&self, other: &AssignmentPattern<'_>) -> bool
fn content_eq(&self, other: &AssignmentPattern<'_>) -> bool
This method tests for contents of
self and other to be equal.Source§fn content_ne(&self, other: &Self) -> bool
fn content_ne(&self, other: &Self) -> bool
This method tests for contents of
self and other not to be equal.
The default implementation is almost always
sufficient, and should not be overridden without very good reason.Source§impl<'a> Debug for AssignmentPattern<'a>
impl<'a> Debug for AssignmentPattern<'a>
Source§impl<'a> Dummy<'a> for AssignmentPattern<'a>
impl<'a> Dummy<'a> for AssignmentPattern<'a>
Source§fn dummy(allocator: &'a Allocator) -> AssignmentPattern<'a>
fn dummy(allocator: &'a Allocator) -> AssignmentPattern<'a>
Create a dummy AssignmentPattern.
Has cost of making 2 allocations (48 bytes).
Source§impl<'a> GatherNodeParts<'a> for AssignmentPattern<'a>
impl<'a> GatherNodeParts<'a> for AssignmentPattern<'a>
Source§impl Gen for AssignmentPattern<'_>
impl Gen for AssignmentPattern<'_>
Source§impl GetNodeId for AssignmentPattern<'_>
impl GetNodeId for AssignmentPattern<'_>
Source§impl GetSpan for AssignmentPattern<'_>
impl GetSpan for AssignmentPattern<'_>
Source§impl GetSpanMut for AssignmentPattern<'_>
impl GetSpanMut for AssignmentPattern<'_>
Source§impl<'a> ReplaceWith<'a> for AssignmentPattern<'a>
impl<'a> ReplaceWith<'a> for AssignmentPattern<'a>
Source§fn replace_with(&mut self, replacer: impl FnOnce(Self) -> Self)
fn replace_with(&mut self, replacer: impl FnOnce(Self) -> Self)
Replace the node in place with the value returned by
replacer. Read moreSource§impl<'a> TakeIn<'a> for AssignmentPattern<'a>
impl<'a> TakeIn<'a> for AssignmentPattern<'a>
Source§fn take_in(&mut self, allocator_accessor: &impl GetAllocator<'a>) -> Self
fn take_in(&mut self, allocator_accessor: &impl GetAllocator<'a>) -> Self
Replace node with a dummy, and return the original. Read more
Source§fn take_in_box(
&mut self,
allocator_accessor: &impl GetAllocator<'a>,
) -> Box<'a, Self>
fn take_in_box( &mut self, allocator_accessor: &impl GetAllocator<'a>, ) -> Box<'a, Self>
Source§impl UnstableAddress for AssignmentPattern<'_>
impl UnstableAddress for AssignmentPattern<'_>
Auto Trait Implementations§
impl<'a> !Freeze for AssignmentPattern<'a>
impl<'a> !RefUnwindSafe for AssignmentPattern<'a>
impl<'a> !Send for AssignmentPattern<'a>
impl<'a> !Sync for AssignmentPattern<'a>
impl<'a> !UnwindSafe for AssignmentPattern<'a>
impl<'a> Forget for AssignmentPattern<'a>
impl<'a> Move for AssignmentPattern<'a>
impl<'a> Unpin for AssignmentPattern<'a>
impl<'a> UnsafeUnpin for AssignmentPattern<'a>
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more