Dynasty 🏰
Dynasty is a powerful inheritance system for Rust, designed specifically for game engines and complex application architectures. It provides a natural class-based inheritance model while maintaining Rust's safety guarantees and performance characteristics.
Features ✨
- Safe Inheritance: Implement class hierarchies with compile-time safety guarantees
- Runtime Type Information: Robust RTTI system for type checking and reflection
- Smart Downcasting: Safe and ergonomic downcasting between types in the hierarchy
- Reflection API: Optional reflection system for runtime introspection
- Serialization Support: Optional integration with serde for serialization
- Zero-Cost Abstractions: Most features compile away to zero overhead
- Game Engine Ready: Designed for high-performance game development scenarios
Quick Start 🚀
Add Dynasty to your Cargo.toml:
[]
= "0.1.0"
Create your class hierarchy:
use *;
// Define a base class
// Create a derived class
// Multiple levels of inheritance
Advanced Features 🛠️
Reflection
Enable the reflection feature to access runtime type information:
[]
= { = "0.1.0", = ["reflection"] }
use *;
// Implement reflection
Serialization
Enable serialization support:
[]
= { = "0.1.0", = ["serialization"] }
use *;
use ;
Project Structure 📁
Dynasty is organized as a workspace with two main crates:
dynasty: The core runtime library providing the inheritance systemdynasty-macros: Procedural macros for the derive and attribute implementations
Performance 🚄
Dynasty is designed with performance in mind:
- Zero-cost abstractions for most features
- Compile-time resolution of inheritance relationships
- Minimal runtime overhead for type checking
- Efficient virtual dispatch using Rust's trait system
Examples 📚
Check out these examples to see Dynasty in action:
Component System
use *;
Event System
use *;
Contributing 🤝
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
To get started:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License 📝
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Acknowledgments 🙏
- Built with and for the Rust community
- Special thanks to all contributors
Built with ❤️ by Tristan J. Poland