1 unstable release
Uses new Rust 2024
| 0.0.1 | Aug 10, 2025 |
|---|
#31 in #anonymous
10KB
178 lines
ags
Anonymous generic struct for rust.
Use Cases
Primarily used for types that are meant to be immediately type erased. For instance:
#[ags::anonymous_generic_struct]
struct CardTemplate {
pub name: impl AsRef<str>,
pub cost: impl CardCost,
pub on_play: impl CardOnPlay,
}
#[ags::anonymous_generic_struct]
impl Card for CardTemplate {
..
}
pub fn create_card() -> Box<dyn Card> {
Box::new(CardTemplate {
..
})
}
Dependencies
~160–570KB
~14K SLoC