1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
use serde::Serialize; use serde::Deserialize; use std::fmt; #[derive(Serialize, Deserialize)] pub struct Config { pub word_list: Vec<String>, pub urls: Vec<String> } impl Config { pub fn new(words: Vec<String>, urls: Vec<String>) -> Self { Config { word_list: words, urls: urls } } } #[derive(Debug)] pub struct Item { pub name: String, pub producer: String, pub mass: String, pub more_info: String, pub stammispris: bool, pub frozen: bool, pub deal: String } impl Item { pub fn new( name: String, producer: String, mass: String, more_info: String, thing: (bool, bool, String) ) -> Self { Item { name: name, producer: producer, mass: mass, more_info: more_info, stammispris: thing.0, frozen: thing.1, deal: thing.2 } } } impl fmt::Display for Item { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(&self.deal)?; Ok(()) } }