https://github.com/mintlu8/sidecast
Dynamic cast between trait objects.
https://github.com/mintlu8/sidecast
Last synced: 10 months ago
JSON representation
Dynamic cast between trait objects.
- Host: GitHub
- URL: https://github.com/mintlu8/sidecast
- Owner: mintlu8
- License: apache-2.0
- Created: 2025-08-14T08:33:51.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-14T09:50:19.000Z (11 months ago)
- Last Synced: 2025-08-14T17:03:05.421Z (11 months ago)
- Language: Rust
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# sidecast
Dynamic cast between trait objects.
## Example
```rust
trait Card: SideCast {}
impl_sidecast!(dyn Card);
trait MinionCard: Card {}
trait SpellCard: Card {}
struct MyMinionCard {}
impl Card for MyMinionCard {}
impl MinionCard for MyMinionCard {}
impl_sidecast!(MyMinionCard => (dyn Display, dyn MinionCard, dyn Serialize));
struct MyGenericCard {}
impl_sidecast!([T: Card] MyGenericCard[T] => (dyn Display, dyn MinionCard, dyn Serialize));
```