crate_paths_cli_core/
item_kind.rs

1use serde::{Deserialize, Serialize};
2use strum::{Display, EnumIter};
3
4/// yanked from rustdoc-types (0.56.0)
5/// because i needed to derive strum on it
6#[derive(Clone, Copy, Debug, Deserialize, Display, EnumIter, Eq, Hash, PartialEq, Serialize)]
7#[serde(rename_all = "snake_case")]
8#[strum(serialize_all = "snake_case")]
9pub enum ItemKind {
10    /// A module declaration, e.g. `mod foo;` or `mod foo {}`
11    Module,
12    /// A crate imported via the `extern crate` syntax.
13    ExternCrate,
14    /// An import of 1 or more items into scope, using the `use` keyword.
15    Use,
16    /// A `struct` declaration.
17    Struct,
18    /// A field of a struct.
19    StructField,
20    /// A `union` declaration.
21    Union,
22    /// An `enum` declaration.
23    Enum,
24    /// A variant of a enum.
25    Variant,
26    /// A function declaration, e.g. `fn f() {}`
27    Function,
28    /// A type alias declaration, e.g. `type Pig = std::borrow::Cow<'static, str>;`
29    TypeAlias,
30    /// The declaration of a constant, e.g. `const GREETING: &str = "Hi :3";`
31    Constant,
32    /// A `trait` declaration.
33    Trait,
34    /// A trait alias declaration, e.g. `trait Int = Add + Sub + Mul + Div;`
35    ///
36    /// See [the tracking issue](https://github.com/rust-lang/rust/issues/41517)
37    TraitAlias,
38    /// An `impl` block.
39    Impl,
40    /// A `static` declaration.
41    Static,
42    /// `type`s from an `extern` block.
43    ///
44    /// See [the tracking issue](https://github.com/rust-lang/rust/issues/43467)
45    ExternType,
46    /// A macro declaration.
47    ///
48    /// Corresponds to either `ItemEnum::Macro(_)`
49    /// or `ItemEnum::ProcMacro(ProcMacro { kind: MacroKind::Bang })`
50    Macro,
51    /// A procedural macro attribute.
52    ///
53    /// Corresponds to `ItemEnum::ProcMacro(ProcMacro { kind: MacroKind::Attr })`
54    ProcAttribute,
55    /// A procedural macro usable in the `#[derive()]` attribute.
56    ///
57    /// Corresponds to `ItemEnum::ProcMacro(ProcMacro { kind: MacroKind::Derive })`
58    ProcDerive,
59    /// An associated constant of a trait or a type.
60    AssocConst,
61    /// An associated type of a trait or a type.
62    AssocType,
63    /// A primitive type, e.g. `u32`.
64    ///
65    /// [`Item`]s of this kind only come from the core library.
66    Primitive,
67    /// A keyword declaration.
68    ///
69    /// [`Item`]s of this kind only come from the come library and exist solely
70    /// to carry documentation for the respective keywords.
71    Keyword,
72    /// An attribute declaration.
73    ///
74    /// [`Item`]s of this kind only come from the core library and exist solely
75    /// to carry documentation for the respective builtin attributes.
76    Attribute,
77}