use serde_json::Result; use std::{alloc::Layout, fs}; #[allow(non_snake_case)] pub mod CAHd_game; use crate::CAHd_game::*; /// Parse json for card data fn load_json(path: &str) -> Result> { let data: String = fs::read_to_string(path).expect("Error reading file"); let jayson: Vec = serde_json::from_str(&data)?; Ok(jayson) } fn main() -> Result<()> { // choose decks let cards_input_path: &str = "data/cah-cards-full.json"; let cards_json: Vec = load_json(cards_input_path)?; // create game with/for player 0 let game = CAHGame::new( CAHPlayer { player_name: "Adam".to_string(), role: PlayerRole::Host, white: vec![], black: vec![], }, cards_json, ); println!("{:#?}", game?.players[0]); Ok(()) }