[][src]Enum rustc_ap_syntax::ast::ItemKind

pub enum ItemKind {
    ExternCrate(Option<Name>),
    Use(P<UseTree>),
    Static(P<Ty>, MutabilityOption<P<Expr>>),
    Const(DefaultnessP<Ty>, Option<P<Expr>>),
    Fn(DefaultnessFnSigGenericsOption<P<Block>>),
    Mod(Mod),
    ForeignMod(ForeignMod),
    GlobalAsm(P<GlobalAsm>),
    TyAlias(DefaultnessGenericsGenericBoundsOption<P<Ty>>),
    Enum(EnumDefGenerics),
    Struct(VariantDataGenerics),
    Union(VariantDataGenerics),
    Trait(IsAutoUnsafeGenericsGenericBoundsVec<P<AssocItem>>),
    TraitAlias(GenericsGenericBounds),
    Impl {
        unsafety: Unsafe,
        polarity: ImplPolarity,
        defaultness: Defaultness,
        constness: Const,
        generics: Generics,
        of_trait: Option<TraitRef>,
        self_ty: P<Ty>,
        items: Vec<P<AssocItem>>,
    },
    Mac(Mac),
    MacroDef(MacroDef),
}

Variants

ExternCrate(Option<Name>)

An extern crate item, with the optional original crate name if the crate was renamed.

E.g., extern crate foo or extern crate foo_bar as foo.

Use(P<UseTree>)

A use declaration item (use).

E.g., use foo;, use foo::bar; or use foo::bar as FooBar;.

Static(P<Ty>, MutabilityOption<P<Expr>>)

A static item (static).

E.g., static FOO: i32 = 42; or static FOO: &'static str = "bar";.

Const(DefaultnessP<Ty>, Option<P<Expr>>)

A constant item (const).

E.g., const FOO: i32 = 42;.

A function declaration (fn).

E.g., fn foo(bar: usize) -> usize { .. }.

Mod(Mod)

A module declaration (mod).

E.g., mod foo; or mod foo { .. }.

ForeignMod(ForeignMod)

An external module (extern).

E.g., extern {} or extern "C" {}.

GlobalAsm(P<GlobalAsm>)

Module-level inline assembly (from global_asm!()).

A type alias (type).

E.g., type Foo = Bar<u8>;.

An enum definition (enum).

E.g., enum Foo<A, B> { C<A>, D<B> }.

A struct definition (struct).

E.g., struct Foo<A> { x: A }.

A union definition (union).

E.g., union Foo<A, B> { x: A, y: B }.

A trait declaration (trait).

E.g., trait Foo { .. }, trait Foo<T> { .. } or auto trait Foo {}.

TraitAlias(GenericsGenericBounds)

Trait alias

E.g., trait Foo = Bar + Quux;.

Impl

An implementation.

E.g., impl<A> Foo<A> { .. } or impl<A> Trait for Foo<A> { .. }.

Fields of Impl

unsafety: Unsafepolarity: ImplPolaritydefaultness: Defaultnessconstness: Constgenerics: Genericsof_trait: Option<TraitRef>

The trait being implemented, if any.

self_ty: P<Ty>items: Vec<P<AssocItem>>
Mac(Mac)

A macro invocation.

E.g., foo!(..).

MacroDef(MacroDef)

A macro definition.

Methods

impl ItemKind[src]

pub fn article(&self) -> &str[src]

pub fn descr(&self) -> &str[src]

pub fn generics(&self) -> Option<&Generics>[src]

Trait Implementations

impl Clone for ItemKind[src]

impl Debug for ItemKind[src]

impl Decodable for ItemKind[src]

impl Encodable for ItemKind[src]

Auto Trait Implementations

impl !RefUnwindSafe for ItemKind

impl !Send for ItemKind

impl !Sync for ItemKind

impl Unpin for ItemKind

impl !UnwindSafe for ItemKind

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<E> SpecializationError for E[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.