mod test2; use std::{fmt::Debug, marker::PhantomData}; use holder::{Holdable, Holder}; fn main() { let mut wrapper = Wrapper:: { value: Token::(PhantomData), _marker: PhantomData, game_state: GameState::Idle, }; let token: &mut Token = wrapper.token_mut(); let token: &Token = wrapper.token(); let game_state: &GameState = wrapper.game_state(); let game_state_mut: &mut GameState = wrapper.game_state_mut(); } #[derive(Holder)] struct Wrapper where T: Debug, { #[hold] value: Token, #[hold(GameStateHolder)] game_state: GameState, _marker: PhantomData, } #[derive(Holdable)] struct Token(PhantomData) where T: Debug; #[derive(Holdable)] enum GameState { Idle, Play, }