tauri_plugin_android_fs/models/
image.rs1use serde::{Deserialize, Serialize};
2
3
4#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
5pub struct Size {
6 pub width: u32,
7 pub height: u32
8}
9
10#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)]
11#[non_exhaustive]
12pub enum ImageFormat {
13
14 Png,
17
18 Jpeg,
21
22 Webp,
25
26 JpegWith {
29
30 quality: f32
34 },
35
36 WebpWith {
39
40 quality: f32
44 }
45}
46
47#[allow(unused)]
48impl ImageFormat {
49
50 pub(crate) fn mime_type(&self) -> &'static str {
51 match self {
52 ImageFormat::Jpeg | ImageFormat::JpegWith { .. } => "image/jpeg",
53 ImageFormat::Webp | ImageFormat::WebpWith { .. } => "image/webp",
54 ImageFormat::Png => "image/png",
55 }
56 }
57}