pub struct UnionMember<P: Phase = Raw> {
pub name: Spanned<ConstructorName>,
pub payload: Option<Vec<FieldDecl<P>>>,
pub span: Span,
}Expand description
A member of a type declaration body: a constructor with an optional payload.
Forms:
- Unit:
Coast—payloadisNone. - Record-payload (parens):
Impulsive(delta_v: Velocity)—payloadisSome(vec![…]). - Record-payload (braces):
LowThrust { thrust: Force, duration: Time }—payloadisSome(vec![…]). The brace/paren choice is purely surface syntax; both produce the same AST.
Fields§
§name: Spanned<ConstructorName>The constructor’s name. Lives in the constructor namespace — distinct from the type namespace.
payload: Option<Vec<FieldDecl<P>>>Inline payload fields, or None for unit constructors.
span: SpanTrait Implementations§
Source§impl<P: Clone + Phase> Clone for UnionMember<P>
impl<P: Clone + Phase> Clone for UnionMember<P>
Source§fn clone(&self) -> UnionMember<P>
fn clone(&self) -> UnionMember<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl FormatEquivalent for UnionMember
impl FormatEquivalent for UnionMember
Source§fn format_equivalent(&self, other: &Self) -> bool
fn format_equivalent(&self, other: &Self) -> bool
Returns
true if self and other are equivalent up to formatting.Source§impl From<UnionMember> for UnionMember<Desugared>
impl From<UnionMember> for UnionMember<Desugared>
Source§fn from(u: UnionMember<Raw>) -> Self
fn from(u: UnionMember<Raw>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<P> Freeze for UnionMember<P>
impl<P> RefUnwindSafe for UnionMember<P>
impl<P> Send for UnionMember<P>
impl<P> Sync for UnionMember<P>
impl<P> Unpin for UnionMember<P>
impl<P> UnsafeUnpin for UnionMember<P>
impl<P> UnwindSafe for UnionMember<P>
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