Enum syn::ForeignItem
source · #[non_exhaustive]pub enum ForeignItem {
Fn(ForeignItemFn),
Static(ForeignItemStatic),
Type(ForeignItemType),
Macro(ForeignItemMacro),
Verbatim(TokenStream),
}
Expand description
An item within an extern
block.
This type is available only if Syn is built with the "full"
feature.
Syntax tree enum
This type is a syntax tree enum.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Fn(ForeignItemFn)
A foreign function in an extern
block.
Static(ForeignItemStatic)
A foreign static item in an extern
block: static ext: u8
.
Type(ForeignItemType)
A foreign type in an extern
block: type void
.
Macro(ForeignItemMacro)
A macro invocation within an extern block.
Verbatim(TokenStream)
Tokens in an extern
block not interpreted by Syn.
Trait Implementations§
source§impl Clone for ForeignItem
impl Clone for ForeignItem
source§impl From<ForeignItemFn> for ForeignItem
impl From<ForeignItemFn> for ForeignItem
source§fn from(e: ForeignItemFn) -> ForeignItem
fn from(e: ForeignItemFn) -> ForeignItem
Converts to this type from the input type.
source§impl From<ForeignItemMacro> for ForeignItem
impl From<ForeignItemMacro> for ForeignItem
source§fn from(e: ForeignItemMacro) -> ForeignItem
fn from(e: ForeignItemMacro) -> ForeignItem
Converts to this type from the input type.
source§impl From<ForeignItemStatic> for ForeignItem
impl From<ForeignItemStatic> for ForeignItem
source§fn from(e: ForeignItemStatic) -> ForeignItem
fn from(e: ForeignItemStatic) -> ForeignItem
Converts to this type from the input type.
source§impl From<ForeignItemType> for ForeignItem
impl From<ForeignItemType> for ForeignItem
source§fn from(e: ForeignItemType) -> ForeignItem
fn from(e: ForeignItemType) -> ForeignItem
Converts to this type from the input type.
source§impl Parse for ForeignItem
impl Parse for ForeignItem
fn parse(input: ParseStream<'_>) -> Result<Self>
source§impl ToTokens for ForeignItem
impl ToTokens for ForeignItem
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 RefUnwindSafe for ForeignItem
impl !Send for ForeignItem
impl !Sync for ForeignItem
impl Unpin for ForeignItem
impl UnwindSafe for ForeignItem
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.