Skip to content

Commit a51ec77

Browse files
committed
v0.57.1
1 parent 013e0ef commit a51ec77

4 files changed

Lines changed: 50 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
<a name="v0.57.1"></a>
2+
# [v0.57.1](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.57.1) - 2026-03-04
3+
4+
5+
**New Method**: Add `ItemEnum::ItemKind` method
6+
([rust#153279](https://github.com/rust-lang/rust/pull/153279)).
7+
8+
**Packaging Improvement**: Don't package development scripts
9+
([#56](https://github.com/rust-lang/rustdoc-types/pull/56)).
10+
11+
12+
- Format Version: 57
13+
- Upstream Commit: [`931e2c4e43fde6a308ee9933538142ed0927f6d9`](https://github.com/rust-lang/rust/commit/931e2c4e43fde6a308ee9933538142ed0927f6d9)
14+
- Diff: [v0.57.0...v0.57.1](https://github.com/rust-lang/rustdoc-types/compare/v0.57.0...v0.57.1)
15+
116
<a name="v0.57.0"></a>
217
# [v0.57.0](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.57.0) - 2025-11-22
318

COMMIT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
361af821ab169a98e9fc1db5d3a57978504ed379
1+
931e2c4e43fde6a308ee9933538142ed0927f6d9

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustdoc-types"
3-
version = "0.57.0"
3+
version = "0.57.1"
44
edition = "2018"
55
license = "MIT OR Apache-2.0"
66
description = "Types for rustdoc's json output"

src/lib.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,39 @@ pub enum ItemEnum {
681681
},
682682
}
683683

684+
impl ItemEnum {
685+
/// Returns the [`ItemKind`] of this item.
686+
pub fn item_kind(&self) -> ItemKind {
687+
match self {
688+
ItemEnum::Module(_) => ItemKind::Module,
689+
ItemEnum::ExternCrate { .. } => ItemKind::ExternCrate,
690+
ItemEnum::Use(_) => ItemKind::Use,
691+
ItemEnum::Union(_) => ItemKind::Union,
692+
ItemEnum::Struct(_) => ItemKind::Struct,
693+
ItemEnum::StructField(_) => ItemKind::StructField,
694+
ItemEnum::Enum(_) => ItemKind::Enum,
695+
ItemEnum::Variant(_) => ItemKind::Variant,
696+
ItemEnum::Function(_) => ItemKind::Function,
697+
ItemEnum::Trait(_) => ItemKind::Trait,
698+
ItemEnum::TraitAlias(_) => ItemKind::TraitAlias,
699+
ItemEnum::Impl(_) => ItemKind::Impl,
700+
ItemEnum::TypeAlias(_) => ItemKind::TypeAlias,
701+
ItemEnum::Constant { .. } => ItemKind::Constant,
702+
ItemEnum::Static(_) => ItemKind::Static,
703+
ItemEnum::ExternType => ItemKind::ExternType,
704+
ItemEnum::Macro(_) => ItemKind::Macro,
705+
ItemEnum::ProcMacro(pm) => match pm.kind {
706+
MacroKind::Bang => ItemKind::Macro,
707+
MacroKind::Attr => ItemKind::ProcAttribute,
708+
MacroKind::Derive => ItemKind::ProcDerive,
709+
},
710+
ItemEnum::Primitive(_) => ItemKind::Primitive,
711+
ItemEnum::AssocConst { .. } => ItemKind::AssocConst,
712+
ItemEnum::AssocType { .. } => ItemKind::AssocType,
713+
}
714+
}
715+
}
716+
684717
/// A module declaration, e.g. `mod foo;` or `mod foo {}`.
685718
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
686719
pub struct Module {

0 commit comments

Comments
 (0)