android_manifest/resources/
types.rs1use super::ResourceType;
2use std::str::FromStr;
3
4#[derive(Debug, PartialEq, Eq, Clone)]
6pub struct StringResource;
7
8impl FromStr for StringResource {
9 type Err = String;
10
11 fn from_str(s: &str) -> Result<Self, Self::Err> {
12 if s == "string" {
13 Ok(StringResource)
14 } else {
15 Err(format!("failed to convert {} to string recource type", s))
16 }
17 }
18}
19
20impl ResourceType for StringResource {
21 fn resource_type() -> &'static str {
22 "string"
23 }
24}
25
26#[derive(Debug, PartialEq, Eq, Clone)]
28pub struct DrawableResource;
29
30impl FromStr for DrawableResource {
31 type Err = String;
32
33 fn from_str(s: &str) -> Result<Self, Self::Err> {
34 if s == "drawable" {
35 Ok(DrawableResource)
36 } else {
37 Err(format!("failed to convert {} to drawable resource type", s))
38 }
39 }
40}
41
42impl ResourceType for DrawableResource {
43 fn resource_type() -> &'static str {
44 "drawable"
45 }
46}
47
48#[derive(Debug, PartialEq, Eq, Clone)]
50pub struct MipmapResource;
51
52impl FromStr for MipmapResource {
53 type Err = String;
54
55 fn from_str(s: &str) -> Result<Self, Self::Err> {
56 if s == "mipmap" {
57 Ok(MipmapResource)
58 } else {
59 Err(format!("failed to convert {} to mipmap resource type", s))
60 }
61 }
62}
63
64impl ResourceType for MipmapResource {
65 fn resource_type() -> &'static str {
66 "mipmap"
67 }
68}
69
70#[derive(Debug, PartialEq, Eq, Clone)]
72pub struct XmlResource;
73
74impl FromStr for XmlResource {
75 type Err = String;
76
77 fn from_str(s: &str) -> Result<Self, Self::Err> {
78 if s == "xml" {
79 Ok(XmlResource)
80 } else {
81 Err(format!("failed to convert {} to xml resource type", s))
82 }
83 }
84}
85
86impl ResourceType for XmlResource {
87 fn resource_type() -> &'static str {
88 "xml"
89 }
90}
91
92#[derive(Debug, PartialEq, Eq, Clone)]
94pub struct StyleResource;
95
96impl FromStr for StyleResource {
97 type Err = String;
98
99 fn from_str(s: &str) -> Result<Self, Self::Err> {
100 if s == "style" {
101 Ok(StyleResource)
102 } else {
103 Err(format!("failed to convert {} to style resource type", s))
104 }
105 }
106}
107
108impl ResourceType for StyleResource {
109 fn resource_type() -> &'static str {
110 "style"
111 }
112}