summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2024-01-22 23:30:53 -0500
committerHubert Figuière <hub@figuiere.net>2024-01-22 23:30:53 -0500
commitb176088cd324491cff681ff71a69fbc880a88c6d (patch)
tree16f6906830c7774100b9e6924dceb29c1f4e3dd2
parent48ddf4ef32a0bdffd21755d3498d79e505bf75a8 (diff)
api: Added mime_types()
Signed-off-by: Hubert Figuière <hub@figuiere.net>
-rw-r--r--src/identify.rs16
-rw-r--r--src/lib.rs2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/identify.rs b/src/identify.rs
index 76cc484..1c64db2 100644
--- a/src/identify.rs
+++ b/src/identify.rs
@@ -24,6 +24,8 @@
use std::collections::HashMap;
use std::io::{Read, Seek, SeekFrom};
+use once_cell::sync::Lazy;
+
use super::{Error, Result, Type};
use crate::fujifilm;
use crate::io::View;
@@ -80,6 +82,20 @@ lazy_static::lazy_static! {
);
}
+static MIME_TYPES: Lazy<Vec<String>> = Lazy::new(|| {
+ crate::identify::TYPE_MIME
+ .iter()
+ .filter_map(|(_, m)| {
+ Some(String::from(*m))
+ })
+ .collect()
+});
+
+/// Return the list of supported mimetypes
+pub fn mime_types() -> &'static [String] {
+ &MIME_TYPES
+}
+
/// Get the mime type associated for the file.
pub(crate) fn mime_for_type(type_: Type) -> Option<&'static str> {
TYPE_TO_MIME.get(&type_).copied()
diff --git a/src/lib.rs b/src/lib.rs
index a33eab5..ae31ba2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -335,6 +335,8 @@ static EXTENSIONS: Lazy<Vec<String>> = Lazy::new(|| {
.collect()
});
+pub use crate::identify::mime_types;
+
/// Return the extensions for raw files (in lowercase).
pub fn extensions() -> &'static [String] {
&EXTENSIONS