Enum syn::ItemKind
[−]
[src]
pub enum ItemKind {
ExternCrate(Option<Ident>),
Use(Box<ViewPath>),
Static(Box<Ty>, Mutability, Box<Expr>),
Const(Box<Ty>, Box<Expr>),
Fn(Box<FnDecl>, Unsafety, Constness, Option<Abi>, Generics, Box<Block>),
Mod(Option<Vec<Item>>),
ForeignMod(ForeignMod),
Ty(Box<Ty>, Generics),
Enum(Vec<Variant>, Generics),
Struct(VariantData, Generics),
Union(VariantData, Generics),
Trait(Unsafety, Generics, Vec<TyParamBound>, Vec<TraitItem>),
DefaultImpl(Unsafety, Path),
Impl(Unsafety, ImplPolarity, Generics, Option<Path>, Box<Ty>, Vec<ImplItem>),
Mac(Mac),
}Variants
ExternCrate(Option<Ident>)Anextern crate item, with optional original crate name.
E.g. extern crate foo or extern crate foo_bar as foo
Use(Box<ViewPath>)A use declaration (use or pub use) item.
E.g. use foo;, use foo::bar; or use foo::bar as FooBar;
Static(Box<Ty>, Mutability, Box<Expr>)A static item (static or pub static).
E.g. static FOO: i32 = 42; or static FOO: &'static str = "bar";
Const(Box<Ty>, Box<Expr>)A constant item (const or pub const).
E.g. const FOO: i32 = 42;
Fn(Box<FnDecl>, Unsafety, Constness, Option<Abi>, Generics, Box<Block>)A function declaration (fn or pub fn).
E.g. fn foo(bar: usize) -> usize { .. }
Mod(Option<Vec<Item>>)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" {}
Ty(Box<Ty>, Generics)A type alias (type or pub type).
E.g. type Foo = Bar<u8>;
Enum(Vec<Variant>, 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(Unsafety, Generics, Vec<TyParamBound>, Vec<TraitItem>)A Trait declaration (trait or pub trait).
E.g. trait Foo { .. } or trait Foo<T> { .. }
DefaultImpl(Unsafety, Path)Default trait implementation.
E.g. impl Trait for .. {} or impl<T> Trait<T> for .. {}
Impl(Unsafety, ImplPolarity, Generics, Option<Path>, Box<Ty>, Vec<ImplItem>)An implementation.
E.g. impl<A> Foo<A> { .. } or impl<A> Trait for Foo<A> { .. }
Mac(Mac)A macro invocation (which includes macro definition).
E.g. macro_rules! foo { .. } or foo!(..)
Trait Implementations
impl Debug for ItemKind[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
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 Eq for ItemKind[src]
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 !=.