deepwoken_reqparse/model/opt.rs
1use std::collections::HashSet;
2
3use crate::{req::Requirement, model::req::Timing};
4
5/// Represents a group of requirements that are optional, but will be
6/// either all acquired or all not
7#[derive(Clone, Default, Debug)]
8pub struct OptionalGroup {
9 pub general: HashSet<Requirement>,
10 pub post: HashSet<Requirement>,
11
12 pub weight: i64
13}
14
15impl OptionalGroup {
16 pub fn get_set(&mut self, timing: Timing) -> &mut HashSet<Requirement> {
17 match timing {
18 Timing::Free => &mut self.general,
19 Timing::Post => &mut self.post,
20 }
21 }
22}