pub enum SpecArgValue {
Expr(Expr),
Pat(Pat),
Captures(Captures),
}Expand description
Each SpecArg’s value needs to be parsed in a way that allows invalid specs, e.g.
forms which do not correspond directly to an syn::Expr in standard Rust.
NOTE:
a SpecArgValue may hold unrelated syntactic elements such as [’syn::Expr], [syn::Pat`],
and even fragments that would never appear as part of a valid Rust program.
Variants§
Implementations§
Source§impl SpecArgValue
impl SpecArgValue
Sourcepub fn try_into_expr(self) -> Result<Expr>
pub fn try_into_expr(self) -> Result<Expr>
Return the Expr or fail.
Sourcepub fn try_into_pat(self) -> Result<Pat>
pub fn try_into_pat(self) -> Result<Pat>
Return the Pat or fail.
Sourcepub fn try_into_captures(self) -> Result<Captures>
pub fn try_into_captures(self) -> Result<Captures>
Return the Captures or fail.
Trait Implementations§
Source§impl Clone for SpecArgValue
impl Clone for SpecArgValue
Source§fn clone(&self) -> SpecArgValue
fn clone(&self) -> SpecArgValue
Returns a duplicate 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 Debug for SpecArgValue
impl Debug for SpecArgValue
Source§impl ToTokens for SpecArgValue
impl ToTokens for SpecArgValue
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,
Auto Trait Implementations§
impl Freeze for SpecArgValue
impl RefUnwindSafe for SpecArgValue
impl !Send for SpecArgValue
impl !Sync for SpecArgValue
impl Unpin for SpecArgValue
impl UnsafeUnpin for SpecArgValue
impl UnwindSafe for SpecArgValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.