1#[derive(Clone, Debug, Eq, PartialEq)]
3pub enum BaseDirectory {
4 Resource,
5 Data,
6 Cache,
7 Temp,
8}
9impl ::tuffite::__private::serde::Serialize for BaseDirectory {
10 fn serialize<S: ::tuffite::__private::serde::Serializer>(
11 &self,
12 serializer: S,
13 ) -> Result<S::Ok, S::Error> {
14 let value: String = match self {
15 Self::Resource => String::from("resource"),
16 Self::Data => String::from("data"),
17 Self::Cache => String::from("cache"),
18 Self::Temp => String::from("temp"),
19 };
20 ::tuffite::__private::serde::Serialize::serialize(&value, serializer)
21 }
22}
23impl<'de> ::tuffite::__private::serde::Deserialize<'de> for BaseDirectory {
24 fn deserialize<D: ::tuffite::__private::serde::Deserializer<'de>>(
25 deserializer: D,
26 ) -> Result<Self, D::Error> {
27 let value = <String as ::tuffite::__private::serde::Deserialize>::deserialize(
28 deserializer,
29 )?;
30 match value {
31 value if value == String::from("resource") => Ok(Self::Resource),
32 value if value == String::from("data") => Ok(Self::Data),
33 value if value == String::from("cache") => Ok(Self::Cache),
34 value if value == String::from("temp") => Ok(Self::Temp),
35 _ => {
36 Err(
37 ::tuffite::__private::serde::de::Error::custom(
38 "invalid Shell API enum value",
39 ),
40 )
41 }
42 }
43 }
44}
45impl ::tuffite::__private::codec::Encode for BaseDirectory {
46 fn encode(
47 &self,
48 encoder: &mut ::tuffite::__private::codec::Encoder,
49 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
50 let value: String = match self {
51 Self::Resource => String::from("resource"),
52 Self::Data => String::from("data"),
53 Self::Cache => String::from("cache"),
54 Self::Temp => String::from("temp"),
55 };
56 ::tuffite::__private::codec::Encode::encode(&value, encoder)
57 }
58}
59impl ::tuffite::__private::codec::Decode for BaseDirectory {
60 fn decode(
61 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
62 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
63 let value = <String as ::tuffite::__private::codec::Decode>::decode(decoder)?;
64 match value {
65 value if value == String::from("resource") => Ok(Self::Resource),
66 value if value == String::from("data") => Ok(Self::Data),
67 value if value == String::from("cache") => Ok(Self::Cache),
68 value if value == String::from("temp") => Ok(Self::Temp),
69 _ => Err(::tuffite::__private::codec::CodecError),
70 }
71 }
72}
73#[derive(
74 Clone,
75 Debug,
76 PartialEq,
77 ::tuffite::__private::serde::Serialize,
78 ::tuffite::__private::serde::Deserialize
79)]
80#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
81pub struct NetworkResponse {
82 pub status: f64,
83 pub body: ::tuffite::Bytes,
84}
85impl ::tuffite::__private::codec::Encode for NetworkResponse {
86 fn encode(
87 &self,
88 encoder: &mut ::tuffite::__private::codec::Encoder,
89 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
90 ::tuffite::__private::codec::Encode::encode(&self.status, encoder)?;
91 ::tuffite::__private::codec::Encode::encode(&self.body, encoder)?;
92 Ok(())
93 }
94}
95impl ::tuffite::__private::codec::Decode for NetworkResponse {
96 fn decode(
97 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
98 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
99 Ok(Self {
100 status: ::tuffite::__private::codec::Decode::decode(decoder)?,
101 body: ::tuffite::__private::codec::Decode::decode(decoder)?,
102 })
103 }
104}
105#[derive(
106 Clone,
107 Debug,
108 PartialEq,
109 ::tuffite::__private::serde::Serialize,
110 ::tuffite::__private::serde::Deserialize
111)]
112#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
113pub struct OpenDirectoryDialogOptions {
114 pub title: Option<String>,
115}
116impl ::tuffite::__private::codec::Encode for OpenDirectoryDialogOptions {
117 fn encode(
118 &self,
119 encoder: &mut ::tuffite::__private::codec::Encoder,
120 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
121 ::tuffite::__private::codec::Encode::encode(&self.title, encoder)?;
122 Ok(())
123 }
124}
125impl ::tuffite::__private::codec::Decode for OpenDirectoryDialogOptions {
126 fn decode(
127 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
128 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
129 Ok(Self {
130 title: ::tuffite::__private::codec::Decode::decode(decoder)?,
131 })
132 }
133}
134#[derive(
135 Clone,
136 Debug,
137 PartialEq,
138 ::tuffite::__private::serde::Serialize,
139 ::tuffite::__private::serde::Deserialize
140)]
141#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
142pub struct OpenFileDialogOptions {
143 pub title: Option<String>,
144 pub default_path: Option<String>,
145 pub extensions: Option<Vec<Vec<String>>>,
146}
147impl ::tuffite::__private::codec::Encode for OpenFileDialogOptions {
148 fn encode(
149 &self,
150 encoder: &mut ::tuffite::__private::codec::Encoder,
151 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
152 ::tuffite::__private::codec::Encode::encode(&self.title, encoder)?;
153 ::tuffite::__private::codec::Encode::encode(&self.default_path, encoder)?;
154 ::tuffite::__private::codec::Encode::encode(&self.extensions, encoder)?;
155 Ok(())
156 }
157}
158impl ::tuffite::__private::codec::Decode for OpenFileDialogOptions {
159 fn decode(
160 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
161 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
162 Ok(Self {
163 title: ::tuffite::__private::codec::Decode::decode(decoder)?,
164 default_path: ::tuffite::__private::codec::Decode::decode(decoder)?,
165 extensions: ::tuffite::__private::codec::Decode::decode(decoder)?,
166 })
167 }
168}
169#[derive(
170 Clone,
171 Debug,
172 PartialEq,
173 ::tuffite::__private::serde::Serialize,
174 ::tuffite::__private::serde::Deserialize
175)]
176#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
177pub struct PathDirectories {
178 pub resource: String,
179 pub data: String,
180 pub cache: String,
181 pub temp: String,
182}
183impl ::tuffite::__private::codec::Encode for PathDirectories {
184 fn encode(
185 &self,
186 encoder: &mut ::tuffite::__private::codec::Encoder,
187 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
188 ::tuffite::__private::codec::Encode::encode(&self.resource, encoder)?;
189 ::tuffite::__private::codec::Encode::encode(&self.data, encoder)?;
190 ::tuffite::__private::codec::Encode::encode(&self.cache, encoder)?;
191 ::tuffite::__private::codec::Encode::encode(&self.temp, encoder)?;
192 Ok(())
193 }
194}
195impl ::tuffite::__private::codec::Decode for PathDirectories {
196 fn decode(
197 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
198 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
199 Ok(Self {
200 resource: ::tuffite::__private::codec::Decode::decode(decoder)?,
201 data: ::tuffite::__private::codec::Decode::decode(decoder)?,
202 cache: ::tuffite::__private::codec::Decode::decode(decoder)?,
203 temp: ::tuffite::__private::codec::Decode::decode(decoder)?,
204 })
205 }
206}
207#[derive(
208 Clone,
209 Debug,
210 PartialEq,
211 ::tuffite::__private::serde::Serialize,
212 ::tuffite::__private::serde::Deserialize
213)]
214#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
215pub struct RemotingCapabilities {
216 pub available: bool,
217 pub protocol: String,
218 pub video_codecs: Vec<String>,
219 pub input: bool,
220 pub clipboard: bool,
221 pub reconnect: bool,
222 pub snapshot: bool,
223}
224impl ::tuffite::__private::codec::Encode for RemotingCapabilities {
225 fn encode(
226 &self,
227 encoder: &mut ::tuffite::__private::codec::Encoder,
228 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
229 ::tuffite::__private::codec::Encode::encode(&self.available, encoder)?;
230 ::tuffite::__private::codec::Encode::encode(&self.protocol, encoder)?;
231 ::tuffite::__private::codec::Encode::encode(&self.video_codecs, encoder)?;
232 ::tuffite::__private::codec::Encode::encode(&self.input, encoder)?;
233 ::tuffite::__private::codec::Encode::encode(&self.clipboard, encoder)?;
234 ::tuffite::__private::codec::Encode::encode(&self.reconnect, encoder)?;
235 ::tuffite::__private::codec::Encode::encode(&self.snapshot, encoder)?;
236 Ok(())
237 }
238}
239impl ::tuffite::__private::codec::Decode for RemotingCapabilities {
240 fn decode(
241 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
242 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
243 Ok(Self {
244 available: ::tuffite::__private::codec::Decode::decode(decoder)?,
245 protocol: ::tuffite::__private::codec::Decode::decode(decoder)?,
246 video_codecs: ::tuffite::__private::codec::Decode::decode(decoder)?,
247 input: ::tuffite::__private::codec::Decode::decode(decoder)?,
248 clipboard: ::tuffite::__private::codec::Decode::decode(decoder)?,
249 reconnect: ::tuffite::__private::codec::Decode::decode(decoder)?,
250 snapshot: ::tuffite::__private::codec::Decode::decode(decoder)?,
251 })
252 }
253}
254#[derive(
255 Clone,
256 Debug,
257 PartialEq,
258 ::tuffite::__private::serde::Serialize,
259 ::tuffite::__private::serde::Deserialize
260)]
261#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
262pub struct RemotingIceCandidate {
263 pub mid: String,
264 pub m_line_index: f64,
265 pub candidate: String,
266}
267impl ::tuffite::__private::codec::Encode for RemotingIceCandidate {
268 fn encode(
269 &self,
270 encoder: &mut ::tuffite::__private::codec::Encoder,
271 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
272 ::tuffite::__private::codec::Encode::encode(&self.mid, encoder)?;
273 ::tuffite::__private::codec::Encode::encode(&self.m_line_index, encoder)?;
274 ::tuffite::__private::codec::Encode::encode(&self.candidate, encoder)?;
275 Ok(())
276 }
277}
278impl ::tuffite::__private::codec::Decode for RemotingIceCandidate {
279 fn decode(
280 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
281 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
282 Ok(Self {
283 mid: ::tuffite::__private::codec::Decode::decode(decoder)?,
284 m_line_index: ::tuffite::__private::codec::Decode::decode(decoder)?,
285 candidate: ::tuffite::__private::codec::Decode::decode(decoder)?,
286 })
287 }
288}
289#[derive(
290 Clone,
291 Debug,
292 PartialEq,
293 ::tuffite::__private::serde::Serialize,
294 ::tuffite::__private::serde::Deserialize
295)]
296#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
297pub struct RemotingIceServer {
298 pub urls: Vec<String>,
299 pub username: Option<String>,
300 pub credential: Option<String>,
301}
302impl ::tuffite::__private::codec::Encode for RemotingIceServer {
303 fn encode(
304 &self,
305 encoder: &mut ::tuffite::__private::codec::Encoder,
306 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
307 ::tuffite::__private::codec::Encode::encode(&self.urls, encoder)?;
308 ::tuffite::__private::codec::Encode::encode(&self.username, encoder)?;
309 ::tuffite::__private::codec::Encode::encode(&self.credential, encoder)?;
310 Ok(())
311 }
312}
313impl ::tuffite::__private::codec::Decode for RemotingIceServer {
314 fn decode(
315 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
316 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
317 Ok(Self {
318 urls: ::tuffite::__private::codec::Decode::decode(decoder)?,
319 username: ::tuffite::__private::codec::Decode::decode(decoder)?,
320 credential: ::tuffite::__private::codec::Decode::decode(decoder)?,
321 })
322 }
323}
324#[derive(
325 Clone,
326 Debug,
327 PartialEq,
328 ::tuffite::__private::serde::Serialize,
329 ::tuffite::__private::serde::Deserialize
330)]
331#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
332pub struct RemotingInputEvent {
333 pub kind: String,
334 pub pressed: Option<bool>,
335 pub usb_keycode: Option<f64>,
336 pub text: Option<String>,
337 pub x: Option<f64>,
338 pub y: Option<f64>,
339 pub button: Option<String>,
340 pub button_down: Option<bool>,
341 pub wheel_delta_x: Option<f64>,
342 pub wheel_delta_y: Option<f64>,
343 pub wheel_ticks_x: Option<f64>,
344 pub wheel_ticks_y: Option<f64>,
345 pub clipboard_mime_type: Option<String>,
346 pub clipboard_data: Option<::tuffite::Bytes>,
347}
348impl ::tuffite::__private::codec::Encode for RemotingInputEvent {
349 fn encode(
350 &self,
351 encoder: &mut ::tuffite::__private::codec::Encoder,
352 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
353 ::tuffite::__private::codec::Encode::encode(&self.kind, encoder)?;
354 ::tuffite::__private::codec::Encode::encode(&self.pressed, encoder)?;
355 ::tuffite::__private::codec::Encode::encode(&self.usb_keycode, encoder)?;
356 ::tuffite::__private::codec::Encode::encode(&self.text, encoder)?;
357 ::tuffite::__private::codec::Encode::encode(&self.x, encoder)?;
358 ::tuffite::__private::codec::Encode::encode(&self.y, encoder)?;
359 ::tuffite::__private::codec::Encode::encode(&self.button, encoder)?;
360 ::tuffite::__private::codec::Encode::encode(&self.button_down, encoder)?;
361 ::tuffite::__private::codec::Encode::encode(&self.wheel_delta_x, encoder)?;
362 ::tuffite::__private::codec::Encode::encode(&self.wheel_delta_y, encoder)?;
363 ::tuffite::__private::codec::Encode::encode(&self.wheel_ticks_x, encoder)?;
364 ::tuffite::__private::codec::Encode::encode(&self.wheel_ticks_y, encoder)?;
365 ::tuffite::__private::codec::Encode::encode(&self.clipboard_mime_type, encoder)?;
366 ::tuffite::__private::codec::Encode::encode(&self.clipboard_data, encoder)?;
367 Ok(())
368 }
369}
370impl ::tuffite::__private::codec::Decode for RemotingInputEvent {
371 fn decode(
372 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
373 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
374 Ok(Self {
375 kind: ::tuffite::__private::codec::Decode::decode(decoder)?,
376 pressed: ::tuffite::__private::codec::Decode::decode(decoder)?,
377 usb_keycode: ::tuffite::__private::codec::Decode::decode(decoder)?,
378 text: ::tuffite::__private::codec::Decode::decode(decoder)?,
379 x: ::tuffite::__private::codec::Decode::decode(decoder)?,
380 y: ::tuffite::__private::codec::Decode::decode(decoder)?,
381 button: ::tuffite::__private::codec::Decode::decode(decoder)?,
382 button_down: ::tuffite::__private::codec::Decode::decode(decoder)?,
383 wheel_delta_x: ::tuffite::__private::codec::Decode::decode(decoder)?,
384 wheel_delta_y: ::tuffite::__private::codec::Decode::decode(decoder)?,
385 wheel_ticks_x: ::tuffite::__private::codec::Decode::decode(decoder)?,
386 wheel_ticks_y: ::tuffite::__private::codec::Decode::decode(decoder)?,
387 clipboard_mime_type: ::tuffite::__private::codec::Decode::decode(decoder)?,
388 clipboard_data: ::tuffite::__private::codec::Decode::decode(decoder)?,
389 })
390 }
391}
392#[derive(
393 Clone,
394 Debug,
395 PartialEq,
396 ::tuffite::__private::serde::Serialize,
397 ::tuffite::__private::serde::Deserialize
398)]
399#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
400pub struct RemotingSession {
401 pub id: i64,
402 pub state: String,
403}
404impl ::tuffite::__private::codec::Encode for RemotingSession {
405 fn encode(
406 &self,
407 encoder: &mut ::tuffite::__private::codec::Encoder,
408 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
409 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
410 ::tuffite::__private::codec::Encode::encode(&self.state, encoder)?;
411 Ok(())
412 }
413}
414impl ::tuffite::__private::codec::Decode for RemotingSession {
415 fn decode(
416 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
417 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
418 Ok(Self {
419 id: ::tuffite::__private::codec::Decode::decode(decoder)?,
420 state: ::tuffite::__private::codec::Decode::decode(decoder)?,
421 })
422 }
423}
424#[derive(
425 Clone,
426 Debug,
427 PartialEq,
428 ::tuffite::__private::serde::Serialize,
429 ::tuffite::__private::serde::Deserialize
430)]
431#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
432pub struct RemotingSessionDescription {
433 pub r#type: String,
434 pub sdp: String,
435}
436impl ::tuffite::__private::codec::Encode for RemotingSessionDescription {
437 fn encode(
438 &self,
439 encoder: &mut ::tuffite::__private::codec::Encoder,
440 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
441 ::tuffite::__private::codec::Encode::encode(&self.r#type, encoder)?;
442 ::tuffite::__private::codec::Encode::encode(&self.sdp, encoder)?;
443 Ok(())
444 }
445}
446impl ::tuffite::__private::codec::Decode for RemotingSessionDescription {
447 fn decode(
448 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
449 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
450 Ok(Self {
451 r#type: ::tuffite::__private::codec::Decode::decode(decoder)?,
452 sdp: ::tuffite::__private::codec::Decode::decode(decoder)?,
453 })
454 }
455}
456#[derive(
457 Clone,
458 Debug,
459 PartialEq,
460 ::tuffite::__private::serde::Serialize,
461 ::tuffite::__private::serde::Deserialize
462)]
463#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
464pub struct RemotingSignal {
465 pub sequence: i64,
466 pub description: Option<RemotingSessionDescription>,
467 pub candidates: Vec<RemotingIceCandidate>,
468}
469impl ::tuffite::__private::codec::Encode for RemotingSignal {
470 fn encode(
471 &self,
472 encoder: &mut ::tuffite::__private::codec::Encoder,
473 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
474 ::tuffite::__private::codec::Encode::encode(&self.sequence, encoder)?;
475 ::tuffite::__private::codec::Encode::encode(&self.description, encoder)?;
476 ::tuffite::__private::codec::Encode::encode(&self.candidates, encoder)?;
477 Ok(())
478 }
479}
480impl ::tuffite::__private::codec::Decode for RemotingSignal {
481 fn decode(
482 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
483 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
484 Ok(Self {
485 sequence: ::tuffite::__private::codec::Decode::decode(decoder)?,
486 description: ::tuffite::__private::codec::Decode::decode(decoder)?,
487 candidates: ::tuffite::__private::codec::Decode::decode(decoder)?,
488 })
489 }
490}
491#[derive(
492 Clone,
493 Debug,
494 PartialEq,
495 ::tuffite::__private::serde::Serialize,
496 ::tuffite::__private::serde::Deserialize
497)]
498#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
499pub struct RemotingSnapshot {
500 pub width: f64,
501 pub height: f64,
502 pub mime_type: String,
503 pub data: ::tuffite::Bytes,
504}
505impl ::tuffite::__private::codec::Encode for RemotingSnapshot {
506 fn encode(
507 &self,
508 encoder: &mut ::tuffite::__private::codec::Encoder,
509 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
510 ::tuffite::__private::codec::Encode::encode(&self.width, encoder)?;
511 ::tuffite::__private::codec::Encode::encode(&self.height, encoder)?;
512 ::tuffite::__private::codec::Encode::encode(&self.mime_type, encoder)?;
513 ::tuffite::__private::codec::Encode::encode(&self.data, encoder)?;
514 Ok(())
515 }
516}
517impl ::tuffite::__private::codec::Decode for RemotingSnapshot {
518 fn decode(
519 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
520 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
521 Ok(Self {
522 width: ::tuffite::__private::codec::Decode::decode(decoder)?,
523 height: ::tuffite::__private::codec::Decode::decode(decoder)?,
524 mime_type: ::tuffite::__private::codec::Decode::decode(decoder)?,
525 data: ::tuffite::__private::codec::Decode::decode(decoder)?,
526 })
527 }
528}
529#[derive(
530 Clone,
531 Debug,
532 PartialEq,
533 ::tuffite::__private::serde::Serialize,
534 ::tuffite::__private::serde::Deserialize
535)]
536#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
537pub struct RemotingStartOptions {
538 pub auth_key: String,
539 pub ice_servers: Vec<RemotingIceServer>,
540 pub max_bitrate_kbps: Option<f64>,
541 pub target_framerate: Option<f64>,
542 pub screen_id: Option<i64>,
543}
544impl ::tuffite::__private::codec::Encode for RemotingStartOptions {
545 fn encode(
546 &self,
547 encoder: &mut ::tuffite::__private::codec::Encoder,
548 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
549 ::tuffite::__private::codec::Encode::encode(&self.auth_key, encoder)?;
550 ::tuffite::__private::codec::Encode::encode(&self.ice_servers, encoder)?;
551 ::tuffite::__private::codec::Encode::encode(&self.max_bitrate_kbps, encoder)?;
552 ::tuffite::__private::codec::Encode::encode(&self.target_framerate, encoder)?;
553 ::tuffite::__private::codec::Encode::encode(&self.screen_id, encoder)?;
554 Ok(())
555 }
556}
557impl ::tuffite::__private::codec::Decode for RemotingStartOptions {
558 fn decode(
559 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
560 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
561 Ok(Self {
562 auth_key: ::tuffite::__private::codec::Decode::decode(decoder)?,
563 ice_servers: ::tuffite::__private::codec::Decode::decode(decoder)?,
564 max_bitrate_kbps: ::tuffite::__private::codec::Decode::decode(decoder)?,
565 target_framerate: ::tuffite::__private::codec::Decode::decode(decoder)?,
566 screen_id: ::tuffite::__private::codec::Decode::decode(decoder)?,
567 })
568 }
569}
570#[derive(
571 Clone,
572 Debug,
573 PartialEq,
574 ::tuffite::__private::serde::Serialize,
575 ::tuffite::__private::serde::Deserialize
576)]
577#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
578pub struct RemotingStats {
579 pub state: String,
580 pub route: String,
581 pub transport: String,
582 pub latency_ms: f64,
583 pub jitter_ms: f64,
584 pub available_bandwidth_kbps: f64,
585 pub packet_loss_percent: f64,
586}
587impl ::tuffite::__private::codec::Encode for RemotingStats {
588 fn encode(
589 &self,
590 encoder: &mut ::tuffite::__private::codec::Encoder,
591 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
592 ::tuffite::__private::codec::Encode::encode(&self.state, encoder)?;
593 ::tuffite::__private::codec::Encode::encode(&self.route, encoder)?;
594 ::tuffite::__private::codec::Encode::encode(&self.transport, encoder)?;
595 ::tuffite::__private::codec::Encode::encode(&self.latency_ms, encoder)?;
596 ::tuffite::__private::codec::Encode::encode(&self.jitter_ms, encoder)?;
597 ::tuffite::__private::codec::Encode::encode(
598 &self.available_bandwidth_kbps,
599 encoder,
600 )?;
601 ::tuffite::__private::codec::Encode::encode(&self.packet_loss_percent, encoder)?;
602 Ok(())
603 }
604}
605impl ::tuffite::__private::codec::Decode for RemotingStats {
606 fn decode(
607 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
608 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
609 Ok(Self {
610 state: ::tuffite::__private::codec::Decode::decode(decoder)?,
611 route: ::tuffite::__private::codec::Decode::decode(decoder)?,
612 transport: ::tuffite::__private::codec::Decode::decode(decoder)?,
613 latency_ms: ::tuffite::__private::codec::Decode::decode(decoder)?,
614 jitter_ms: ::tuffite::__private::codec::Decode::decode(decoder)?,
615 available_bandwidth_kbps: ::tuffite::__private::codec::Decode::decode(
616 decoder,
617 )?,
618 packet_loss_percent: ::tuffite::__private::codec::Decode::decode(decoder)?,
619 })
620 }
621}
622#[derive(
623 Clone,
624 Debug,
625 PartialEq,
626 ::tuffite::__private::serde::Serialize,
627 ::tuffite::__private::serde::Deserialize
628)]
629#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
630pub struct WindowBounds {
631 pub x: f64,
632 pub y: f64,
633 pub width: f64,
634 pub height: f64,
635}
636impl ::tuffite::__private::codec::Encode for WindowBounds {
637 fn encode(
638 &self,
639 encoder: &mut ::tuffite::__private::codec::Encoder,
640 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
641 ::tuffite::__private::codec::Encode::encode(&self.x, encoder)?;
642 ::tuffite::__private::codec::Encode::encode(&self.y, encoder)?;
643 ::tuffite::__private::codec::Encode::encode(&self.width, encoder)?;
644 ::tuffite::__private::codec::Encode::encode(&self.height, encoder)?;
645 Ok(())
646 }
647}
648impl ::tuffite::__private::codec::Decode for WindowBounds {
649 fn decode(
650 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
651 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
652 Ok(Self {
653 x: ::tuffite::__private::codec::Decode::decode(decoder)?,
654 y: ::tuffite::__private::codec::Decode::decode(decoder)?,
655 width: ::tuffite::__private::codec::Decode::decode(decoder)?,
656 height: ::tuffite::__private::codec::Decode::decode(decoder)?,
657 })
658 }
659}
660pub type WindowId = i64;
661#[derive(
662 Clone,
663 Debug,
664 PartialEq,
665 ::tuffite::__private::serde::Serialize,
666 ::tuffite::__private::serde::Deserialize
667)]
668#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
669pub struct WindowInfo {
670 pub id: WindowId,
671 pub label: String,
672 pub title: String,
673 pub url: String,
674 pub bounds: WindowBounds,
675 pub focused: bool,
676 pub minimized: bool,
677 pub maximized: bool,
678 pub fullscreen: bool,
679}
680impl ::tuffite::__private::codec::Encode for WindowInfo {
681 fn encode(
682 &self,
683 encoder: &mut ::tuffite::__private::codec::Encoder,
684 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
685 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
686 ::tuffite::__private::codec::Encode::encode(&self.label, encoder)?;
687 ::tuffite::__private::codec::Encode::encode(&self.title, encoder)?;
688 ::tuffite::__private::codec::Encode::encode(&self.url, encoder)?;
689 ::tuffite::__private::codec::Encode::encode(&self.bounds, encoder)?;
690 ::tuffite::__private::codec::Encode::encode(&self.focused, encoder)?;
691 ::tuffite::__private::codec::Encode::encode(&self.minimized, encoder)?;
692 ::tuffite::__private::codec::Encode::encode(&self.maximized, encoder)?;
693 ::tuffite::__private::codec::Encode::encode(&self.fullscreen, encoder)?;
694 Ok(())
695 }
696}
697impl ::tuffite::__private::codec::Decode for WindowInfo {
698 fn decode(
699 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
700 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
701 Ok(Self {
702 id: ::tuffite::__private::codec::Decode::decode(decoder)?,
703 label: ::tuffite::__private::codec::Decode::decode(decoder)?,
704 title: ::tuffite::__private::codec::Decode::decode(decoder)?,
705 url: ::tuffite::__private::codec::Decode::decode(decoder)?,
706 bounds: ::tuffite::__private::codec::Decode::decode(decoder)?,
707 focused: ::tuffite::__private::codec::Decode::decode(decoder)?,
708 minimized: ::tuffite::__private::codec::Decode::decode(decoder)?,
709 maximized: ::tuffite::__private::codec::Decode::decode(decoder)?,
710 fullscreen: ::tuffite::__private::codec::Decode::decode(decoder)?,
711 })
712 }
713}
714#[derive(
715 Clone,
716 Debug,
717 PartialEq,
718 ::tuffite::__private::serde::Serialize,
719 ::tuffite::__private::serde::Deserialize
720)]
721#[serde(crate = "::tuffite::__private::serde", rename_all = "camelCase")]
722pub struct WindowOptions {
723 pub label: Option<String>,
724 pub url: Option<String>,
725 pub title: Option<String>,
726 pub bounds: Option<WindowBounds>,
727 pub focused: Option<bool>,
728}
729impl ::tuffite::__private::codec::Encode for WindowOptions {
730 fn encode(
731 &self,
732 encoder: &mut ::tuffite::__private::codec::Encoder,
733 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
734 ::tuffite::__private::codec::Encode::encode(&self.label, encoder)?;
735 ::tuffite::__private::codec::Encode::encode(&self.url, encoder)?;
736 ::tuffite::__private::codec::Encode::encode(&self.title, encoder)?;
737 ::tuffite::__private::codec::Encode::encode(&self.bounds, encoder)?;
738 ::tuffite::__private::codec::Encode::encode(&self.focused, encoder)?;
739 Ok(())
740 }
741}
742impl ::tuffite::__private::codec::Decode for WindowOptions {
743 fn decode(
744 decoder: &mut ::tuffite::__private::codec::Decoder<'_>,
745 ) -> Result<Self, ::tuffite::__private::codec::CodecError> {
746 Ok(Self {
747 label: ::tuffite::__private::codec::Decode::decode(decoder)?,
748 url: ::tuffite::__private::codec::Decode::decode(decoder)?,
749 title: ::tuffite::__private::codec::Decode::decode(decoder)?,
750 bounds: ::tuffite::__private::codec::Decode::decode(decoder)?,
751 focused: ::tuffite::__private::codec::Decode::decode(decoder)?,
752 })
753 }
754}
755pub mod dialog {
756 #[derive(Clone, Debug, PartialEq)]
757 pub struct OpenFile {
758 pub options: Option<super::OpenFileDialogOptions>,
759 }
760 impl OpenFile {
761 pub fn respond(
762 response: Result<Option<String>, ::tuffite::CommandError>,
763 ) -> ::tuffite::CommandResult {
764 use ::tuffite::__private::codec::Encode as _;
765 let response = response?;
766 let mut encoder = ::tuffite::__private::codec::Encoder::new();
767 response
768 .encode(&mut encoder)
769 .map_err(|_| {
770 ::tuffite::CommandError::Failed(
771 "unable to encode ShellAPI response".to_owned(),
772 )
773 })?;
774 Ok(encoder.finish())
775 }
776 }
777 #[derive(Clone, Debug, PartialEq)]
778 pub struct OpenDirectory {
779 pub options: Option<super::OpenDirectoryDialogOptions>,
780 }
781 impl OpenDirectory {
782 pub fn respond(
783 response: Result<Option<String>, ::tuffite::CommandError>,
784 ) -> ::tuffite::CommandResult {
785 use ::tuffite::__private::codec::Encode as _;
786 let response = response?;
787 let mut encoder = ::tuffite::__private::codec::Encoder::new();
788 response
789 .encode(&mut encoder)
790 .map_err(|_| {
791 ::tuffite::CommandError::Failed(
792 "unable to encode ShellAPI response".to_owned(),
793 )
794 })?;
795 Ok(encoder.finish())
796 }
797 }
798}
799pub mod path {
800 #[derive(Clone, Debug, PartialEq)]
801 pub struct Directories {}
802 impl Directories {
803 pub fn respond(
804 response: Result<super::PathDirectories, ::tuffite::CommandError>,
805 ) -> ::tuffite::CommandResult {
806 use ::tuffite::__private::codec::Encode as _;
807 let response = response?;
808 let mut encoder = ::tuffite::__private::codec::Encoder::new();
809 response
810 .encode(&mut encoder)
811 .map_err(|_| {
812 ::tuffite::CommandError::Failed(
813 "unable to encode ShellAPI response".to_owned(),
814 )
815 })?;
816 Ok(encoder.finish())
817 }
818 }
819 #[derive(Clone, Debug, PartialEq)]
820 pub struct Resolve {
821 pub base: super::BaseDirectory,
822 pub relative: Option<String>,
823 }
824 impl Resolve {
825 pub fn respond(
826 response: Result<String, ::tuffite::CommandError>,
827 ) -> ::tuffite::CommandResult {
828 use ::tuffite::__private::codec::Encode as _;
829 let response = response?;
830 let mut encoder = ::tuffite::__private::codec::Encoder::new();
831 response
832 .encode(&mut encoder)
833 .map_err(|_| {
834 ::tuffite::CommandError::Failed(
835 "unable to encode ShellAPI response".to_owned(),
836 )
837 })?;
838 Ok(encoder.finish())
839 }
840 }
841}
842pub mod remoting {
843 #[derive(Clone, Debug, PartialEq)]
844 pub struct Capabilities {}
845 impl Capabilities {
846 pub fn respond(
847 response: Result<super::RemotingCapabilities, ::tuffite::CommandError>,
848 ) -> ::tuffite::CommandResult {
849 use ::tuffite::__private::codec::Encode as _;
850 let response = response?;
851 let mut encoder = ::tuffite::__private::codec::Encoder::new();
852 response
853 .encode(&mut encoder)
854 .map_err(|_| {
855 ::tuffite::CommandError::Failed(
856 "unable to encode ShellAPI response".to_owned(),
857 )
858 })?;
859 Ok(encoder.finish())
860 }
861 }
862 #[derive(Clone, Debug, PartialEq)]
863 pub struct Start {
864 pub options: super::RemotingStartOptions,
865 }
866 impl Start {
867 pub fn respond(
868 response: Result<super::RemotingSession, ::tuffite::CommandError>,
869 ) -> ::tuffite::CommandResult {
870 use ::tuffite::__private::codec::Encode as _;
871 let response = response?;
872 let mut encoder = ::tuffite::__private::codec::Encoder::new();
873 response
874 .encode(&mut encoder)
875 .map_err(|_| {
876 ::tuffite::CommandError::Failed(
877 "unable to encode ShellAPI response".to_owned(),
878 )
879 })?;
880 Ok(encoder.finish())
881 }
882 }
883 #[derive(Clone, Debug, PartialEq)]
884 pub struct ProcessSignal {
885 pub id: i64,
886 pub signal: super::RemotingSignal,
887 }
888 impl ProcessSignal {
889 pub fn respond(
890 response: Result<(), ::tuffite::CommandError>,
891 ) -> ::tuffite::CommandResult {
892 use ::tuffite::__private::codec::Encode as _;
893 let response = response?;
894 let mut encoder = ::tuffite::__private::codec::Encoder::new();
895 response
896 .encode(&mut encoder)
897 .map_err(|_| {
898 ::tuffite::CommandError::Failed(
899 "unable to encode ShellAPI response".to_owned(),
900 )
901 })?;
902 Ok(encoder.finish())
903 }
904 }
905 #[derive(Clone, Debug, PartialEq)]
906 pub struct TakeSignals {
907 pub id: i64,
908 pub after_sequence: Option<i64>,
909 }
910 impl TakeSignals {
911 pub fn respond(
912 response: Result<Vec<super::RemotingSignal>, ::tuffite::CommandError>,
913 ) -> ::tuffite::CommandResult {
914 use ::tuffite::__private::codec::Encode as _;
915 let response = response?;
916 let mut encoder = ::tuffite::__private::codec::Encoder::new();
917 response
918 .encode(&mut encoder)
919 .map_err(|_| {
920 ::tuffite::CommandError::Failed(
921 "unable to encode ShellAPI response".to_owned(),
922 )
923 })?;
924 Ok(encoder.finish())
925 }
926 }
927 #[derive(Clone, Debug, PartialEq)]
928 pub struct SendInput {
929 pub id: i64,
930 pub event: super::RemotingInputEvent,
931 }
932 impl SendInput {
933 pub fn respond(
934 response: Result<(), ::tuffite::CommandError>,
935 ) -> ::tuffite::CommandResult {
936 use ::tuffite::__private::codec::Encode as _;
937 let response = response?;
938 let mut encoder = ::tuffite::__private::codec::Encoder::new();
939 response
940 .encode(&mut encoder)
941 .map_err(|_| {
942 ::tuffite::CommandError::Failed(
943 "unable to encode ShellAPI response".to_owned(),
944 )
945 })?;
946 Ok(encoder.finish())
947 }
948 }
949 #[derive(Clone, Debug, PartialEq)]
950 pub struct Stop {
951 pub id: i64,
952 }
953 impl Stop {
954 pub fn respond(
955 response: Result<(), ::tuffite::CommandError>,
956 ) -> ::tuffite::CommandResult {
957 use ::tuffite::__private::codec::Encode as _;
958 let response = response?;
959 let mut encoder = ::tuffite::__private::codec::Encoder::new();
960 response
961 .encode(&mut encoder)
962 .map_err(|_| {
963 ::tuffite::CommandError::Failed(
964 "unable to encode ShellAPI response".to_owned(),
965 )
966 })?;
967 Ok(encoder.finish())
968 }
969 }
970 #[derive(Clone, Debug, PartialEq)]
971 pub struct Stats {
972 pub id: i64,
973 }
974 impl Stats {
975 pub fn respond(
976 response: Result<super::RemotingStats, ::tuffite::CommandError>,
977 ) -> ::tuffite::CommandResult {
978 use ::tuffite::__private::codec::Encode as _;
979 let response = response?;
980 let mut encoder = ::tuffite::__private::codec::Encoder::new();
981 response
982 .encode(&mut encoder)
983 .map_err(|_| {
984 ::tuffite::CommandError::Failed(
985 "unable to encode ShellAPI response".to_owned(),
986 )
987 })?;
988 Ok(encoder.finish())
989 }
990 }
991 #[derive(Clone, Debug, PartialEq)]
992 pub struct Capture {
993 pub screen_id: Option<i64>,
994 }
995 impl Capture {
996 pub fn respond(
997 response: Result<super::RemotingSnapshot, ::tuffite::CommandError>,
998 ) -> ::tuffite::CommandResult {
999 use ::tuffite::__private::codec::Encode as _;
1000 let response = response?;
1001 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1002 response
1003 .encode(&mut encoder)
1004 .map_err(|_| {
1005 ::tuffite::CommandError::Failed(
1006 "unable to encode ShellAPI response".to_owned(),
1007 )
1008 })?;
1009 Ok(encoder.finish())
1010 }
1011 }
1012 #[derive(Clone, Debug, PartialEq)]
1013 pub struct InjectInput {
1014 pub event: super::RemotingInputEvent,
1015 }
1016 impl InjectInput {
1017 pub fn respond(
1018 response: Result<(), ::tuffite::CommandError>,
1019 ) -> ::tuffite::CommandResult {
1020 use ::tuffite::__private::codec::Encode as _;
1021 let response = response?;
1022 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1023 response
1024 .encode(&mut encoder)
1025 .map_err(|_| {
1026 ::tuffite::CommandError::Failed(
1027 "unable to encode ShellAPI response".to_owned(),
1028 )
1029 })?;
1030 Ok(encoder.finish())
1031 }
1032 }
1033}
1034pub mod fs {
1035 #[derive(Clone, Debug, PartialEq)]
1036 pub struct ReadFile {
1037 pub base: super::BaseDirectory,
1038 pub path: String,
1039 }
1040 impl ReadFile {
1041 pub fn respond(
1042 response: Result<::tuffite::Bytes, ::tuffite::CommandError>,
1043 ) -> ::tuffite::CommandResult {
1044 use ::tuffite::__private::codec::Encode as _;
1045 let response = response?;
1046 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1047 response
1048 .encode(&mut encoder)
1049 .map_err(|_| {
1050 ::tuffite::CommandError::Failed(
1051 "unable to encode ShellAPI response".to_owned(),
1052 )
1053 })?;
1054 Ok(encoder.finish())
1055 }
1056 }
1057 #[derive(Clone, Debug, PartialEq)]
1058 pub struct WriteFile {
1059 pub base: super::BaseDirectory,
1060 pub path: String,
1061 pub contents: ::tuffite::Bytes,
1062 }
1063 impl WriteFile {
1064 pub fn respond(
1065 response: Result<(), ::tuffite::CommandError>,
1066 ) -> ::tuffite::CommandResult {
1067 use ::tuffite::__private::codec::Encode as _;
1068 let response = response?;
1069 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1070 response
1071 .encode(&mut encoder)
1072 .map_err(|_| {
1073 ::tuffite::CommandError::Failed(
1074 "unable to encode ShellAPI response".to_owned(),
1075 )
1076 })?;
1077 Ok(encoder.finish())
1078 }
1079 }
1080 #[derive(Clone, Debug, PartialEq)]
1081 pub struct Exists {
1082 pub base: super::BaseDirectory,
1083 pub path: String,
1084 }
1085 impl Exists {
1086 pub fn respond(
1087 response: Result<bool, ::tuffite::CommandError>,
1088 ) -> ::tuffite::CommandResult {
1089 use ::tuffite::__private::codec::Encode as _;
1090 let response = response?;
1091 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1092 response
1093 .encode(&mut encoder)
1094 .map_err(|_| {
1095 ::tuffite::CommandError::Failed(
1096 "unable to encode ShellAPI response".to_owned(),
1097 )
1098 })?;
1099 Ok(encoder.finish())
1100 }
1101 }
1102 #[derive(Clone, Debug, PartialEq)]
1103 pub struct CreateDir {
1104 pub base: super::BaseDirectory,
1105 pub path: String,
1106 }
1107 impl CreateDir {
1108 pub fn respond(
1109 response: Result<(), ::tuffite::CommandError>,
1110 ) -> ::tuffite::CommandResult {
1111 use ::tuffite::__private::codec::Encode as _;
1112 let response = response?;
1113 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1114 response
1115 .encode(&mut encoder)
1116 .map_err(|_| {
1117 ::tuffite::CommandError::Failed(
1118 "unable to encode ShellAPI response".to_owned(),
1119 )
1120 })?;
1121 Ok(encoder.finish())
1122 }
1123 }
1124 #[derive(Clone, Debug, PartialEq)]
1125 pub struct RemoveFile {
1126 pub base: super::BaseDirectory,
1127 pub path: String,
1128 }
1129 impl RemoveFile {
1130 pub fn respond(
1131 response: Result<(), ::tuffite::CommandError>,
1132 ) -> ::tuffite::CommandResult {
1133 use ::tuffite::__private::codec::Encode as _;
1134 let response = response?;
1135 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1136 response
1137 .encode(&mut encoder)
1138 .map_err(|_| {
1139 ::tuffite::CommandError::Failed(
1140 "unable to encode ShellAPI response".to_owned(),
1141 )
1142 })?;
1143 Ok(encoder.finish())
1144 }
1145 }
1146}
1147pub mod storage {
1148 #[derive(Clone, Debug, PartialEq)]
1149 pub struct Get {
1150 pub key: String,
1151 }
1152 impl Get {
1153 pub fn respond(
1154 response: Result<Option<::tuffite::Bytes>, ::tuffite::CommandError>,
1155 ) -> ::tuffite::CommandResult {
1156 use ::tuffite::__private::codec::Encode as _;
1157 let response = response?;
1158 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1159 response
1160 .encode(&mut encoder)
1161 .map_err(|_| {
1162 ::tuffite::CommandError::Failed(
1163 "unable to encode ShellAPI response".to_owned(),
1164 )
1165 })?;
1166 Ok(encoder.finish())
1167 }
1168 }
1169 #[derive(Clone, Debug, PartialEq)]
1170 pub struct Set {
1171 pub key: String,
1172 pub value: ::tuffite::Bytes,
1173 }
1174 impl Set {
1175 pub fn respond(
1176 response: Result<(), ::tuffite::CommandError>,
1177 ) -> ::tuffite::CommandResult {
1178 use ::tuffite::__private::codec::Encode as _;
1179 let response = response?;
1180 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1181 response
1182 .encode(&mut encoder)
1183 .map_err(|_| {
1184 ::tuffite::CommandError::Failed(
1185 "unable to encode ShellAPI response".to_owned(),
1186 )
1187 })?;
1188 Ok(encoder.finish())
1189 }
1190 }
1191 #[derive(Clone, Debug, PartialEq)]
1192 pub struct Remove {
1193 pub key: String,
1194 }
1195 impl Remove {
1196 pub fn respond(
1197 response: Result<(), ::tuffite::CommandError>,
1198 ) -> ::tuffite::CommandResult {
1199 use ::tuffite::__private::codec::Encode as _;
1200 let response = response?;
1201 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1202 response
1203 .encode(&mut encoder)
1204 .map_err(|_| {
1205 ::tuffite::CommandError::Failed(
1206 "unable to encode ShellAPI response".to_owned(),
1207 )
1208 })?;
1209 Ok(encoder.finish())
1210 }
1211 }
1212 #[derive(Clone, Debug, PartialEq)]
1213 pub struct Clear {}
1214 impl Clear {
1215 pub fn respond(
1216 response: Result<(), ::tuffite::CommandError>,
1217 ) -> ::tuffite::CommandResult {
1218 use ::tuffite::__private::codec::Encode as _;
1219 let response = response?;
1220 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1221 response
1222 .encode(&mut encoder)
1223 .map_err(|_| {
1224 ::tuffite::CommandError::Failed(
1225 "unable to encode ShellAPI response".to_owned(),
1226 )
1227 })?;
1228 Ok(encoder.finish())
1229 }
1230 }
1231}
1232pub mod log {
1233 #[derive(Clone, Debug, PartialEq)]
1234 pub struct Trace {
1235 pub message: String,
1236 }
1237 impl Trace {
1238 pub fn respond(
1239 response: Result<(), ::tuffite::CommandError>,
1240 ) -> ::tuffite::CommandResult {
1241 use ::tuffite::__private::codec::Encode as _;
1242 let response = response?;
1243 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1244 response
1245 .encode(&mut encoder)
1246 .map_err(|_| {
1247 ::tuffite::CommandError::Failed(
1248 "unable to encode ShellAPI response".to_owned(),
1249 )
1250 })?;
1251 Ok(encoder.finish())
1252 }
1253 }
1254 #[derive(Clone, Debug, PartialEq)]
1255 pub struct Debug {
1256 pub message: String,
1257 }
1258 impl Debug {
1259 pub fn respond(
1260 response: Result<(), ::tuffite::CommandError>,
1261 ) -> ::tuffite::CommandResult {
1262 use ::tuffite::__private::codec::Encode as _;
1263 let response = response?;
1264 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1265 response
1266 .encode(&mut encoder)
1267 .map_err(|_| {
1268 ::tuffite::CommandError::Failed(
1269 "unable to encode ShellAPI response".to_owned(),
1270 )
1271 })?;
1272 Ok(encoder.finish())
1273 }
1274 }
1275 #[derive(Clone, Debug, PartialEq)]
1276 pub struct Info {
1277 pub message: String,
1278 }
1279 impl Info {
1280 pub fn respond(
1281 response: Result<(), ::tuffite::CommandError>,
1282 ) -> ::tuffite::CommandResult {
1283 use ::tuffite::__private::codec::Encode as _;
1284 let response = response?;
1285 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1286 response
1287 .encode(&mut encoder)
1288 .map_err(|_| {
1289 ::tuffite::CommandError::Failed(
1290 "unable to encode ShellAPI response".to_owned(),
1291 )
1292 })?;
1293 Ok(encoder.finish())
1294 }
1295 }
1296 #[derive(Clone, Debug, PartialEq)]
1297 pub struct Warn {
1298 pub message: String,
1299 }
1300 impl Warn {
1301 pub fn respond(
1302 response: Result<(), ::tuffite::CommandError>,
1303 ) -> ::tuffite::CommandResult {
1304 use ::tuffite::__private::codec::Encode as _;
1305 let response = response?;
1306 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1307 response
1308 .encode(&mut encoder)
1309 .map_err(|_| {
1310 ::tuffite::CommandError::Failed(
1311 "unable to encode ShellAPI response".to_owned(),
1312 )
1313 })?;
1314 Ok(encoder.finish())
1315 }
1316 }
1317 #[derive(Clone, Debug, PartialEq)]
1318 pub struct Error {
1319 pub message: String,
1320 }
1321 impl Error {
1322 pub fn respond(
1323 response: Result<(), ::tuffite::CommandError>,
1324 ) -> ::tuffite::CommandResult {
1325 use ::tuffite::__private::codec::Encode as _;
1326 let response = response?;
1327 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1328 response
1329 .encode(&mut encoder)
1330 .map_err(|_| {
1331 ::tuffite::CommandError::Failed(
1332 "unable to encode ShellAPI response".to_owned(),
1333 )
1334 })?;
1335 Ok(encoder.finish())
1336 }
1337 }
1338}
1339pub mod net {
1340 #[derive(Clone, Debug, PartialEq)]
1341 pub struct Request {
1342 pub url: String,
1343 }
1344 impl Request {
1345 pub fn respond(
1346 response: Result<super::NetworkResponse, ::tuffite::CommandError>,
1347 ) -> ::tuffite::CommandResult {
1348 use ::tuffite::__private::codec::Encode as _;
1349 let response = response?;
1350 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1351 response
1352 .encode(&mut encoder)
1353 .map_err(|_| {
1354 ::tuffite::CommandError::Failed(
1355 "unable to encode ShellAPI response".to_owned(),
1356 )
1357 })?;
1358 Ok(encoder.finish())
1359 }
1360 }
1361}
1362pub mod utility {
1363 #[derive(Clone, Debug, PartialEq)]
1364 pub struct Invoke {
1365 pub name: String,
1366 pub request_id: i64,
1367 pub payload: Option<::tuffite::Bytes>,
1368 }
1369 impl Invoke {
1370 pub fn respond(
1371 response: Result<::tuffite::Bytes, ::tuffite::CommandError>,
1372 ) -> ::tuffite::CommandResult {
1373 use ::tuffite::__private::codec::Encode as _;
1374 let response = response?;
1375 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1376 response
1377 .encode(&mut encoder)
1378 .map_err(|_| {
1379 ::tuffite::CommandError::Failed(
1380 "unable to encode ShellAPI response".to_owned(),
1381 )
1382 })?;
1383 Ok(encoder.finish())
1384 }
1385 }
1386 #[derive(Clone, Debug, PartialEq)]
1387 pub struct Cancel {
1388 pub name: String,
1389 pub request_id: i64,
1390 }
1391 impl Cancel {
1392 pub fn respond(
1393 response: Result<(), ::tuffite::CommandError>,
1394 ) -> ::tuffite::CommandResult {
1395 use ::tuffite::__private::codec::Encode as _;
1396 let response = response?;
1397 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1398 response
1399 .encode(&mut encoder)
1400 .map_err(|_| {
1401 ::tuffite::CommandError::Failed(
1402 "unable to encode ShellAPI response".to_owned(),
1403 )
1404 })?;
1405 Ok(encoder.finish())
1406 }
1407 }
1408}
1409pub mod window {
1410 #[derive(Clone, Debug, PartialEq)]
1411 pub struct Current {}
1412 impl Current {
1413 pub fn respond(
1414 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1415 ) -> ::tuffite::CommandResult {
1416 use ::tuffite::__private::codec::Encode as _;
1417 let response = response?;
1418 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1419 response
1420 .encode(&mut encoder)
1421 .map_err(|_| {
1422 ::tuffite::CommandError::Failed(
1423 "unable to encode ShellAPI response".to_owned(),
1424 )
1425 })?;
1426 Ok(encoder.finish())
1427 }
1428 }
1429 #[derive(Clone, Debug, PartialEq)]
1430 pub struct List {}
1431 impl List {
1432 pub fn respond(
1433 response: Result<Vec<super::WindowInfo>, ::tuffite::CommandError>,
1434 ) -> ::tuffite::CommandResult {
1435 use ::tuffite::__private::codec::Encode as _;
1436 let response = response?;
1437 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1438 response
1439 .encode(&mut encoder)
1440 .map_err(|_| {
1441 ::tuffite::CommandError::Failed(
1442 "unable to encode ShellAPI response".to_owned(),
1443 )
1444 })?;
1445 Ok(encoder.finish())
1446 }
1447 }
1448 #[derive(Clone, Debug, PartialEq)]
1449 pub struct Create {
1450 pub options: Option<super::WindowOptions>,
1451 }
1452 impl Create {
1453 pub fn respond(
1454 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1455 ) -> ::tuffite::CommandResult {
1456 use ::tuffite::__private::codec::Encode as _;
1457 let response = response?;
1458 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1459 response
1460 .encode(&mut encoder)
1461 .map_err(|_| {
1462 ::tuffite::CommandError::Failed(
1463 "unable to encode ShellAPI response".to_owned(),
1464 )
1465 })?;
1466 Ok(encoder.finish())
1467 }
1468 }
1469 #[derive(Clone, Debug, PartialEq)]
1470 pub struct Focus {
1471 pub id: Option<super::WindowId>,
1472 }
1473 impl Focus {
1474 pub fn respond(
1475 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1476 ) -> ::tuffite::CommandResult {
1477 use ::tuffite::__private::codec::Encode as _;
1478 let response = response?;
1479 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1480 response
1481 .encode(&mut encoder)
1482 .map_err(|_| {
1483 ::tuffite::CommandError::Failed(
1484 "unable to encode ShellAPI response".to_owned(),
1485 )
1486 })?;
1487 Ok(encoder.finish())
1488 }
1489 }
1490 #[derive(Clone, Debug, PartialEq)]
1491 pub struct Minimize {
1492 pub id: Option<super::WindowId>,
1493 }
1494 impl Minimize {
1495 pub fn respond(
1496 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1497 ) -> ::tuffite::CommandResult {
1498 use ::tuffite::__private::codec::Encode as _;
1499 let response = response?;
1500 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1501 response
1502 .encode(&mut encoder)
1503 .map_err(|_| {
1504 ::tuffite::CommandError::Failed(
1505 "unable to encode ShellAPI response".to_owned(),
1506 )
1507 })?;
1508 Ok(encoder.finish())
1509 }
1510 }
1511 #[derive(Clone, Debug, PartialEq)]
1512 pub struct Maximize {
1513 pub id: Option<super::WindowId>,
1514 }
1515 impl Maximize {
1516 pub fn respond(
1517 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1518 ) -> ::tuffite::CommandResult {
1519 use ::tuffite::__private::codec::Encode as _;
1520 let response = response?;
1521 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1522 response
1523 .encode(&mut encoder)
1524 .map_err(|_| {
1525 ::tuffite::CommandError::Failed(
1526 "unable to encode ShellAPI response".to_owned(),
1527 )
1528 })?;
1529 Ok(encoder.finish())
1530 }
1531 }
1532 #[derive(Clone, Debug, PartialEq)]
1533 pub struct Restore {
1534 pub id: Option<super::WindowId>,
1535 }
1536 impl Restore {
1537 pub fn respond(
1538 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1539 ) -> ::tuffite::CommandResult {
1540 use ::tuffite::__private::codec::Encode as _;
1541 let response = response?;
1542 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1543 response
1544 .encode(&mut encoder)
1545 .map_err(|_| {
1546 ::tuffite::CommandError::Failed(
1547 "unable to encode ShellAPI response".to_owned(),
1548 )
1549 })?;
1550 Ok(encoder.finish())
1551 }
1552 }
1553 #[derive(Clone, Debug, PartialEq)]
1554 pub struct SetFullscreen {
1555 pub fullscreen: bool,
1556 pub id: Option<super::WindowId>,
1557 }
1558 impl SetFullscreen {
1559 pub fn respond(
1560 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1561 ) -> ::tuffite::CommandResult {
1562 use ::tuffite::__private::codec::Encode as _;
1563 let response = response?;
1564 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1565 response
1566 .encode(&mut encoder)
1567 .map_err(|_| {
1568 ::tuffite::CommandError::Failed(
1569 "unable to encode ShellAPI response".to_owned(),
1570 )
1571 })?;
1572 Ok(encoder.finish())
1573 }
1574 }
1575 #[derive(Clone, Debug, PartialEq)]
1576 pub struct Close {
1577 pub id: Option<super::WindowId>,
1578 }
1579 impl Close {
1580 pub fn respond(
1581 response: Result<(), ::tuffite::CommandError>,
1582 ) -> ::tuffite::CommandResult {
1583 use ::tuffite::__private::codec::Encode as _;
1584 let response = response?;
1585 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1586 response
1587 .encode(&mut encoder)
1588 .map_err(|_| {
1589 ::tuffite::CommandError::Failed(
1590 "unable to encode ShellAPI response".to_owned(),
1591 )
1592 })?;
1593 Ok(encoder.finish())
1594 }
1595 }
1596 #[derive(Clone, Debug, PartialEq)]
1597 pub struct SetTitle {
1598 pub title: String,
1599 pub id: Option<super::WindowId>,
1600 }
1601 impl SetTitle {
1602 pub fn respond(
1603 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1604 ) -> ::tuffite::CommandResult {
1605 use ::tuffite::__private::codec::Encode as _;
1606 let response = response?;
1607 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1608 response
1609 .encode(&mut encoder)
1610 .map_err(|_| {
1611 ::tuffite::CommandError::Failed(
1612 "unable to encode ShellAPI response".to_owned(),
1613 )
1614 })?;
1615 Ok(encoder.finish())
1616 }
1617 }
1618 #[derive(Clone, Debug, PartialEq)]
1619 pub struct GetBounds {
1620 pub id: Option<super::WindowId>,
1621 }
1622 impl GetBounds {
1623 pub fn respond(
1624 response: Result<super::WindowBounds, ::tuffite::CommandError>,
1625 ) -> ::tuffite::CommandResult {
1626 use ::tuffite::__private::codec::Encode as _;
1627 let response = response?;
1628 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1629 response
1630 .encode(&mut encoder)
1631 .map_err(|_| {
1632 ::tuffite::CommandError::Failed(
1633 "unable to encode ShellAPI response".to_owned(),
1634 )
1635 })?;
1636 Ok(encoder.finish())
1637 }
1638 }
1639 #[derive(Clone, Debug, PartialEq)]
1640 pub struct SetBounds {
1641 pub bounds: super::WindowBounds,
1642 pub id: Option<super::WindowId>,
1643 }
1644 impl SetBounds {
1645 pub fn respond(
1646 response: Result<super::WindowInfo, ::tuffite::CommandError>,
1647 ) -> ::tuffite::CommandResult {
1648 use ::tuffite::__private::codec::Encode as _;
1649 let response = response?;
1650 let mut encoder = ::tuffite::__private::codec::Encoder::new();
1651 response
1652 .encode(&mut encoder)
1653 .map_err(|_| {
1654 ::tuffite::CommandError::Failed(
1655 "unable to encode ShellAPI response".to_owned(),
1656 )
1657 })?;
1658 Ok(encoder.finish())
1659 }
1660 }
1661}
1662impl ::tuffite::ShellApiRequest for dialog::OpenFile {
1663 type Response = Option<String>;
1664 const CHANNEL: &'static str = "tuffite.dialog.openFile";
1665 fn encode(
1666 &self,
1667 encoder: &mut ::tuffite::__private::codec::Encoder,
1668 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
1669 let _ = &encoder;
1670 ::tuffite::__private::codec::Encode::encode(&self.options, encoder)?;
1671 Ok(())
1672 }
1673}
1674impl dialog::OpenFile {
1675 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
1676 "tuffite.dialog.openFile",
1677 0xf6c3_3f30_40f2_fe25u64,
1678 0x3608_5a8d_453f_a7f9u64,
1679 );
1680 #[doc(hidden)]
1681 pub fn __tuffite_decode(
1682 command: ::tuffite::Command<'_>,
1683 ) -> Result<Self, ::tuffite::CommandError> {
1684 if command.id() != Self::COMMAND.id() {
1685 return Err(::tuffite::CommandError::UnknownCommand);
1686 }
1687 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
1688 return Err(
1689 ::tuffite::CommandError::SchemaMismatch(
1690 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
1691 .to_owned(),
1692 ),
1693 );
1694 }
1695 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
1696 let options: Option<OpenFileDialogOptions> = ::tuffite::__private::codec::Decode::decode(
1697 &mut decoder,
1698 )
1699 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1700 "invalid ShellAPI request".to_owned(),
1701 ))?;
1702 decoder
1703 .finish()
1704 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1705 "trailing ShellAPI request data".to_owned(),
1706 ))?;
1707 Ok(Self { options })
1708 }
1709 #[doc(hidden)]
1710 pub fn __tuffite_dispatch<A>(
1711 command: ::tuffite::Command<'_>,
1712 application: &mut A,
1713 handler: fn(
1714 &mut A,
1715 Option<OpenFileDialogOptions>,
1716 ) -> Result<Option<String>, ::tuffite::CommandError>,
1717 ) -> ::tuffite::CommandResult {
1718 let request = Self::__tuffite_decode(command)?;
1719 Self::respond(handler(application, request.options))
1720 }
1721}
1722impl ::tuffite::ShellApiRequest for dialog::OpenDirectory {
1723 type Response = Option<String>;
1724 const CHANNEL: &'static str = "tuffite.dialog.openDirectory";
1725 fn encode(
1726 &self,
1727 encoder: &mut ::tuffite::__private::codec::Encoder,
1728 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
1729 let _ = &encoder;
1730 ::tuffite::__private::codec::Encode::encode(&self.options, encoder)?;
1731 Ok(())
1732 }
1733}
1734impl dialog::OpenDirectory {
1735 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
1736 "tuffite.dialog.openDirectory",
1737 0xb48f_1748_2022_9a1du64,
1738 0x466e_2f72_d286_69fau64,
1739 );
1740 #[doc(hidden)]
1741 pub fn __tuffite_decode(
1742 command: ::tuffite::Command<'_>,
1743 ) -> Result<Self, ::tuffite::CommandError> {
1744 if command.id() != Self::COMMAND.id() {
1745 return Err(::tuffite::CommandError::UnknownCommand);
1746 }
1747 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
1748 return Err(
1749 ::tuffite::CommandError::SchemaMismatch(
1750 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
1751 .to_owned(),
1752 ),
1753 );
1754 }
1755 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
1756 let options: Option<OpenDirectoryDialogOptions> = ::tuffite::__private::codec::Decode::decode(
1757 &mut decoder,
1758 )
1759 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1760 "invalid ShellAPI request".to_owned(),
1761 ))?;
1762 decoder
1763 .finish()
1764 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1765 "trailing ShellAPI request data".to_owned(),
1766 ))?;
1767 Ok(Self { options })
1768 }
1769 #[doc(hidden)]
1770 pub fn __tuffite_dispatch<A>(
1771 command: ::tuffite::Command<'_>,
1772 application: &mut A,
1773 handler: fn(
1774 &mut A,
1775 Option<OpenDirectoryDialogOptions>,
1776 ) -> Result<Option<String>, ::tuffite::CommandError>,
1777 ) -> ::tuffite::CommandResult {
1778 let request = Self::__tuffite_decode(command)?;
1779 Self::respond(handler(application, request.options))
1780 }
1781}
1782impl ::tuffite::ShellApiRequest for path::Directories {
1783 type Response = PathDirectories;
1784 const CHANNEL: &'static str = "tuffite.path.directories";
1785 fn encode(
1786 &self,
1787 encoder: &mut ::tuffite::__private::codec::Encoder,
1788 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
1789 let _ = &encoder;
1790 Ok(())
1791 }
1792}
1793impl path::Directories {
1794 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
1795 "tuffite.path.directories",
1796 0xdc47_b521_6a77_1dc7u64,
1797 0xb013_83ce_4e5b_a27au64,
1798 );
1799 #[doc(hidden)]
1800 pub fn __tuffite_decode(
1801 command: ::tuffite::Command<'_>,
1802 ) -> Result<Self, ::tuffite::CommandError> {
1803 if command.id() != Self::COMMAND.id() {
1804 return Err(::tuffite::CommandError::UnknownCommand);
1805 }
1806 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
1807 return Err(
1808 ::tuffite::CommandError::SchemaMismatch(
1809 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
1810 .to_owned(),
1811 ),
1812 );
1813 }
1814 if !command.payload().is_empty() {
1815 return Err(
1816 ::tuffite::CommandError::InvalidArgument(
1817 "trailing ShellAPI request data".to_owned(),
1818 ),
1819 );
1820 }
1821 Ok(Self {})
1822 }
1823 #[doc(hidden)]
1824 pub fn __tuffite_dispatch<A>(
1825 command: ::tuffite::Command<'_>,
1826 application: &mut A,
1827 handler: fn(&mut A) -> Result<PathDirectories, ::tuffite::CommandError>,
1828 ) -> ::tuffite::CommandResult {
1829 Self::__tuffite_decode(command)?;
1830 Self::respond(handler(application))
1831 }
1832}
1833impl ::tuffite::ShellApiRequest for path::Resolve {
1834 type Response = String;
1835 const CHANNEL: &'static str = "tuffite.path.resolve";
1836 fn encode(
1837 &self,
1838 encoder: &mut ::tuffite::__private::codec::Encoder,
1839 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
1840 let _ = &encoder;
1841 ::tuffite::__private::codec::Encode::encode(&self.base, encoder)?;
1842 ::tuffite::__private::codec::Encode::encode(&self.relative, encoder)?;
1843 Ok(())
1844 }
1845}
1846impl path::Resolve {
1847 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
1848 "tuffite.path.resolve",
1849 0xc97a_0a14_2d4f_8077u64,
1850 0x0170_c444_04ed_c31cu64,
1851 );
1852 #[doc(hidden)]
1853 pub fn __tuffite_decode(
1854 command: ::tuffite::Command<'_>,
1855 ) -> Result<Self, ::tuffite::CommandError> {
1856 if command.id() != Self::COMMAND.id() {
1857 return Err(::tuffite::CommandError::UnknownCommand);
1858 }
1859 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
1860 return Err(
1861 ::tuffite::CommandError::SchemaMismatch(
1862 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
1863 .to_owned(),
1864 ),
1865 );
1866 }
1867 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
1868 let base: BaseDirectory = ::tuffite::__private::codec::Decode::decode(
1869 &mut decoder,
1870 )
1871 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1872 "invalid ShellAPI request".to_owned(),
1873 ))?;
1874 let relative: Option<String> = ::tuffite::__private::codec::Decode::decode(
1875 &mut decoder,
1876 )
1877 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1878 "invalid ShellAPI request".to_owned(),
1879 ))?;
1880 decoder
1881 .finish()
1882 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1883 "trailing ShellAPI request data".to_owned(),
1884 ))?;
1885 Ok(Self { base, relative })
1886 }
1887 #[doc(hidden)]
1888 pub fn __tuffite_dispatch<A>(
1889 command: ::tuffite::Command<'_>,
1890 application: &mut A,
1891 handler: fn(
1892 &mut A,
1893 BaseDirectory,
1894 Option<String>,
1895 ) -> Result<String, ::tuffite::CommandError>,
1896 ) -> ::tuffite::CommandResult {
1897 let request = Self::__tuffite_decode(command)?;
1898 Self::respond(handler(application, request.base, request.relative))
1899 }
1900}
1901impl ::tuffite::ShellApiRequest for remoting::Capabilities {
1902 type Response = RemotingCapabilities;
1903 const CHANNEL: &'static str = "tuffite.remoting.capabilities";
1904 fn encode(
1905 &self,
1906 encoder: &mut ::tuffite::__private::codec::Encoder,
1907 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
1908 let _ = &encoder;
1909 Ok(())
1910 }
1911}
1912impl remoting::Capabilities {
1913 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
1914 "tuffite.remoting.capabilities",
1915 0xd95b_4f76_c83c_2718u64,
1916 0x2669_08a3_eb5b_2aa5u64,
1917 );
1918 #[doc(hidden)]
1919 pub fn __tuffite_decode(
1920 command: ::tuffite::Command<'_>,
1921 ) -> Result<Self, ::tuffite::CommandError> {
1922 if command.id() != Self::COMMAND.id() {
1923 return Err(::tuffite::CommandError::UnknownCommand);
1924 }
1925 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
1926 return Err(
1927 ::tuffite::CommandError::SchemaMismatch(
1928 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
1929 .to_owned(),
1930 ),
1931 );
1932 }
1933 if !command.payload().is_empty() {
1934 return Err(
1935 ::tuffite::CommandError::InvalidArgument(
1936 "trailing ShellAPI request data".to_owned(),
1937 ),
1938 );
1939 }
1940 Ok(Self {})
1941 }
1942 #[doc(hidden)]
1943 pub fn __tuffite_dispatch<A>(
1944 command: ::tuffite::Command<'_>,
1945 application: &mut A,
1946 handler: fn(&mut A) -> Result<RemotingCapabilities, ::tuffite::CommandError>,
1947 ) -> ::tuffite::CommandResult {
1948 Self::__tuffite_decode(command)?;
1949 Self::respond(handler(application))
1950 }
1951}
1952impl ::tuffite::ShellApiRequest for remoting::Start {
1953 type Response = RemotingSession;
1954 const CHANNEL: &'static str = "tuffite.remoting.start";
1955 fn encode(
1956 &self,
1957 encoder: &mut ::tuffite::__private::codec::Encoder,
1958 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
1959 let _ = &encoder;
1960 ::tuffite::__private::codec::Encode::encode(&self.options, encoder)?;
1961 Ok(())
1962 }
1963}
1964impl remoting::Start {
1965 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
1966 "tuffite.remoting.start",
1967 0xef17_8b75_5bff_5be8u64,
1968 0x351d_30bb_9a8e_0c61u64,
1969 );
1970 #[doc(hidden)]
1971 pub fn __tuffite_decode(
1972 command: ::tuffite::Command<'_>,
1973 ) -> Result<Self, ::tuffite::CommandError> {
1974 if command.id() != Self::COMMAND.id() {
1975 return Err(::tuffite::CommandError::UnknownCommand);
1976 }
1977 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
1978 return Err(
1979 ::tuffite::CommandError::SchemaMismatch(
1980 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
1981 .to_owned(),
1982 ),
1983 );
1984 }
1985 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
1986 let options: RemotingStartOptions = ::tuffite::__private::codec::Decode::decode(
1987 &mut decoder,
1988 )
1989 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1990 "invalid ShellAPI request".to_owned(),
1991 ))?;
1992 decoder
1993 .finish()
1994 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
1995 "trailing ShellAPI request data".to_owned(),
1996 ))?;
1997 Ok(Self { options })
1998 }
1999 #[doc(hidden)]
2000 pub fn __tuffite_dispatch<A>(
2001 command: ::tuffite::Command<'_>,
2002 application: &mut A,
2003 handler: fn(
2004 &mut A,
2005 RemotingStartOptions,
2006 ) -> Result<RemotingSession, ::tuffite::CommandError>,
2007 ) -> ::tuffite::CommandResult {
2008 let request = Self::__tuffite_decode(command)?;
2009 Self::respond(handler(application, request.options))
2010 }
2011}
2012impl ::tuffite::ShellApiRequest for remoting::ProcessSignal {
2013 type Response = ();
2014 const CHANNEL: &'static str = "tuffite.remoting.processSignal";
2015 fn encode(
2016 &self,
2017 encoder: &mut ::tuffite::__private::codec::Encoder,
2018 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2019 let _ = &encoder;
2020 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
2021 ::tuffite::__private::codec::Encode::encode(&self.signal, encoder)?;
2022 Ok(())
2023 }
2024}
2025impl remoting::ProcessSignal {
2026 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2027 "tuffite.remoting.processSignal",
2028 0x9259_0b17_22c0_f00cu64,
2029 0x3259_6946_f161_45cfu64,
2030 );
2031 #[doc(hidden)]
2032 pub fn __tuffite_decode(
2033 command: ::tuffite::Command<'_>,
2034 ) -> Result<Self, ::tuffite::CommandError> {
2035 if command.id() != Self::COMMAND.id() {
2036 return Err(::tuffite::CommandError::UnknownCommand);
2037 }
2038 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2039 return Err(
2040 ::tuffite::CommandError::SchemaMismatch(
2041 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2042 .to_owned(),
2043 ),
2044 );
2045 }
2046 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2047 let id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2048 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2049 "invalid ShellAPI request".to_owned(),
2050 ))?;
2051 let signal: RemotingSignal = ::tuffite::__private::codec::Decode::decode(
2052 &mut decoder,
2053 )
2054 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2055 "invalid ShellAPI request".to_owned(),
2056 ))?;
2057 decoder
2058 .finish()
2059 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2060 "trailing ShellAPI request data".to_owned(),
2061 ))?;
2062 Ok(Self { id, signal })
2063 }
2064 #[doc(hidden)]
2065 pub fn __tuffite_dispatch<A>(
2066 command: ::tuffite::Command<'_>,
2067 application: &mut A,
2068 handler: fn(&mut A, i64, RemotingSignal) -> Result<(), ::tuffite::CommandError>,
2069 ) -> ::tuffite::CommandResult {
2070 let request = Self::__tuffite_decode(command)?;
2071 Self::respond(handler(application, request.id, request.signal))
2072 }
2073}
2074impl ::tuffite::ShellApiRequest for remoting::TakeSignals {
2075 type Response = Vec<RemotingSignal>;
2076 const CHANNEL: &'static str = "tuffite.remoting.takeSignals";
2077 fn encode(
2078 &self,
2079 encoder: &mut ::tuffite::__private::codec::Encoder,
2080 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2081 let _ = &encoder;
2082 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
2083 ::tuffite::__private::codec::Encode::encode(&self.after_sequence, encoder)?;
2084 Ok(())
2085 }
2086}
2087impl remoting::TakeSignals {
2088 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2089 "tuffite.remoting.takeSignals",
2090 0xcfd0_7b61_ea21_251bu64,
2091 0x3583_8aef_6986_98a1u64,
2092 );
2093 #[doc(hidden)]
2094 pub fn __tuffite_decode(
2095 command: ::tuffite::Command<'_>,
2096 ) -> Result<Self, ::tuffite::CommandError> {
2097 if command.id() != Self::COMMAND.id() {
2098 return Err(::tuffite::CommandError::UnknownCommand);
2099 }
2100 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2101 return Err(
2102 ::tuffite::CommandError::SchemaMismatch(
2103 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2104 .to_owned(),
2105 ),
2106 );
2107 }
2108 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2109 let id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2110 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2111 "invalid ShellAPI request".to_owned(),
2112 ))?;
2113 let after_sequence: Option<i64> = ::tuffite::__private::codec::Decode::decode(
2114 &mut decoder,
2115 )
2116 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2117 "invalid ShellAPI request".to_owned(),
2118 ))?;
2119 decoder
2120 .finish()
2121 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2122 "trailing ShellAPI request data".to_owned(),
2123 ))?;
2124 Ok(Self { id, after_sequence })
2125 }
2126 #[doc(hidden)]
2127 pub fn __tuffite_dispatch<A>(
2128 command: ::tuffite::Command<'_>,
2129 application: &mut A,
2130 handler: fn(
2131 &mut A,
2132 i64,
2133 Option<i64>,
2134 ) -> Result<Vec<RemotingSignal>, ::tuffite::CommandError>,
2135 ) -> ::tuffite::CommandResult {
2136 let request = Self::__tuffite_decode(command)?;
2137 Self::respond(handler(application, request.id, request.after_sequence))
2138 }
2139}
2140impl ::tuffite::ShellApiRequest for remoting::SendInput {
2141 type Response = ();
2142 const CHANNEL: &'static str = "tuffite.remoting.sendInput";
2143 fn encode(
2144 &self,
2145 encoder: &mut ::tuffite::__private::codec::Encoder,
2146 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2147 let _ = &encoder;
2148 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
2149 ::tuffite::__private::codec::Encode::encode(&self.event, encoder)?;
2150 Ok(())
2151 }
2152}
2153impl remoting::SendInput {
2154 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2155 "tuffite.remoting.sendInput",
2156 0x8f01_760c_8fbd_e013u64,
2157 0x9684_7a08_83ac_9883u64,
2158 );
2159 #[doc(hidden)]
2160 pub fn __tuffite_decode(
2161 command: ::tuffite::Command<'_>,
2162 ) -> Result<Self, ::tuffite::CommandError> {
2163 if command.id() != Self::COMMAND.id() {
2164 return Err(::tuffite::CommandError::UnknownCommand);
2165 }
2166 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2167 return Err(
2168 ::tuffite::CommandError::SchemaMismatch(
2169 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2170 .to_owned(),
2171 ),
2172 );
2173 }
2174 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2175 let id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2176 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2177 "invalid ShellAPI request".to_owned(),
2178 ))?;
2179 let event: RemotingInputEvent = ::tuffite::__private::codec::Decode::decode(
2180 &mut decoder,
2181 )
2182 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2183 "invalid ShellAPI request".to_owned(),
2184 ))?;
2185 decoder
2186 .finish()
2187 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2188 "trailing ShellAPI request data".to_owned(),
2189 ))?;
2190 Ok(Self { id, event })
2191 }
2192 #[doc(hidden)]
2193 pub fn __tuffite_dispatch<A>(
2194 command: ::tuffite::Command<'_>,
2195 application: &mut A,
2196 handler: fn(
2197 &mut A,
2198 i64,
2199 RemotingInputEvent,
2200 ) -> Result<(), ::tuffite::CommandError>,
2201 ) -> ::tuffite::CommandResult {
2202 let request = Self::__tuffite_decode(command)?;
2203 Self::respond(handler(application, request.id, request.event))
2204 }
2205}
2206impl ::tuffite::ShellApiRequest for remoting::Stop {
2207 type Response = ();
2208 const CHANNEL: &'static str = "tuffite.remoting.stop";
2209 fn encode(
2210 &self,
2211 encoder: &mut ::tuffite::__private::codec::Encoder,
2212 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2213 let _ = &encoder;
2214 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
2215 Ok(())
2216 }
2217}
2218impl remoting::Stop {
2219 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2220 "tuffite.remoting.stop",
2221 0x8db3_cd25_bc28_e427u64,
2222 0x3289_69ae_8937_4051u64,
2223 );
2224 #[doc(hidden)]
2225 pub fn __tuffite_decode(
2226 command: ::tuffite::Command<'_>,
2227 ) -> Result<Self, ::tuffite::CommandError> {
2228 if command.id() != Self::COMMAND.id() {
2229 return Err(::tuffite::CommandError::UnknownCommand);
2230 }
2231 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2232 return Err(
2233 ::tuffite::CommandError::SchemaMismatch(
2234 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2235 .to_owned(),
2236 ),
2237 );
2238 }
2239 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2240 let id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2241 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2242 "invalid ShellAPI request".to_owned(),
2243 ))?;
2244 decoder
2245 .finish()
2246 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2247 "trailing ShellAPI request data".to_owned(),
2248 ))?;
2249 Ok(Self { id })
2250 }
2251 #[doc(hidden)]
2252 pub fn __tuffite_dispatch<A>(
2253 command: ::tuffite::Command<'_>,
2254 application: &mut A,
2255 handler: fn(&mut A, i64) -> Result<(), ::tuffite::CommandError>,
2256 ) -> ::tuffite::CommandResult {
2257 let request = Self::__tuffite_decode(command)?;
2258 Self::respond(handler(application, request.id))
2259 }
2260}
2261impl ::tuffite::ShellApiRequest for remoting::Stats {
2262 type Response = RemotingStats;
2263 const CHANNEL: &'static str = "tuffite.remoting.stats";
2264 fn encode(
2265 &self,
2266 encoder: &mut ::tuffite::__private::codec::Encoder,
2267 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2268 let _ = &encoder;
2269 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
2270 Ok(())
2271 }
2272}
2273impl remoting::Stats {
2274 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2275 "tuffite.remoting.stats",
2276 0xf501_1f12_12ad_4546u64,
2277 0xe361_2f19_69a8_6fa4u64,
2278 );
2279 #[doc(hidden)]
2280 pub fn __tuffite_decode(
2281 command: ::tuffite::Command<'_>,
2282 ) -> Result<Self, ::tuffite::CommandError> {
2283 if command.id() != Self::COMMAND.id() {
2284 return Err(::tuffite::CommandError::UnknownCommand);
2285 }
2286 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2287 return Err(
2288 ::tuffite::CommandError::SchemaMismatch(
2289 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2290 .to_owned(),
2291 ),
2292 );
2293 }
2294 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2295 let id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2296 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2297 "invalid ShellAPI request".to_owned(),
2298 ))?;
2299 decoder
2300 .finish()
2301 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2302 "trailing ShellAPI request data".to_owned(),
2303 ))?;
2304 Ok(Self { id })
2305 }
2306 #[doc(hidden)]
2307 pub fn __tuffite_dispatch<A>(
2308 command: ::tuffite::Command<'_>,
2309 application: &mut A,
2310 handler: fn(&mut A, i64) -> Result<RemotingStats, ::tuffite::CommandError>,
2311 ) -> ::tuffite::CommandResult {
2312 let request = Self::__tuffite_decode(command)?;
2313 Self::respond(handler(application, request.id))
2314 }
2315}
2316impl ::tuffite::ShellApiRequest for remoting::Capture {
2317 type Response = RemotingSnapshot;
2318 const CHANNEL: &'static str = "tuffite.remoting.capture";
2319 fn encode(
2320 &self,
2321 encoder: &mut ::tuffite::__private::codec::Encoder,
2322 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2323 let _ = &encoder;
2324 ::tuffite::__private::codec::Encode::encode(&self.screen_id, encoder)?;
2325 Ok(())
2326 }
2327}
2328impl remoting::Capture {
2329 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2330 "tuffite.remoting.capture",
2331 0x155d_7c65_1339_b2b9u64,
2332 0xbd9b_d620_30b9_dc25u64,
2333 );
2334 #[doc(hidden)]
2335 pub fn __tuffite_decode(
2336 command: ::tuffite::Command<'_>,
2337 ) -> Result<Self, ::tuffite::CommandError> {
2338 if command.id() != Self::COMMAND.id() {
2339 return Err(::tuffite::CommandError::UnknownCommand);
2340 }
2341 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2342 return Err(
2343 ::tuffite::CommandError::SchemaMismatch(
2344 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2345 .to_owned(),
2346 ),
2347 );
2348 }
2349 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2350 let screen_id: Option<i64> = ::tuffite::__private::codec::Decode::decode(
2351 &mut decoder,
2352 )
2353 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2354 "invalid ShellAPI request".to_owned(),
2355 ))?;
2356 decoder
2357 .finish()
2358 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2359 "trailing ShellAPI request data".to_owned(),
2360 ))?;
2361 Ok(Self { screen_id })
2362 }
2363 #[doc(hidden)]
2364 pub fn __tuffite_dispatch<A>(
2365 command: ::tuffite::Command<'_>,
2366 application: &mut A,
2367 handler: fn(
2368 &mut A,
2369 Option<i64>,
2370 ) -> Result<RemotingSnapshot, ::tuffite::CommandError>,
2371 ) -> ::tuffite::CommandResult {
2372 let request = Self::__tuffite_decode(command)?;
2373 Self::respond(handler(application, request.screen_id))
2374 }
2375}
2376impl ::tuffite::ShellApiRequest for remoting::InjectInput {
2377 type Response = ();
2378 const CHANNEL: &'static str = "tuffite.remoting.injectInput";
2379 fn encode(
2380 &self,
2381 encoder: &mut ::tuffite::__private::codec::Encoder,
2382 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2383 let _ = &encoder;
2384 ::tuffite::__private::codec::Encode::encode(&self.event, encoder)?;
2385 Ok(())
2386 }
2387}
2388impl remoting::InjectInput {
2389 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2390 "tuffite.remoting.injectInput",
2391 0x4d93_0f12_59de_1d5fu64,
2392 0x3e2c_b856_ef0f_0c8eu64,
2393 );
2394 #[doc(hidden)]
2395 pub fn __tuffite_decode(
2396 command: ::tuffite::Command<'_>,
2397 ) -> Result<Self, ::tuffite::CommandError> {
2398 if command.id() != Self::COMMAND.id() {
2399 return Err(::tuffite::CommandError::UnknownCommand);
2400 }
2401 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2402 return Err(
2403 ::tuffite::CommandError::SchemaMismatch(
2404 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2405 .to_owned(),
2406 ),
2407 );
2408 }
2409 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2410 let event: RemotingInputEvent = ::tuffite::__private::codec::Decode::decode(
2411 &mut decoder,
2412 )
2413 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2414 "invalid ShellAPI request".to_owned(),
2415 ))?;
2416 decoder
2417 .finish()
2418 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2419 "trailing ShellAPI request data".to_owned(),
2420 ))?;
2421 Ok(Self { event })
2422 }
2423 #[doc(hidden)]
2424 pub fn __tuffite_dispatch<A>(
2425 command: ::tuffite::Command<'_>,
2426 application: &mut A,
2427 handler: fn(&mut A, RemotingInputEvent) -> Result<(), ::tuffite::CommandError>,
2428 ) -> ::tuffite::CommandResult {
2429 let request = Self::__tuffite_decode(command)?;
2430 Self::respond(handler(application, request.event))
2431 }
2432}
2433impl ::tuffite::ShellApiRequest for fs::ReadFile {
2434 type Response = ::tuffite::Bytes;
2435 const CHANNEL: &'static str = "tuffite.fs.readFile";
2436 fn encode(
2437 &self,
2438 encoder: &mut ::tuffite::__private::codec::Encoder,
2439 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2440 let _ = &encoder;
2441 ::tuffite::__private::codec::Encode::encode(&self.base, encoder)?;
2442 ::tuffite::__private::codec::Encode::encode(&self.path, encoder)?;
2443 Ok(())
2444 }
2445}
2446impl fs::ReadFile {
2447 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2448 "tuffite.fs.readFile",
2449 0xa26f_3393_8cdc_7294u64,
2450 0xd411_76c0_7662_7b9bu64,
2451 );
2452 #[doc(hidden)]
2453 pub fn __tuffite_decode(
2454 command: ::tuffite::Command<'_>,
2455 ) -> Result<Self, ::tuffite::CommandError> {
2456 if command.id() != Self::COMMAND.id() {
2457 return Err(::tuffite::CommandError::UnknownCommand);
2458 }
2459 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2460 return Err(
2461 ::tuffite::CommandError::SchemaMismatch(
2462 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2463 .to_owned(),
2464 ),
2465 );
2466 }
2467 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2468 let base: BaseDirectory = ::tuffite::__private::codec::Decode::decode(
2469 &mut decoder,
2470 )
2471 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2472 "invalid ShellAPI request".to_owned(),
2473 ))?;
2474 let path: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2475 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2476 "invalid ShellAPI request".to_owned(),
2477 ))?;
2478 decoder
2479 .finish()
2480 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2481 "trailing ShellAPI request data".to_owned(),
2482 ))?;
2483 Ok(Self { base, path })
2484 }
2485 #[doc(hidden)]
2486 pub fn __tuffite_dispatch<A>(
2487 command: ::tuffite::Command<'_>,
2488 application: &mut A,
2489 handler: fn(
2490 &mut A,
2491 BaseDirectory,
2492 String,
2493 ) -> Result<::tuffite::Bytes, ::tuffite::CommandError>,
2494 ) -> ::tuffite::CommandResult {
2495 let request = Self::__tuffite_decode(command)?;
2496 Self::respond(handler(application, request.base, request.path))
2497 }
2498}
2499impl ::tuffite::ShellApiRequest for fs::WriteFile {
2500 type Response = ();
2501 const CHANNEL: &'static str = "tuffite.fs.writeFile";
2502 fn encode(
2503 &self,
2504 encoder: &mut ::tuffite::__private::codec::Encoder,
2505 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2506 let _ = &encoder;
2507 ::tuffite::__private::codec::Encode::encode(&self.base, encoder)?;
2508 ::tuffite::__private::codec::Encode::encode(&self.path, encoder)?;
2509 ::tuffite::__private::codec::Encode::encode(&self.contents, encoder)?;
2510 Ok(())
2511 }
2512}
2513impl fs::WriteFile {
2514 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2515 "tuffite.fs.writeFile",
2516 0x2f93_310d_ba55_c933u64,
2517 0xe4ba_90d2_2c7b_5a79u64,
2518 );
2519 #[doc(hidden)]
2520 pub fn __tuffite_decode(
2521 command: ::tuffite::Command<'_>,
2522 ) -> Result<Self, ::tuffite::CommandError> {
2523 if command.id() != Self::COMMAND.id() {
2524 return Err(::tuffite::CommandError::UnknownCommand);
2525 }
2526 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2527 return Err(
2528 ::tuffite::CommandError::SchemaMismatch(
2529 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2530 .to_owned(),
2531 ),
2532 );
2533 }
2534 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2535 let base: BaseDirectory = ::tuffite::__private::codec::Decode::decode(
2536 &mut decoder,
2537 )
2538 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2539 "invalid ShellAPI request".to_owned(),
2540 ))?;
2541 let path: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2542 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2543 "invalid ShellAPI request".to_owned(),
2544 ))?;
2545 let contents: ::tuffite::Bytes = ::tuffite::__private::codec::Decode::decode(
2546 &mut decoder,
2547 )
2548 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2549 "invalid ShellAPI request".to_owned(),
2550 ))?;
2551 decoder
2552 .finish()
2553 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2554 "trailing ShellAPI request data".to_owned(),
2555 ))?;
2556 Ok(Self { base, path, contents })
2557 }
2558 #[doc(hidden)]
2559 pub fn __tuffite_dispatch<A>(
2560 command: ::tuffite::Command<'_>,
2561 application: &mut A,
2562 handler: fn(
2563 &mut A,
2564 BaseDirectory,
2565 String,
2566 ::tuffite::Bytes,
2567 ) -> Result<(), ::tuffite::CommandError>,
2568 ) -> ::tuffite::CommandResult {
2569 let request = Self::__tuffite_decode(command)?;
2570 Self::respond(handler(application, request.base, request.path, request.contents))
2571 }
2572}
2573impl ::tuffite::ShellApiRequest for fs::Exists {
2574 type Response = bool;
2575 const CHANNEL: &'static str = "tuffite.fs.exists";
2576 fn encode(
2577 &self,
2578 encoder: &mut ::tuffite::__private::codec::Encoder,
2579 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2580 let _ = &encoder;
2581 ::tuffite::__private::codec::Encode::encode(&self.base, encoder)?;
2582 ::tuffite::__private::codec::Encode::encode(&self.path, encoder)?;
2583 Ok(())
2584 }
2585}
2586impl fs::Exists {
2587 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2588 "tuffite.fs.exists",
2589 0xfebb_6a4e_2e5b_af29u64,
2590 0xc294_caaa_f32f_6c6fu64,
2591 );
2592 #[doc(hidden)]
2593 pub fn __tuffite_decode(
2594 command: ::tuffite::Command<'_>,
2595 ) -> Result<Self, ::tuffite::CommandError> {
2596 if command.id() != Self::COMMAND.id() {
2597 return Err(::tuffite::CommandError::UnknownCommand);
2598 }
2599 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2600 return Err(
2601 ::tuffite::CommandError::SchemaMismatch(
2602 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2603 .to_owned(),
2604 ),
2605 );
2606 }
2607 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2608 let base: BaseDirectory = ::tuffite::__private::codec::Decode::decode(
2609 &mut decoder,
2610 )
2611 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2612 "invalid ShellAPI request".to_owned(),
2613 ))?;
2614 let path: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2615 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2616 "invalid ShellAPI request".to_owned(),
2617 ))?;
2618 decoder
2619 .finish()
2620 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2621 "trailing ShellAPI request data".to_owned(),
2622 ))?;
2623 Ok(Self { base, path })
2624 }
2625 #[doc(hidden)]
2626 pub fn __tuffite_dispatch<A>(
2627 command: ::tuffite::Command<'_>,
2628 application: &mut A,
2629 handler: fn(
2630 &mut A,
2631 BaseDirectory,
2632 String,
2633 ) -> Result<bool, ::tuffite::CommandError>,
2634 ) -> ::tuffite::CommandResult {
2635 let request = Self::__tuffite_decode(command)?;
2636 Self::respond(handler(application, request.base, request.path))
2637 }
2638}
2639impl ::tuffite::ShellApiRequest for fs::CreateDir {
2640 type Response = ();
2641 const CHANNEL: &'static str = "tuffite.fs.createDir";
2642 fn encode(
2643 &self,
2644 encoder: &mut ::tuffite::__private::codec::Encoder,
2645 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2646 let _ = &encoder;
2647 ::tuffite::__private::codec::Encode::encode(&self.base, encoder)?;
2648 ::tuffite::__private::codec::Encode::encode(&self.path, encoder)?;
2649 Ok(())
2650 }
2651}
2652impl fs::CreateDir {
2653 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2654 "tuffite.fs.createDir",
2655 0x920d_3f68_cfee_5a2bu64,
2656 0x3f9f_56ad_94d4_9c0cu64,
2657 );
2658 #[doc(hidden)]
2659 pub fn __tuffite_decode(
2660 command: ::tuffite::Command<'_>,
2661 ) -> Result<Self, ::tuffite::CommandError> {
2662 if command.id() != Self::COMMAND.id() {
2663 return Err(::tuffite::CommandError::UnknownCommand);
2664 }
2665 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2666 return Err(
2667 ::tuffite::CommandError::SchemaMismatch(
2668 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2669 .to_owned(),
2670 ),
2671 );
2672 }
2673 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2674 let base: BaseDirectory = ::tuffite::__private::codec::Decode::decode(
2675 &mut decoder,
2676 )
2677 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2678 "invalid ShellAPI request".to_owned(),
2679 ))?;
2680 let path: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2681 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2682 "invalid ShellAPI request".to_owned(),
2683 ))?;
2684 decoder
2685 .finish()
2686 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2687 "trailing ShellAPI request data".to_owned(),
2688 ))?;
2689 Ok(Self { base, path })
2690 }
2691 #[doc(hidden)]
2692 pub fn __tuffite_dispatch<A>(
2693 command: ::tuffite::Command<'_>,
2694 application: &mut A,
2695 handler: fn(&mut A, BaseDirectory, String) -> Result<(), ::tuffite::CommandError>,
2696 ) -> ::tuffite::CommandResult {
2697 let request = Self::__tuffite_decode(command)?;
2698 Self::respond(handler(application, request.base, request.path))
2699 }
2700}
2701impl ::tuffite::ShellApiRequest for fs::RemoveFile {
2702 type Response = ();
2703 const CHANNEL: &'static str = "tuffite.fs.removeFile";
2704 fn encode(
2705 &self,
2706 encoder: &mut ::tuffite::__private::codec::Encoder,
2707 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2708 let _ = &encoder;
2709 ::tuffite::__private::codec::Encode::encode(&self.base, encoder)?;
2710 ::tuffite::__private::codec::Encode::encode(&self.path, encoder)?;
2711 Ok(())
2712 }
2713}
2714impl fs::RemoveFile {
2715 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2716 "tuffite.fs.removeFile",
2717 0xefb0_bcaf_7707_86cau64,
2718 0x3f9f_56ad_94d4_9c0cu64,
2719 );
2720 #[doc(hidden)]
2721 pub fn __tuffite_decode(
2722 command: ::tuffite::Command<'_>,
2723 ) -> Result<Self, ::tuffite::CommandError> {
2724 if command.id() != Self::COMMAND.id() {
2725 return Err(::tuffite::CommandError::UnknownCommand);
2726 }
2727 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2728 return Err(
2729 ::tuffite::CommandError::SchemaMismatch(
2730 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2731 .to_owned(),
2732 ),
2733 );
2734 }
2735 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2736 let base: BaseDirectory = ::tuffite::__private::codec::Decode::decode(
2737 &mut decoder,
2738 )
2739 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2740 "invalid ShellAPI request".to_owned(),
2741 ))?;
2742 let path: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2743 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2744 "invalid ShellAPI request".to_owned(),
2745 ))?;
2746 decoder
2747 .finish()
2748 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2749 "trailing ShellAPI request data".to_owned(),
2750 ))?;
2751 Ok(Self { base, path })
2752 }
2753 #[doc(hidden)]
2754 pub fn __tuffite_dispatch<A>(
2755 command: ::tuffite::Command<'_>,
2756 application: &mut A,
2757 handler: fn(&mut A, BaseDirectory, String) -> Result<(), ::tuffite::CommandError>,
2758 ) -> ::tuffite::CommandResult {
2759 let request = Self::__tuffite_decode(command)?;
2760 Self::respond(handler(application, request.base, request.path))
2761 }
2762}
2763impl ::tuffite::ShellApiRequest for storage::Get {
2764 type Response = Option<::tuffite::Bytes>;
2765 const CHANNEL: &'static str = "tuffite.storage.get";
2766 fn encode(
2767 &self,
2768 encoder: &mut ::tuffite::__private::codec::Encoder,
2769 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2770 let _ = &encoder;
2771 ::tuffite::__private::codec::Encode::encode(&self.key, encoder)?;
2772 Ok(())
2773 }
2774}
2775impl storage::Get {
2776 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2777 "tuffite.storage.get",
2778 0xb840_92a6_e6ca_f9a6u64,
2779 0x71ea_bd90_27ef_4903u64,
2780 );
2781 #[doc(hidden)]
2782 pub fn __tuffite_decode(
2783 command: ::tuffite::Command<'_>,
2784 ) -> Result<Self, ::tuffite::CommandError> {
2785 if command.id() != Self::COMMAND.id() {
2786 return Err(::tuffite::CommandError::UnknownCommand);
2787 }
2788 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2789 return Err(
2790 ::tuffite::CommandError::SchemaMismatch(
2791 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2792 .to_owned(),
2793 ),
2794 );
2795 }
2796 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2797 let key: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2798 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2799 "invalid ShellAPI request".to_owned(),
2800 ))?;
2801 decoder
2802 .finish()
2803 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2804 "trailing ShellAPI request data".to_owned(),
2805 ))?;
2806 Ok(Self { key })
2807 }
2808 #[doc(hidden)]
2809 pub fn __tuffite_dispatch<A>(
2810 command: ::tuffite::Command<'_>,
2811 application: &mut A,
2812 handler: fn(
2813 &mut A,
2814 String,
2815 ) -> Result<Option<::tuffite::Bytes>, ::tuffite::CommandError>,
2816 ) -> ::tuffite::CommandResult {
2817 let request = Self::__tuffite_decode(command)?;
2818 Self::respond(handler(application, request.key))
2819 }
2820}
2821impl ::tuffite::ShellApiRequest for storage::Set {
2822 type Response = ();
2823 const CHANNEL: &'static str = "tuffite.storage.set";
2824 fn encode(
2825 &self,
2826 encoder: &mut ::tuffite::__private::codec::Encoder,
2827 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2828 let _ = &encoder;
2829 ::tuffite::__private::codec::Encode::encode(&self.key, encoder)?;
2830 ::tuffite::__private::codec::Encode::encode(&self.value, encoder)?;
2831 Ok(())
2832 }
2833}
2834impl storage::Set {
2835 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2836 "tuffite.storage.set",
2837 0x3ed2_e38b_c15b_bfb8u64,
2838 0x9f36_d4f5_ebbe_c33eu64,
2839 );
2840 #[doc(hidden)]
2841 pub fn __tuffite_decode(
2842 command: ::tuffite::Command<'_>,
2843 ) -> Result<Self, ::tuffite::CommandError> {
2844 if command.id() != Self::COMMAND.id() {
2845 return Err(::tuffite::CommandError::UnknownCommand);
2846 }
2847 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2848 return Err(
2849 ::tuffite::CommandError::SchemaMismatch(
2850 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2851 .to_owned(),
2852 ),
2853 );
2854 }
2855 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2856 let key: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2857 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2858 "invalid ShellAPI request".to_owned(),
2859 ))?;
2860 let value: ::tuffite::Bytes = ::tuffite::__private::codec::Decode::decode(
2861 &mut decoder,
2862 )
2863 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2864 "invalid ShellAPI request".to_owned(),
2865 ))?;
2866 decoder
2867 .finish()
2868 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2869 "trailing ShellAPI request data".to_owned(),
2870 ))?;
2871 Ok(Self { key, value })
2872 }
2873 #[doc(hidden)]
2874 pub fn __tuffite_dispatch<A>(
2875 command: ::tuffite::Command<'_>,
2876 application: &mut A,
2877 handler: fn(
2878 &mut A,
2879 String,
2880 ::tuffite::Bytes,
2881 ) -> Result<(), ::tuffite::CommandError>,
2882 ) -> ::tuffite::CommandResult {
2883 let request = Self::__tuffite_decode(command)?;
2884 Self::respond(handler(application, request.key, request.value))
2885 }
2886}
2887impl ::tuffite::ShellApiRequest for storage::Remove {
2888 type Response = ();
2889 const CHANNEL: &'static str = "tuffite.storage.remove";
2890 fn encode(
2891 &self,
2892 encoder: &mut ::tuffite::__private::codec::Encoder,
2893 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2894 let _ = &encoder;
2895 ::tuffite::__private::codec::Encode::encode(&self.key, encoder)?;
2896 Ok(())
2897 }
2898}
2899impl storage::Remove {
2900 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2901 "tuffite.storage.remove",
2902 0x3b36_008e_53d2_0f70u64,
2903 0x40aa_8f27_e6e1_fd27u64,
2904 );
2905 #[doc(hidden)]
2906 pub fn __tuffite_decode(
2907 command: ::tuffite::Command<'_>,
2908 ) -> Result<Self, ::tuffite::CommandError> {
2909 if command.id() != Self::COMMAND.id() {
2910 return Err(::tuffite::CommandError::UnknownCommand);
2911 }
2912 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2913 return Err(
2914 ::tuffite::CommandError::SchemaMismatch(
2915 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2916 .to_owned(),
2917 ),
2918 );
2919 }
2920 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
2921 let key: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
2922 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2923 "invalid ShellAPI request".to_owned(),
2924 ))?;
2925 decoder
2926 .finish()
2927 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
2928 "trailing ShellAPI request data".to_owned(),
2929 ))?;
2930 Ok(Self { key })
2931 }
2932 #[doc(hidden)]
2933 pub fn __tuffite_dispatch<A>(
2934 command: ::tuffite::Command<'_>,
2935 application: &mut A,
2936 handler: fn(&mut A, String) -> Result<(), ::tuffite::CommandError>,
2937 ) -> ::tuffite::CommandResult {
2938 let request = Self::__tuffite_decode(command)?;
2939 Self::respond(handler(application, request.key))
2940 }
2941}
2942impl ::tuffite::ShellApiRequest for storage::Clear {
2943 type Response = ();
2944 const CHANNEL: &'static str = "tuffite.storage.clear";
2945 fn encode(
2946 &self,
2947 encoder: &mut ::tuffite::__private::codec::Encoder,
2948 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
2949 let _ = &encoder;
2950 Ok(())
2951 }
2952}
2953impl storage::Clear {
2954 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
2955 "tuffite.storage.clear",
2956 0x20da_5788_1305_2815u64,
2957 0xd3c2_b7fb_02d6_33e2u64,
2958 );
2959 #[doc(hidden)]
2960 pub fn __tuffite_decode(
2961 command: ::tuffite::Command<'_>,
2962 ) -> Result<Self, ::tuffite::CommandError> {
2963 if command.id() != Self::COMMAND.id() {
2964 return Err(::tuffite::CommandError::UnknownCommand);
2965 }
2966 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
2967 return Err(
2968 ::tuffite::CommandError::SchemaMismatch(
2969 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
2970 .to_owned(),
2971 ),
2972 );
2973 }
2974 if !command.payload().is_empty() {
2975 return Err(
2976 ::tuffite::CommandError::InvalidArgument(
2977 "trailing ShellAPI request data".to_owned(),
2978 ),
2979 );
2980 }
2981 Ok(Self {})
2982 }
2983 #[doc(hidden)]
2984 pub fn __tuffite_dispatch<A>(
2985 command: ::tuffite::Command<'_>,
2986 application: &mut A,
2987 handler: fn(&mut A) -> Result<(), ::tuffite::CommandError>,
2988 ) -> ::tuffite::CommandResult {
2989 Self::__tuffite_decode(command)?;
2990 Self::respond(handler(application))
2991 }
2992}
2993impl ::tuffite::ShellApiRequest for log::Trace {
2994 type Response = ();
2995 const CHANNEL: &'static str = "tuffite.log.trace";
2996 fn encode(
2997 &self,
2998 encoder: &mut ::tuffite::__private::codec::Encoder,
2999 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3000 let _ = &encoder;
3001 ::tuffite::__private::codec::Encode::encode(&self.message, encoder)?;
3002 Ok(())
3003 }
3004}
3005impl log::Trace {
3006 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3007 "tuffite.log.trace",
3008 0x4328_4b4e_0543_9064u64,
3009 0x40aa_8f27_e6e1_fd27u64,
3010 );
3011 #[doc(hidden)]
3012 pub fn __tuffite_decode(
3013 command: ::tuffite::Command<'_>,
3014 ) -> Result<Self, ::tuffite::CommandError> {
3015 if command.id() != Self::COMMAND.id() {
3016 return Err(::tuffite::CommandError::UnknownCommand);
3017 }
3018 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3019 return Err(
3020 ::tuffite::CommandError::SchemaMismatch(
3021 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3022 .to_owned(),
3023 ),
3024 );
3025 }
3026 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3027 let message: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3028 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3029 "invalid ShellAPI request".to_owned(),
3030 ))?;
3031 decoder
3032 .finish()
3033 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3034 "trailing ShellAPI request data".to_owned(),
3035 ))?;
3036 Ok(Self { message })
3037 }
3038 #[doc(hidden)]
3039 pub fn __tuffite_dispatch<A>(
3040 command: ::tuffite::Command<'_>,
3041 application: &mut A,
3042 handler: fn(&mut A, String) -> Result<(), ::tuffite::CommandError>,
3043 ) -> ::tuffite::CommandResult {
3044 let request = Self::__tuffite_decode(command)?;
3045 Self::respond(handler(application, request.message))
3046 }
3047}
3048impl ::tuffite::ShellApiRequest for log::Debug {
3049 type Response = ();
3050 const CHANNEL: &'static str = "tuffite.log.debug";
3051 fn encode(
3052 &self,
3053 encoder: &mut ::tuffite::__private::codec::Encoder,
3054 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3055 let _ = &encoder;
3056 ::tuffite::__private::codec::Encode::encode(&self.message, encoder)?;
3057 Ok(())
3058 }
3059}
3060impl log::Debug {
3061 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3062 "tuffite.log.debug",
3063 0xbe82_2657_209b_1e90u64,
3064 0x40aa_8f27_e6e1_fd27u64,
3065 );
3066 #[doc(hidden)]
3067 pub fn __tuffite_decode(
3068 command: ::tuffite::Command<'_>,
3069 ) -> Result<Self, ::tuffite::CommandError> {
3070 if command.id() != Self::COMMAND.id() {
3071 return Err(::tuffite::CommandError::UnknownCommand);
3072 }
3073 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3074 return Err(
3075 ::tuffite::CommandError::SchemaMismatch(
3076 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3077 .to_owned(),
3078 ),
3079 );
3080 }
3081 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3082 let message: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3083 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3084 "invalid ShellAPI request".to_owned(),
3085 ))?;
3086 decoder
3087 .finish()
3088 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3089 "trailing ShellAPI request data".to_owned(),
3090 ))?;
3091 Ok(Self { message })
3092 }
3093 #[doc(hidden)]
3094 pub fn __tuffite_dispatch<A>(
3095 command: ::tuffite::Command<'_>,
3096 application: &mut A,
3097 handler: fn(&mut A, String) -> Result<(), ::tuffite::CommandError>,
3098 ) -> ::tuffite::CommandResult {
3099 let request = Self::__tuffite_decode(command)?;
3100 Self::respond(handler(application, request.message))
3101 }
3102}
3103impl ::tuffite::ShellApiRequest for log::Info {
3104 type Response = ();
3105 const CHANNEL: &'static str = "tuffite.log.info";
3106 fn encode(
3107 &self,
3108 encoder: &mut ::tuffite::__private::codec::Encoder,
3109 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3110 let _ = &encoder;
3111 ::tuffite::__private::codec::Encode::encode(&self.message, encoder)?;
3112 Ok(())
3113 }
3114}
3115impl log::Info {
3116 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3117 "tuffite.log.info",
3118 0x4160_d54e_6426_a92cu64,
3119 0x40aa_8f27_e6e1_fd27u64,
3120 );
3121 #[doc(hidden)]
3122 pub fn __tuffite_decode(
3123 command: ::tuffite::Command<'_>,
3124 ) -> Result<Self, ::tuffite::CommandError> {
3125 if command.id() != Self::COMMAND.id() {
3126 return Err(::tuffite::CommandError::UnknownCommand);
3127 }
3128 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3129 return Err(
3130 ::tuffite::CommandError::SchemaMismatch(
3131 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3132 .to_owned(),
3133 ),
3134 );
3135 }
3136 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3137 let message: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3138 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3139 "invalid ShellAPI request".to_owned(),
3140 ))?;
3141 decoder
3142 .finish()
3143 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3144 "trailing ShellAPI request data".to_owned(),
3145 ))?;
3146 Ok(Self { message })
3147 }
3148 #[doc(hidden)]
3149 pub fn __tuffite_dispatch<A>(
3150 command: ::tuffite::Command<'_>,
3151 application: &mut A,
3152 handler: fn(&mut A, String) -> Result<(), ::tuffite::CommandError>,
3153 ) -> ::tuffite::CommandResult {
3154 let request = Self::__tuffite_decode(command)?;
3155 Self::respond(handler(application, request.message))
3156 }
3157}
3158impl ::tuffite::ShellApiRequest for log::Warn {
3159 type Response = ();
3160 const CHANNEL: &'static str = "tuffite.log.warn";
3161 fn encode(
3162 &self,
3163 encoder: &mut ::tuffite::__private::codec::Encoder,
3164 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3165 let _ = &encoder;
3166 ::tuffite::__private::codec::Encode::encode(&self.message, encoder)?;
3167 Ok(())
3168 }
3169}
3170impl log::Warn {
3171 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3172 "tuffite.log.warn",
3173 0xde6e_140a_5418_6f3eu64,
3174 0x40aa_8f27_e6e1_fd27u64,
3175 );
3176 #[doc(hidden)]
3177 pub fn __tuffite_decode(
3178 command: ::tuffite::Command<'_>,
3179 ) -> Result<Self, ::tuffite::CommandError> {
3180 if command.id() != Self::COMMAND.id() {
3181 return Err(::tuffite::CommandError::UnknownCommand);
3182 }
3183 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3184 return Err(
3185 ::tuffite::CommandError::SchemaMismatch(
3186 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3187 .to_owned(),
3188 ),
3189 );
3190 }
3191 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3192 let message: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3193 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3194 "invalid ShellAPI request".to_owned(),
3195 ))?;
3196 decoder
3197 .finish()
3198 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3199 "trailing ShellAPI request data".to_owned(),
3200 ))?;
3201 Ok(Self { message })
3202 }
3203 #[doc(hidden)]
3204 pub fn __tuffite_dispatch<A>(
3205 command: ::tuffite::Command<'_>,
3206 application: &mut A,
3207 handler: fn(&mut A, String) -> Result<(), ::tuffite::CommandError>,
3208 ) -> ::tuffite::CommandResult {
3209 let request = Self::__tuffite_decode(command)?;
3210 Self::respond(handler(application, request.message))
3211 }
3212}
3213impl ::tuffite::ShellApiRequest for log::Error {
3214 type Response = ();
3215 const CHANNEL: &'static str = "tuffite.log.error";
3216 fn encode(
3217 &self,
3218 encoder: &mut ::tuffite::__private::codec::Encoder,
3219 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3220 let _ = &encoder;
3221 ::tuffite::__private::codec::Encode::encode(&self.message, encoder)?;
3222 Ok(())
3223 }
3224}
3225impl log::Error {
3226 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3227 "tuffite.log.error",
3228 0xe2dc_7147_6939_9f0fu64,
3229 0x40aa_8f27_e6e1_fd27u64,
3230 );
3231 #[doc(hidden)]
3232 pub fn __tuffite_decode(
3233 command: ::tuffite::Command<'_>,
3234 ) -> Result<Self, ::tuffite::CommandError> {
3235 if command.id() != Self::COMMAND.id() {
3236 return Err(::tuffite::CommandError::UnknownCommand);
3237 }
3238 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3239 return Err(
3240 ::tuffite::CommandError::SchemaMismatch(
3241 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3242 .to_owned(),
3243 ),
3244 );
3245 }
3246 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3247 let message: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3248 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3249 "invalid ShellAPI request".to_owned(),
3250 ))?;
3251 decoder
3252 .finish()
3253 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3254 "trailing ShellAPI request data".to_owned(),
3255 ))?;
3256 Ok(Self { message })
3257 }
3258 #[doc(hidden)]
3259 pub fn __tuffite_dispatch<A>(
3260 command: ::tuffite::Command<'_>,
3261 application: &mut A,
3262 handler: fn(&mut A, String) -> Result<(), ::tuffite::CommandError>,
3263 ) -> ::tuffite::CommandResult {
3264 let request = Self::__tuffite_decode(command)?;
3265 Self::respond(handler(application, request.message))
3266 }
3267}
3268impl ::tuffite::ShellApiRequest for net::Request {
3269 type Response = NetworkResponse;
3270 const CHANNEL: &'static str = "tuffite.net.request";
3271 fn encode(
3272 &self,
3273 encoder: &mut ::tuffite::__private::codec::Encoder,
3274 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3275 let _ = &encoder;
3276 ::tuffite::__private::codec::Encode::encode(&self.url, encoder)?;
3277 Ok(())
3278 }
3279}
3280impl net::Request {
3281 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3282 "tuffite.net.request",
3283 0x2a0a_1e40_0c90_3a7du64,
3284 0x353b_4a12_fc82_fd19u64,
3285 );
3286 #[doc(hidden)]
3287 pub fn __tuffite_decode(
3288 command: ::tuffite::Command<'_>,
3289 ) -> Result<Self, ::tuffite::CommandError> {
3290 if command.id() != Self::COMMAND.id() {
3291 return Err(::tuffite::CommandError::UnknownCommand);
3292 }
3293 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3294 return Err(
3295 ::tuffite::CommandError::SchemaMismatch(
3296 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3297 .to_owned(),
3298 ),
3299 );
3300 }
3301 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3302 let url: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3303 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3304 "invalid ShellAPI request".to_owned(),
3305 ))?;
3306 decoder
3307 .finish()
3308 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3309 "trailing ShellAPI request data".to_owned(),
3310 ))?;
3311 Ok(Self { url })
3312 }
3313 #[doc(hidden)]
3314 pub fn __tuffite_dispatch<A>(
3315 command: ::tuffite::Command<'_>,
3316 application: &mut A,
3317 handler: fn(&mut A, String) -> Result<NetworkResponse, ::tuffite::CommandError>,
3318 ) -> ::tuffite::CommandResult {
3319 let request = Self::__tuffite_decode(command)?;
3320 Self::respond(handler(application, request.url))
3321 }
3322}
3323impl ::tuffite::ShellApiRequest for utility::Invoke {
3324 type Response = ::tuffite::Bytes;
3325 const CHANNEL: &'static str = "tuffite.utility.invoke";
3326 fn encode(
3327 &self,
3328 encoder: &mut ::tuffite::__private::codec::Encoder,
3329 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3330 let _ = &encoder;
3331 ::tuffite::__private::codec::Encode::encode(&self.name, encoder)?;
3332 ::tuffite::__private::codec::Encode::encode(&self.request_id, encoder)?;
3333 ::tuffite::__private::codec::Encode::encode(&self.payload, encoder)?;
3334 Ok(())
3335 }
3336}
3337impl utility::Invoke {
3338 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3339 "tuffite.utility.invoke",
3340 0x41c7_d64a_8b6e_d93au64,
3341 0xb528_7876_8ef6_9fb7u64,
3342 );
3343 #[doc(hidden)]
3344 pub fn __tuffite_decode(
3345 command: ::tuffite::Command<'_>,
3346 ) -> Result<Self, ::tuffite::CommandError> {
3347 if command.id() != Self::COMMAND.id() {
3348 return Err(::tuffite::CommandError::UnknownCommand);
3349 }
3350 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3351 return Err(
3352 ::tuffite::CommandError::SchemaMismatch(
3353 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3354 .to_owned(),
3355 ),
3356 );
3357 }
3358 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3359 let name: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3360 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3361 "invalid ShellAPI request".to_owned(),
3362 ))?;
3363 let request_id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3364 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3365 "invalid ShellAPI request".to_owned(),
3366 ))?;
3367 let payload: Option<::tuffite::Bytes> = ::tuffite::__private::codec::Decode::decode(
3368 &mut decoder,
3369 )
3370 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3371 "invalid ShellAPI request".to_owned(),
3372 ))?;
3373 decoder
3374 .finish()
3375 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3376 "trailing ShellAPI request data".to_owned(),
3377 ))?;
3378 Ok(Self { name, request_id, payload })
3379 }
3380 #[doc(hidden)]
3381 pub fn __tuffite_dispatch<A>(
3382 command: ::tuffite::Command<'_>,
3383 application: &mut A,
3384 handler: fn(
3385 &mut A,
3386 String,
3387 i64,
3388 Option<::tuffite::Bytes>,
3389 ) -> Result<::tuffite::Bytes, ::tuffite::CommandError>,
3390 ) -> ::tuffite::CommandResult {
3391 let request = Self::__tuffite_decode(command)?;
3392 Self::respond(
3393 handler(application, request.name, request.request_id, request.payload),
3394 )
3395 }
3396}
3397impl ::tuffite::ShellApiRequest for utility::Cancel {
3398 type Response = ();
3399 const CHANNEL: &'static str = "tuffite.utility.cancel";
3400 fn encode(
3401 &self,
3402 encoder: &mut ::tuffite::__private::codec::Encoder,
3403 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3404 let _ = &encoder;
3405 ::tuffite::__private::codec::Encode::encode(&self.name, encoder)?;
3406 ::tuffite::__private::codec::Encode::encode(&self.request_id, encoder)?;
3407 Ok(())
3408 }
3409}
3410impl utility::Cancel {
3411 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3412 "tuffite.utility.cancel",
3413 0xff42_61ad_e322_8f69u64,
3414 0x665d_1fc0_58af_d7beu64,
3415 );
3416 #[doc(hidden)]
3417 pub fn __tuffite_decode(
3418 command: ::tuffite::Command<'_>,
3419 ) -> Result<Self, ::tuffite::CommandError> {
3420 if command.id() != Self::COMMAND.id() {
3421 return Err(::tuffite::CommandError::UnknownCommand);
3422 }
3423 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3424 return Err(
3425 ::tuffite::CommandError::SchemaMismatch(
3426 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3427 .to_owned(),
3428 ),
3429 );
3430 }
3431 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3432 let name: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3433 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3434 "invalid ShellAPI request".to_owned(),
3435 ))?;
3436 let request_id: i64 = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3437 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3438 "invalid ShellAPI request".to_owned(),
3439 ))?;
3440 decoder
3441 .finish()
3442 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3443 "trailing ShellAPI request data".to_owned(),
3444 ))?;
3445 Ok(Self { name, request_id })
3446 }
3447 #[doc(hidden)]
3448 pub fn __tuffite_dispatch<A>(
3449 command: ::tuffite::Command<'_>,
3450 application: &mut A,
3451 handler: fn(&mut A, String, i64) -> Result<(), ::tuffite::CommandError>,
3452 ) -> ::tuffite::CommandResult {
3453 let request = Self::__tuffite_decode(command)?;
3454 Self::respond(handler(application, request.name, request.request_id))
3455 }
3456}
3457impl ::tuffite::ShellApiRequest for window::Current {
3458 type Response = WindowInfo;
3459 const CHANNEL: &'static str = "tuffite.window.current";
3460 fn encode(
3461 &self,
3462 encoder: &mut ::tuffite::__private::codec::Encoder,
3463 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3464 let _ = &encoder;
3465 Ok(())
3466 }
3467}
3468impl window::Current {
3469 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3470 "tuffite.window.current",
3471 0xa775_1ce3_5090_f0adu64,
3472 0xbe8a_74fb_9eaf_bf49u64,
3473 );
3474 #[doc(hidden)]
3475 pub fn __tuffite_decode(
3476 command: ::tuffite::Command<'_>,
3477 ) -> Result<Self, ::tuffite::CommandError> {
3478 if command.id() != Self::COMMAND.id() {
3479 return Err(::tuffite::CommandError::UnknownCommand);
3480 }
3481 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3482 return Err(
3483 ::tuffite::CommandError::SchemaMismatch(
3484 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3485 .to_owned(),
3486 ),
3487 );
3488 }
3489 if !command.payload().is_empty() {
3490 return Err(
3491 ::tuffite::CommandError::InvalidArgument(
3492 "trailing ShellAPI request data".to_owned(),
3493 ),
3494 );
3495 }
3496 Ok(Self {})
3497 }
3498 #[doc(hidden)]
3499 pub fn __tuffite_dispatch<A>(
3500 command: ::tuffite::Command<'_>,
3501 application: &mut A,
3502 handler: fn(&mut A) -> Result<WindowInfo, ::tuffite::CommandError>,
3503 ) -> ::tuffite::CommandResult {
3504 Self::__tuffite_decode(command)?;
3505 Self::respond(handler(application))
3506 }
3507}
3508impl ::tuffite::ShellApiRequest for window::List {
3509 type Response = Vec<WindowInfo>;
3510 const CHANNEL: &'static str = "tuffite.window.list";
3511 fn encode(
3512 &self,
3513 encoder: &mut ::tuffite::__private::codec::Encoder,
3514 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3515 let _ = &encoder;
3516 Ok(())
3517 }
3518}
3519impl window::List {
3520 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3521 "tuffite.window.list",
3522 0xec4d_3013_18c9_bd74u64,
3523 0xb9f2_e933_315b_14f4u64,
3524 );
3525 #[doc(hidden)]
3526 pub fn __tuffite_decode(
3527 command: ::tuffite::Command<'_>,
3528 ) -> Result<Self, ::tuffite::CommandError> {
3529 if command.id() != Self::COMMAND.id() {
3530 return Err(::tuffite::CommandError::UnknownCommand);
3531 }
3532 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3533 return Err(
3534 ::tuffite::CommandError::SchemaMismatch(
3535 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3536 .to_owned(),
3537 ),
3538 );
3539 }
3540 if !command.payload().is_empty() {
3541 return Err(
3542 ::tuffite::CommandError::InvalidArgument(
3543 "trailing ShellAPI request data".to_owned(),
3544 ),
3545 );
3546 }
3547 Ok(Self {})
3548 }
3549 #[doc(hidden)]
3550 pub fn __tuffite_dispatch<A>(
3551 command: ::tuffite::Command<'_>,
3552 application: &mut A,
3553 handler: fn(&mut A) -> Result<Vec<WindowInfo>, ::tuffite::CommandError>,
3554 ) -> ::tuffite::CommandResult {
3555 Self::__tuffite_decode(command)?;
3556 Self::respond(handler(application))
3557 }
3558}
3559impl ::tuffite::ShellApiRequest for window::Create {
3560 type Response = WindowInfo;
3561 const CHANNEL: &'static str = "tuffite.window.create";
3562 fn encode(
3563 &self,
3564 encoder: &mut ::tuffite::__private::codec::Encoder,
3565 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3566 let _ = &encoder;
3567 ::tuffite::__private::codec::Encode::encode(&self.options, encoder)?;
3568 Ok(())
3569 }
3570}
3571impl window::Create {
3572 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3573 "tuffite.window.create",
3574 0x2780_4c86_ebf9_7cf3u64,
3575 0x9910_f247_5b83_26c4u64,
3576 );
3577 #[doc(hidden)]
3578 pub fn __tuffite_decode(
3579 command: ::tuffite::Command<'_>,
3580 ) -> Result<Self, ::tuffite::CommandError> {
3581 if command.id() != Self::COMMAND.id() {
3582 return Err(::tuffite::CommandError::UnknownCommand);
3583 }
3584 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3585 return Err(
3586 ::tuffite::CommandError::SchemaMismatch(
3587 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3588 .to_owned(),
3589 ),
3590 );
3591 }
3592 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3593 let options: Option<WindowOptions> = ::tuffite::__private::codec::Decode::decode(
3594 &mut decoder,
3595 )
3596 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3597 "invalid ShellAPI request".to_owned(),
3598 ))?;
3599 decoder
3600 .finish()
3601 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3602 "trailing ShellAPI request data".to_owned(),
3603 ))?;
3604 Ok(Self { options })
3605 }
3606 #[doc(hidden)]
3607 pub fn __tuffite_dispatch<A>(
3608 command: ::tuffite::Command<'_>,
3609 application: &mut A,
3610 handler: fn(
3611 &mut A,
3612 Option<WindowOptions>,
3613 ) -> Result<WindowInfo, ::tuffite::CommandError>,
3614 ) -> ::tuffite::CommandResult {
3615 let request = Self::__tuffite_decode(command)?;
3616 Self::respond(handler(application, request.options))
3617 }
3618}
3619impl ::tuffite::ShellApiRequest for window::Focus {
3620 type Response = WindowInfo;
3621 const CHANNEL: &'static str = "tuffite.window.focus";
3622 fn encode(
3623 &self,
3624 encoder: &mut ::tuffite::__private::codec::Encoder,
3625 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3626 let _ = &encoder;
3627 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3628 Ok(())
3629 }
3630}
3631impl window::Focus {
3632 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3633 "tuffite.window.focus",
3634 0x7328_589a_4597_f73eu64,
3635 0x1896_b9c0_d603_79f2u64,
3636 );
3637 #[doc(hidden)]
3638 pub fn __tuffite_decode(
3639 command: ::tuffite::Command<'_>,
3640 ) -> Result<Self, ::tuffite::CommandError> {
3641 if command.id() != Self::COMMAND.id() {
3642 return Err(::tuffite::CommandError::UnknownCommand);
3643 }
3644 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3645 return Err(
3646 ::tuffite::CommandError::SchemaMismatch(
3647 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3648 .to_owned(),
3649 ),
3650 );
3651 }
3652 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3653 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
3654 &mut decoder,
3655 )
3656 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3657 "invalid ShellAPI request".to_owned(),
3658 ))?;
3659 decoder
3660 .finish()
3661 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3662 "trailing ShellAPI request data".to_owned(),
3663 ))?;
3664 Ok(Self { id })
3665 }
3666 #[doc(hidden)]
3667 pub fn __tuffite_dispatch<A>(
3668 command: ::tuffite::Command<'_>,
3669 application: &mut A,
3670 handler: fn(
3671 &mut A,
3672 Option<WindowId>,
3673 ) -> Result<WindowInfo, ::tuffite::CommandError>,
3674 ) -> ::tuffite::CommandResult {
3675 let request = Self::__tuffite_decode(command)?;
3676 Self::respond(handler(application, request.id))
3677 }
3678}
3679impl ::tuffite::ShellApiRequest for window::Minimize {
3680 type Response = WindowInfo;
3681 const CHANNEL: &'static str = "tuffite.window.minimize";
3682 fn encode(
3683 &self,
3684 encoder: &mut ::tuffite::__private::codec::Encoder,
3685 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3686 let _ = &encoder;
3687 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3688 Ok(())
3689 }
3690}
3691impl window::Minimize {
3692 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3693 "tuffite.window.minimize",
3694 0x7103_a11c_2116_72d9u64,
3695 0x1896_b9c0_d603_79f2u64,
3696 );
3697 #[doc(hidden)]
3698 pub fn __tuffite_decode(
3699 command: ::tuffite::Command<'_>,
3700 ) -> Result<Self, ::tuffite::CommandError> {
3701 if command.id() != Self::COMMAND.id() {
3702 return Err(::tuffite::CommandError::UnknownCommand);
3703 }
3704 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3705 return Err(
3706 ::tuffite::CommandError::SchemaMismatch(
3707 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3708 .to_owned(),
3709 ),
3710 );
3711 }
3712 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3713 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
3714 &mut decoder,
3715 )
3716 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3717 "invalid ShellAPI request".to_owned(),
3718 ))?;
3719 decoder
3720 .finish()
3721 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3722 "trailing ShellAPI request data".to_owned(),
3723 ))?;
3724 Ok(Self { id })
3725 }
3726 #[doc(hidden)]
3727 pub fn __tuffite_dispatch<A>(
3728 command: ::tuffite::Command<'_>,
3729 application: &mut A,
3730 handler: fn(
3731 &mut A,
3732 Option<WindowId>,
3733 ) -> Result<WindowInfo, ::tuffite::CommandError>,
3734 ) -> ::tuffite::CommandResult {
3735 let request = Self::__tuffite_decode(command)?;
3736 Self::respond(handler(application, request.id))
3737 }
3738}
3739impl ::tuffite::ShellApiRequest for window::Maximize {
3740 type Response = WindowInfo;
3741 const CHANNEL: &'static str = "tuffite.window.maximize";
3742 fn encode(
3743 &self,
3744 encoder: &mut ::tuffite::__private::codec::Encoder,
3745 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3746 let _ = &encoder;
3747 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3748 Ok(())
3749 }
3750}
3751impl window::Maximize {
3752 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3753 "tuffite.window.maximize",
3754 0x9ccd_2de1_2523_e120u64,
3755 0x1896_b9c0_d603_79f2u64,
3756 );
3757 #[doc(hidden)]
3758 pub fn __tuffite_decode(
3759 command: ::tuffite::Command<'_>,
3760 ) -> Result<Self, ::tuffite::CommandError> {
3761 if command.id() != Self::COMMAND.id() {
3762 return Err(::tuffite::CommandError::UnknownCommand);
3763 }
3764 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3765 return Err(
3766 ::tuffite::CommandError::SchemaMismatch(
3767 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3768 .to_owned(),
3769 ),
3770 );
3771 }
3772 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3773 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
3774 &mut decoder,
3775 )
3776 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3777 "invalid ShellAPI request".to_owned(),
3778 ))?;
3779 decoder
3780 .finish()
3781 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3782 "trailing ShellAPI request data".to_owned(),
3783 ))?;
3784 Ok(Self { id })
3785 }
3786 #[doc(hidden)]
3787 pub fn __tuffite_dispatch<A>(
3788 command: ::tuffite::Command<'_>,
3789 application: &mut A,
3790 handler: fn(
3791 &mut A,
3792 Option<WindowId>,
3793 ) -> Result<WindowInfo, ::tuffite::CommandError>,
3794 ) -> ::tuffite::CommandResult {
3795 let request = Self::__tuffite_decode(command)?;
3796 Self::respond(handler(application, request.id))
3797 }
3798}
3799impl ::tuffite::ShellApiRequest for window::Restore {
3800 type Response = WindowInfo;
3801 const CHANNEL: &'static str = "tuffite.window.restore";
3802 fn encode(
3803 &self,
3804 encoder: &mut ::tuffite::__private::codec::Encoder,
3805 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3806 let _ = &encoder;
3807 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3808 Ok(())
3809 }
3810}
3811impl window::Restore {
3812 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3813 "tuffite.window.restore",
3814 0x83ee_03e8_39ae_389bu64,
3815 0x1896_b9c0_d603_79f2u64,
3816 );
3817 #[doc(hidden)]
3818 pub fn __tuffite_decode(
3819 command: ::tuffite::Command<'_>,
3820 ) -> Result<Self, ::tuffite::CommandError> {
3821 if command.id() != Self::COMMAND.id() {
3822 return Err(::tuffite::CommandError::UnknownCommand);
3823 }
3824 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3825 return Err(
3826 ::tuffite::CommandError::SchemaMismatch(
3827 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3828 .to_owned(),
3829 ),
3830 );
3831 }
3832 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3833 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
3834 &mut decoder,
3835 )
3836 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3837 "invalid ShellAPI request".to_owned(),
3838 ))?;
3839 decoder
3840 .finish()
3841 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3842 "trailing ShellAPI request data".to_owned(),
3843 ))?;
3844 Ok(Self { id })
3845 }
3846 #[doc(hidden)]
3847 pub fn __tuffite_dispatch<A>(
3848 command: ::tuffite::Command<'_>,
3849 application: &mut A,
3850 handler: fn(
3851 &mut A,
3852 Option<WindowId>,
3853 ) -> Result<WindowInfo, ::tuffite::CommandError>,
3854 ) -> ::tuffite::CommandResult {
3855 let request = Self::__tuffite_decode(command)?;
3856 Self::respond(handler(application, request.id))
3857 }
3858}
3859impl ::tuffite::ShellApiRequest for window::SetFullscreen {
3860 type Response = WindowInfo;
3861 const CHANNEL: &'static str = "tuffite.window.setFullscreen";
3862 fn encode(
3863 &self,
3864 encoder: &mut ::tuffite::__private::codec::Encoder,
3865 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3866 let _ = &encoder;
3867 ::tuffite::__private::codec::Encode::encode(&self.fullscreen, encoder)?;
3868 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3869 Ok(())
3870 }
3871}
3872impl window::SetFullscreen {
3873 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3874 "tuffite.window.setFullscreen",
3875 0x8930_6e3b_b335_392au64,
3876 0xd87b_48da_1a9a_fa04u64,
3877 );
3878 #[doc(hidden)]
3879 pub fn __tuffite_decode(
3880 command: ::tuffite::Command<'_>,
3881 ) -> Result<Self, ::tuffite::CommandError> {
3882 if command.id() != Self::COMMAND.id() {
3883 return Err(::tuffite::CommandError::UnknownCommand);
3884 }
3885 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3886 return Err(
3887 ::tuffite::CommandError::SchemaMismatch(
3888 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3889 .to_owned(),
3890 ),
3891 );
3892 }
3893 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3894 let fullscreen: bool = ::tuffite::__private::codec::Decode::decode(&mut decoder)
3895 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3896 "invalid ShellAPI request".to_owned(),
3897 ))?;
3898 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
3899 &mut decoder,
3900 )
3901 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3902 "invalid ShellAPI request".to_owned(),
3903 ))?;
3904 decoder
3905 .finish()
3906 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3907 "trailing ShellAPI request data".to_owned(),
3908 ))?;
3909 Ok(Self { fullscreen, id })
3910 }
3911 #[doc(hidden)]
3912 pub fn __tuffite_dispatch<A>(
3913 command: ::tuffite::Command<'_>,
3914 application: &mut A,
3915 handler: fn(
3916 &mut A,
3917 bool,
3918 Option<WindowId>,
3919 ) -> Result<WindowInfo, ::tuffite::CommandError>,
3920 ) -> ::tuffite::CommandResult {
3921 let request = Self::__tuffite_decode(command)?;
3922 Self::respond(handler(application, request.fullscreen, request.id))
3923 }
3924}
3925impl ::tuffite::ShellApiRequest for window::Close {
3926 type Response = ();
3927 const CHANNEL: &'static str = "tuffite.window.close";
3928 fn encode(
3929 &self,
3930 encoder: &mut ::tuffite::__private::codec::Encoder,
3931 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3932 let _ = &encoder;
3933 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3934 Ok(())
3935 }
3936}
3937impl window::Close {
3938 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3939 "tuffite.window.close",
3940 0xbef2_0904_2f19_30efu64,
3941 0x8b2a_a9b1_8608_5f5bu64,
3942 );
3943 #[doc(hidden)]
3944 pub fn __tuffite_decode(
3945 command: ::tuffite::Command<'_>,
3946 ) -> Result<Self, ::tuffite::CommandError> {
3947 if command.id() != Self::COMMAND.id() {
3948 return Err(::tuffite::CommandError::UnknownCommand);
3949 }
3950 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
3951 return Err(
3952 ::tuffite::CommandError::SchemaMismatch(
3953 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
3954 .to_owned(),
3955 ),
3956 );
3957 }
3958 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
3959 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
3960 &mut decoder,
3961 )
3962 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3963 "invalid ShellAPI request".to_owned(),
3964 ))?;
3965 decoder
3966 .finish()
3967 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
3968 "trailing ShellAPI request data".to_owned(),
3969 ))?;
3970 Ok(Self { id })
3971 }
3972 #[doc(hidden)]
3973 pub fn __tuffite_dispatch<A>(
3974 command: ::tuffite::Command<'_>,
3975 application: &mut A,
3976 handler: fn(&mut A, Option<WindowId>) -> Result<(), ::tuffite::CommandError>,
3977 ) -> ::tuffite::CommandResult {
3978 let request = Self::__tuffite_decode(command)?;
3979 Self::respond(handler(application, request.id))
3980 }
3981}
3982impl ::tuffite::ShellApiRequest for window::SetTitle {
3983 type Response = WindowInfo;
3984 const CHANNEL: &'static str = "tuffite.window.setTitle";
3985 fn encode(
3986 &self,
3987 encoder: &mut ::tuffite::__private::codec::Encoder,
3988 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
3989 let _ = &encoder;
3990 ::tuffite::__private::codec::Encode::encode(&self.title, encoder)?;
3991 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
3992 Ok(())
3993 }
3994}
3995impl window::SetTitle {
3996 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
3997 "tuffite.window.setTitle",
3998 0x316f_0207_55c4_79cau64,
3999 0x0457_3d00_d14e_1335u64,
4000 );
4001 #[doc(hidden)]
4002 pub fn __tuffite_decode(
4003 command: ::tuffite::Command<'_>,
4004 ) -> Result<Self, ::tuffite::CommandError> {
4005 if command.id() != Self::COMMAND.id() {
4006 return Err(::tuffite::CommandError::UnknownCommand);
4007 }
4008 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
4009 return Err(
4010 ::tuffite::CommandError::SchemaMismatch(
4011 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
4012 .to_owned(),
4013 ),
4014 );
4015 }
4016 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
4017 let title: String = ::tuffite::__private::codec::Decode::decode(&mut decoder)
4018 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4019 "invalid ShellAPI request".to_owned(),
4020 ))?;
4021 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
4022 &mut decoder,
4023 )
4024 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4025 "invalid ShellAPI request".to_owned(),
4026 ))?;
4027 decoder
4028 .finish()
4029 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4030 "trailing ShellAPI request data".to_owned(),
4031 ))?;
4032 Ok(Self { title, id })
4033 }
4034 #[doc(hidden)]
4035 pub fn __tuffite_dispatch<A>(
4036 command: ::tuffite::Command<'_>,
4037 application: &mut A,
4038 handler: fn(
4039 &mut A,
4040 String,
4041 Option<WindowId>,
4042 ) -> Result<WindowInfo, ::tuffite::CommandError>,
4043 ) -> ::tuffite::CommandResult {
4044 let request = Self::__tuffite_decode(command)?;
4045 Self::respond(handler(application, request.title, request.id))
4046 }
4047}
4048impl ::tuffite::ShellApiRequest for window::GetBounds {
4049 type Response = WindowBounds;
4050 const CHANNEL: &'static str = "tuffite.window.getBounds";
4051 fn encode(
4052 &self,
4053 encoder: &mut ::tuffite::__private::codec::Encoder,
4054 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
4055 let _ = &encoder;
4056 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
4057 Ok(())
4058 }
4059}
4060impl window::GetBounds {
4061 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
4062 "tuffite.window.getBounds",
4063 0xe5a8_1d21_f786_57f1u64,
4064 0x508f_19bc_5731_81eeu64,
4065 );
4066 #[doc(hidden)]
4067 pub fn __tuffite_decode(
4068 command: ::tuffite::Command<'_>,
4069 ) -> Result<Self, ::tuffite::CommandError> {
4070 if command.id() != Self::COMMAND.id() {
4071 return Err(::tuffite::CommandError::UnknownCommand);
4072 }
4073 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
4074 return Err(
4075 ::tuffite::CommandError::SchemaMismatch(
4076 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
4077 .to_owned(),
4078 ),
4079 );
4080 }
4081 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
4082 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
4083 &mut decoder,
4084 )
4085 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4086 "invalid ShellAPI request".to_owned(),
4087 ))?;
4088 decoder
4089 .finish()
4090 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4091 "trailing ShellAPI request data".to_owned(),
4092 ))?;
4093 Ok(Self { id })
4094 }
4095 #[doc(hidden)]
4096 pub fn __tuffite_dispatch<A>(
4097 command: ::tuffite::Command<'_>,
4098 application: &mut A,
4099 handler: fn(
4100 &mut A,
4101 Option<WindowId>,
4102 ) -> Result<WindowBounds, ::tuffite::CommandError>,
4103 ) -> ::tuffite::CommandResult {
4104 let request = Self::__tuffite_decode(command)?;
4105 Self::respond(handler(application, request.id))
4106 }
4107}
4108impl ::tuffite::ShellApiRequest for window::SetBounds {
4109 type Response = WindowInfo;
4110 const CHANNEL: &'static str = "tuffite.window.setBounds";
4111 fn encode(
4112 &self,
4113 encoder: &mut ::tuffite::__private::codec::Encoder,
4114 ) -> Result<(), ::tuffite::__private::codec::CodecError> {
4115 let _ = &encoder;
4116 ::tuffite::__private::codec::Encode::encode(&self.bounds, encoder)?;
4117 ::tuffite::__private::codec::Encode::encode(&self.id, encoder)?;
4118 Ok(())
4119 }
4120}
4121impl window::SetBounds {
4122 pub const COMMAND: ::tuffite::CommandDescriptor = ::tuffite::CommandDescriptor::new(
4123 "tuffite.window.setBounds",
4124 0x5b73_dc63_3e97_3510u64,
4125 0xfd14_6d8b_bf8b_2e49u64,
4126 );
4127 #[doc(hidden)]
4128 pub fn __tuffite_decode(
4129 command: ::tuffite::Command<'_>,
4130 ) -> Result<Self, ::tuffite::CommandError> {
4131 if command.id() != Self::COMMAND.id() {
4132 return Err(::tuffite::CommandError::UnknownCommand);
4133 }
4134 if command.schema_fingerprint() != Self::COMMAND.schema_fingerprint() {
4135 return Err(
4136 ::tuffite::CommandError::SchemaMismatch(
4137 "ShellAPI schema fingerprint mismatch; regenerate application bindings"
4138 .to_owned(),
4139 ),
4140 );
4141 }
4142 let mut decoder = ::tuffite::__private::codec::Decoder::new(command.payload());
4143 let bounds: WindowBounds = ::tuffite::__private::codec::Decode::decode(
4144 &mut decoder,
4145 )
4146 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4147 "invalid ShellAPI request".to_owned(),
4148 ))?;
4149 let id: Option<WindowId> = ::tuffite::__private::codec::Decode::decode(
4150 &mut decoder,
4151 )
4152 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4153 "invalid ShellAPI request".to_owned(),
4154 ))?;
4155 decoder
4156 .finish()
4157 .map_err(|_| ::tuffite::CommandError::InvalidArgument(
4158 "trailing ShellAPI request data".to_owned(),
4159 ))?;
4160 Ok(Self { bounds, id })
4161 }
4162 #[doc(hidden)]
4163 pub fn __tuffite_dispatch<A>(
4164 command: ::tuffite::Command<'_>,
4165 application: &mut A,
4166 handler: fn(
4167 &mut A,
4168 WindowBounds,
4169 Option<WindowId>,
4170 ) -> Result<WindowInfo, ::tuffite::CommandError>,
4171 ) -> ::tuffite::CommandResult {
4172 let request = Self::__tuffite_decode(command)?;
4173 Self::respond(handler(application, request.bounds, request.id))
4174 }
4175}