SHARE
TWEET

Untitled

a guest Jan 20th, 2020 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #[derive(Serialize, Deserialize, Debug)]
  2. pub struct Ability {
  3.     name: String,
  4.     consume: HashMap<String, u16>,
  5.     drain: bool,
  6.     copy: bool,
  7.     npc: bool,
  8.     trade: bool,
  9. //    requirements: HashMap<String, AbilityRequirement>,
  10. }
  11.  
  12. //#[derive(Serialize, Deserialize, Debug)]
  13. pub Abilities: Vec<Ability>;
  14.  
  15. impl Abilities {
  16.     pub fn read(file: String) -> Result<Ability, Box<Error>>{
  17.         let path = Path::new(&file);
  18.         let file = File::open(path)?;
  19.         let reader = BufReader::new(file);
  20.         let abilities = serde_json::from_reader(reader)?;
  21.  
  22.         Ok(abilities)
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top