pub struct MetaNameValueInvalidExpr {
pub path: Path,
pub eq_token: Eq,
pub value: TokenStream,
pub error: Error,
}Expand description
Represents a name-value attribute like foo = ... where we failed
to parse the RHS (...) as a syn::Expr.
For example:
#[processor(vis = pub(crate))]We first try to parse that vis = pub(crate) into a syn::Meta::NameValue.
This requires the RHS (pub(crate)) to be a valid syn::Expr.
Because pub(crate) is not a valid expression, we store the TokenStream
corresponding to pub(crate) in this struct, as well as the original syn::Error
obtained from <syn::Expr as Parse>::parse(quote!(pub(crate)))
This syn::Error is used for good error messages when a type does not implement
[FromMeta::from_invalid_expr], as the default implementation of that function just
returns the stored error.
Fields§
§path: PathIn vis = pub(crate), this is the vis
eq_token: EqIn vis = pub(crate), this is the =
value: TokenStreamThe original input that we tried to parse as a syn::Expr, but failed
In vis = pub(crate), this is pub(crate)
error: ErrorThe error that we got from failing to parse input as a syn::Expr
In vis = pub(crate), this is:
<syn::Expr as syn::parse::Parse>::parse(quote!(pub(crate))).unwrap_err()Trait Implementations§
Source§impl Clone for MetaNameValueInvalidExpr
impl Clone for MetaNameValueInvalidExpr
Source§fn clone(&self) -> MetaNameValueInvalidExpr
fn clone(&self) -> MetaNameValueInvalidExpr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetaNameValueInvalidExpr
impl Debug for MetaNameValueInvalidExpr
impl Eq for MetaNameValueInvalidExpr
Source§impl PartialEq for MetaNameValueInvalidExpr
impl PartialEq for MetaNameValueInvalidExpr
Source§impl ToTokens for MetaNameValueInvalidExpr
impl ToTokens for MetaNameValueInvalidExpr
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 !Send for MetaNameValueInvalidExpr
impl !Sync for MetaNameValueInvalidExpr
impl Freeze for MetaNameValueInvalidExpr
impl RefUnwindSafe for MetaNameValueInvalidExpr
impl Unpin for MetaNameValueInvalidExpr
impl UnsafeUnpin for MetaNameValueInvalidExpr
impl UnwindSafe for MetaNameValueInvalidExpr
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
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
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.