Enum syn::ForeignItem
source · [−]#[non_exhaustive]
pub enum ForeignItem {
Fn(ForeignItemFn),
Static(ForeignItemStatic),
Type(ForeignItemType),
Macro(ForeignItemMacro),
Verbatim(TokenStream),
}
full
only.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
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
sourceimpl Clone for ForeignItem
Available on crate feature clone-impls
only.
impl Clone for ForeignItem
clone-impls
only.sourceimpl From<ForeignItemFn> for ForeignItem
impl From<ForeignItemFn> for ForeignItem
sourcefn from(e: ForeignItemFn) -> ForeignItem
fn from(e: ForeignItemFn) -> ForeignItem
Converts to this type from the input type.
sourceimpl From<ForeignItemMacro> for ForeignItem
impl From<ForeignItemMacro> for ForeignItem
sourcefn from(e: ForeignItemMacro) -> ForeignItem
fn from(e: ForeignItemMacro) -> ForeignItem
Converts to this type from the input type.
sourceimpl From<ForeignItemStatic> for ForeignItem
impl From<ForeignItemStatic> for ForeignItem
sourcefn from(e: ForeignItemStatic) -> ForeignItem
fn from(e: ForeignItemStatic) -> ForeignItem
Converts to this type from the input type.
sourceimpl From<ForeignItemType> for ForeignItem
impl From<ForeignItemType> for ForeignItem
sourcefn from(e: ForeignItemType) -> ForeignItem
fn from(e: ForeignItemType) -> ForeignItem
Converts to this type from the input type.
sourceimpl Parse for ForeignItem
Available on crate feature parsing
only.
impl Parse for ForeignItem
parsing
only.fn parse(input: ParseStream<'_>) -> Result<Self>
sourceimpl ToTokens for ForeignItem
Available on crate feature printing
only.
impl ToTokens for ForeignItem
printing
only.sourcefn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Write self
to the given TokenStream
. Read more
sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
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
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> Spanned for T where
T: Spanned + ?Sized,
impl<T> Spanned for T where
T: Spanned + ?Sized,
sourcefn span(&self) -> Span
fn span(&self) -> Span
parsing
and printing
only.Returns a Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty. Read more