typed_use_cases 0.1.2

Formalize use cases at the type level. Zero runtime overhead. Experimental proof-of-concept.
Documentation
//! # typed_use_cases
//!
//! **Formalize use cases at the type level. Zero runtime overhead.**
//!
//! A Rust library that brings UML use cases into your type system, providing compile-time
//! awareness when your code structure changes in ways that affect declared use cases.
//!
//! > ⚠️ **Experimental**: This is a proof-of-concept library. It has not been validated in
//! > production environments and should be considered an exploratory tool for representing
//! > use cases in type systems.
//!
//! ## Quick Example
//!
//! ```rust
//! use typed_use_cases::{Actor, Entity, UseCase};
//!
//! // Define actors
//! #[derive(Actor)]
//! struct Authenticated { user_id: u64 }
//!
//! // Define entities
//! #[derive(Entity)]
//! struct Cart { owner: Authenticated, items: Vec<u64> }
//!
//! // Declare a use case
//! trait AddItemToCart: UseCase<
//!     Authenticated,
//!     Cart,
//!     Input = u64,
//!     Output = Cart,
//!     Dependencies = (),
//! > {}
//!
//! // Define your System type (application-specific, not part of this library)
//! struct System;
//!
//! // Implement the use case
//! impl UseCase<Authenticated, Cart> for System {
//!     const NAME: &'static str = "Add item to cart";
//!     const DESCRIPTION: &'static str = "User adds product to their cart";
//!     
//!     type Input = u64;
//!     type Output = Cart;
//!     type Dependencies = ();
//!
//!     fn satisfy(
//!         actor: Authenticated,
//!         mut cart: Cart,
//!         product_id: u64,
//!         _deps: (),
//!     ) -> Cart {
//!         cart.items.push(product_id);
//!         cart
//!     }
//! }
//!
//! impl AddItemToCart for System {}
//!
//! // Verify at compile time (in tests only)
//! # #[cfg(test)]
//! typed_use_cases::implement_all_use_cases!(System: [AddItemToCart]);
//! ```
//!
//! ## What This Library Does
//!
//! - **Formalizes use cases** as named traits in Rust
//! - **Compile-time awareness**: The compiler knows which use cases exist
//! - **Breaking changes are visible**: If you change a method signature, the compiler breaks at the use case level
//! - **Zero runtime overhead**: Uses a zero-sized System type (0 bytes)
//! - **Verification in tests only**: Uses `#[cfg(test)]` to verify implementations
//!
//! ## What This Library Is NOT
//!
//! - ❌ **NOT a verification tool** - Does not prove your program satisfies a use case
//! - ❌ **NOT a testing framework** - Does not test that your system fulfills requirements
//! - ❌ **NOT a formal methods tool** - Does not prove program properties
//! - ❌ **NOT for runtime enforcement** - All verification happens at compile time
//!
//! ## Installation
//!
//! Using cargo:
//!
//! ```bash
//! cargo add typed_use_cases
//! ```
//!
//! Or in `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! typed_use_cases = "0.1"
//! ```
//!
//! ## Core Concepts
//!
//! - [`Actor`] - The initiator of a use case (e.g., `Authenticated`, `Anonymous`)
//! - [`Entity`] - What the use case operates on (e.g., `Cart`, `Order`)
//! - [`DependentEntity`] - An entity owned by a specific actor
//! - [`UseCase`] - The central trait representing an action
//! - [`implement_all_use_cases!`] - Macro to verify all use cases are implemented

pub mod traits;
pub mod macros;

pub use traits::{Actor, Entity, DependentEntity, UseCase};
pub use typed_use_cases_derive::{Actor, Entity};