Enum macro_tools::exposed::struct_like::FieldOrVariant
source · pub enum FieldOrVariant<'a> {
Field(&'a Field),
Variant(&'a Variant),
}
Expand description
Enum to encapsulate either a field from a struct or a variant from an enum.
Variants§
Field(&'a Field)
Represents a field within a struct or union.
Variant(&'a Variant)
Represents a variant within an enum.
Implementations§
source§impl<'a> FieldOrVariant<'a>
impl<'a> FieldOrVariant<'a>
sourcepub fn vis(&self) -> Option<&Visibility>
pub fn vis(&self) -> Option<&Visibility>
Returns a reference to the visibility of the item.
sourcepub fn mutability(&self) -> Option<&FieldMutability>
pub fn mutability(&self) -> Option<&FieldMutability>
Returns a reference to the mutability of the item.
sourcepub fn discriminant(&self) -> Option<&(Eq, Expr)>
pub fn discriminant(&self) -> Option<&(Eq, Expr)>
Returns a reference to the discriminant of the item.
Trait Implementations§
source§impl<'a> Clone for FieldOrVariant<'a>
impl<'a> Clone for FieldOrVariant<'a>
source§fn clone(&self) -> FieldOrVariant<'a>
fn clone(&self) -> FieldOrVariant<'a>
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<'a> Debug for FieldOrVariant<'a>
impl<'a> Debug for FieldOrVariant<'a>
source§impl<'a> From<&'a Field> for FieldOrVariant<'a>
impl<'a> From<&'a Field> for FieldOrVariant<'a>
source§impl<'a> From<&'a Variant> for FieldOrVariant<'a>
impl<'a> From<&'a Variant> for FieldOrVariant<'a>
source§impl<'a> PartialEq for FieldOrVariant<'a>
impl<'a> PartialEq for FieldOrVariant<'a>
source§fn eq(&self, other: &FieldOrVariant<'a>) -> bool
fn eq(&self, other: &FieldOrVariant<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToTokens for FieldOrVariant<'_>
impl ToTokens for FieldOrVariant<'_>
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
impl<'a> Copy for FieldOrVariant<'a>
impl<'a> StructuralPartialEq for FieldOrVariant<'a>
Auto Trait Implementations§
impl<'a> Freeze for FieldOrVariant<'a>
impl<'a> RefUnwindSafe for FieldOrVariant<'a>
impl<'a> !Send for FieldOrVariant<'a>
impl<'a> !Sync for FieldOrVariant<'a>
impl<'a> Unpin for FieldOrVariant<'a>
impl<'a> UnwindSafe for FieldOrVariant<'a>
Blanket Implementations§
source§impl<S> AssignWithType for S
impl<S> AssignWithType for S
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
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.