Remove unwrap statements and return OperationError's
parent: tbd commit: cf491a4
1 | use |
2 | , |
3 | , | PhantomData
4 | str FromStr, |
5 | ; |
6 | |
7 | use Error; |
8 | |
9 | use crate:: |
10 | , |
11 | , | ObjectBackend
12 | , | GiteratedOperation
13 | , |
14 | , |
15 | ; |
16 | |
17 | |
18 | pub use *; |
19 | |
20 | |
21 | |
22 | 'b, |
23 | S: Clone + Send + Sync, |
24 | O: GiteratedObject, |
25 | B: + 'b + Send + Clone, |
26 | > |
27 | pub(crate) inner: O, |
28 | pub(crate) backend: B, |
29 | pub(crate) _marker: , |
30 | |
31 | |
32 | |
33 | Object |
34 | |
35 | |
36 | &self.inner |
37 | |
38 | |
39 | pub unsafe |
40 | Object |
41 | inner: object, |
42 | backend, |
43 | _marker: PhantomData, |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | S: Clone + Send + Sync, |
50 | O: GiteratedObject + Display, |
51 | B: + Send + Sync + Clone, |
52 | > |
53 | |
54 | |
55 | self.inner.fmt |
56 | |
57 | |
58 | |
59 | |
60 | ; |
61 | |
62 | ; |
63 | |
64 | |
65 | |
66 | 'b, |
67 | I: Clone + Send + Sync, |
68 | O: GiteratedObject + Clone + Debug + 'static, |
69 | B: , |
70 | > |
71 | |
72 | pub async |
73 | &mut self, |
74 | operation_state: &I, |
75 | |
76 | let result = self |
77 | .request |
78 | GetValue |
79 | value_name: value_name .to_string, |
80 | , |
81 | operation_state, |
82 | |
83 | .await?; |
84 | |
85 | Ok |
86 | |
87 | |
88 | pub async |
89 | &mut self, |
90 | operation_state: &I, |
91 | |
92 | self.request |
93 | GetSetting |
94 | setting_name: name .to_string, |
95 | , |
96 | operation_state, |
97 | |
98 | .await |
99 | .map |
100 | |
101 | |
102 | pub async |
103 | &mut self, |
104 | setting: S, |
105 | operation_state: &I, |
106 | |
107 | self.request |
108 | SetSetting |
109 | setting_name: name .to_string, |
110 | value: to_value .unwrap, |
111 | , |
112 | operation_state, |
113 | |
114 | .await |
115 | |
116 | |
117 | pub async |
118 | &mut self, |
119 | request: R, |
120 | operation_state: &I, |
121 | |
122 | |
123 | : Clone, | Success
124 | : Clone, | Failure
125 | |
126 | self.backend |
127 | .object_operation |
128 | self.inner.clone, |
129 | , | operation_name
130 | request, |
131 | operation_state, |
132 | |
133 | .await |
134 | |
135 | |
136 |