Enum rustc_ap_rustc_ast::ast::ItemKind[][src]

pub enum ItemKind {
Show variants ExternCrate(Option<Symbol>), Use(UseTree), Static(P<Ty>, MutabilityOption<P<Expr>>), Const(DefaultnessP<Ty>, Option<P<Expr>>), Fn(Box<FnKind>), Mod(UnsafeModKind), ForeignMod(ForeignMod), GlobalAsm(InlineAsm), TyAlias(Box<TyAliasKind>), Enum(EnumDefGenerics), Struct(VariantDataGenerics), Union(VariantDataGenerics), Trait(Box<TraitKind>), TraitAlias(GenericsGenericBounds), Impl(Box<ImplKind>), MacCall(MacCall), MacroDef(MacroDef),
}

Variants

ExternCrate(Option<Symbol>)

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(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;.

Fn(Box<FnKind>)

A function declaration (fn).

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

A module declaration (mod).

E.g., mod foo; or mod foo { .. }. unsafe keyword on modules is accepted syntactically for macro DSLs, but not semantically by Rust.

ForeignMod(ForeignMod)

An external module (extern).

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

GlobalAsm(InlineAsm)

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

TyAlias(Box<TyAliasKind>)

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 }.

Trait(Box<TraitKind>)

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(Box<ImplKind>)

An implementation.

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

MacCall(MacCall)

A macro invocation.

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

MacroDef(MacroDef)

A macro definition.

Implementations

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]

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 Debug for ItemKind[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<__D: Decoder> Decodable<__D> for ItemKind[src]

fn decode(__decoder: &mut __D) -> Result<Self, <__D as Decoder>::Error>[src]

impl<__E: Encoder> Encodable<__E> for ItemKind[src]

fn encode(&self, __encoder: &mut __E) -> Result<(), <__E as Encoder>::Error>[src]

impl From<AssocItemKind> for ItemKind[src]

fn from(assoc_item_kind: AssocItemKind) -> ItemKind[src]

Performs the conversion.

impl From<ForeignItemKind> for ItemKind[src]

fn from(foreign_item_kind: ForeignItemKind) -> ItemKind[src]

Performs the conversion.

impl TryFrom<ItemKind> for AssocItemKind[src]

type Error = ItemKind

The type returned in the event of a conversion error.

fn try_from(item_kind: ItemKind) -> Result<AssocItemKind, ItemKind>[src]

Performs the conversion.

impl TryFrom<ItemKind> for ForeignItemKind[src]

type Error = ItemKind

The type returned in the event of a conversion error.

fn try_from(item_kind: ItemKind) -> Result<ForeignItemKind, ItemKind>[src]

Performs the conversion.

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

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

impl<T> Erased for T[src]