Skip to content

Commit dab435b

Browse files
committed
v0.57.2
1 parent 37c2500 commit dab435b

4 files changed

Lines changed: 61 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
<a name="v0.57.2"></a>
2+
# [v0.57.2](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.57.2) - 2026-03-12
3+
4+
**New Feature**: Add the `rkyv_0_8` Cargo feature, to derive traits for the [rkyv](https://rkyv.org/) zero-copy deserialization framework
5+
([rust#153283](https://github.com/rust-lang/rust/pull/153283)).
6+
7+
- Format Version: 57
8+
- Upstream Commit: [`cf951bae8758e387dcc2b2480ccd971cd6a15972`](https://github.com/rust-lang/rust/commit/cf951bae8758e387dcc2b2480ccd971cd6a15972)
9+
- Diff: [v0.57.1...v0.57.2](https://github.com/rust-lang/rustdoc-types/compare/v0.57.1...v0.57.2)
10+
111
<a name="v0.57.1"></a>
212
# [v0.57.1](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.57.1) - 2026-03-04
313

COMMIT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1d81c5021a21453e77ca2a0cd7f2a8006e9775ae
1+
cf951bae8758e387dcc2b2480ccd971cd6a15972

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.1"
3+
version = "0.57.2"
44
edition = "2018"
55
license = "MIT OR Apache-2.0"
66
description = "Types for rustdoc's json output"

src/lib.rs

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@
1919
//! ## `rkyv_0_8`
2020
//!
2121
//! We expose a `rkyv_0_8` feature, disabled by default. When enabled, it derives `rkyv`'s
22-
//! [`Archive`](rkyv::Archive), [`Serialize`](rkyv::Serialize) and [`Deserialize`](rkyv::Deserialize)
23-
//! traits for all types in this crate. Furthermore, it exposes the corresponding `Archived*` types
24-
//! (e.g. [`ArchivedId`] for [`Id`]).
22+
//! [`Archive`][3], [`Serialize`][4] and [`Deserialize`][5] traits for all types in this crate.
23+
//! Furthermore, it exposes the corresponding `Archived*` types (e.g. `ArchivedId` for [`Id`]).
2524
//!
2625
//! `rkyv` lets you works with JSON output without paying the deserialization cost _upfront_,
27-
//! thanks to [zero-copy deserialization][3].
26+
//! thanks to [zero-copy deserialization][6].
2827
//! You can perform various types of analyses on the `Archived*` version of the relevant types,
2928
//! incurring the full deserialization cost only for the subset of items you actually need.
3029
//!
3130
//! [1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types/near/474855731
3231
//! [2]: https://crates.io/crates/rustc-hash
33-
//! [3]: https://rkyv.org/zero-copy-deserialization.html
32+
//! [3]: https://docs.rs/rkyv/0.8.15/rkyv/trait.Archive.html
33+
//! [4]: https://docs.rs/rkyv/0.8.15/rkyv/trait.Serialize.html
34+
//! [5]: https://docs.rs/rkyv/0.8.15/rkyv/trait.Deserialize.html
35+
//! [6]: https://rkyv.org/zero-copy-deserialization.html
3436
3537
// # On `rkyv` Derives
3638
//
@@ -827,6 +829,45 @@ pub enum ItemEnum {
827829
},
828830
}
829831

832+
impl ItemEnum {
833+
/// Get just the kind of this item, but with no further data.
834+
///
835+
/// ```rust
836+
/// # use rustdoc_json_types::{ItemKind, ItemEnum};
837+
/// let item = ItemEnum::ExternCrate { name: "libc".to_owned(), rename: None };
838+
/// assert_eq!(item.item_kind(), ItemKind::ExternCrate);
839+
/// ```
840+
pub fn item_kind(&self) -> ItemKind {
841+
match self {
842+
ItemEnum::Module(_) => ItemKind::Module,
843+
ItemEnum::ExternCrate { .. } => ItemKind::ExternCrate,
844+
ItemEnum::Use(_) => ItemKind::Use,
845+
ItemEnum::Union(_) => ItemKind::Union,
846+
ItemEnum::Struct(_) => ItemKind::Struct,
847+
ItemEnum::StructField(_) => ItemKind::StructField,
848+
ItemEnum::Enum(_) => ItemKind::Enum,
849+
ItemEnum::Variant(_) => ItemKind::Variant,
850+
ItemEnum::Function(_) => ItemKind::Function,
851+
ItemEnum::Trait(_) => ItemKind::Trait,
852+
ItemEnum::TraitAlias(_) => ItemKind::TraitAlias,
853+
ItemEnum::Impl(_) => ItemKind::Impl,
854+
ItemEnum::TypeAlias(_) => ItemKind::TypeAlias,
855+
ItemEnum::Constant { .. } => ItemKind::Constant,
856+
ItemEnum::Static(_) => ItemKind::Static,
857+
ItemEnum::ExternType => ItemKind::ExternType,
858+
ItemEnum::Macro(_) => ItemKind::Macro,
859+
ItemEnum::ProcMacro(pm) => match pm.kind {
860+
MacroKind::Bang => ItemKind::Macro,
861+
MacroKind::Attr => ItemKind::ProcAttribute,
862+
MacroKind::Derive => ItemKind::ProcDerive,
863+
},
864+
ItemEnum::Primitive(_) => ItemKind::Primitive,
865+
ItemEnum::AssocConst { .. } => ItemKind::AssocConst,
866+
ItemEnum::AssocType { .. } => ItemKind::AssocType,
867+
}
868+
}
869+
}
870+
830871
/// A module declaration, e.g. `mod foo;` or `mod foo {}`.
831872
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
832873
#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
@@ -982,10 +1023,10 @@ pub enum VariantKind {
9821023
/// }
9831024
/// ```
9841025
Struct {
985-
/// The list of variants in the enum.
986-
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::Variant`].
1026+
/// The list of named fields in the variant.
1027+
/// All of the corresponding [`Item`]s are of kind [`ItemEnum::StructField`].
9871028
fields: Vec<Id>,
988-
/// Whether any variants have been removed from the result, due to being private or hidden.
1029+
/// Whether any fields have been removed from the result, due to being private or hidden.
9891030
has_stripped_fields: bool,
9901031
},
9911032
}

0 commit comments

Comments
 (0)