@@ -119,8 +119,14 @@ enum DecoderImpl<R: Read + Seek> {
119
119
Mp3 ( mp3:: Mp3Decoder < R > ) ,
120
120
#[ cfg( feature = "symphonia" ) ]
121
121
Symphonia ( symphonia:: SymphoniaDecoder , PhantomData < R > ) ,
122
+ // This variant is here just to satisfy the compiler when there are no decoders enabled.
123
+ // It is unreachable and should never be constructed.
124
+ #[ allow( dead_code) ]
125
+ None ( Unreachable , PhantomData < R > ) ,
122
126
}
123
127
128
+ enum Unreachable { }
129
+
124
130
impl < R : Read + Seek > DecoderImpl < R > {
125
131
#[ inline]
126
132
fn next ( & mut self ) -> Option < Sample > {
@@ -135,6 +141,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
135
141
DecoderImpl :: Mp3 ( source) => source. next ( ) ,
136
142
#[ cfg( feature = "symphonia" ) ]
137
143
DecoderImpl :: Symphonia ( source, PhantomData ) => source. next ( ) ,
144
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
138
145
}
139
146
}
140
147
@@ -151,6 +158,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
151
158
DecoderImpl :: Mp3 ( source) => source. size_hint ( ) ,
152
159
#[ cfg( feature = "symphonia" ) ]
153
160
DecoderImpl :: Symphonia ( source, PhantomData ) => source. size_hint ( ) ,
161
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
154
162
}
155
163
}
156
164
@@ -167,6 +175,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
167
175
DecoderImpl :: Mp3 ( source) => source. current_span_len ( ) ,
168
176
#[ cfg( feature = "symphonia" ) ]
169
177
DecoderImpl :: Symphonia ( source, PhantomData ) => source. current_span_len ( ) ,
178
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
170
179
}
171
180
}
172
181
@@ -183,6 +192,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
183
192
DecoderImpl :: Mp3 ( source) => source. channels ( ) ,
184
193
#[ cfg( feature = "symphonia" ) ]
185
194
DecoderImpl :: Symphonia ( source, PhantomData ) => source. channels ( ) ,
195
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
186
196
}
187
197
}
188
198
@@ -199,6 +209,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
199
209
DecoderImpl :: Mp3 ( source) => source. sample_rate ( ) ,
200
210
#[ cfg( feature = "symphonia" ) ]
201
211
DecoderImpl :: Symphonia ( source, PhantomData ) => source. sample_rate ( ) ,
212
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
202
213
}
203
214
}
204
215
@@ -221,6 +232,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
221
232
DecoderImpl :: Mp3 ( source) => source. total_duration ( ) ,
222
233
#[ cfg( feature = "symphonia" ) ]
223
234
DecoderImpl :: Symphonia ( source, PhantomData ) => source. total_duration ( ) ,
235
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
224
236
}
225
237
}
226
238
@@ -237,6 +249,7 @@ impl<R: Read + Seek> DecoderImpl<R> {
237
249
DecoderImpl :: Mp3 ( source) => source. try_seek ( pos) ,
238
250
#[ cfg( feature = "symphonia" ) ]
239
251
DecoderImpl :: Symphonia ( source, PhantomData ) => source. try_seek ( pos) ,
252
+ DecoderImpl :: None ( _, _) => unreachable ! ( ) ,
240
253
}
241
254
}
242
255
}
0 commit comments