Skip to content

Commit 3bf7264

Browse files
committed
rustdoc-json-types: Document Id
1 parent 0e682e9 commit 3bf7264

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/rustdoc-json-types/lib.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,19 @@ pub enum TypeBindingKind {
188188
Constraint(Vec<GenericBound>),
189189
}
190190

191-
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
191+
/// An opaque identifier for an item.
192+
///
193+
/// It can be used to lookup in [Crate::index] or [Crate::paths] to resolve it
194+
/// to an [Item].
195+
///
196+
/// Id's are only valid within a single JSON blob. They cannot be used to
197+
/// resolve references between the JSON output's for different crates.
198+
///
199+
/// Rustdoc makes no guarantees about the inner value of Id's. Applications
200+
/// should treat them as opaque keys to lookup items, and avoid attempting
201+
/// to parse them, or otherwise really on implementation details.
202+
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
203+
// FIXME(aDotInTheVoid): Consider making this non-public in rustdoc-types.
192204
pub struct Id(pub String);
193205

194206
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]

0 commit comments

Comments
 (0)