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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
use std::num::ParseIntError;
use strum_macros::{EnumString, IntoStaticStr};
use thiserror::Error;
use crate::helper::macros::verbose_error_to_error;
#[derive(Debug, Error)]
#[error(transparent)]
pub struct ParseError(#[from] ParseHitObjectError);
#[derive(Debug, Error)]
#[error("Expected combo skip count to be 3 bits")]
pub struct ComboSkipCountTooHigh;
#[derive(Debug, Error, IntoStaticStr, EnumString)]
#[non_exhaustive]
pub enum ParseColonSetError {
#[error("Failed to parse the first item")]
InvalidFirstItem,
#[error("The colon separator is missing")]
MissingSeparator,
#[error("Failed to parse the second item")]
InvalidSecondItem,
}
verbose_error_to_error!(ParseColonSetError);
#[derive(Debug, Error, EnumString, IntoStaticStr)]
#[non_exhaustive]
pub enum ParseHitObjectError {
#[error("Invalid `hit_sound` value")]
InvalidHitSound,
#[error("Missing `hit_sound` field")]
MissingHitSound,
#[error("Missing `hit_sample` field")]
MissingHitSample,
#[error("Invalid `hit_sample` value")]
InvalidHitSample,
#[error("Invalid `x` value")]
InvalidX,
#[error("Missing `x` field")]
MissingX,
#[error("Invalid `y` value")]
InvalidY,
#[error("Missing `y` field")]
MissingY,
#[error("Missing `obj_type` field")]
MissingObjType,
#[error("Invalid `obj_type` value")]
InvalidObjType,
#[error("Missing `time` field")]
MissingTime,
#[error("Invalid `time` value")]
InvalidTime,
#[error("Invalid `curve_type` value")]
InvalidCurveType,
#[error("Missing `curve_type` field")]
MissingCurveType,
#[error("Invalid `curve_point` value")]
InvalidCurvePoint,
#[error("Missing `curve_point` field")]
MissingCurvePoint,
#[error("Invalid `edge_sound` value")]
InvalidEdgeSound,
#[error("Missing `edge_sound` field")]
MissingEdgeSound,
#[error("Invalid `edge_set` value")]
InvalidEdgeSet,
#[error("Missing `edge_set` field")]
MissingEdgeSet,
#[error("Invalid `slides_count` value")]
InvalidSlidesCount,
#[error("Missing `slides_count` field")]
MissingSlidesCount,
#[error("Invalid `length` value")]
InvalidLength,
#[error("Missing `length` field")]
MissingLength,
#[error("Invalid `end_time` value")]
InvalidEndTime,
#[error("Missing `end_time` field")]
MissingEndTime,
#[error("Unknown object type")]
UnknownObjType,
}
verbose_error_to_error!(ParseHitObjectError);
#[derive(Debug, Error, EnumString, IntoStaticStr)]
#[non_exhaustive]
pub enum ParseHitSampleError {
#[error("Invalid `sample_set` value")]
InvalidSampleSet,
#[error("Invalid `index` value")]
InvalidIndex,
#[error("Invalid `volume` value")]
InvalidVolume,
#[error("Missing field separator")]
MissingSeparator,
}
verbose_error_to_error!(ParseHitSampleError);
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ParseSampleSetError {
#[error("There was a problem parsing the `str` into an integer first")]
ParseValueError(#[from] ParseIntError),
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum VolumeSetError {
#[error("The volume was too high, expected to be in range 1 ~ 100")]
VolumeTooHigh,
#[error("The volume was attempted to set to 0, expected to be in range 1 ~ 100")]
VolumeTooLow,
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ParseVolumeError {
#[error(transparent)]
VolumeSetError(#[from] VolumeSetError),
#[error(transparent)]
ParseIntError(#[from] ParseIntError),
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ParseCurveTypeError {
#[error("Unknown `CurveType` variant")]
UnknownVariant,
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ParseHitSoundError {
#[error(transparent)]
ParseIntError(#[from] ParseIntError),
}