Enum proc_easy::ReferenceExpr
source · [−]Expand description
Expression that may be a constant or a reference to member field. Often used pattern is having attribute that refer to a field or constant expression.
Examples
/// Peeking first `const` token it decides to parse `Expr` variant.
let re: ReferenceExpr = parse_quote!(const 42);
assert_eq!(re, ReferenceExpr::Expr { const_: parse_quote!(const), expr: parse_quote!(42) });
/// Without `const` token it decides to parse `Member` variant.
let re: ReferenceExpr = parse_quote!(foo);
assert_eq!(re, ReferenceExpr::Member { member: format_ident!("foo").into() });
Variants
Member
Fields
member: Member
Member reference.
Expr
Constant expression
Trait Implementations
sourceimpl Clone for ReferenceExpr
impl Clone for ReferenceExpr
sourcefn clone(&self) -> ReferenceExpr
fn clone(&self) -> ReferenceExpr
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ReferenceExpr
impl Debug for ReferenceExpr
sourceimpl Parse for ReferenceExpr
impl Parse for ReferenceExpr
fn parse(input: ParseStream<'_>) -> Result<Self, Error>
sourceimpl PartialEq<ReferenceExpr> for ReferenceExpr
impl PartialEq<ReferenceExpr> for ReferenceExpr
sourcefn eq(&self, other: &ReferenceExpr) -> bool
fn eq(&self, other: &ReferenceExpr) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ReferenceExpr) -> bool
fn ne(&self, other: &ReferenceExpr) -> bool
This method tests for !=
.
impl Eq for ReferenceExpr
impl StructuralEq for ReferenceExpr
impl StructuralPartialEq for ReferenceExpr
Auto Trait Implementations
impl RefUnwindSafe for ReferenceExpr
impl !Send for ReferenceExpr
impl !Sync for ReferenceExpr
impl Unpin for ReferenceExpr
impl UnwindSafe for ReferenceExpr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more