pub enum FieldKey {
Named(Ident),
Index(Index),
}Expand description
Identifies a struct field by name or position.
Construct from a syn::Ident, syn::Index, &str, or usize.
Implements ToTokens and Display for use in
generated code and error messages.
§Examples
ⓘ
use zyn::ext::FieldKey;
let named = "id".into();
let indexed = 0usize.into();
assert!(named.is_named());
assert!(indexed.is_index());Variants§
Named(Ident)
A named field identified by its syn::Ident.
Index(Index)
A positional field identified by its syn::Index.
Implementations§
Trait Implementations§
Source§impl ToTokens for FieldKey
impl ToTokens for FieldKey
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 FieldKey
impl RefUnwindSafe for FieldKey
impl !Send for FieldKey
impl !Sync for FieldKey
impl Unpin for FieldKey
impl UnsafeUnpin for FieldKey
impl UnwindSafe for FieldKey
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> 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.