anitomy_ng/options.rs
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5//! Port of `include/anitomy/options.hpp`.
6
7/// Declares [`Options`] and its `Default` from one field list, so the fields
8/// and their (all-`true`) defaults can't fall out of sync. The bindings
9/// (`anitomy-py`, `anitomy-js`) mirror this same field list; keep them aligned.
10macro_rules! options {
11 ($($field:ident),+ $(,)?) => {
12 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
13 pub struct Options {
14 $(pub $field: bool),+
15 }
16
17 impl Default for Options {
18 fn default() -> Self {
19 Options {
20 $($field: true),+
21 }
22 }
23 }
24 };
25}
26
27options! {
28 parse_episode,
29 parse_episode_title,
30 parse_file_checksum,
31 parse_file_extension,
32 parse_part,
33 parse_release_group,
34 parse_season,
35 parse_title,
36 parse_video_resolution,
37 parse_year,
38}