feat(IconInfo): add mime_type method
This commit is contained in:
parent
1d3fd63754
commit
dcc865ba8e
3 changed files with 12 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1638,7 +1638,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "site_icons"
|
name = "site_icons"
|
||||||
version = "0.4.11"
|
version = "0.4.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"clap",
|
"clap",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "site_icons"
|
name = "site_icons"
|
||||||
version = "0.4.11"
|
version = "0.4.12"
|
||||||
authors = ["Sam Denty <sam@samdenty.com>"]
|
authors = ["Sam Denty <sam@samdenty.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
|
|
|
@ -160,6 +160,16 @@ impl IconInfo {
|
||||||
IconInfo::SVG => None,
|
IconInfo::SVG => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mime_type(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
IconInfo::PNG { .. } => "image/png",
|
||||||
|
IconInfo::JPEG { .. } => "image/jpeg",
|
||||||
|
IconInfo::ICO { .. } => "image/x-icon",
|
||||||
|
IconInfo::GIF { .. } => "image/gif",
|
||||||
|
IconInfo::SVG => "image/svg+xml",
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for IconInfo {
|
impl Display for IconInfo {
|
||||||
|
|
Reference in a new issue