Enum syntax::ast::ItemKind
[−]
[src]
pub enum ItemKind { ExternCrate(Option<Name>), Use(P<UseTree>), Static(P<Ty>, Mutability, P<Expr>), Const(P<Ty>, P<Expr>), Fn(P<FnDecl>, Unsafety, Spanned<Constness>, Abi, Generics, P<Block>), Mod(Mod), ForeignMod(ForeignMod), GlobalAsm(P<GlobalAsm>), Ty(P<Ty>, Generics), Enum(EnumDef, Generics), Struct(VariantData, Generics), Union(VariantData, Generics), Trait(IsAuto, Unsafety, Generics, TyParamBounds, Vec<TraitItem>), TraitAlias(Generics, TyParamBounds), Impl(Unsafety, ImplPolarity, Defaultness, Generics, Option<TraitRef>, P<Ty>, Vec<ImplItem>), Mac(Mac), MacroDef(MacroDef), }
Variants
ExternCrate(Option<Name>)
An extern crate
item, with optional original crate name.
E.g. extern crate foo
or extern crate foo_bar as foo
Use(P<UseTree>)
A use declaration (use
or pub use
) item.
E.g. use foo;
, use foo::bar;
or use foo::bar as FooBar;
Static(P<Ty>, Mutability, P<Expr>)
A static item (static
or pub static
).
E.g. static FOO: i32 = 42;
or static FOO: &'static str = "bar";
Const(P<Ty>, P<Expr>)
A constant item (const
or pub const
).
E.g. const FOO: i32 = 42;
Fn(P<FnDecl>, Unsafety, Spanned<Constness>, Abi, Generics, P<Block>)
A function declaration (fn
or pub fn
).
E.g. fn foo(bar: usize) -> usize { .. }
Mod(Mod)
A module declaration (mod
or pub mod
).
E.g. mod foo;
or mod foo { .. }
ForeignMod(ForeignMod)
An external module (extern
or pub extern
).
E.g. extern {}
or extern "C" {}
GlobalAsm(P<GlobalAsm>)
Module-level inline assembly (from global_asm!()
)
Ty(P<Ty>, Generics)
A type alias (type
or pub type
).
E.g. type Foo = Bar<u8>;
Enum(EnumDef, Generics)
An enum definition (enum
or pub enum
).
E.g. enum Foo<A, B> { C<A>, D<B> }
Struct(VariantData, Generics)
A struct definition (struct
or pub struct
).
E.g. struct Foo<A> { x: A }
Union(VariantData, Generics)
A union definition (union
or pub union
).
E.g. union Foo<A, B> { x: A, y: B }
Trait(IsAuto, Unsafety, Generics, TyParamBounds, Vec<TraitItem>)
A Trait declaration (trait
or pub trait
).
E.g. trait Foo { .. }
, trait Foo<T> { .. }
or auto trait Foo {}
TraitAlias(Generics, TyParamBounds)
Trait alias
E.g. trait Foo = Bar + Quux;
Impl(Unsafety, ImplPolarity, Defaultness, Generics, Option<TraitRef>, P<Ty>, Vec<ImplItem>)
An implementation.
E.g. impl<A> Foo<A> { .. }
or impl<A> Trait for Foo<A> { .. }
Mac(Mac)
A macro invocation.
E.g. macro_rules! foo { .. }
or foo!(..)
MacroDef(MacroDef)
A macro definition.
Methods
impl ItemKind
[src]
pub fn descriptive_variant(&self) -> &str
[src]
Trait Implementations
impl Clone for ItemKind
[src]
fn clone(&self) -> ItemKind
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for ItemKind
[src]
fn eq(&self, __arg_0: &ItemKind) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ItemKind) -> bool
[src]
This method tests for !=
.
impl Eq for ItemKind
[src]
impl Encodable for ItemKind
[src]
impl Decodable for ItemKind
[src]
impl Hash for ItemKind
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more