// edition:2021 // check-pass use std::collections::HashMap; use std::future::Future; use std::pin::Pin; pub struct GameMode {} struct GameStateManager<'a> { gamestate_stack: Vec + 'a>>, } pub trait GameState<'a> {} async fn construct_gamestate_replay<'a>( _gamemode: &GameMode, _factory: &mut GameStateManager<'a>, ) -> Box + 'a> { unimplemented!() } type FutureGameState<'a, 'b> = Pin + 'a>> + 'b>>; struct MenuOption<'a> { command: Box Fn(&'b mut GameStateManager<'a>) -> FutureGameState<'a, 'b> + 'a>, } impl<'a> MenuOption<'a> { fn new( _command: impl for<'b> Fn(&'b mut GameStateManager<'a>) -> FutureGameState<'a, 'b> + 'a, ) -> Self { unimplemented!() } } struct MenuState<'a> { options: Vec>, } impl<'a> GameState<'a> for MenuState<'a> {} pub async fn get_replay_menu<'a>( gamemodes: &'a HashMap<&str, GameMode>, ) -> Box + 'a> { let recordings: Vec = vec![]; let _ = recordings .into_iter() .map(|entry| { MenuOption::new(move |f| { Box::pin(construct_gamestate_replay(&gamemodes[entry.as_str()], f)) }) }) .collect::>(); todo!() } fn main() {}