Skip to main content

AssignmentPattern

Struct AssignmentPattern 

Source
#[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>

Source

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: The Span covering this node
  • left
  • right
Source

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: The Span covering this node
  • left
  • right
Source§

impl AssignmentPattern<'_>

Source

pub fn node_id(&self) -> NodeId

Get NodeId of AssignmentPattern.

Only use this method on a post-semantic AST where NodeIds are always defined.

Source

pub fn set_node_id(&self, node_id: NodeId)

Trait Implementations§

Source§

impl<'a> BoundNames<'a> for AssignmentPattern<'a>

Source§

fn bound_names<F>(&self, f: &mut F)
where F: FnMut(&BindingIdentifier<'a>),

Source§

impl<'new_alloc> CloneIn<'new_alloc> for AssignmentPattern<'_>

Source§

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

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 more
Source§

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

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<'_>

Source§

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

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>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Dummy<'a> for AssignmentPattern<'a>

Source§

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>

Source§

fn gather<F>(&self, f: &mut F)
where F: FnMut(&str),

Source§

impl Gen for AssignmentPattern<'_>

Source§

fn gen(&self, p: &mut Codegen<'_>, ctx: Context)

Generate code for an AST node.
Source§

fn print(&self, p: &mut Codegen<'_>, ctx: Context)

Generate code for an AST node. Alias for gen.
Source§

impl GetNodeId for AssignmentPattern<'_>

Source§

fn node_id(&self) -> NodeId

Get the NodeId for an AST node.
Source§

impl GetSpan for AssignmentPattern<'_>

Source§

fn span(&self) -> Span

Get the Span for an AST node.
Source§

impl GetSpanMut for AssignmentPattern<'_>

Source§

fn span_mut(&mut self) -> &mut Span

Get a mutable reference to an AST node’s Span.
Source§

impl<'a> ReplaceWith<'a> for AssignmentPattern<'a>

Source§

fn replace_with(&mut self, replacer: impl FnOnce(Self) -> Self)

Replace the node in place with the value returned by replacer. Read more
Source§

impl<'a> TakeIn<'a> for AssignmentPattern<'a>

Source§

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>

Replace node with a dummy, allocate the original node into the arena, and return it as a Box<Self>. Read more
Source§

impl UnstableAddress for AssignmentPattern<'_>

Source§

fn unstable_address(&self) -> Address

Get the memory Address of a reference to an AST node in arena, which is not necessarily stable. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.