strong_type/
lib.rs

1//! This crate offers a derive macro for crafting strong types in Rust, where a strong type
2//! encapsulates a primitive type, providing a distinct, purpose-specific identity. This pattern
3//! is useful for creating distinct types for distinct purposes. Several macro attributes are
4//! provided to customize the strong type, such as directly implementing arithmetic operators of
5//! the underlying primitive type,
6//!
7//! See the [crate documentation](https://crates.io/crates/strong-type) for more details and examples.
8//!
9
10use std::fmt::Debug;
11
12/// Derive macro to create strong types in Rust.
13pub use strong_type_derive::StrongType;
14
15/// Trait for strong types to obtain the associated underlying type and primitive type.
16pub trait StrongType: Debug + PartialEq + PartialOrd + Clone + Default + Send + Sync {
17    type UnderlyingType: Default;
18    type PrimitiveType;
19}