forge
Explore
Log in

Don't you dare go Hollow

S1: Format::ALL replaces the list of formats in Reader::new

Browse files at this commit

cd5df0a9bc2e7be9e9de46ae23b91d68afe0e6c2Ahmet Kaan GümüşParent: 93365f3
crates/ec-probe/src/lib.rsmodified+15 -12
@@ -83,6 +83,20 @@ pub enum Format {
83 }83 }
84 84
85 impl Format {85 impl Format {
86+ /// Every format this crate can open.
87+ pub const ALL: [Format; 10] = [
88+ Format::Wav,
89+ Format::Flac,
90+ Format::Mp3,
91+ Format::Adts,
92+ Format::Dts,
93+ Format::Ogg,
94+ Format::Mp4,
95+ Format::Matroska,
96+ Format::Avi,
97+ Format::Amr,
98+ ];
99+
86 /// Short lowercase name for logs and capability tables.100 /// Short lowercase name for logs and capability tables.
87 pub fn name(&self) -> &'static str {101 pub fn name(&self) -> &'static str {
88 match self {102 match self {
@@ -258,18 +272,7 @@ impl Reader {
258 let format = sniff(&head)272 let format = sniff(&head)
259 .or_else(|| {273 .or_else(|| {
260 let hint = hint?.to_ascii_lowercase();274 let hint = hint?.to_ascii_lowercase();
261- [275+ Format::ALL
262- Format::Wav,
263- Format::Flac,
264- Format::Mp3,
265- Format::Adts,
266- Format::Dts,
267- Format::Ogg,
268- Format::Mp4,
269- Format::Matroska,
270- Format::Avi,
271- Format::Amr,
272- ]
273 .into_iter()276 .into_iter()
274 .find(|f| f.extensions().contains(&hint.as_str()))277 .find(|f| f.extensions().contains(&hint.as_str()))
275 })278 })