Skip to content

Commit

Permalink
Document SID container guarantees
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Aug 31, 2023
1 parent 1c9a66d commit 27b6ff3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/type/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,15 @@ pub trait NamedType: Type {
/// A marker trait for compile-time validation of which types can be flattened.
pub trait Flatten: Type {}

/// The Specta ID for the type. Holds for the given properties `T::SID == T::SID`, `T::SID != S::SID` and `Type<T>::SID == Type<S>::SID` (unlike std::any::TypeId)
/// The unique Specta ID for the type.
///
/// Be aware type aliases don't exist as far as Specta is concerned as they are flattened into their inner type by Rust's trait system.
/// The Specta Type ID holds for the given properties:
/// - `T::SID == T::SID`
/// - `T::SID != S::SID`
/// - `Type<T>::SID == Type<S>::SID` (unlike std::any::TypeId)
/// - `Box<T> == Arc<T> == Rc<T>` (unlike std::any::TypeId)
///
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[doc(hidden)]
pub struct TypeSid(u64);
Expand Down

0 comments on commit 27b6ff3

Please sign in to comment.