1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_settings_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct AccessibilityMarker;
16
17impl fidl::endpoints::ProtocolMarker for AccessibilityMarker {
18 type Proxy = AccessibilityProxy;
19 type RequestStream = AccessibilityRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = AccessibilitySynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.settings.Accessibility";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for AccessibilityMarker {}
26pub type AccessibilitySetResult = Result<(), Error>;
27
28pub trait AccessibilityProxyInterface: Send + Sync {
29 type WatchResponseFut: std::future::Future<Output = Result<AccessibilitySettings, fidl::Error>>
30 + Send;
31 fn r#watch(&self) -> Self::WatchResponseFut;
32 type SetResponseFut: std::future::Future<Output = Result<AccessibilitySetResult, fidl::Error>>
33 + Send;
34 fn r#set(&self, settings: &AccessibilitySettings) -> Self::SetResponseFut;
35}
36#[derive(Debug)]
37#[cfg(target_os = "fuchsia")]
38pub struct AccessibilitySynchronousProxy {
39 client: fidl::client::sync::Client,
40}
41
42#[cfg(target_os = "fuchsia")]
43impl fidl::endpoints::SynchronousProxy for AccessibilitySynchronousProxy {
44 type Proxy = AccessibilityProxy;
45 type Protocol = AccessibilityMarker;
46
47 fn from_channel(inner: fidl::Channel) -> Self {
48 Self::new(inner)
49 }
50
51 fn into_channel(self) -> fidl::Channel {
52 self.client.into_channel()
53 }
54
55 fn as_channel(&self) -> &fidl::Channel {
56 self.client.as_channel()
57 }
58}
59
60#[cfg(target_os = "fuchsia")]
61impl AccessibilitySynchronousProxy {
62 pub fn new(channel: fidl::Channel) -> Self {
63 Self { client: fidl::client::sync::Client::new(channel) }
64 }
65
66 pub fn into_channel(self) -> fidl::Channel {
67 self.client.into_channel()
68 }
69
70 pub fn wait_for_event(
73 &self,
74 deadline: zx::MonotonicInstant,
75 ) -> Result<AccessibilityEvent, fidl::Error> {
76 AccessibilityEvent::decode(self.client.wait_for_event::<AccessibilityMarker>(deadline)?)
77 }
78
79 pub fn r#watch(
89 &self,
90 ___deadline: zx::MonotonicInstant,
91 ) -> Result<AccessibilitySettings, fidl::Error> {
92 let _response = self.client.send_query::<
93 fidl::encoding::EmptyPayload,
94 AccessibilityWatchResponse,
95 AccessibilityMarker,
96 >(
97 (),
98 0x417d0b95ddbf7674,
99 fidl::encoding::DynamicFlags::empty(),
100 ___deadline,
101 )?;
102 Ok(_response.settings)
103 }
104
105 pub fn r#set(
108 &self,
109 mut settings: &AccessibilitySettings,
110 ___deadline: zx::MonotonicInstant,
111 ) -> Result<AccessibilitySetResult, fidl::Error> {
112 let _response = self.client.send_query::<
113 AccessibilitySetRequest,
114 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
115 AccessibilityMarker,
116 >(
117 (settings,),
118 0x298485ef354fb8cb,
119 fidl::encoding::DynamicFlags::empty(),
120 ___deadline,
121 )?;
122 Ok(_response.map(|x| x))
123 }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl From<AccessibilitySynchronousProxy> for zx::NullableHandle {
128 fn from(value: AccessibilitySynchronousProxy) -> Self {
129 value.into_channel().into()
130 }
131}
132
133#[cfg(target_os = "fuchsia")]
134impl From<fidl::Channel> for AccessibilitySynchronousProxy {
135 fn from(value: fidl::Channel) -> Self {
136 Self::new(value)
137 }
138}
139
140#[cfg(target_os = "fuchsia")]
141impl fidl::endpoints::FromClient for AccessibilitySynchronousProxy {
142 type Protocol = AccessibilityMarker;
143
144 fn from_client(value: fidl::endpoints::ClientEnd<AccessibilityMarker>) -> Self {
145 Self::new(value.into_channel())
146 }
147}
148
149#[derive(Debug, Clone)]
150pub struct AccessibilityProxy {
151 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
152}
153
154impl fidl::endpoints::Proxy for AccessibilityProxy {
155 type Protocol = AccessibilityMarker;
156
157 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
158 Self::new(inner)
159 }
160
161 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
162 self.client.into_channel().map_err(|client| Self { client })
163 }
164
165 fn as_channel(&self) -> &::fidl::AsyncChannel {
166 self.client.as_channel()
167 }
168}
169
170impl AccessibilityProxy {
171 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
173 let protocol_name = <AccessibilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
174 Self { client: fidl::client::Client::new(channel, protocol_name) }
175 }
176
177 pub fn take_event_stream(&self) -> AccessibilityEventStream {
183 AccessibilityEventStream { event_receiver: self.client.take_event_receiver() }
184 }
185
186 pub fn r#watch(
196 &self,
197 ) -> fidl::client::QueryResponseFut<
198 AccessibilitySettings,
199 fidl::encoding::DefaultFuchsiaResourceDialect,
200 > {
201 AccessibilityProxyInterface::r#watch(self)
202 }
203
204 pub fn r#set(
207 &self,
208 mut settings: &AccessibilitySettings,
209 ) -> fidl::client::QueryResponseFut<
210 AccessibilitySetResult,
211 fidl::encoding::DefaultFuchsiaResourceDialect,
212 > {
213 AccessibilityProxyInterface::r#set(self, settings)
214 }
215}
216
217impl AccessibilityProxyInterface for AccessibilityProxy {
218 type WatchResponseFut = fidl::client::QueryResponseFut<
219 AccessibilitySettings,
220 fidl::encoding::DefaultFuchsiaResourceDialect,
221 >;
222 fn r#watch(&self) -> Self::WatchResponseFut {
223 fn _decode(
224 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
225 ) -> Result<AccessibilitySettings, fidl::Error> {
226 let _response = fidl::client::decode_transaction_body::<
227 AccessibilityWatchResponse,
228 fidl::encoding::DefaultFuchsiaResourceDialect,
229 0x417d0b95ddbf7674,
230 >(_buf?)?;
231 Ok(_response.settings)
232 }
233 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AccessibilitySettings>(
234 (),
235 0x417d0b95ddbf7674,
236 fidl::encoding::DynamicFlags::empty(),
237 _decode,
238 )
239 }
240
241 type SetResponseFut = fidl::client::QueryResponseFut<
242 AccessibilitySetResult,
243 fidl::encoding::DefaultFuchsiaResourceDialect,
244 >;
245 fn r#set(&self, mut settings: &AccessibilitySettings) -> Self::SetResponseFut {
246 fn _decode(
247 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
248 ) -> Result<AccessibilitySetResult, fidl::Error> {
249 let _response = fidl::client::decode_transaction_body::<
250 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
251 fidl::encoding::DefaultFuchsiaResourceDialect,
252 0x298485ef354fb8cb,
253 >(_buf?)?;
254 Ok(_response.map(|x| x))
255 }
256 self.client.send_query_and_decode::<AccessibilitySetRequest, AccessibilitySetResult>(
257 (settings,),
258 0x298485ef354fb8cb,
259 fidl::encoding::DynamicFlags::empty(),
260 _decode,
261 )
262 }
263}
264
265pub struct AccessibilityEventStream {
266 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
267}
268
269impl std::marker::Unpin for AccessibilityEventStream {}
270
271impl futures::stream::FusedStream for AccessibilityEventStream {
272 fn is_terminated(&self) -> bool {
273 self.event_receiver.is_terminated()
274 }
275}
276
277impl futures::Stream for AccessibilityEventStream {
278 type Item = Result<AccessibilityEvent, fidl::Error>;
279
280 fn poll_next(
281 mut self: std::pin::Pin<&mut Self>,
282 cx: &mut std::task::Context<'_>,
283 ) -> std::task::Poll<Option<Self::Item>> {
284 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
285 &mut self.event_receiver,
286 cx
287 )?) {
288 Some(buf) => std::task::Poll::Ready(Some(AccessibilityEvent::decode(buf))),
289 None => std::task::Poll::Ready(None),
290 }
291 }
292}
293
294#[derive(Debug)]
295pub enum AccessibilityEvent {}
296
297impl AccessibilityEvent {
298 fn decode(
300 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
301 ) -> Result<AccessibilityEvent, fidl::Error> {
302 let (bytes, _handles) = buf.split_mut();
303 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
304 debug_assert_eq!(tx_header.tx_id, 0);
305 match tx_header.ordinal {
306 _ => Err(fidl::Error::UnknownOrdinal {
307 ordinal: tx_header.ordinal,
308 protocol_name: <AccessibilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
309 }),
310 }
311 }
312}
313
314pub struct AccessibilityRequestStream {
316 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317 is_terminated: bool,
318}
319
320impl std::marker::Unpin for AccessibilityRequestStream {}
321
322impl futures::stream::FusedStream for AccessibilityRequestStream {
323 fn is_terminated(&self) -> bool {
324 self.is_terminated
325 }
326}
327
328impl fidl::endpoints::RequestStream for AccessibilityRequestStream {
329 type Protocol = AccessibilityMarker;
330 type ControlHandle = AccessibilityControlHandle;
331
332 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
333 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
334 }
335
336 fn control_handle(&self) -> Self::ControlHandle {
337 AccessibilityControlHandle { inner: self.inner.clone() }
338 }
339
340 fn into_inner(
341 self,
342 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
343 {
344 (self.inner, self.is_terminated)
345 }
346
347 fn from_inner(
348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
349 is_terminated: bool,
350 ) -> Self {
351 Self { inner, is_terminated }
352 }
353}
354
355impl futures::Stream for AccessibilityRequestStream {
356 type Item = Result<AccessibilityRequest, fidl::Error>;
357
358 fn poll_next(
359 mut self: std::pin::Pin<&mut Self>,
360 cx: &mut std::task::Context<'_>,
361 ) -> std::task::Poll<Option<Self::Item>> {
362 let this = &mut *self;
363 if this.inner.check_shutdown(cx) {
364 this.is_terminated = true;
365 return std::task::Poll::Ready(None);
366 }
367 if this.is_terminated {
368 panic!("polled AccessibilityRequestStream after completion");
369 }
370 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
371 |bytes, handles| {
372 match this.inner.channel().read_etc(cx, bytes, handles) {
373 std::task::Poll::Ready(Ok(())) => {}
374 std::task::Poll::Pending => return std::task::Poll::Pending,
375 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
376 this.is_terminated = true;
377 return std::task::Poll::Ready(None);
378 }
379 std::task::Poll::Ready(Err(e)) => {
380 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
381 e.into(),
382 ))));
383 }
384 }
385
386 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
388
389 std::task::Poll::Ready(Some(match header.ordinal {
390 0x417d0b95ddbf7674 => {
391 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
392 let mut req = fidl::new_empty!(
393 fidl::encoding::EmptyPayload,
394 fidl::encoding::DefaultFuchsiaResourceDialect
395 );
396 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
397 let control_handle =
398 AccessibilityControlHandle { inner: this.inner.clone() };
399 Ok(AccessibilityRequest::Watch {
400 responder: AccessibilityWatchResponder {
401 control_handle: std::mem::ManuallyDrop::new(control_handle),
402 tx_id: header.tx_id,
403 },
404 })
405 }
406 0x298485ef354fb8cb => {
407 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
408 let mut req = fidl::new_empty!(
409 AccessibilitySetRequest,
410 fidl::encoding::DefaultFuchsiaResourceDialect
411 );
412 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessibilitySetRequest>(&header, _body_bytes, handles, &mut req)?;
413 let control_handle =
414 AccessibilityControlHandle { inner: this.inner.clone() };
415 Ok(AccessibilityRequest::Set {
416 settings: req.settings,
417
418 responder: AccessibilitySetResponder {
419 control_handle: std::mem::ManuallyDrop::new(control_handle),
420 tx_id: header.tx_id,
421 },
422 })
423 }
424 _ => Err(fidl::Error::UnknownOrdinal {
425 ordinal: header.ordinal,
426 protocol_name:
427 <AccessibilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
428 }),
429 }))
430 },
431 )
432 }
433}
434
435#[derive(Debug)]
440pub enum AccessibilityRequest {
441 Watch { responder: AccessibilityWatchResponder },
451 Set { settings: AccessibilitySettings, responder: AccessibilitySetResponder },
454}
455
456impl AccessibilityRequest {
457 #[allow(irrefutable_let_patterns)]
458 pub fn into_watch(self) -> Option<(AccessibilityWatchResponder)> {
459 if let AccessibilityRequest::Watch { responder } = self { Some((responder)) } else { None }
460 }
461
462 #[allow(irrefutable_let_patterns)]
463 pub fn into_set(self) -> Option<(AccessibilitySettings, AccessibilitySetResponder)> {
464 if let AccessibilityRequest::Set { settings, responder } = self {
465 Some((settings, responder))
466 } else {
467 None
468 }
469 }
470
471 pub fn method_name(&self) -> &'static str {
473 match *self {
474 AccessibilityRequest::Watch { .. } => "watch",
475 AccessibilityRequest::Set { .. } => "set",
476 }
477 }
478}
479
480#[derive(Debug, Clone)]
481pub struct AccessibilityControlHandle {
482 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
483}
484
485impl AccessibilityControlHandle {
486 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
487 self.inner.shutdown_with_epitaph(status.into())
488 }
489}
490
491impl fidl::endpoints::ControlHandle for AccessibilityControlHandle {
492 fn shutdown(&self) {
493 self.inner.shutdown()
494 }
495
496 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
497 self.inner.shutdown_with_epitaph(status)
498 }
499
500 fn is_closed(&self) -> bool {
501 self.inner.channel().is_closed()
502 }
503 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
504 self.inner.channel().on_closed()
505 }
506
507 #[cfg(target_os = "fuchsia")]
508 fn signal_peer(
509 &self,
510 clear_mask: zx::Signals,
511 set_mask: zx::Signals,
512 ) -> Result<(), zx_status::Status> {
513 use fidl::Peered;
514 self.inner.channel().signal_peer(clear_mask, set_mask)
515 }
516}
517
518impl AccessibilityControlHandle {}
519
520#[must_use = "FIDL methods require a response to be sent"]
521#[derive(Debug)]
522pub struct AccessibilityWatchResponder {
523 control_handle: std::mem::ManuallyDrop<AccessibilityControlHandle>,
524 tx_id: u32,
525}
526
527impl std::ops::Drop for AccessibilityWatchResponder {
531 fn drop(&mut self) {
532 self.control_handle.shutdown();
533 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
535 }
536}
537
538impl fidl::endpoints::Responder for AccessibilityWatchResponder {
539 type ControlHandle = AccessibilityControlHandle;
540
541 fn control_handle(&self) -> &AccessibilityControlHandle {
542 &self.control_handle
543 }
544
545 fn drop_without_shutdown(mut self) {
546 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
548 std::mem::forget(self);
550 }
551}
552
553impl AccessibilityWatchResponder {
554 pub fn send(self, mut settings: &AccessibilitySettings) -> Result<(), fidl::Error> {
558 let _result = self.send_raw(settings);
559 if _result.is_err() {
560 self.control_handle.shutdown();
561 }
562 self.drop_without_shutdown();
563 _result
564 }
565
566 pub fn send_no_shutdown_on_err(
568 self,
569 mut settings: &AccessibilitySettings,
570 ) -> Result<(), fidl::Error> {
571 let _result = self.send_raw(settings);
572 self.drop_without_shutdown();
573 _result
574 }
575
576 fn send_raw(&self, mut settings: &AccessibilitySettings) -> Result<(), fidl::Error> {
577 self.control_handle.inner.send::<AccessibilityWatchResponse>(
578 (settings,),
579 self.tx_id,
580 0x417d0b95ddbf7674,
581 fidl::encoding::DynamicFlags::empty(),
582 )
583 }
584}
585
586#[must_use = "FIDL methods require a response to be sent"]
587#[derive(Debug)]
588pub struct AccessibilitySetResponder {
589 control_handle: std::mem::ManuallyDrop<AccessibilityControlHandle>,
590 tx_id: u32,
591}
592
593impl std::ops::Drop for AccessibilitySetResponder {
597 fn drop(&mut self) {
598 self.control_handle.shutdown();
599 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
601 }
602}
603
604impl fidl::endpoints::Responder for AccessibilitySetResponder {
605 type ControlHandle = AccessibilityControlHandle;
606
607 fn control_handle(&self) -> &AccessibilityControlHandle {
608 &self.control_handle
609 }
610
611 fn drop_without_shutdown(mut self) {
612 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
614 std::mem::forget(self);
616 }
617}
618
619impl AccessibilitySetResponder {
620 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
624 let _result = self.send_raw(result);
625 if _result.is_err() {
626 self.control_handle.shutdown();
627 }
628 self.drop_without_shutdown();
629 _result
630 }
631
632 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
634 let _result = self.send_raw(result);
635 self.drop_without_shutdown();
636 _result
637 }
638
639 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
640 self.control_handle
641 .inner
642 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
643 result,
644 self.tx_id,
645 0x298485ef354fb8cb,
646 fidl::encoding::DynamicFlags::empty(),
647 )
648 }
649}
650
651#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
652pub struct AudioMarker;
653
654impl fidl::endpoints::ProtocolMarker for AudioMarker {
655 type Proxy = AudioProxy;
656 type RequestStream = AudioRequestStream;
657 #[cfg(target_os = "fuchsia")]
658 type SynchronousProxy = AudioSynchronousProxy;
659
660 const DEBUG_NAME: &'static str = "fuchsia.settings.Audio";
661}
662impl fidl::endpoints::DiscoverableProtocolMarker for AudioMarker {}
663pub type AudioSetResult = Result<(), Error>;
664pub type AudioSet2Result = Result<(), Error>;
665
666pub trait AudioProxyInterface: Send + Sync {
667 type WatchResponseFut: std::future::Future<Output = Result<AudioSettings, fidl::Error>> + Send;
668 fn r#watch(&self) -> Self::WatchResponseFut;
669 type Watch2ResponseFut: std::future::Future<Output = Result<AudioSettings2, fidl::Error>> + Send;
670 fn r#watch2(&self) -> Self::Watch2ResponseFut;
671 type SetResponseFut: std::future::Future<Output = Result<AudioSetResult, fidl::Error>> + Send;
672 fn r#set(&self, settings: &AudioSettings) -> Self::SetResponseFut;
673 type Set2ResponseFut: std::future::Future<Output = Result<AudioSet2Result, fidl::Error>> + Send;
674 fn r#set2(&self, settings: &AudioSettings2) -> Self::Set2ResponseFut;
675}
676#[derive(Debug)]
677#[cfg(target_os = "fuchsia")]
678pub struct AudioSynchronousProxy {
679 client: fidl::client::sync::Client,
680}
681
682#[cfg(target_os = "fuchsia")]
683impl fidl::endpoints::SynchronousProxy for AudioSynchronousProxy {
684 type Proxy = AudioProxy;
685 type Protocol = AudioMarker;
686
687 fn from_channel(inner: fidl::Channel) -> Self {
688 Self::new(inner)
689 }
690
691 fn into_channel(self) -> fidl::Channel {
692 self.client.into_channel()
693 }
694
695 fn as_channel(&self) -> &fidl::Channel {
696 self.client.as_channel()
697 }
698}
699
700#[cfg(target_os = "fuchsia")]
701impl AudioSynchronousProxy {
702 pub fn new(channel: fidl::Channel) -> Self {
703 Self { client: fidl::client::sync::Client::new(channel) }
704 }
705
706 pub fn into_channel(self) -> fidl::Channel {
707 self.client.into_channel()
708 }
709
710 pub fn wait_for_event(
713 &self,
714 deadline: zx::MonotonicInstant,
715 ) -> Result<AudioEvent, fidl::Error> {
716 AudioEvent::decode(self.client.wait_for_event::<AudioMarker>(deadline)?)
717 }
718
719 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<AudioSettings, fidl::Error> {
725 let _response = self
726 .client
727 .send_query::<fidl::encoding::EmptyPayload, AudioWatchResponse, AudioMarker>(
728 (),
729 0x2995cf83f9d0f805,
730 fidl::encoding::DynamicFlags::empty(),
731 ___deadline,
732 )?;
733 Ok(_response.settings)
734 }
735
736 pub fn r#watch2(
741 &self,
742 ___deadline: zx::MonotonicInstant,
743 ) -> Result<AudioSettings2, fidl::Error> {
744 let _response = self.client.send_query::<
745 fidl::encoding::EmptyPayload,
746 fidl::encoding::FlexibleType<AudioWatch2Response>,
747 AudioMarker,
748 >(
749 (),
750 0x4d10b204de1796e2,
751 fidl::encoding::DynamicFlags::FLEXIBLE,
752 ___deadline,
753 )?
754 .into_result::<AudioMarker>("watch2")?;
755 Ok(_response.settings)
756 }
757
758 pub fn r#set(
761 &self,
762 mut settings: &AudioSettings,
763 ___deadline: zx::MonotonicInstant,
764 ) -> Result<AudioSetResult, fidl::Error> {
765 let _response = self.client.send_query::<AudioSetRequest, fidl::encoding::ResultType<
766 fidl::encoding::EmptyStruct,
767 Error,
768 >, AudioMarker>(
769 (settings,),
770 0x4f3865db04da626c,
771 fidl::encoding::DynamicFlags::empty(),
772 ___deadline,
773 )?;
774 Ok(_response.map(|x| x))
775 }
776
777 pub fn r#set2(
780 &self,
781 mut settings: &AudioSettings2,
782 ___deadline: zx::MonotonicInstant,
783 ) -> Result<AudioSet2Result, fidl::Error> {
784 let _response = self.client.send_query::<
785 AudioSet2Request,
786 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
787 AudioMarker,
788 >(
789 (settings,),
790 0x1f027e9ed7beefe3,
791 fidl::encoding::DynamicFlags::FLEXIBLE,
792 ___deadline,
793 )?
794 .into_result::<AudioMarker>("set2")?;
795 Ok(_response.map(|x| x))
796 }
797}
798
799#[cfg(target_os = "fuchsia")]
800impl From<AudioSynchronousProxy> for zx::NullableHandle {
801 fn from(value: AudioSynchronousProxy) -> Self {
802 value.into_channel().into()
803 }
804}
805
806#[cfg(target_os = "fuchsia")]
807impl From<fidl::Channel> for AudioSynchronousProxy {
808 fn from(value: fidl::Channel) -> Self {
809 Self::new(value)
810 }
811}
812
813#[cfg(target_os = "fuchsia")]
814impl fidl::endpoints::FromClient for AudioSynchronousProxy {
815 type Protocol = AudioMarker;
816
817 fn from_client(value: fidl::endpoints::ClientEnd<AudioMarker>) -> Self {
818 Self::new(value.into_channel())
819 }
820}
821
822#[derive(Debug, Clone)]
823pub struct AudioProxy {
824 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
825}
826
827impl fidl::endpoints::Proxy for AudioProxy {
828 type Protocol = AudioMarker;
829
830 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
831 Self::new(inner)
832 }
833
834 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
835 self.client.into_channel().map_err(|client| Self { client })
836 }
837
838 fn as_channel(&self) -> &::fidl::AsyncChannel {
839 self.client.as_channel()
840 }
841}
842
843impl AudioProxy {
844 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
846 let protocol_name = <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
847 Self { client: fidl::client::Client::new(channel, protocol_name) }
848 }
849
850 pub fn take_event_stream(&self) -> AudioEventStream {
856 AudioEventStream { event_receiver: self.client.take_event_receiver() }
857 }
858
859 pub fn r#watch(
865 &self,
866 ) -> fidl::client::QueryResponseFut<AudioSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
867 {
868 AudioProxyInterface::r#watch(self)
869 }
870
871 pub fn r#watch2(
876 &self,
877 ) -> fidl::client::QueryResponseFut<AudioSettings2, fidl::encoding::DefaultFuchsiaResourceDialect>
878 {
879 AudioProxyInterface::r#watch2(self)
880 }
881
882 pub fn r#set(
885 &self,
886 mut settings: &AudioSettings,
887 ) -> fidl::client::QueryResponseFut<AudioSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
888 {
889 AudioProxyInterface::r#set(self, settings)
890 }
891
892 pub fn r#set2(
895 &self,
896 mut settings: &AudioSettings2,
897 ) -> fidl::client::QueryResponseFut<
898 AudioSet2Result,
899 fidl::encoding::DefaultFuchsiaResourceDialect,
900 > {
901 AudioProxyInterface::r#set2(self, settings)
902 }
903}
904
905impl AudioProxyInterface for AudioProxy {
906 type WatchResponseFut = fidl::client::QueryResponseFut<
907 AudioSettings,
908 fidl::encoding::DefaultFuchsiaResourceDialect,
909 >;
910 fn r#watch(&self) -> Self::WatchResponseFut {
911 fn _decode(
912 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
913 ) -> Result<AudioSettings, fidl::Error> {
914 let _response = fidl::client::decode_transaction_body::<
915 AudioWatchResponse,
916 fidl::encoding::DefaultFuchsiaResourceDialect,
917 0x2995cf83f9d0f805,
918 >(_buf?)?;
919 Ok(_response.settings)
920 }
921 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AudioSettings>(
922 (),
923 0x2995cf83f9d0f805,
924 fidl::encoding::DynamicFlags::empty(),
925 _decode,
926 )
927 }
928
929 type Watch2ResponseFut = fidl::client::QueryResponseFut<
930 AudioSettings2,
931 fidl::encoding::DefaultFuchsiaResourceDialect,
932 >;
933 fn r#watch2(&self) -> Self::Watch2ResponseFut {
934 fn _decode(
935 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
936 ) -> Result<AudioSettings2, fidl::Error> {
937 let _response = fidl::client::decode_transaction_body::<
938 fidl::encoding::FlexibleType<AudioWatch2Response>,
939 fidl::encoding::DefaultFuchsiaResourceDialect,
940 0x4d10b204de1796e2,
941 >(_buf?)?
942 .into_result::<AudioMarker>("watch2")?;
943 Ok(_response.settings)
944 }
945 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AudioSettings2>(
946 (),
947 0x4d10b204de1796e2,
948 fidl::encoding::DynamicFlags::FLEXIBLE,
949 _decode,
950 )
951 }
952
953 type SetResponseFut = fidl::client::QueryResponseFut<
954 AudioSetResult,
955 fidl::encoding::DefaultFuchsiaResourceDialect,
956 >;
957 fn r#set(&self, mut settings: &AudioSettings) -> Self::SetResponseFut {
958 fn _decode(
959 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
960 ) -> Result<AudioSetResult, fidl::Error> {
961 let _response = fidl::client::decode_transaction_body::<
962 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
963 fidl::encoding::DefaultFuchsiaResourceDialect,
964 0x4f3865db04da626c,
965 >(_buf?)?;
966 Ok(_response.map(|x| x))
967 }
968 self.client.send_query_and_decode::<AudioSetRequest, AudioSetResult>(
969 (settings,),
970 0x4f3865db04da626c,
971 fidl::encoding::DynamicFlags::empty(),
972 _decode,
973 )
974 }
975
976 type Set2ResponseFut = fidl::client::QueryResponseFut<
977 AudioSet2Result,
978 fidl::encoding::DefaultFuchsiaResourceDialect,
979 >;
980 fn r#set2(&self, mut settings: &AudioSettings2) -> Self::Set2ResponseFut {
981 fn _decode(
982 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
983 ) -> Result<AudioSet2Result, fidl::Error> {
984 let _response = fidl::client::decode_transaction_body::<
985 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
986 fidl::encoding::DefaultFuchsiaResourceDialect,
987 0x1f027e9ed7beefe3,
988 >(_buf?)?
989 .into_result::<AudioMarker>("set2")?;
990 Ok(_response.map(|x| x))
991 }
992 self.client.send_query_and_decode::<AudioSet2Request, AudioSet2Result>(
993 (settings,),
994 0x1f027e9ed7beefe3,
995 fidl::encoding::DynamicFlags::FLEXIBLE,
996 _decode,
997 )
998 }
999}
1000
1001pub struct AudioEventStream {
1002 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1003}
1004
1005impl std::marker::Unpin for AudioEventStream {}
1006
1007impl futures::stream::FusedStream for AudioEventStream {
1008 fn is_terminated(&self) -> bool {
1009 self.event_receiver.is_terminated()
1010 }
1011}
1012
1013impl futures::Stream for AudioEventStream {
1014 type Item = Result<AudioEvent, fidl::Error>;
1015
1016 fn poll_next(
1017 mut self: std::pin::Pin<&mut Self>,
1018 cx: &mut std::task::Context<'_>,
1019 ) -> std::task::Poll<Option<Self::Item>> {
1020 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1021 &mut self.event_receiver,
1022 cx
1023 )?) {
1024 Some(buf) => std::task::Poll::Ready(Some(AudioEvent::decode(buf))),
1025 None => std::task::Poll::Ready(None),
1026 }
1027 }
1028}
1029
1030#[derive(Debug)]
1031pub enum AudioEvent {
1032 #[non_exhaustive]
1033 _UnknownEvent {
1034 ordinal: u64,
1036 },
1037}
1038
1039impl AudioEvent {
1040 fn decode(
1042 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1043 ) -> Result<AudioEvent, fidl::Error> {
1044 let (bytes, _handles) = buf.split_mut();
1045 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1046 debug_assert_eq!(tx_header.tx_id, 0);
1047 match tx_header.ordinal {
1048 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1049 Ok(AudioEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1050 }
1051 _ => Err(fidl::Error::UnknownOrdinal {
1052 ordinal: tx_header.ordinal,
1053 protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1054 }),
1055 }
1056 }
1057}
1058
1059pub struct AudioRequestStream {
1061 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1062 is_terminated: bool,
1063}
1064
1065impl std::marker::Unpin for AudioRequestStream {}
1066
1067impl futures::stream::FusedStream for AudioRequestStream {
1068 fn is_terminated(&self) -> bool {
1069 self.is_terminated
1070 }
1071}
1072
1073impl fidl::endpoints::RequestStream for AudioRequestStream {
1074 type Protocol = AudioMarker;
1075 type ControlHandle = AudioControlHandle;
1076
1077 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1078 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1079 }
1080
1081 fn control_handle(&self) -> Self::ControlHandle {
1082 AudioControlHandle { inner: self.inner.clone() }
1083 }
1084
1085 fn into_inner(
1086 self,
1087 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1088 {
1089 (self.inner, self.is_terminated)
1090 }
1091
1092 fn from_inner(
1093 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1094 is_terminated: bool,
1095 ) -> Self {
1096 Self { inner, is_terminated }
1097 }
1098}
1099
1100impl futures::Stream for AudioRequestStream {
1101 type Item = Result<AudioRequest, fidl::Error>;
1102
1103 fn poll_next(
1104 mut self: std::pin::Pin<&mut Self>,
1105 cx: &mut std::task::Context<'_>,
1106 ) -> std::task::Poll<Option<Self::Item>> {
1107 let this = &mut *self;
1108 if this.inner.check_shutdown(cx) {
1109 this.is_terminated = true;
1110 return std::task::Poll::Ready(None);
1111 }
1112 if this.is_terminated {
1113 panic!("polled AudioRequestStream after completion");
1114 }
1115 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1116 |bytes, handles| {
1117 match this.inner.channel().read_etc(cx, bytes, handles) {
1118 std::task::Poll::Ready(Ok(())) => {}
1119 std::task::Poll::Pending => return std::task::Poll::Pending,
1120 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1121 this.is_terminated = true;
1122 return std::task::Poll::Ready(None);
1123 }
1124 std::task::Poll::Ready(Err(e)) => {
1125 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1126 e.into(),
1127 ))));
1128 }
1129 }
1130
1131 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1133
1134 std::task::Poll::Ready(Some(match header.ordinal {
1135 0x2995cf83f9d0f805 => {
1136 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1137 let mut req = fidl::new_empty!(
1138 fidl::encoding::EmptyPayload,
1139 fidl::encoding::DefaultFuchsiaResourceDialect
1140 );
1141 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1142 let control_handle = AudioControlHandle { inner: this.inner.clone() };
1143 Ok(AudioRequest::Watch {
1144 responder: AudioWatchResponder {
1145 control_handle: std::mem::ManuallyDrop::new(control_handle),
1146 tx_id: header.tx_id,
1147 },
1148 })
1149 }
1150 0x4d10b204de1796e2 => {
1151 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1152 let mut req = fidl::new_empty!(
1153 fidl::encoding::EmptyPayload,
1154 fidl::encoding::DefaultFuchsiaResourceDialect
1155 );
1156 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1157 let control_handle = AudioControlHandle { inner: this.inner.clone() };
1158 Ok(AudioRequest::Watch2 {
1159 responder: AudioWatch2Responder {
1160 control_handle: std::mem::ManuallyDrop::new(control_handle),
1161 tx_id: header.tx_id,
1162 },
1163 })
1164 }
1165 0x4f3865db04da626c => {
1166 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1167 let mut req = fidl::new_empty!(
1168 AudioSetRequest,
1169 fidl::encoding::DefaultFuchsiaResourceDialect
1170 );
1171 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioSetRequest>(&header, _body_bytes, handles, &mut req)?;
1172 let control_handle = AudioControlHandle { inner: this.inner.clone() };
1173 Ok(AudioRequest::Set {
1174 settings: req.settings,
1175
1176 responder: AudioSetResponder {
1177 control_handle: std::mem::ManuallyDrop::new(control_handle),
1178 tx_id: header.tx_id,
1179 },
1180 })
1181 }
1182 0x1f027e9ed7beefe3 => {
1183 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1184 let mut req = fidl::new_empty!(
1185 AudioSet2Request,
1186 fidl::encoding::DefaultFuchsiaResourceDialect
1187 );
1188 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioSet2Request>(&header, _body_bytes, handles, &mut req)?;
1189 let control_handle = AudioControlHandle { inner: this.inner.clone() };
1190 Ok(AudioRequest::Set2 {
1191 settings: req.settings,
1192
1193 responder: AudioSet2Responder {
1194 control_handle: std::mem::ManuallyDrop::new(control_handle),
1195 tx_id: header.tx_id,
1196 },
1197 })
1198 }
1199 _ if header.tx_id == 0
1200 && header
1201 .dynamic_flags()
1202 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1203 {
1204 Ok(AudioRequest::_UnknownMethod {
1205 ordinal: header.ordinal,
1206 control_handle: AudioControlHandle { inner: this.inner.clone() },
1207 method_type: fidl::MethodType::OneWay,
1208 })
1209 }
1210 _ if header
1211 .dynamic_flags()
1212 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1213 {
1214 this.inner.send_framework_err(
1215 fidl::encoding::FrameworkErr::UnknownMethod,
1216 header.tx_id,
1217 header.ordinal,
1218 header.dynamic_flags(),
1219 (bytes, handles),
1220 )?;
1221 Ok(AudioRequest::_UnknownMethod {
1222 ordinal: header.ordinal,
1223 control_handle: AudioControlHandle { inner: this.inner.clone() },
1224 method_type: fidl::MethodType::TwoWay,
1225 })
1226 }
1227 _ => Err(fidl::Error::UnknownOrdinal {
1228 ordinal: header.ordinal,
1229 protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1230 }),
1231 }))
1232 },
1233 )
1234 }
1235}
1236
1237#[derive(Debug)]
1242pub enum AudioRequest {
1243 Watch { responder: AudioWatchResponder },
1249 Watch2 { responder: AudioWatch2Responder },
1254 Set { settings: AudioSettings, responder: AudioSetResponder },
1257 Set2 { settings: AudioSettings2, responder: AudioSet2Responder },
1260 #[non_exhaustive]
1262 _UnknownMethod {
1263 ordinal: u64,
1265 control_handle: AudioControlHandle,
1266 method_type: fidl::MethodType,
1267 },
1268}
1269
1270impl AudioRequest {
1271 #[allow(irrefutable_let_patterns)]
1272 pub fn into_watch(self) -> Option<(AudioWatchResponder)> {
1273 if let AudioRequest::Watch { responder } = self { Some((responder)) } else { None }
1274 }
1275
1276 #[allow(irrefutable_let_patterns)]
1277 pub fn into_watch2(self) -> Option<(AudioWatch2Responder)> {
1278 if let AudioRequest::Watch2 { responder } = self { Some((responder)) } else { None }
1279 }
1280
1281 #[allow(irrefutable_let_patterns)]
1282 pub fn into_set(self) -> Option<(AudioSettings, AudioSetResponder)> {
1283 if let AudioRequest::Set { settings, responder } = self {
1284 Some((settings, responder))
1285 } else {
1286 None
1287 }
1288 }
1289
1290 #[allow(irrefutable_let_patterns)]
1291 pub fn into_set2(self) -> Option<(AudioSettings2, AudioSet2Responder)> {
1292 if let AudioRequest::Set2 { settings, responder } = self {
1293 Some((settings, responder))
1294 } else {
1295 None
1296 }
1297 }
1298
1299 pub fn method_name(&self) -> &'static str {
1301 match *self {
1302 AudioRequest::Watch { .. } => "watch",
1303 AudioRequest::Watch2 { .. } => "watch2",
1304 AudioRequest::Set { .. } => "set",
1305 AudioRequest::Set2 { .. } => "set2",
1306 AudioRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1307 "unknown one-way method"
1308 }
1309 AudioRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1310 "unknown two-way method"
1311 }
1312 }
1313 }
1314}
1315
1316#[derive(Debug, Clone)]
1317pub struct AudioControlHandle {
1318 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1319}
1320
1321impl AudioControlHandle {
1322 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1323 self.inner.shutdown_with_epitaph(status.into())
1324 }
1325}
1326
1327impl fidl::endpoints::ControlHandle for AudioControlHandle {
1328 fn shutdown(&self) {
1329 self.inner.shutdown()
1330 }
1331
1332 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1333 self.inner.shutdown_with_epitaph(status)
1334 }
1335
1336 fn is_closed(&self) -> bool {
1337 self.inner.channel().is_closed()
1338 }
1339 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1340 self.inner.channel().on_closed()
1341 }
1342
1343 #[cfg(target_os = "fuchsia")]
1344 fn signal_peer(
1345 &self,
1346 clear_mask: zx::Signals,
1347 set_mask: zx::Signals,
1348 ) -> Result<(), zx_status::Status> {
1349 use fidl::Peered;
1350 self.inner.channel().signal_peer(clear_mask, set_mask)
1351 }
1352}
1353
1354impl AudioControlHandle {}
1355
1356#[must_use = "FIDL methods require a response to be sent"]
1357#[derive(Debug)]
1358pub struct AudioWatchResponder {
1359 control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1360 tx_id: u32,
1361}
1362
1363impl std::ops::Drop for AudioWatchResponder {
1367 fn drop(&mut self) {
1368 self.control_handle.shutdown();
1369 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371 }
1372}
1373
1374impl fidl::endpoints::Responder for AudioWatchResponder {
1375 type ControlHandle = AudioControlHandle;
1376
1377 fn control_handle(&self) -> &AudioControlHandle {
1378 &self.control_handle
1379 }
1380
1381 fn drop_without_shutdown(mut self) {
1382 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1384 std::mem::forget(self);
1386 }
1387}
1388
1389impl AudioWatchResponder {
1390 pub fn send(self, mut settings: &AudioSettings) -> Result<(), fidl::Error> {
1394 let _result = self.send_raw(settings);
1395 if _result.is_err() {
1396 self.control_handle.shutdown();
1397 }
1398 self.drop_without_shutdown();
1399 _result
1400 }
1401
1402 pub fn send_no_shutdown_on_err(self, mut settings: &AudioSettings) -> Result<(), fidl::Error> {
1404 let _result = self.send_raw(settings);
1405 self.drop_without_shutdown();
1406 _result
1407 }
1408
1409 fn send_raw(&self, mut settings: &AudioSettings) -> Result<(), fidl::Error> {
1410 self.control_handle.inner.send::<AudioWatchResponse>(
1411 (settings,),
1412 self.tx_id,
1413 0x2995cf83f9d0f805,
1414 fidl::encoding::DynamicFlags::empty(),
1415 )
1416 }
1417}
1418
1419#[must_use = "FIDL methods require a response to be sent"]
1420#[derive(Debug)]
1421pub struct AudioWatch2Responder {
1422 control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1423 tx_id: u32,
1424}
1425
1426impl std::ops::Drop for AudioWatch2Responder {
1430 fn drop(&mut self) {
1431 self.control_handle.shutdown();
1432 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1434 }
1435}
1436
1437impl fidl::endpoints::Responder for AudioWatch2Responder {
1438 type ControlHandle = AudioControlHandle;
1439
1440 fn control_handle(&self) -> &AudioControlHandle {
1441 &self.control_handle
1442 }
1443
1444 fn drop_without_shutdown(mut self) {
1445 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1447 std::mem::forget(self);
1449 }
1450}
1451
1452impl AudioWatch2Responder {
1453 pub fn send(self, mut settings: &AudioSettings2) -> Result<(), fidl::Error> {
1457 let _result = self.send_raw(settings);
1458 if _result.is_err() {
1459 self.control_handle.shutdown();
1460 }
1461 self.drop_without_shutdown();
1462 _result
1463 }
1464
1465 pub fn send_no_shutdown_on_err(self, mut settings: &AudioSettings2) -> Result<(), fidl::Error> {
1467 let _result = self.send_raw(settings);
1468 self.drop_without_shutdown();
1469 _result
1470 }
1471
1472 fn send_raw(&self, mut settings: &AudioSettings2) -> Result<(), fidl::Error> {
1473 self.control_handle.inner.send::<fidl::encoding::FlexibleType<AudioWatch2Response>>(
1474 fidl::encoding::Flexible::new((settings,)),
1475 self.tx_id,
1476 0x4d10b204de1796e2,
1477 fidl::encoding::DynamicFlags::FLEXIBLE,
1478 )
1479 }
1480}
1481
1482#[must_use = "FIDL methods require a response to be sent"]
1483#[derive(Debug)]
1484pub struct AudioSetResponder {
1485 control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1486 tx_id: u32,
1487}
1488
1489impl std::ops::Drop for AudioSetResponder {
1493 fn drop(&mut self) {
1494 self.control_handle.shutdown();
1495 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1497 }
1498}
1499
1500impl fidl::endpoints::Responder for AudioSetResponder {
1501 type ControlHandle = AudioControlHandle;
1502
1503 fn control_handle(&self) -> &AudioControlHandle {
1504 &self.control_handle
1505 }
1506
1507 fn drop_without_shutdown(mut self) {
1508 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1510 std::mem::forget(self);
1512 }
1513}
1514
1515impl AudioSetResponder {
1516 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1520 let _result = self.send_raw(result);
1521 if _result.is_err() {
1522 self.control_handle.shutdown();
1523 }
1524 self.drop_without_shutdown();
1525 _result
1526 }
1527
1528 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1530 let _result = self.send_raw(result);
1531 self.drop_without_shutdown();
1532 _result
1533 }
1534
1535 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1536 self.control_handle
1537 .inner
1538 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1539 result,
1540 self.tx_id,
1541 0x4f3865db04da626c,
1542 fidl::encoding::DynamicFlags::empty(),
1543 )
1544 }
1545}
1546
1547#[must_use = "FIDL methods require a response to be sent"]
1548#[derive(Debug)]
1549pub struct AudioSet2Responder {
1550 control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1551 tx_id: u32,
1552}
1553
1554impl std::ops::Drop for AudioSet2Responder {
1558 fn drop(&mut self) {
1559 self.control_handle.shutdown();
1560 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1562 }
1563}
1564
1565impl fidl::endpoints::Responder for AudioSet2Responder {
1566 type ControlHandle = AudioControlHandle;
1567
1568 fn control_handle(&self) -> &AudioControlHandle {
1569 &self.control_handle
1570 }
1571
1572 fn drop_without_shutdown(mut self) {
1573 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1575 std::mem::forget(self);
1577 }
1578}
1579
1580impl AudioSet2Responder {
1581 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1585 let _result = self.send_raw(result);
1586 if _result.is_err() {
1587 self.control_handle.shutdown();
1588 }
1589 self.drop_without_shutdown();
1590 _result
1591 }
1592
1593 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1595 let _result = self.send_raw(result);
1596 self.drop_without_shutdown();
1597 _result
1598 }
1599
1600 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1601 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1602 fidl::encoding::EmptyStruct,
1603 Error,
1604 >>(
1605 fidl::encoding::FlexibleResult::new(result),
1606 self.tx_id,
1607 0x1f027e9ed7beefe3,
1608 fidl::encoding::DynamicFlags::FLEXIBLE,
1609 )
1610 }
1611}
1612
1613#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1614pub struct DisplayMarker;
1615
1616impl fidl::endpoints::ProtocolMarker for DisplayMarker {
1617 type Proxy = DisplayProxy;
1618 type RequestStream = DisplayRequestStream;
1619 #[cfg(target_os = "fuchsia")]
1620 type SynchronousProxy = DisplaySynchronousProxy;
1621
1622 const DEBUG_NAME: &'static str = "fuchsia.settings.Display";
1623}
1624impl fidl::endpoints::DiscoverableProtocolMarker for DisplayMarker {}
1625pub type DisplaySetResult = Result<(), Error>;
1626
1627pub trait DisplayProxyInterface: Send + Sync {
1628 type WatchResponseFut: std::future::Future<Output = Result<DisplaySettings, fidl::Error>> + Send;
1629 fn r#watch(&self) -> Self::WatchResponseFut;
1630 type SetResponseFut: std::future::Future<Output = Result<DisplaySetResult, fidl::Error>> + Send;
1631 fn r#set(&self, settings: &DisplaySettings) -> Self::SetResponseFut;
1632}
1633#[derive(Debug)]
1634#[cfg(target_os = "fuchsia")]
1635pub struct DisplaySynchronousProxy {
1636 client: fidl::client::sync::Client,
1637}
1638
1639#[cfg(target_os = "fuchsia")]
1640impl fidl::endpoints::SynchronousProxy for DisplaySynchronousProxy {
1641 type Proxy = DisplayProxy;
1642 type Protocol = DisplayMarker;
1643
1644 fn from_channel(inner: fidl::Channel) -> Self {
1645 Self::new(inner)
1646 }
1647
1648 fn into_channel(self) -> fidl::Channel {
1649 self.client.into_channel()
1650 }
1651
1652 fn as_channel(&self) -> &fidl::Channel {
1653 self.client.as_channel()
1654 }
1655}
1656
1657#[cfg(target_os = "fuchsia")]
1658impl DisplaySynchronousProxy {
1659 pub fn new(channel: fidl::Channel) -> Self {
1660 Self { client: fidl::client::sync::Client::new(channel) }
1661 }
1662
1663 pub fn into_channel(self) -> fidl::Channel {
1664 self.client.into_channel()
1665 }
1666
1667 pub fn wait_for_event(
1670 &self,
1671 deadline: zx::MonotonicInstant,
1672 ) -> Result<DisplayEvent, fidl::Error> {
1673 DisplayEvent::decode(self.client.wait_for_event::<DisplayMarker>(deadline)?)
1674 }
1675
1676 pub fn r#watch(
1682 &self,
1683 ___deadline: zx::MonotonicInstant,
1684 ) -> Result<DisplaySettings, fidl::Error> {
1685 let _response = self
1686 .client
1687 .send_query::<fidl::encoding::EmptyPayload, DisplayWatchResponse, DisplayMarker>(
1688 (),
1689 0x7da3212470364db1,
1690 fidl::encoding::DynamicFlags::empty(),
1691 ___deadline,
1692 )?;
1693 Ok(_response.settings)
1694 }
1695
1696 pub fn r#set(
1699 &self,
1700 mut settings: &DisplaySettings,
1701 ___deadline: zx::MonotonicInstant,
1702 ) -> Result<DisplaySetResult, fidl::Error> {
1703 let _response = self.client.send_query::<DisplaySetRequest, fidl::encoding::ResultType<
1704 fidl::encoding::EmptyStruct,
1705 Error,
1706 >, DisplayMarker>(
1707 (settings,),
1708 0x1029e06ace17479c,
1709 fidl::encoding::DynamicFlags::empty(),
1710 ___deadline,
1711 )?;
1712 Ok(_response.map(|x| x))
1713 }
1714}
1715
1716#[cfg(target_os = "fuchsia")]
1717impl From<DisplaySynchronousProxy> for zx::NullableHandle {
1718 fn from(value: DisplaySynchronousProxy) -> Self {
1719 value.into_channel().into()
1720 }
1721}
1722
1723#[cfg(target_os = "fuchsia")]
1724impl From<fidl::Channel> for DisplaySynchronousProxy {
1725 fn from(value: fidl::Channel) -> Self {
1726 Self::new(value)
1727 }
1728}
1729
1730#[cfg(target_os = "fuchsia")]
1731impl fidl::endpoints::FromClient for DisplaySynchronousProxy {
1732 type Protocol = DisplayMarker;
1733
1734 fn from_client(value: fidl::endpoints::ClientEnd<DisplayMarker>) -> Self {
1735 Self::new(value.into_channel())
1736 }
1737}
1738
1739#[derive(Debug, Clone)]
1740pub struct DisplayProxy {
1741 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1742}
1743
1744impl fidl::endpoints::Proxy for DisplayProxy {
1745 type Protocol = DisplayMarker;
1746
1747 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1748 Self::new(inner)
1749 }
1750
1751 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1752 self.client.into_channel().map_err(|client| Self { client })
1753 }
1754
1755 fn as_channel(&self) -> &::fidl::AsyncChannel {
1756 self.client.as_channel()
1757 }
1758}
1759
1760impl DisplayProxy {
1761 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1763 let protocol_name = <DisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1764 Self { client: fidl::client::Client::new(channel, protocol_name) }
1765 }
1766
1767 pub fn take_event_stream(&self) -> DisplayEventStream {
1773 DisplayEventStream { event_receiver: self.client.take_event_receiver() }
1774 }
1775
1776 pub fn r#watch(
1782 &self,
1783 ) -> fidl::client::QueryResponseFut<
1784 DisplaySettings,
1785 fidl::encoding::DefaultFuchsiaResourceDialect,
1786 > {
1787 DisplayProxyInterface::r#watch(self)
1788 }
1789
1790 pub fn r#set(
1793 &self,
1794 mut settings: &DisplaySettings,
1795 ) -> fidl::client::QueryResponseFut<
1796 DisplaySetResult,
1797 fidl::encoding::DefaultFuchsiaResourceDialect,
1798 > {
1799 DisplayProxyInterface::r#set(self, settings)
1800 }
1801}
1802
1803impl DisplayProxyInterface for DisplayProxy {
1804 type WatchResponseFut = fidl::client::QueryResponseFut<
1805 DisplaySettings,
1806 fidl::encoding::DefaultFuchsiaResourceDialect,
1807 >;
1808 fn r#watch(&self) -> Self::WatchResponseFut {
1809 fn _decode(
1810 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1811 ) -> Result<DisplaySettings, fidl::Error> {
1812 let _response = fidl::client::decode_transaction_body::<
1813 DisplayWatchResponse,
1814 fidl::encoding::DefaultFuchsiaResourceDialect,
1815 0x7da3212470364db1,
1816 >(_buf?)?;
1817 Ok(_response.settings)
1818 }
1819 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DisplaySettings>(
1820 (),
1821 0x7da3212470364db1,
1822 fidl::encoding::DynamicFlags::empty(),
1823 _decode,
1824 )
1825 }
1826
1827 type SetResponseFut = fidl::client::QueryResponseFut<
1828 DisplaySetResult,
1829 fidl::encoding::DefaultFuchsiaResourceDialect,
1830 >;
1831 fn r#set(&self, mut settings: &DisplaySettings) -> Self::SetResponseFut {
1832 fn _decode(
1833 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1834 ) -> Result<DisplaySetResult, fidl::Error> {
1835 let _response = fidl::client::decode_transaction_body::<
1836 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1837 fidl::encoding::DefaultFuchsiaResourceDialect,
1838 0x1029e06ace17479c,
1839 >(_buf?)?;
1840 Ok(_response.map(|x| x))
1841 }
1842 self.client.send_query_and_decode::<DisplaySetRequest, DisplaySetResult>(
1843 (settings,),
1844 0x1029e06ace17479c,
1845 fidl::encoding::DynamicFlags::empty(),
1846 _decode,
1847 )
1848 }
1849}
1850
1851pub struct DisplayEventStream {
1852 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1853}
1854
1855impl std::marker::Unpin for DisplayEventStream {}
1856
1857impl futures::stream::FusedStream for DisplayEventStream {
1858 fn is_terminated(&self) -> bool {
1859 self.event_receiver.is_terminated()
1860 }
1861}
1862
1863impl futures::Stream for DisplayEventStream {
1864 type Item = Result<DisplayEvent, fidl::Error>;
1865
1866 fn poll_next(
1867 mut self: std::pin::Pin<&mut Self>,
1868 cx: &mut std::task::Context<'_>,
1869 ) -> std::task::Poll<Option<Self::Item>> {
1870 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1871 &mut self.event_receiver,
1872 cx
1873 )?) {
1874 Some(buf) => std::task::Poll::Ready(Some(DisplayEvent::decode(buf))),
1875 None => std::task::Poll::Ready(None),
1876 }
1877 }
1878}
1879
1880#[derive(Debug)]
1881pub enum DisplayEvent {}
1882
1883impl DisplayEvent {
1884 fn decode(
1886 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1887 ) -> Result<DisplayEvent, fidl::Error> {
1888 let (bytes, _handles) = buf.split_mut();
1889 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1890 debug_assert_eq!(tx_header.tx_id, 0);
1891 match tx_header.ordinal {
1892 _ => Err(fidl::Error::UnknownOrdinal {
1893 ordinal: tx_header.ordinal,
1894 protocol_name: <DisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1895 }),
1896 }
1897 }
1898}
1899
1900pub struct DisplayRequestStream {
1902 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1903 is_terminated: bool,
1904}
1905
1906impl std::marker::Unpin for DisplayRequestStream {}
1907
1908impl futures::stream::FusedStream for DisplayRequestStream {
1909 fn is_terminated(&self) -> bool {
1910 self.is_terminated
1911 }
1912}
1913
1914impl fidl::endpoints::RequestStream for DisplayRequestStream {
1915 type Protocol = DisplayMarker;
1916 type ControlHandle = DisplayControlHandle;
1917
1918 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1919 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1920 }
1921
1922 fn control_handle(&self) -> Self::ControlHandle {
1923 DisplayControlHandle { inner: self.inner.clone() }
1924 }
1925
1926 fn into_inner(
1927 self,
1928 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1929 {
1930 (self.inner, self.is_terminated)
1931 }
1932
1933 fn from_inner(
1934 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1935 is_terminated: bool,
1936 ) -> Self {
1937 Self { inner, is_terminated }
1938 }
1939}
1940
1941impl futures::Stream for DisplayRequestStream {
1942 type Item = Result<DisplayRequest, fidl::Error>;
1943
1944 fn poll_next(
1945 mut self: std::pin::Pin<&mut Self>,
1946 cx: &mut std::task::Context<'_>,
1947 ) -> std::task::Poll<Option<Self::Item>> {
1948 let this = &mut *self;
1949 if this.inner.check_shutdown(cx) {
1950 this.is_terminated = true;
1951 return std::task::Poll::Ready(None);
1952 }
1953 if this.is_terminated {
1954 panic!("polled DisplayRequestStream after completion");
1955 }
1956 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1957 |bytes, handles| {
1958 match this.inner.channel().read_etc(cx, bytes, handles) {
1959 std::task::Poll::Ready(Ok(())) => {}
1960 std::task::Poll::Pending => return std::task::Poll::Pending,
1961 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1962 this.is_terminated = true;
1963 return std::task::Poll::Ready(None);
1964 }
1965 std::task::Poll::Ready(Err(e)) => {
1966 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1967 e.into(),
1968 ))));
1969 }
1970 }
1971
1972 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1974
1975 std::task::Poll::Ready(Some(match header.ordinal {
1976 0x7da3212470364db1 => {
1977 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1978 let mut req = fidl::new_empty!(
1979 fidl::encoding::EmptyPayload,
1980 fidl::encoding::DefaultFuchsiaResourceDialect
1981 );
1982 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1983 let control_handle = DisplayControlHandle { inner: this.inner.clone() };
1984 Ok(DisplayRequest::Watch {
1985 responder: DisplayWatchResponder {
1986 control_handle: std::mem::ManuallyDrop::new(control_handle),
1987 tx_id: header.tx_id,
1988 },
1989 })
1990 }
1991 0x1029e06ace17479c => {
1992 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1993 let mut req = fidl::new_empty!(
1994 DisplaySetRequest,
1995 fidl::encoding::DefaultFuchsiaResourceDialect
1996 );
1997 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DisplaySetRequest>(&header, _body_bytes, handles, &mut req)?;
1998 let control_handle = DisplayControlHandle { inner: this.inner.clone() };
1999 Ok(DisplayRequest::Set {
2000 settings: req.settings,
2001
2002 responder: DisplaySetResponder {
2003 control_handle: std::mem::ManuallyDrop::new(control_handle),
2004 tx_id: header.tx_id,
2005 },
2006 })
2007 }
2008 _ => Err(fidl::Error::UnknownOrdinal {
2009 ordinal: header.ordinal,
2010 protocol_name:
2011 <DisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2012 }),
2013 }))
2014 },
2015 )
2016 }
2017}
2018
2019#[derive(Debug)]
2024pub enum DisplayRequest {
2025 Watch { responder: DisplayWatchResponder },
2031 Set { settings: DisplaySettings, responder: DisplaySetResponder },
2034}
2035
2036impl DisplayRequest {
2037 #[allow(irrefutable_let_patterns)]
2038 pub fn into_watch(self) -> Option<(DisplayWatchResponder)> {
2039 if let DisplayRequest::Watch { responder } = self { Some((responder)) } else { None }
2040 }
2041
2042 #[allow(irrefutable_let_patterns)]
2043 pub fn into_set(self) -> Option<(DisplaySettings, DisplaySetResponder)> {
2044 if let DisplayRequest::Set { settings, responder } = self {
2045 Some((settings, responder))
2046 } else {
2047 None
2048 }
2049 }
2050
2051 pub fn method_name(&self) -> &'static str {
2053 match *self {
2054 DisplayRequest::Watch { .. } => "watch",
2055 DisplayRequest::Set { .. } => "set",
2056 }
2057 }
2058}
2059
2060#[derive(Debug, Clone)]
2061pub struct DisplayControlHandle {
2062 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2063}
2064
2065impl DisplayControlHandle {
2066 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2067 self.inner.shutdown_with_epitaph(status.into())
2068 }
2069}
2070
2071impl fidl::endpoints::ControlHandle for DisplayControlHandle {
2072 fn shutdown(&self) {
2073 self.inner.shutdown()
2074 }
2075
2076 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2077 self.inner.shutdown_with_epitaph(status)
2078 }
2079
2080 fn is_closed(&self) -> bool {
2081 self.inner.channel().is_closed()
2082 }
2083 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2084 self.inner.channel().on_closed()
2085 }
2086
2087 #[cfg(target_os = "fuchsia")]
2088 fn signal_peer(
2089 &self,
2090 clear_mask: zx::Signals,
2091 set_mask: zx::Signals,
2092 ) -> Result<(), zx_status::Status> {
2093 use fidl::Peered;
2094 self.inner.channel().signal_peer(clear_mask, set_mask)
2095 }
2096}
2097
2098impl DisplayControlHandle {}
2099
2100#[must_use = "FIDL methods require a response to be sent"]
2101#[derive(Debug)]
2102pub struct DisplayWatchResponder {
2103 control_handle: std::mem::ManuallyDrop<DisplayControlHandle>,
2104 tx_id: u32,
2105}
2106
2107impl std::ops::Drop for DisplayWatchResponder {
2111 fn drop(&mut self) {
2112 self.control_handle.shutdown();
2113 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2115 }
2116}
2117
2118impl fidl::endpoints::Responder for DisplayWatchResponder {
2119 type ControlHandle = DisplayControlHandle;
2120
2121 fn control_handle(&self) -> &DisplayControlHandle {
2122 &self.control_handle
2123 }
2124
2125 fn drop_without_shutdown(mut self) {
2126 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2128 std::mem::forget(self);
2130 }
2131}
2132
2133impl DisplayWatchResponder {
2134 pub fn send(self, mut settings: &DisplaySettings) -> Result<(), fidl::Error> {
2138 let _result = self.send_raw(settings);
2139 if _result.is_err() {
2140 self.control_handle.shutdown();
2141 }
2142 self.drop_without_shutdown();
2143 _result
2144 }
2145
2146 pub fn send_no_shutdown_on_err(
2148 self,
2149 mut settings: &DisplaySettings,
2150 ) -> Result<(), fidl::Error> {
2151 let _result = self.send_raw(settings);
2152 self.drop_without_shutdown();
2153 _result
2154 }
2155
2156 fn send_raw(&self, mut settings: &DisplaySettings) -> Result<(), fidl::Error> {
2157 self.control_handle.inner.send::<DisplayWatchResponse>(
2158 (settings,),
2159 self.tx_id,
2160 0x7da3212470364db1,
2161 fidl::encoding::DynamicFlags::empty(),
2162 )
2163 }
2164}
2165
2166#[must_use = "FIDL methods require a response to be sent"]
2167#[derive(Debug)]
2168pub struct DisplaySetResponder {
2169 control_handle: std::mem::ManuallyDrop<DisplayControlHandle>,
2170 tx_id: u32,
2171}
2172
2173impl std::ops::Drop for DisplaySetResponder {
2177 fn drop(&mut self) {
2178 self.control_handle.shutdown();
2179 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2181 }
2182}
2183
2184impl fidl::endpoints::Responder for DisplaySetResponder {
2185 type ControlHandle = DisplayControlHandle;
2186
2187 fn control_handle(&self) -> &DisplayControlHandle {
2188 &self.control_handle
2189 }
2190
2191 fn drop_without_shutdown(mut self) {
2192 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2194 std::mem::forget(self);
2196 }
2197}
2198
2199impl DisplaySetResponder {
2200 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2204 let _result = self.send_raw(result);
2205 if _result.is_err() {
2206 self.control_handle.shutdown();
2207 }
2208 self.drop_without_shutdown();
2209 _result
2210 }
2211
2212 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2214 let _result = self.send_raw(result);
2215 self.drop_without_shutdown();
2216 _result
2217 }
2218
2219 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2220 self.control_handle
2221 .inner
2222 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2223 result,
2224 self.tx_id,
2225 0x1029e06ace17479c,
2226 fidl::encoding::DynamicFlags::empty(),
2227 )
2228 }
2229}
2230
2231#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2232pub struct DoNotDisturbMarker;
2233
2234impl fidl::endpoints::ProtocolMarker for DoNotDisturbMarker {
2235 type Proxy = DoNotDisturbProxy;
2236 type RequestStream = DoNotDisturbRequestStream;
2237 #[cfg(target_os = "fuchsia")]
2238 type SynchronousProxy = DoNotDisturbSynchronousProxy;
2239
2240 const DEBUG_NAME: &'static str = "fuchsia.settings.DoNotDisturb";
2241}
2242impl fidl::endpoints::DiscoverableProtocolMarker for DoNotDisturbMarker {}
2243pub type DoNotDisturbSetResult = Result<(), Error>;
2244
2245pub trait DoNotDisturbProxyInterface: Send + Sync {
2246 type WatchResponseFut: std::future::Future<Output = Result<DoNotDisturbSettings, fidl::Error>>
2247 + Send;
2248 fn r#watch(&self) -> Self::WatchResponseFut;
2249 type SetResponseFut: std::future::Future<Output = Result<DoNotDisturbSetResult, fidl::Error>>
2250 + Send;
2251 fn r#set(&self, settings: &DoNotDisturbSettings) -> Self::SetResponseFut;
2252}
2253#[derive(Debug)]
2254#[cfg(target_os = "fuchsia")]
2255pub struct DoNotDisturbSynchronousProxy {
2256 client: fidl::client::sync::Client,
2257}
2258
2259#[cfg(target_os = "fuchsia")]
2260impl fidl::endpoints::SynchronousProxy for DoNotDisturbSynchronousProxy {
2261 type Proxy = DoNotDisturbProxy;
2262 type Protocol = DoNotDisturbMarker;
2263
2264 fn from_channel(inner: fidl::Channel) -> Self {
2265 Self::new(inner)
2266 }
2267
2268 fn into_channel(self) -> fidl::Channel {
2269 self.client.into_channel()
2270 }
2271
2272 fn as_channel(&self) -> &fidl::Channel {
2273 self.client.as_channel()
2274 }
2275}
2276
2277#[cfg(target_os = "fuchsia")]
2278impl DoNotDisturbSynchronousProxy {
2279 pub fn new(channel: fidl::Channel) -> Self {
2280 Self { client: fidl::client::sync::Client::new(channel) }
2281 }
2282
2283 pub fn into_channel(self) -> fidl::Channel {
2284 self.client.into_channel()
2285 }
2286
2287 pub fn wait_for_event(
2290 &self,
2291 deadline: zx::MonotonicInstant,
2292 ) -> Result<DoNotDisturbEvent, fidl::Error> {
2293 DoNotDisturbEvent::decode(self.client.wait_for_event::<DoNotDisturbMarker>(deadline)?)
2294 }
2295
2296 pub fn r#watch(
2302 &self,
2303 ___deadline: zx::MonotonicInstant,
2304 ) -> Result<DoNotDisturbSettings, fidl::Error> {
2305 let _response = self.client.send_query::<
2306 fidl::encoding::EmptyPayload,
2307 DoNotDisturbWatchResponse,
2308 DoNotDisturbMarker,
2309 >(
2310 (),
2311 0x1eeae2f97a5547fb,
2312 fidl::encoding::DynamicFlags::empty(),
2313 ___deadline,
2314 )?;
2315 Ok(_response.settings)
2316 }
2317
2318 pub fn r#set(
2321 &self,
2322 mut settings: &DoNotDisturbSettings,
2323 ___deadline: zx::MonotonicInstant,
2324 ) -> Result<DoNotDisturbSetResult, fidl::Error> {
2325 let _response = self.client.send_query::<
2326 DoNotDisturbSetRequest,
2327 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2328 DoNotDisturbMarker,
2329 >(
2330 (settings,),
2331 0x7fef934e7f5777b0,
2332 fidl::encoding::DynamicFlags::empty(),
2333 ___deadline,
2334 )?;
2335 Ok(_response.map(|x| x))
2336 }
2337}
2338
2339#[cfg(target_os = "fuchsia")]
2340impl From<DoNotDisturbSynchronousProxy> for zx::NullableHandle {
2341 fn from(value: DoNotDisturbSynchronousProxy) -> Self {
2342 value.into_channel().into()
2343 }
2344}
2345
2346#[cfg(target_os = "fuchsia")]
2347impl From<fidl::Channel> for DoNotDisturbSynchronousProxy {
2348 fn from(value: fidl::Channel) -> Self {
2349 Self::new(value)
2350 }
2351}
2352
2353#[cfg(target_os = "fuchsia")]
2354impl fidl::endpoints::FromClient for DoNotDisturbSynchronousProxy {
2355 type Protocol = DoNotDisturbMarker;
2356
2357 fn from_client(value: fidl::endpoints::ClientEnd<DoNotDisturbMarker>) -> Self {
2358 Self::new(value.into_channel())
2359 }
2360}
2361
2362#[derive(Debug, Clone)]
2363pub struct DoNotDisturbProxy {
2364 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2365}
2366
2367impl fidl::endpoints::Proxy for DoNotDisturbProxy {
2368 type Protocol = DoNotDisturbMarker;
2369
2370 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2371 Self::new(inner)
2372 }
2373
2374 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2375 self.client.into_channel().map_err(|client| Self { client })
2376 }
2377
2378 fn as_channel(&self) -> &::fidl::AsyncChannel {
2379 self.client.as_channel()
2380 }
2381}
2382
2383impl DoNotDisturbProxy {
2384 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2386 let protocol_name = <DoNotDisturbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2387 Self { client: fidl::client::Client::new(channel, protocol_name) }
2388 }
2389
2390 pub fn take_event_stream(&self) -> DoNotDisturbEventStream {
2396 DoNotDisturbEventStream { event_receiver: self.client.take_event_receiver() }
2397 }
2398
2399 pub fn r#watch(
2405 &self,
2406 ) -> fidl::client::QueryResponseFut<
2407 DoNotDisturbSettings,
2408 fidl::encoding::DefaultFuchsiaResourceDialect,
2409 > {
2410 DoNotDisturbProxyInterface::r#watch(self)
2411 }
2412
2413 pub fn r#set(
2416 &self,
2417 mut settings: &DoNotDisturbSettings,
2418 ) -> fidl::client::QueryResponseFut<
2419 DoNotDisturbSetResult,
2420 fidl::encoding::DefaultFuchsiaResourceDialect,
2421 > {
2422 DoNotDisturbProxyInterface::r#set(self, settings)
2423 }
2424}
2425
2426impl DoNotDisturbProxyInterface for DoNotDisturbProxy {
2427 type WatchResponseFut = fidl::client::QueryResponseFut<
2428 DoNotDisturbSettings,
2429 fidl::encoding::DefaultFuchsiaResourceDialect,
2430 >;
2431 fn r#watch(&self) -> Self::WatchResponseFut {
2432 fn _decode(
2433 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2434 ) -> Result<DoNotDisturbSettings, fidl::Error> {
2435 let _response = fidl::client::decode_transaction_body::<
2436 DoNotDisturbWatchResponse,
2437 fidl::encoding::DefaultFuchsiaResourceDialect,
2438 0x1eeae2f97a5547fb,
2439 >(_buf?)?;
2440 Ok(_response.settings)
2441 }
2442 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DoNotDisturbSettings>(
2443 (),
2444 0x1eeae2f97a5547fb,
2445 fidl::encoding::DynamicFlags::empty(),
2446 _decode,
2447 )
2448 }
2449
2450 type SetResponseFut = fidl::client::QueryResponseFut<
2451 DoNotDisturbSetResult,
2452 fidl::encoding::DefaultFuchsiaResourceDialect,
2453 >;
2454 fn r#set(&self, mut settings: &DoNotDisturbSettings) -> Self::SetResponseFut {
2455 fn _decode(
2456 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2457 ) -> Result<DoNotDisturbSetResult, fidl::Error> {
2458 let _response = fidl::client::decode_transaction_body::<
2459 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2460 fidl::encoding::DefaultFuchsiaResourceDialect,
2461 0x7fef934e7f5777b0,
2462 >(_buf?)?;
2463 Ok(_response.map(|x| x))
2464 }
2465 self.client.send_query_and_decode::<DoNotDisturbSetRequest, DoNotDisturbSetResult>(
2466 (settings,),
2467 0x7fef934e7f5777b0,
2468 fidl::encoding::DynamicFlags::empty(),
2469 _decode,
2470 )
2471 }
2472}
2473
2474pub struct DoNotDisturbEventStream {
2475 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2476}
2477
2478impl std::marker::Unpin for DoNotDisturbEventStream {}
2479
2480impl futures::stream::FusedStream for DoNotDisturbEventStream {
2481 fn is_terminated(&self) -> bool {
2482 self.event_receiver.is_terminated()
2483 }
2484}
2485
2486impl futures::Stream for DoNotDisturbEventStream {
2487 type Item = Result<DoNotDisturbEvent, fidl::Error>;
2488
2489 fn poll_next(
2490 mut self: std::pin::Pin<&mut Self>,
2491 cx: &mut std::task::Context<'_>,
2492 ) -> std::task::Poll<Option<Self::Item>> {
2493 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2494 &mut self.event_receiver,
2495 cx
2496 )?) {
2497 Some(buf) => std::task::Poll::Ready(Some(DoNotDisturbEvent::decode(buf))),
2498 None => std::task::Poll::Ready(None),
2499 }
2500 }
2501}
2502
2503#[derive(Debug)]
2504pub enum DoNotDisturbEvent {}
2505
2506impl DoNotDisturbEvent {
2507 fn decode(
2509 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2510 ) -> Result<DoNotDisturbEvent, fidl::Error> {
2511 let (bytes, _handles) = buf.split_mut();
2512 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2513 debug_assert_eq!(tx_header.tx_id, 0);
2514 match tx_header.ordinal {
2515 _ => Err(fidl::Error::UnknownOrdinal {
2516 ordinal: tx_header.ordinal,
2517 protocol_name: <DoNotDisturbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2518 }),
2519 }
2520 }
2521}
2522
2523pub struct DoNotDisturbRequestStream {
2525 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2526 is_terminated: bool,
2527}
2528
2529impl std::marker::Unpin for DoNotDisturbRequestStream {}
2530
2531impl futures::stream::FusedStream for DoNotDisturbRequestStream {
2532 fn is_terminated(&self) -> bool {
2533 self.is_terminated
2534 }
2535}
2536
2537impl fidl::endpoints::RequestStream for DoNotDisturbRequestStream {
2538 type Protocol = DoNotDisturbMarker;
2539 type ControlHandle = DoNotDisturbControlHandle;
2540
2541 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2542 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2543 }
2544
2545 fn control_handle(&self) -> Self::ControlHandle {
2546 DoNotDisturbControlHandle { inner: self.inner.clone() }
2547 }
2548
2549 fn into_inner(
2550 self,
2551 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2552 {
2553 (self.inner, self.is_terminated)
2554 }
2555
2556 fn from_inner(
2557 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2558 is_terminated: bool,
2559 ) -> Self {
2560 Self { inner, is_terminated }
2561 }
2562}
2563
2564impl futures::Stream for DoNotDisturbRequestStream {
2565 type Item = Result<DoNotDisturbRequest, fidl::Error>;
2566
2567 fn poll_next(
2568 mut self: std::pin::Pin<&mut Self>,
2569 cx: &mut std::task::Context<'_>,
2570 ) -> std::task::Poll<Option<Self::Item>> {
2571 let this = &mut *self;
2572 if this.inner.check_shutdown(cx) {
2573 this.is_terminated = true;
2574 return std::task::Poll::Ready(None);
2575 }
2576 if this.is_terminated {
2577 panic!("polled DoNotDisturbRequestStream after completion");
2578 }
2579 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2580 |bytes, handles| {
2581 match this.inner.channel().read_etc(cx, bytes, handles) {
2582 std::task::Poll::Ready(Ok(())) => {}
2583 std::task::Poll::Pending => return std::task::Poll::Pending,
2584 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2585 this.is_terminated = true;
2586 return std::task::Poll::Ready(None);
2587 }
2588 std::task::Poll::Ready(Err(e)) => {
2589 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2590 e.into(),
2591 ))));
2592 }
2593 }
2594
2595 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2597
2598 std::task::Poll::Ready(Some(match header.ordinal {
2599 0x1eeae2f97a5547fb => {
2600 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2601 let mut req = fidl::new_empty!(
2602 fidl::encoding::EmptyPayload,
2603 fidl::encoding::DefaultFuchsiaResourceDialect
2604 );
2605 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2606 let control_handle =
2607 DoNotDisturbControlHandle { inner: this.inner.clone() };
2608 Ok(DoNotDisturbRequest::Watch {
2609 responder: DoNotDisturbWatchResponder {
2610 control_handle: std::mem::ManuallyDrop::new(control_handle),
2611 tx_id: header.tx_id,
2612 },
2613 })
2614 }
2615 0x7fef934e7f5777b0 => {
2616 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2617 let mut req = fidl::new_empty!(
2618 DoNotDisturbSetRequest,
2619 fidl::encoding::DefaultFuchsiaResourceDialect
2620 );
2621 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DoNotDisturbSetRequest>(&header, _body_bytes, handles, &mut req)?;
2622 let control_handle =
2623 DoNotDisturbControlHandle { inner: this.inner.clone() };
2624 Ok(DoNotDisturbRequest::Set {
2625 settings: req.settings,
2626
2627 responder: DoNotDisturbSetResponder {
2628 control_handle: std::mem::ManuallyDrop::new(control_handle),
2629 tx_id: header.tx_id,
2630 },
2631 })
2632 }
2633 _ => Err(fidl::Error::UnknownOrdinal {
2634 ordinal: header.ordinal,
2635 protocol_name:
2636 <DoNotDisturbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2637 }),
2638 }))
2639 },
2640 )
2641 }
2642}
2643
2644#[derive(Debug)]
2653pub enum DoNotDisturbRequest {
2654 Watch { responder: DoNotDisturbWatchResponder },
2660 Set { settings: DoNotDisturbSettings, responder: DoNotDisturbSetResponder },
2663}
2664
2665impl DoNotDisturbRequest {
2666 #[allow(irrefutable_let_patterns)]
2667 pub fn into_watch(self) -> Option<(DoNotDisturbWatchResponder)> {
2668 if let DoNotDisturbRequest::Watch { responder } = self { Some((responder)) } else { None }
2669 }
2670
2671 #[allow(irrefutable_let_patterns)]
2672 pub fn into_set(self) -> Option<(DoNotDisturbSettings, DoNotDisturbSetResponder)> {
2673 if let DoNotDisturbRequest::Set { settings, responder } = self {
2674 Some((settings, responder))
2675 } else {
2676 None
2677 }
2678 }
2679
2680 pub fn method_name(&self) -> &'static str {
2682 match *self {
2683 DoNotDisturbRequest::Watch { .. } => "watch",
2684 DoNotDisturbRequest::Set { .. } => "set",
2685 }
2686 }
2687}
2688
2689#[derive(Debug, Clone)]
2690pub struct DoNotDisturbControlHandle {
2691 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2692}
2693
2694impl DoNotDisturbControlHandle {
2695 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2696 self.inner.shutdown_with_epitaph(status.into())
2697 }
2698}
2699
2700impl fidl::endpoints::ControlHandle for DoNotDisturbControlHandle {
2701 fn shutdown(&self) {
2702 self.inner.shutdown()
2703 }
2704
2705 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2706 self.inner.shutdown_with_epitaph(status)
2707 }
2708
2709 fn is_closed(&self) -> bool {
2710 self.inner.channel().is_closed()
2711 }
2712 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2713 self.inner.channel().on_closed()
2714 }
2715
2716 #[cfg(target_os = "fuchsia")]
2717 fn signal_peer(
2718 &self,
2719 clear_mask: zx::Signals,
2720 set_mask: zx::Signals,
2721 ) -> Result<(), zx_status::Status> {
2722 use fidl::Peered;
2723 self.inner.channel().signal_peer(clear_mask, set_mask)
2724 }
2725}
2726
2727impl DoNotDisturbControlHandle {}
2728
2729#[must_use = "FIDL methods require a response to be sent"]
2730#[derive(Debug)]
2731pub struct DoNotDisturbWatchResponder {
2732 control_handle: std::mem::ManuallyDrop<DoNotDisturbControlHandle>,
2733 tx_id: u32,
2734}
2735
2736impl std::ops::Drop for DoNotDisturbWatchResponder {
2740 fn drop(&mut self) {
2741 self.control_handle.shutdown();
2742 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2744 }
2745}
2746
2747impl fidl::endpoints::Responder for DoNotDisturbWatchResponder {
2748 type ControlHandle = DoNotDisturbControlHandle;
2749
2750 fn control_handle(&self) -> &DoNotDisturbControlHandle {
2751 &self.control_handle
2752 }
2753
2754 fn drop_without_shutdown(mut self) {
2755 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2757 std::mem::forget(self);
2759 }
2760}
2761
2762impl DoNotDisturbWatchResponder {
2763 pub fn send(self, mut settings: &DoNotDisturbSettings) -> Result<(), fidl::Error> {
2767 let _result = self.send_raw(settings);
2768 if _result.is_err() {
2769 self.control_handle.shutdown();
2770 }
2771 self.drop_without_shutdown();
2772 _result
2773 }
2774
2775 pub fn send_no_shutdown_on_err(
2777 self,
2778 mut settings: &DoNotDisturbSettings,
2779 ) -> Result<(), fidl::Error> {
2780 let _result = self.send_raw(settings);
2781 self.drop_without_shutdown();
2782 _result
2783 }
2784
2785 fn send_raw(&self, mut settings: &DoNotDisturbSettings) -> Result<(), fidl::Error> {
2786 self.control_handle.inner.send::<DoNotDisturbWatchResponse>(
2787 (settings,),
2788 self.tx_id,
2789 0x1eeae2f97a5547fb,
2790 fidl::encoding::DynamicFlags::empty(),
2791 )
2792 }
2793}
2794
2795#[must_use = "FIDL methods require a response to be sent"]
2796#[derive(Debug)]
2797pub struct DoNotDisturbSetResponder {
2798 control_handle: std::mem::ManuallyDrop<DoNotDisturbControlHandle>,
2799 tx_id: u32,
2800}
2801
2802impl std::ops::Drop for DoNotDisturbSetResponder {
2806 fn drop(&mut self) {
2807 self.control_handle.shutdown();
2808 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2810 }
2811}
2812
2813impl fidl::endpoints::Responder for DoNotDisturbSetResponder {
2814 type ControlHandle = DoNotDisturbControlHandle;
2815
2816 fn control_handle(&self) -> &DoNotDisturbControlHandle {
2817 &self.control_handle
2818 }
2819
2820 fn drop_without_shutdown(mut self) {
2821 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2823 std::mem::forget(self);
2825 }
2826}
2827
2828impl DoNotDisturbSetResponder {
2829 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2833 let _result = self.send_raw(result);
2834 if _result.is_err() {
2835 self.control_handle.shutdown();
2836 }
2837 self.drop_without_shutdown();
2838 _result
2839 }
2840
2841 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2843 let _result = self.send_raw(result);
2844 self.drop_without_shutdown();
2845 _result
2846 }
2847
2848 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2849 self.control_handle
2850 .inner
2851 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2852 result,
2853 self.tx_id,
2854 0x7fef934e7f5777b0,
2855 fidl::encoding::DynamicFlags::empty(),
2856 )
2857 }
2858}
2859
2860#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2861pub struct FactoryResetMarker;
2862
2863impl fidl::endpoints::ProtocolMarker for FactoryResetMarker {
2864 type Proxy = FactoryResetProxy;
2865 type RequestStream = FactoryResetRequestStream;
2866 #[cfg(target_os = "fuchsia")]
2867 type SynchronousProxy = FactoryResetSynchronousProxy;
2868
2869 const DEBUG_NAME: &'static str = "fuchsia.settings.FactoryReset";
2870}
2871impl fidl::endpoints::DiscoverableProtocolMarker for FactoryResetMarker {}
2872pub type FactoryResetSetResult = Result<(), Error>;
2873
2874pub trait FactoryResetProxyInterface: Send + Sync {
2875 type WatchResponseFut: std::future::Future<Output = Result<FactoryResetSettings, fidl::Error>>
2876 + Send;
2877 fn r#watch(&self) -> Self::WatchResponseFut;
2878 type SetResponseFut: std::future::Future<Output = Result<FactoryResetSetResult, fidl::Error>>
2879 + Send;
2880 fn r#set(&self, settings: &FactoryResetSettings) -> Self::SetResponseFut;
2881}
2882#[derive(Debug)]
2883#[cfg(target_os = "fuchsia")]
2884pub struct FactoryResetSynchronousProxy {
2885 client: fidl::client::sync::Client,
2886}
2887
2888#[cfg(target_os = "fuchsia")]
2889impl fidl::endpoints::SynchronousProxy for FactoryResetSynchronousProxy {
2890 type Proxy = FactoryResetProxy;
2891 type Protocol = FactoryResetMarker;
2892
2893 fn from_channel(inner: fidl::Channel) -> Self {
2894 Self::new(inner)
2895 }
2896
2897 fn into_channel(self) -> fidl::Channel {
2898 self.client.into_channel()
2899 }
2900
2901 fn as_channel(&self) -> &fidl::Channel {
2902 self.client.as_channel()
2903 }
2904}
2905
2906#[cfg(target_os = "fuchsia")]
2907impl FactoryResetSynchronousProxy {
2908 pub fn new(channel: fidl::Channel) -> Self {
2909 Self { client: fidl::client::sync::Client::new(channel) }
2910 }
2911
2912 pub fn into_channel(self) -> fidl::Channel {
2913 self.client.into_channel()
2914 }
2915
2916 pub fn wait_for_event(
2919 &self,
2920 deadline: zx::MonotonicInstant,
2921 ) -> Result<FactoryResetEvent, fidl::Error> {
2922 FactoryResetEvent::decode(self.client.wait_for_event::<FactoryResetMarker>(deadline)?)
2923 }
2924
2925 pub fn r#watch(
2934 &self,
2935 ___deadline: zx::MonotonicInstant,
2936 ) -> Result<FactoryResetSettings, fidl::Error> {
2937 let _response = self.client.send_query::<
2938 fidl::encoding::EmptyPayload,
2939 FactoryResetWatchResponse,
2940 FactoryResetMarker,
2941 >(
2942 (),
2943 0x50cfc9906eb406a1,
2944 fidl::encoding::DynamicFlags::empty(),
2945 ___deadline,
2946 )?;
2947 Ok(_response.settings)
2948 }
2949
2950 pub fn r#set(
2953 &self,
2954 mut settings: &FactoryResetSettings,
2955 ___deadline: zx::MonotonicInstant,
2956 ) -> Result<FactoryResetSetResult, fidl::Error> {
2957 let _response = self.client.send_query::<
2958 FactoryResetSetRequest,
2959 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2960 FactoryResetMarker,
2961 >(
2962 (settings,),
2963 0x5b35942c1cb1eca8,
2964 fidl::encoding::DynamicFlags::empty(),
2965 ___deadline,
2966 )?;
2967 Ok(_response.map(|x| x))
2968 }
2969}
2970
2971#[cfg(target_os = "fuchsia")]
2972impl From<FactoryResetSynchronousProxy> for zx::NullableHandle {
2973 fn from(value: FactoryResetSynchronousProxy) -> Self {
2974 value.into_channel().into()
2975 }
2976}
2977
2978#[cfg(target_os = "fuchsia")]
2979impl From<fidl::Channel> for FactoryResetSynchronousProxy {
2980 fn from(value: fidl::Channel) -> Self {
2981 Self::new(value)
2982 }
2983}
2984
2985#[cfg(target_os = "fuchsia")]
2986impl fidl::endpoints::FromClient for FactoryResetSynchronousProxy {
2987 type Protocol = FactoryResetMarker;
2988
2989 fn from_client(value: fidl::endpoints::ClientEnd<FactoryResetMarker>) -> Self {
2990 Self::new(value.into_channel())
2991 }
2992}
2993
2994#[derive(Debug, Clone)]
2995pub struct FactoryResetProxy {
2996 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2997}
2998
2999impl fidl::endpoints::Proxy for FactoryResetProxy {
3000 type Protocol = FactoryResetMarker;
3001
3002 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3003 Self::new(inner)
3004 }
3005
3006 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3007 self.client.into_channel().map_err(|client| Self { client })
3008 }
3009
3010 fn as_channel(&self) -> &::fidl::AsyncChannel {
3011 self.client.as_channel()
3012 }
3013}
3014
3015impl FactoryResetProxy {
3016 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3018 let protocol_name = <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3019 Self { client: fidl::client::Client::new(channel, protocol_name) }
3020 }
3021
3022 pub fn take_event_stream(&self) -> FactoryResetEventStream {
3028 FactoryResetEventStream { event_receiver: self.client.take_event_receiver() }
3029 }
3030
3031 pub fn r#watch(
3040 &self,
3041 ) -> fidl::client::QueryResponseFut<
3042 FactoryResetSettings,
3043 fidl::encoding::DefaultFuchsiaResourceDialect,
3044 > {
3045 FactoryResetProxyInterface::r#watch(self)
3046 }
3047
3048 pub fn r#set(
3051 &self,
3052 mut settings: &FactoryResetSettings,
3053 ) -> fidl::client::QueryResponseFut<
3054 FactoryResetSetResult,
3055 fidl::encoding::DefaultFuchsiaResourceDialect,
3056 > {
3057 FactoryResetProxyInterface::r#set(self, settings)
3058 }
3059}
3060
3061impl FactoryResetProxyInterface for FactoryResetProxy {
3062 type WatchResponseFut = fidl::client::QueryResponseFut<
3063 FactoryResetSettings,
3064 fidl::encoding::DefaultFuchsiaResourceDialect,
3065 >;
3066 fn r#watch(&self) -> Self::WatchResponseFut {
3067 fn _decode(
3068 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3069 ) -> Result<FactoryResetSettings, fidl::Error> {
3070 let _response = fidl::client::decode_transaction_body::<
3071 FactoryResetWatchResponse,
3072 fidl::encoding::DefaultFuchsiaResourceDialect,
3073 0x50cfc9906eb406a1,
3074 >(_buf?)?;
3075 Ok(_response.settings)
3076 }
3077 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, FactoryResetSettings>(
3078 (),
3079 0x50cfc9906eb406a1,
3080 fidl::encoding::DynamicFlags::empty(),
3081 _decode,
3082 )
3083 }
3084
3085 type SetResponseFut = fidl::client::QueryResponseFut<
3086 FactoryResetSetResult,
3087 fidl::encoding::DefaultFuchsiaResourceDialect,
3088 >;
3089 fn r#set(&self, mut settings: &FactoryResetSettings) -> Self::SetResponseFut {
3090 fn _decode(
3091 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3092 ) -> Result<FactoryResetSetResult, fidl::Error> {
3093 let _response = fidl::client::decode_transaction_body::<
3094 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3095 fidl::encoding::DefaultFuchsiaResourceDialect,
3096 0x5b35942c1cb1eca8,
3097 >(_buf?)?;
3098 Ok(_response.map(|x| x))
3099 }
3100 self.client.send_query_and_decode::<FactoryResetSetRequest, FactoryResetSetResult>(
3101 (settings,),
3102 0x5b35942c1cb1eca8,
3103 fidl::encoding::DynamicFlags::empty(),
3104 _decode,
3105 )
3106 }
3107}
3108
3109pub struct FactoryResetEventStream {
3110 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3111}
3112
3113impl std::marker::Unpin for FactoryResetEventStream {}
3114
3115impl futures::stream::FusedStream for FactoryResetEventStream {
3116 fn is_terminated(&self) -> bool {
3117 self.event_receiver.is_terminated()
3118 }
3119}
3120
3121impl futures::Stream for FactoryResetEventStream {
3122 type Item = Result<FactoryResetEvent, fidl::Error>;
3123
3124 fn poll_next(
3125 mut self: std::pin::Pin<&mut Self>,
3126 cx: &mut std::task::Context<'_>,
3127 ) -> std::task::Poll<Option<Self::Item>> {
3128 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3129 &mut self.event_receiver,
3130 cx
3131 )?) {
3132 Some(buf) => std::task::Poll::Ready(Some(FactoryResetEvent::decode(buf))),
3133 None => std::task::Poll::Ready(None),
3134 }
3135 }
3136}
3137
3138#[derive(Debug)]
3139pub enum FactoryResetEvent {}
3140
3141impl FactoryResetEvent {
3142 fn decode(
3144 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3145 ) -> Result<FactoryResetEvent, fidl::Error> {
3146 let (bytes, _handles) = buf.split_mut();
3147 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3148 debug_assert_eq!(tx_header.tx_id, 0);
3149 match tx_header.ordinal {
3150 _ => Err(fidl::Error::UnknownOrdinal {
3151 ordinal: tx_header.ordinal,
3152 protocol_name: <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3153 }),
3154 }
3155 }
3156}
3157
3158pub struct FactoryResetRequestStream {
3160 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3161 is_terminated: bool,
3162}
3163
3164impl std::marker::Unpin for FactoryResetRequestStream {}
3165
3166impl futures::stream::FusedStream for FactoryResetRequestStream {
3167 fn is_terminated(&self) -> bool {
3168 self.is_terminated
3169 }
3170}
3171
3172impl fidl::endpoints::RequestStream for FactoryResetRequestStream {
3173 type Protocol = FactoryResetMarker;
3174 type ControlHandle = FactoryResetControlHandle;
3175
3176 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3177 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3178 }
3179
3180 fn control_handle(&self) -> Self::ControlHandle {
3181 FactoryResetControlHandle { inner: self.inner.clone() }
3182 }
3183
3184 fn into_inner(
3185 self,
3186 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3187 {
3188 (self.inner, self.is_terminated)
3189 }
3190
3191 fn from_inner(
3192 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3193 is_terminated: bool,
3194 ) -> Self {
3195 Self { inner, is_terminated }
3196 }
3197}
3198
3199impl futures::Stream for FactoryResetRequestStream {
3200 type Item = Result<FactoryResetRequest, fidl::Error>;
3201
3202 fn poll_next(
3203 mut self: std::pin::Pin<&mut Self>,
3204 cx: &mut std::task::Context<'_>,
3205 ) -> std::task::Poll<Option<Self::Item>> {
3206 let this = &mut *self;
3207 if this.inner.check_shutdown(cx) {
3208 this.is_terminated = true;
3209 return std::task::Poll::Ready(None);
3210 }
3211 if this.is_terminated {
3212 panic!("polled FactoryResetRequestStream after completion");
3213 }
3214 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3215 |bytes, handles| {
3216 match this.inner.channel().read_etc(cx, bytes, handles) {
3217 std::task::Poll::Ready(Ok(())) => {}
3218 std::task::Poll::Pending => return std::task::Poll::Pending,
3219 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3220 this.is_terminated = true;
3221 return std::task::Poll::Ready(None);
3222 }
3223 std::task::Poll::Ready(Err(e)) => {
3224 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3225 e.into(),
3226 ))));
3227 }
3228 }
3229
3230 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3232
3233 std::task::Poll::Ready(Some(match header.ordinal {
3234 0x50cfc9906eb406a1 => {
3235 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3236 let mut req = fidl::new_empty!(
3237 fidl::encoding::EmptyPayload,
3238 fidl::encoding::DefaultFuchsiaResourceDialect
3239 );
3240 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3241 let control_handle =
3242 FactoryResetControlHandle { inner: this.inner.clone() };
3243 Ok(FactoryResetRequest::Watch {
3244 responder: FactoryResetWatchResponder {
3245 control_handle: std::mem::ManuallyDrop::new(control_handle),
3246 tx_id: header.tx_id,
3247 },
3248 })
3249 }
3250 0x5b35942c1cb1eca8 => {
3251 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3252 let mut req = fidl::new_empty!(
3253 FactoryResetSetRequest,
3254 fidl::encoding::DefaultFuchsiaResourceDialect
3255 );
3256 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryResetSetRequest>(&header, _body_bytes, handles, &mut req)?;
3257 let control_handle =
3258 FactoryResetControlHandle { inner: this.inner.clone() };
3259 Ok(FactoryResetRequest::Set {
3260 settings: req.settings,
3261
3262 responder: FactoryResetSetResponder {
3263 control_handle: std::mem::ManuallyDrop::new(control_handle),
3264 tx_id: header.tx_id,
3265 },
3266 })
3267 }
3268 _ => Err(fidl::Error::UnknownOrdinal {
3269 ordinal: header.ordinal,
3270 protocol_name:
3271 <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3272 }),
3273 }))
3274 },
3275 )
3276 }
3277}
3278
3279#[derive(Debug)]
3281pub enum FactoryResetRequest {
3282 Watch { responder: FactoryResetWatchResponder },
3291 Set { settings: FactoryResetSettings, responder: FactoryResetSetResponder },
3294}
3295
3296impl FactoryResetRequest {
3297 #[allow(irrefutable_let_patterns)]
3298 pub fn into_watch(self) -> Option<(FactoryResetWatchResponder)> {
3299 if let FactoryResetRequest::Watch { responder } = self { Some((responder)) } else { None }
3300 }
3301
3302 #[allow(irrefutable_let_patterns)]
3303 pub fn into_set(self) -> Option<(FactoryResetSettings, FactoryResetSetResponder)> {
3304 if let FactoryResetRequest::Set { settings, responder } = self {
3305 Some((settings, responder))
3306 } else {
3307 None
3308 }
3309 }
3310
3311 pub fn method_name(&self) -> &'static str {
3313 match *self {
3314 FactoryResetRequest::Watch { .. } => "watch",
3315 FactoryResetRequest::Set { .. } => "set",
3316 }
3317 }
3318}
3319
3320#[derive(Debug, Clone)]
3321pub struct FactoryResetControlHandle {
3322 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3323}
3324
3325impl FactoryResetControlHandle {
3326 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3327 self.inner.shutdown_with_epitaph(status.into())
3328 }
3329}
3330
3331impl fidl::endpoints::ControlHandle for FactoryResetControlHandle {
3332 fn shutdown(&self) {
3333 self.inner.shutdown()
3334 }
3335
3336 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3337 self.inner.shutdown_with_epitaph(status)
3338 }
3339
3340 fn is_closed(&self) -> bool {
3341 self.inner.channel().is_closed()
3342 }
3343 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3344 self.inner.channel().on_closed()
3345 }
3346
3347 #[cfg(target_os = "fuchsia")]
3348 fn signal_peer(
3349 &self,
3350 clear_mask: zx::Signals,
3351 set_mask: zx::Signals,
3352 ) -> Result<(), zx_status::Status> {
3353 use fidl::Peered;
3354 self.inner.channel().signal_peer(clear_mask, set_mask)
3355 }
3356}
3357
3358impl FactoryResetControlHandle {}
3359
3360#[must_use = "FIDL methods require a response to be sent"]
3361#[derive(Debug)]
3362pub struct FactoryResetWatchResponder {
3363 control_handle: std::mem::ManuallyDrop<FactoryResetControlHandle>,
3364 tx_id: u32,
3365}
3366
3367impl std::ops::Drop for FactoryResetWatchResponder {
3371 fn drop(&mut self) {
3372 self.control_handle.shutdown();
3373 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3375 }
3376}
3377
3378impl fidl::endpoints::Responder for FactoryResetWatchResponder {
3379 type ControlHandle = FactoryResetControlHandle;
3380
3381 fn control_handle(&self) -> &FactoryResetControlHandle {
3382 &self.control_handle
3383 }
3384
3385 fn drop_without_shutdown(mut self) {
3386 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3388 std::mem::forget(self);
3390 }
3391}
3392
3393impl FactoryResetWatchResponder {
3394 pub fn send(self, mut settings: &FactoryResetSettings) -> Result<(), fidl::Error> {
3398 let _result = self.send_raw(settings);
3399 if _result.is_err() {
3400 self.control_handle.shutdown();
3401 }
3402 self.drop_without_shutdown();
3403 _result
3404 }
3405
3406 pub fn send_no_shutdown_on_err(
3408 self,
3409 mut settings: &FactoryResetSettings,
3410 ) -> Result<(), fidl::Error> {
3411 let _result = self.send_raw(settings);
3412 self.drop_without_shutdown();
3413 _result
3414 }
3415
3416 fn send_raw(&self, mut settings: &FactoryResetSettings) -> Result<(), fidl::Error> {
3417 self.control_handle.inner.send::<FactoryResetWatchResponse>(
3418 (settings,),
3419 self.tx_id,
3420 0x50cfc9906eb406a1,
3421 fidl::encoding::DynamicFlags::empty(),
3422 )
3423 }
3424}
3425
3426#[must_use = "FIDL methods require a response to be sent"]
3427#[derive(Debug)]
3428pub struct FactoryResetSetResponder {
3429 control_handle: std::mem::ManuallyDrop<FactoryResetControlHandle>,
3430 tx_id: u32,
3431}
3432
3433impl std::ops::Drop for FactoryResetSetResponder {
3437 fn drop(&mut self) {
3438 self.control_handle.shutdown();
3439 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3441 }
3442}
3443
3444impl fidl::endpoints::Responder for FactoryResetSetResponder {
3445 type ControlHandle = FactoryResetControlHandle;
3446
3447 fn control_handle(&self) -> &FactoryResetControlHandle {
3448 &self.control_handle
3449 }
3450
3451 fn drop_without_shutdown(mut self) {
3452 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3454 std::mem::forget(self);
3456 }
3457}
3458
3459impl FactoryResetSetResponder {
3460 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3464 let _result = self.send_raw(result);
3465 if _result.is_err() {
3466 self.control_handle.shutdown();
3467 }
3468 self.drop_without_shutdown();
3469 _result
3470 }
3471
3472 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3474 let _result = self.send_raw(result);
3475 self.drop_without_shutdown();
3476 _result
3477 }
3478
3479 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3480 self.control_handle
3481 .inner
3482 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3483 result,
3484 self.tx_id,
3485 0x5b35942c1cb1eca8,
3486 fidl::encoding::DynamicFlags::empty(),
3487 )
3488 }
3489}
3490
3491#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3492pub struct InputMarker;
3493
3494impl fidl::endpoints::ProtocolMarker for InputMarker {
3495 type Proxy = InputProxy;
3496 type RequestStream = InputRequestStream;
3497 #[cfg(target_os = "fuchsia")]
3498 type SynchronousProxy = InputSynchronousProxy;
3499
3500 const DEBUG_NAME: &'static str = "fuchsia.settings.Input";
3501}
3502impl fidl::endpoints::DiscoverableProtocolMarker for InputMarker {}
3503pub type InputSetResult = Result<(), Error>;
3504
3505pub trait InputProxyInterface: Send + Sync {
3506 type WatchResponseFut: std::future::Future<Output = Result<InputSettings, fidl::Error>> + Send;
3507 fn r#watch(&self) -> Self::WatchResponseFut;
3508 type SetResponseFut: std::future::Future<Output = Result<InputSetResult, fidl::Error>> + Send;
3509 fn r#set(&self, input_states: &[InputState]) -> Self::SetResponseFut;
3510}
3511#[derive(Debug)]
3512#[cfg(target_os = "fuchsia")]
3513pub struct InputSynchronousProxy {
3514 client: fidl::client::sync::Client,
3515}
3516
3517#[cfg(target_os = "fuchsia")]
3518impl fidl::endpoints::SynchronousProxy for InputSynchronousProxy {
3519 type Proxy = InputProxy;
3520 type Protocol = InputMarker;
3521
3522 fn from_channel(inner: fidl::Channel) -> Self {
3523 Self::new(inner)
3524 }
3525
3526 fn into_channel(self) -> fidl::Channel {
3527 self.client.into_channel()
3528 }
3529
3530 fn as_channel(&self) -> &fidl::Channel {
3531 self.client.as_channel()
3532 }
3533}
3534
3535#[cfg(target_os = "fuchsia")]
3536impl InputSynchronousProxy {
3537 pub fn new(channel: fidl::Channel) -> Self {
3538 Self { client: fidl::client::sync::Client::new(channel) }
3539 }
3540
3541 pub fn into_channel(self) -> fidl::Channel {
3542 self.client.into_channel()
3543 }
3544
3545 pub fn wait_for_event(
3548 &self,
3549 deadline: zx::MonotonicInstant,
3550 ) -> Result<InputEvent, fidl::Error> {
3551 InputEvent::decode(self.client.wait_for_event::<InputMarker>(deadline)?)
3552 }
3553
3554 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<InputSettings, fidl::Error> {
3571 let _response = self
3572 .client
3573 .send_query::<fidl::encoding::EmptyPayload, InputWatchResponse, InputMarker>(
3574 (),
3575 0x1bc41a7e0edd19c9,
3576 fidl::encoding::DynamicFlags::empty(),
3577 ___deadline,
3578 )?;
3579 Ok(_response.settings)
3580 }
3581
3582 pub fn r#set(
3589 &self,
3590 mut input_states: &[InputState],
3591 ___deadline: zx::MonotonicInstant,
3592 ) -> Result<InputSetResult, fidl::Error> {
3593 let _response = self.client.send_query::<InputSetRequest, fidl::encoding::ResultType<
3594 fidl::encoding::EmptyStruct,
3595 Error,
3596 >, InputMarker>(
3597 (input_states,),
3598 0x2447379e693141ca,
3599 fidl::encoding::DynamicFlags::empty(),
3600 ___deadline,
3601 )?;
3602 Ok(_response.map(|x| x))
3603 }
3604}
3605
3606#[cfg(target_os = "fuchsia")]
3607impl From<InputSynchronousProxy> for zx::NullableHandle {
3608 fn from(value: InputSynchronousProxy) -> Self {
3609 value.into_channel().into()
3610 }
3611}
3612
3613#[cfg(target_os = "fuchsia")]
3614impl From<fidl::Channel> for InputSynchronousProxy {
3615 fn from(value: fidl::Channel) -> Self {
3616 Self::new(value)
3617 }
3618}
3619
3620#[cfg(target_os = "fuchsia")]
3621impl fidl::endpoints::FromClient for InputSynchronousProxy {
3622 type Protocol = InputMarker;
3623
3624 fn from_client(value: fidl::endpoints::ClientEnd<InputMarker>) -> Self {
3625 Self::new(value.into_channel())
3626 }
3627}
3628
3629#[derive(Debug, Clone)]
3630pub struct InputProxy {
3631 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3632}
3633
3634impl fidl::endpoints::Proxy for InputProxy {
3635 type Protocol = InputMarker;
3636
3637 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3638 Self::new(inner)
3639 }
3640
3641 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3642 self.client.into_channel().map_err(|client| Self { client })
3643 }
3644
3645 fn as_channel(&self) -> &::fidl::AsyncChannel {
3646 self.client.as_channel()
3647 }
3648}
3649
3650impl InputProxy {
3651 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3653 let protocol_name = <InputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3654 Self { client: fidl::client::Client::new(channel, protocol_name) }
3655 }
3656
3657 pub fn take_event_stream(&self) -> InputEventStream {
3663 InputEventStream { event_receiver: self.client.take_event_receiver() }
3664 }
3665
3666 pub fn r#watch(
3683 &self,
3684 ) -> fidl::client::QueryResponseFut<InputSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
3685 {
3686 InputProxyInterface::r#watch(self)
3687 }
3688
3689 pub fn r#set(
3696 &self,
3697 mut input_states: &[InputState],
3698 ) -> fidl::client::QueryResponseFut<InputSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
3699 {
3700 InputProxyInterface::r#set(self, input_states)
3701 }
3702}
3703
3704impl InputProxyInterface for InputProxy {
3705 type WatchResponseFut = fidl::client::QueryResponseFut<
3706 InputSettings,
3707 fidl::encoding::DefaultFuchsiaResourceDialect,
3708 >;
3709 fn r#watch(&self) -> Self::WatchResponseFut {
3710 fn _decode(
3711 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3712 ) -> Result<InputSettings, fidl::Error> {
3713 let _response = fidl::client::decode_transaction_body::<
3714 InputWatchResponse,
3715 fidl::encoding::DefaultFuchsiaResourceDialect,
3716 0x1bc41a7e0edd19c9,
3717 >(_buf?)?;
3718 Ok(_response.settings)
3719 }
3720 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InputSettings>(
3721 (),
3722 0x1bc41a7e0edd19c9,
3723 fidl::encoding::DynamicFlags::empty(),
3724 _decode,
3725 )
3726 }
3727
3728 type SetResponseFut = fidl::client::QueryResponseFut<
3729 InputSetResult,
3730 fidl::encoding::DefaultFuchsiaResourceDialect,
3731 >;
3732 fn r#set(&self, mut input_states: &[InputState]) -> Self::SetResponseFut {
3733 fn _decode(
3734 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3735 ) -> Result<InputSetResult, fidl::Error> {
3736 let _response = fidl::client::decode_transaction_body::<
3737 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3738 fidl::encoding::DefaultFuchsiaResourceDialect,
3739 0x2447379e693141ca,
3740 >(_buf?)?;
3741 Ok(_response.map(|x| x))
3742 }
3743 self.client.send_query_and_decode::<InputSetRequest, InputSetResult>(
3744 (input_states,),
3745 0x2447379e693141ca,
3746 fidl::encoding::DynamicFlags::empty(),
3747 _decode,
3748 )
3749 }
3750}
3751
3752pub struct InputEventStream {
3753 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3754}
3755
3756impl std::marker::Unpin for InputEventStream {}
3757
3758impl futures::stream::FusedStream for InputEventStream {
3759 fn is_terminated(&self) -> bool {
3760 self.event_receiver.is_terminated()
3761 }
3762}
3763
3764impl futures::Stream for InputEventStream {
3765 type Item = Result<InputEvent, fidl::Error>;
3766
3767 fn poll_next(
3768 mut self: std::pin::Pin<&mut Self>,
3769 cx: &mut std::task::Context<'_>,
3770 ) -> std::task::Poll<Option<Self::Item>> {
3771 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3772 &mut self.event_receiver,
3773 cx
3774 )?) {
3775 Some(buf) => std::task::Poll::Ready(Some(InputEvent::decode(buf))),
3776 None => std::task::Poll::Ready(None),
3777 }
3778 }
3779}
3780
3781#[derive(Debug)]
3782pub enum InputEvent {}
3783
3784impl InputEvent {
3785 fn decode(
3787 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3788 ) -> Result<InputEvent, fidl::Error> {
3789 let (bytes, _handles) = buf.split_mut();
3790 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3791 debug_assert_eq!(tx_header.tx_id, 0);
3792 match tx_header.ordinal {
3793 _ => Err(fidl::Error::UnknownOrdinal {
3794 ordinal: tx_header.ordinal,
3795 protocol_name: <InputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3796 }),
3797 }
3798 }
3799}
3800
3801pub struct InputRequestStream {
3803 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3804 is_terminated: bool,
3805}
3806
3807impl std::marker::Unpin for InputRequestStream {}
3808
3809impl futures::stream::FusedStream for InputRequestStream {
3810 fn is_terminated(&self) -> bool {
3811 self.is_terminated
3812 }
3813}
3814
3815impl fidl::endpoints::RequestStream for InputRequestStream {
3816 type Protocol = InputMarker;
3817 type ControlHandle = InputControlHandle;
3818
3819 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3820 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3821 }
3822
3823 fn control_handle(&self) -> Self::ControlHandle {
3824 InputControlHandle { inner: self.inner.clone() }
3825 }
3826
3827 fn into_inner(
3828 self,
3829 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3830 {
3831 (self.inner, self.is_terminated)
3832 }
3833
3834 fn from_inner(
3835 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3836 is_terminated: bool,
3837 ) -> Self {
3838 Self { inner, is_terminated }
3839 }
3840}
3841
3842impl futures::Stream for InputRequestStream {
3843 type Item = Result<InputRequest, fidl::Error>;
3844
3845 fn poll_next(
3846 mut self: std::pin::Pin<&mut Self>,
3847 cx: &mut std::task::Context<'_>,
3848 ) -> std::task::Poll<Option<Self::Item>> {
3849 let this = &mut *self;
3850 if this.inner.check_shutdown(cx) {
3851 this.is_terminated = true;
3852 return std::task::Poll::Ready(None);
3853 }
3854 if this.is_terminated {
3855 panic!("polled InputRequestStream after completion");
3856 }
3857 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3858 |bytes, handles| {
3859 match this.inner.channel().read_etc(cx, bytes, handles) {
3860 std::task::Poll::Ready(Ok(())) => {}
3861 std::task::Poll::Pending => return std::task::Poll::Pending,
3862 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3863 this.is_terminated = true;
3864 return std::task::Poll::Ready(None);
3865 }
3866 std::task::Poll::Ready(Err(e)) => {
3867 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3868 e.into(),
3869 ))));
3870 }
3871 }
3872
3873 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3875
3876 std::task::Poll::Ready(Some(match header.ordinal {
3877 0x1bc41a7e0edd19c9 => {
3878 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3879 let mut req = fidl::new_empty!(
3880 fidl::encoding::EmptyPayload,
3881 fidl::encoding::DefaultFuchsiaResourceDialect
3882 );
3883 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3884 let control_handle = InputControlHandle { inner: this.inner.clone() };
3885 Ok(InputRequest::Watch {
3886 responder: InputWatchResponder {
3887 control_handle: std::mem::ManuallyDrop::new(control_handle),
3888 tx_id: header.tx_id,
3889 },
3890 })
3891 }
3892 0x2447379e693141ca => {
3893 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3894 let mut req = fidl::new_empty!(
3895 InputSetRequest,
3896 fidl::encoding::DefaultFuchsiaResourceDialect
3897 );
3898 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputSetRequest>(&header, _body_bytes, handles, &mut req)?;
3899 let control_handle = InputControlHandle { inner: this.inner.clone() };
3900 Ok(InputRequest::Set {
3901 input_states: req.input_states,
3902
3903 responder: InputSetResponder {
3904 control_handle: std::mem::ManuallyDrop::new(control_handle),
3905 tx_id: header.tx_id,
3906 },
3907 })
3908 }
3909 _ => Err(fidl::Error::UnknownOrdinal {
3910 ordinal: header.ordinal,
3911 protocol_name: <InputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3912 }),
3913 }))
3914 },
3915 )
3916 }
3917}
3918
3919#[derive(Debug)]
3924pub enum InputRequest {
3925 Watch { responder: InputWatchResponder },
3942 Set { input_states: Vec<InputState>, responder: InputSetResponder },
3949}
3950
3951impl InputRequest {
3952 #[allow(irrefutable_let_patterns)]
3953 pub fn into_watch(self) -> Option<(InputWatchResponder)> {
3954 if let InputRequest::Watch { responder } = self { Some((responder)) } else { None }
3955 }
3956
3957 #[allow(irrefutable_let_patterns)]
3958 pub fn into_set(self) -> Option<(Vec<InputState>, InputSetResponder)> {
3959 if let InputRequest::Set { input_states, responder } = self {
3960 Some((input_states, responder))
3961 } else {
3962 None
3963 }
3964 }
3965
3966 pub fn method_name(&self) -> &'static str {
3968 match *self {
3969 InputRequest::Watch { .. } => "watch",
3970 InputRequest::Set { .. } => "set",
3971 }
3972 }
3973}
3974
3975#[derive(Debug, Clone)]
3976pub struct InputControlHandle {
3977 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3978}
3979
3980impl InputControlHandle {
3981 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3982 self.inner.shutdown_with_epitaph(status.into())
3983 }
3984}
3985
3986impl fidl::endpoints::ControlHandle for InputControlHandle {
3987 fn shutdown(&self) {
3988 self.inner.shutdown()
3989 }
3990
3991 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3992 self.inner.shutdown_with_epitaph(status)
3993 }
3994
3995 fn is_closed(&self) -> bool {
3996 self.inner.channel().is_closed()
3997 }
3998 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3999 self.inner.channel().on_closed()
4000 }
4001
4002 #[cfg(target_os = "fuchsia")]
4003 fn signal_peer(
4004 &self,
4005 clear_mask: zx::Signals,
4006 set_mask: zx::Signals,
4007 ) -> Result<(), zx_status::Status> {
4008 use fidl::Peered;
4009 self.inner.channel().signal_peer(clear_mask, set_mask)
4010 }
4011}
4012
4013impl InputControlHandle {}
4014
4015#[must_use = "FIDL methods require a response to be sent"]
4016#[derive(Debug)]
4017pub struct InputWatchResponder {
4018 control_handle: std::mem::ManuallyDrop<InputControlHandle>,
4019 tx_id: u32,
4020}
4021
4022impl std::ops::Drop for InputWatchResponder {
4026 fn drop(&mut self) {
4027 self.control_handle.shutdown();
4028 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4030 }
4031}
4032
4033impl fidl::endpoints::Responder for InputWatchResponder {
4034 type ControlHandle = InputControlHandle;
4035
4036 fn control_handle(&self) -> &InputControlHandle {
4037 &self.control_handle
4038 }
4039
4040 fn drop_without_shutdown(mut self) {
4041 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4043 std::mem::forget(self);
4045 }
4046}
4047
4048impl InputWatchResponder {
4049 pub fn send(self, mut settings: &InputSettings) -> Result<(), fidl::Error> {
4053 let _result = self.send_raw(settings);
4054 if _result.is_err() {
4055 self.control_handle.shutdown();
4056 }
4057 self.drop_without_shutdown();
4058 _result
4059 }
4060
4061 pub fn send_no_shutdown_on_err(self, mut settings: &InputSettings) -> Result<(), fidl::Error> {
4063 let _result = self.send_raw(settings);
4064 self.drop_without_shutdown();
4065 _result
4066 }
4067
4068 fn send_raw(&self, mut settings: &InputSettings) -> Result<(), fidl::Error> {
4069 self.control_handle.inner.send::<InputWatchResponse>(
4070 (settings,),
4071 self.tx_id,
4072 0x1bc41a7e0edd19c9,
4073 fidl::encoding::DynamicFlags::empty(),
4074 )
4075 }
4076}
4077
4078#[must_use = "FIDL methods require a response to be sent"]
4079#[derive(Debug)]
4080pub struct InputSetResponder {
4081 control_handle: std::mem::ManuallyDrop<InputControlHandle>,
4082 tx_id: u32,
4083}
4084
4085impl std::ops::Drop for InputSetResponder {
4089 fn drop(&mut self) {
4090 self.control_handle.shutdown();
4091 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4093 }
4094}
4095
4096impl fidl::endpoints::Responder for InputSetResponder {
4097 type ControlHandle = InputControlHandle;
4098
4099 fn control_handle(&self) -> &InputControlHandle {
4100 &self.control_handle
4101 }
4102
4103 fn drop_without_shutdown(mut self) {
4104 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4106 std::mem::forget(self);
4108 }
4109}
4110
4111impl InputSetResponder {
4112 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4116 let _result = self.send_raw(result);
4117 if _result.is_err() {
4118 self.control_handle.shutdown();
4119 }
4120 self.drop_without_shutdown();
4121 _result
4122 }
4123
4124 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4126 let _result = self.send_raw(result);
4127 self.drop_without_shutdown();
4128 _result
4129 }
4130
4131 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4132 self.control_handle
4133 .inner
4134 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
4135 result,
4136 self.tx_id,
4137 0x2447379e693141ca,
4138 fidl::encoding::DynamicFlags::empty(),
4139 )
4140 }
4141}
4142
4143#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4144pub struct IntlMarker;
4145
4146impl fidl::endpoints::ProtocolMarker for IntlMarker {
4147 type Proxy = IntlProxy;
4148 type RequestStream = IntlRequestStream;
4149 #[cfg(target_os = "fuchsia")]
4150 type SynchronousProxy = IntlSynchronousProxy;
4151
4152 const DEBUG_NAME: &'static str = "fuchsia.settings.Intl";
4153}
4154impl fidl::endpoints::DiscoverableProtocolMarker for IntlMarker {}
4155pub type IntlSetResult = Result<(), Error>;
4156
4157pub trait IntlProxyInterface: Send + Sync {
4158 type WatchResponseFut: std::future::Future<Output = Result<IntlSettings, fidl::Error>> + Send;
4159 fn r#watch(&self) -> Self::WatchResponseFut;
4160 type SetResponseFut: std::future::Future<Output = Result<IntlSetResult, fidl::Error>> + Send;
4161 fn r#set(&self, settings: &IntlSettings) -> Self::SetResponseFut;
4162}
4163#[derive(Debug)]
4164#[cfg(target_os = "fuchsia")]
4165pub struct IntlSynchronousProxy {
4166 client: fidl::client::sync::Client,
4167}
4168
4169#[cfg(target_os = "fuchsia")]
4170impl fidl::endpoints::SynchronousProxy for IntlSynchronousProxy {
4171 type Proxy = IntlProxy;
4172 type Protocol = IntlMarker;
4173
4174 fn from_channel(inner: fidl::Channel) -> Self {
4175 Self::new(inner)
4176 }
4177
4178 fn into_channel(self) -> fidl::Channel {
4179 self.client.into_channel()
4180 }
4181
4182 fn as_channel(&self) -> &fidl::Channel {
4183 self.client.as_channel()
4184 }
4185}
4186
4187#[cfg(target_os = "fuchsia")]
4188impl IntlSynchronousProxy {
4189 pub fn new(channel: fidl::Channel) -> Self {
4190 Self { client: fidl::client::sync::Client::new(channel) }
4191 }
4192
4193 pub fn into_channel(self) -> fidl::Channel {
4194 self.client.into_channel()
4195 }
4196
4197 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<IntlEvent, fidl::Error> {
4200 IntlEvent::decode(self.client.wait_for_event::<IntlMarker>(deadline)?)
4201 }
4202
4203 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<IntlSettings, fidl::Error> {
4209 let _response =
4210 self.client.send_query::<fidl::encoding::EmptyPayload, IntlWatchResponse, IntlMarker>(
4211 (),
4212 0x3c85d6b8a85ab6e3,
4213 fidl::encoding::DynamicFlags::empty(),
4214 ___deadline,
4215 )?;
4216 Ok(_response.settings)
4217 }
4218
4219 pub fn r#set(
4222 &self,
4223 mut settings: &IntlSettings,
4224 ___deadline: zx::MonotonicInstant,
4225 ) -> Result<IntlSetResult, fidl::Error> {
4226 let _response = self.client.send_query::<IntlSetRequest, fidl::encoding::ResultType<
4227 fidl::encoding::EmptyStruct,
4228 Error,
4229 >, IntlMarker>(
4230 (settings,),
4231 0x273014eb4d880c5a,
4232 fidl::encoding::DynamicFlags::empty(),
4233 ___deadline,
4234 )?;
4235 Ok(_response.map(|x| x))
4236 }
4237}
4238
4239#[cfg(target_os = "fuchsia")]
4240impl From<IntlSynchronousProxy> for zx::NullableHandle {
4241 fn from(value: IntlSynchronousProxy) -> Self {
4242 value.into_channel().into()
4243 }
4244}
4245
4246#[cfg(target_os = "fuchsia")]
4247impl From<fidl::Channel> for IntlSynchronousProxy {
4248 fn from(value: fidl::Channel) -> Self {
4249 Self::new(value)
4250 }
4251}
4252
4253#[cfg(target_os = "fuchsia")]
4254impl fidl::endpoints::FromClient for IntlSynchronousProxy {
4255 type Protocol = IntlMarker;
4256
4257 fn from_client(value: fidl::endpoints::ClientEnd<IntlMarker>) -> Self {
4258 Self::new(value.into_channel())
4259 }
4260}
4261
4262#[derive(Debug, Clone)]
4263pub struct IntlProxy {
4264 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4265}
4266
4267impl fidl::endpoints::Proxy for IntlProxy {
4268 type Protocol = IntlMarker;
4269
4270 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4271 Self::new(inner)
4272 }
4273
4274 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4275 self.client.into_channel().map_err(|client| Self { client })
4276 }
4277
4278 fn as_channel(&self) -> &::fidl::AsyncChannel {
4279 self.client.as_channel()
4280 }
4281}
4282
4283impl IntlProxy {
4284 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4286 let protocol_name = <IntlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4287 Self { client: fidl::client::Client::new(channel, protocol_name) }
4288 }
4289
4290 pub fn take_event_stream(&self) -> IntlEventStream {
4296 IntlEventStream { event_receiver: self.client.take_event_receiver() }
4297 }
4298
4299 pub fn r#watch(
4305 &self,
4306 ) -> fidl::client::QueryResponseFut<IntlSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
4307 {
4308 IntlProxyInterface::r#watch(self)
4309 }
4310
4311 pub fn r#set(
4314 &self,
4315 mut settings: &IntlSettings,
4316 ) -> fidl::client::QueryResponseFut<IntlSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
4317 {
4318 IntlProxyInterface::r#set(self, settings)
4319 }
4320}
4321
4322impl IntlProxyInterface for IntlProxy {
4323 type WatchResponseFut =
4324 fidl::client::QueryResponseFut<IntlSettings, fidl::encoding::DefaultFuchsiaResourceDialect>;
4325 fn r#watch(&self) -> Self::WatchResponseFut {
4326 fn _decode(
4327 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4328 ) -> Result<IntlSettings, fidl::Error> {
4329 let _response = fidl::client::decode_transaction_body::<
4330 IntlWatchResponse,
4331 fidl::encoding::DefaultFuchsiaResourceDialect,
4332 0x3c85d6b8a85ab6e3,
4333 >(_buf?)?;
4334 Ok(_response.settings)
4335 }
4336 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, IntlSettings>(
4337 (),
4338 0x3c85d6b8a85ab6e3,
4339 fidl::encoding::DynamicFlags::empty(),
4340 _decode,
4341 )
4342 }
4343
4344 type SetResponseFut = fidl::client::QueryResponseFut<
4345 IntlSetResult,
4346 fidl::encoding::DefaultFuchsiaResourceDialect,
4347 >;
4348 fn r#set(&self, mut settings: &IntlSettings) -> Self::SetResponseFut {
4349 fn _decode(
4350 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4351 ) -> Result<IntlSetResult, fidl::Error> {
4352 let _response = fidl::client::decode_transaction_body::<
4353 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4354 fidl::encoding::DefaultFuchsiaResourceDialect,
4355 0x273014eb4d880c5a,
4356 >(_buf?)?;
4357 Ok(_response.map(|x| x))
4358 }
4359 self.client.send_query_and_decode::<IntlSetRequest, IntlSetResult>(
4360 (settings,),
4361 0x273014eb4d880c5a,
4362 fidl::encoding::DynamicFlags::empty(),
4363 _decode,
4364 )
4365 }
4366}
4367
4368pub struct IntlEventStream {
4369 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4370}
4371
4372impl std::marker::Unpin for IntlEventStream {}
4373
4374impl futures::stream::FusedStream for IntlEventStream {
4375 fn is_terminated(&self) -> bool {
4376 self.event_receiver.is_terminated()
4377 }
4378}
4379
4380impl futures::Stream for IntlEventStream {
4381 type Item = Result<IntlEvent, fidl::Error>;
4382
4383 fn poll_next(
4384 mut self: std::pin::Pin<&mut Self>,
4385 cx: &mut std::task::Context<'_>,
4386 ) -> std::task::Poll<Option<Self::Item>> {
4387 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4388 &mut self.event_receiver,
4389 cx
4390 )?) {
4391 Some(buf) => std::task::Poll::Ready(Some(IntlEvent::decode(buf))),
4392 None => std::task::Poll::Ready(None),
4393 }
4394 }
4395}
4396
4397#[derive(Debug)]
4398pub enum IntlEvent {}
4399
4400impl IntlEvent {
4401 fn decode(
4403 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4404 ) -> Result<IntlEvent, fidl::Error> {
4405 let (bytes, _handles) = buf.split_mut();
4406 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4407 debug_assert_eq!(tx_header.tx_id, 0);
4408 match tx_header.ordinal {
4409 _ => Err(fidl::Error::UnknownOrdinal {
4410 ordinal: tx_header.ordinal,
4411 protocol_name: <IntlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4412 }),
4413 }
4414 }
4415}
4416
4417pub struct IntlRequestStream {
4419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4420 is_terminated: bool,
4421}
4422
4423impl std::marker::Unpin for IntlRequestStream {}
4424
4425impl futures::stream::FusedStream for IntlRequestStream {
4426 fn is_terminated(&self) -> bool {
4427 self.is_terminated
4428 }
4429}
4430
4431impl fidl::endpoints::RequestStream for IntlRequestStream {
4432 type Protocol = IntlMarker;
4433 type ControlHandle = IntlControlHandle;
4434
4435 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4436 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4437 }
4438
4439 fn control_handle(&self) -> Self::ControlHandle {
4440 IntlControlHandle { inner: self.inner.clone() }
4441 }
4442
4443 fn into_inner(
4444 self,
4445 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4446 {
4447 (self.inner, self.is_terminated)
4448 }
4449
4450 fn from_inner(
4451 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4452 is_terminated: bool,
4453 ) -> Self {
4454 Self { inner, is_terminated }
4455 }
4456}
4457
4458impl futures::Stream for IntlRequestStream {
4459 type Item = Result<IntlRequest, fidl::Error>;
4460
4461 fn poll_next(
4462 mut self: std::pin::Pin<&mut Self>,
4463 cx: &mut std::task::Context<'_>,
4464 ) -> std::task::Poll<Option<Self::Item>> {
4465 let this = &mut *self;
4466 if this.inner.check_shutdown(cx) {
4467 this.is_terminated = true;
4468 return std::task::Poll::Ready(None);
4469 }
4470 if this.is_terminated {
4471 panic!("polled IntlRequestStream after completion");
4472 }
4473 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4474 |bytes, handles| {
4475 match this.inner.channel().read_etc(cx, bytes, handles) {
4476 std::task::Poll::Ready(Ok(())) => {}
4477 std::task::Poll::Pending => return std::task::Poll::Pending,
4478 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4479 this.is_terminated = true;
4480 return std::task::Poll::Ready(None);
4481 }
4482 std::task::Poll::Ready(Err(e)) => {
4483 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4484 e.into(),
4485 ))));
4486 }
4487 }
4488
4489 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4491
4492 std::task::Poll::Ready(Some(match header.ordinal {
4493 0x3c85d6b8a85ab6e3 => {
4494 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4495 let mut req = fidl::new_empty!(
4496 fidl::encoding::EmptyPayload,
4497 fidl::encoding::DefaultFuchsiaResourceDialect
4498 );
4499 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4500 let control_handle = IntlControlHandle { inner: this.inner.clone() };
4501 Ok(IntlRequest::Watch {
4502 responder: IntlWatchResponder {
4503 control_handle: std::mem::ManuallyDrop::new(control_handle),
4504 tx_id: header.tx_id,
4505 },
4506 })
4507 }
4508 0x273014eb4d880c5a => {
4509 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4510 let mut req = fidl::new_empty!(
4511 IntlSetRequest,
4512 fidl::encoding::DefaultFuchsiaResourceDialect
4513 );
4514 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntlSetRequest>(&header, _body_bytes, handles, &mut req)?;
4515 let control_handle = IntlControlHandle { inner: this.inner.clone() };
4516 Ok(IntlRequest::Set {
4517 settings: req.settings,
4518
4519 responder: IntlSetResponder {
4520 control_handle: std::mem::ManuallyDrop::new(control_handle),
4521 tx_id: header.tx_id,
4522 },
4523 })
4524 }
4525 _ => Err(fidl::Error::UnknownOrdinal {
4526 ordinal: header.ordinal,
4527 protocol_name: <IntlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4528 }),
4529 }))
4530 },
4531 )
4532 }
4533}
4534
4535#[derive(Debug)]
4542pub enum IntlRequest {
4543 Watch { responder: IntlWatchResponder },
4549 Set { settings: IntlSettings, responder: IntlSetResponder },
4552}
4553
4554impl IntlRequest {
4555 #[allow(irrefutable_let_patterns)]
4556 pub fn into_watch(self) -> Option<(IntlWatchResponder)> {
4557 if let IntlRequest::Watch { responder } = self { Some((responder)) } else { None }
4558 }
4559
4560 #[allow(irrefutable_let_patterns)]
4561 pub fn into_set(self) -> Option<(IntlSettings, IntlSetResponder)> {
4562 if let IntlRequest::Set { settings, responder } = self {
4563 Some((settings, responder))
4564 } else {
4565 None
4566 }
4567 }
4568
4569 pub fn method_name(&self) -> &'static str {
4571 match *self {
4572 IntlRequest::Watch { .. } => "watch",
4573 IntlRequest::Set { .. } => "set",
4574 }
4575 }
4576}
4577
4578#[derive(Debug, Clone)]
4579pub struct IntlControlHandle {
4580 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4581}
4582
4583impl IntlControlHandle {
4584 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4585 self.inner.shutdown_with_epitaph(status.into())
4586 }
4587}
4588
4589impl fidl::endpoints::ControlHandle for IntlControlHandle {
4590 fn shutdown(&self) {
4591 self.inner.shutdown()
4592 }
4593
4594 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4595 self.inner.shutdown_with_epitaph(status)
4596 }
4597
4598 fn is_closed(&self) -> bool {
4599 self.inner.channel().is_closed()
4600 }
4601 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4602 self.inner.channel().on_closed()
4603 }
4604
4605 #[cfg(target_os = "fuchsia")]
4606 fn signal_peer(
4607 &self,
4608 clear_mask: zx::Signals,
4609 set_mask: zx::Signals,
4610 ) -> Result<(), zx_status::Status> {
4611 use fidl::Peered;
4612 self.inner.channel().signal_peer(clear_mask, set_mask)
4613 }
4614}
4615
4616impl IntlControlHandle {}
4617
4618#[must_use = "FIDL methods require a response to be sent"]
4619#[derive(Debug)]
4620pub struct IntlWatchResponder {
4621 control_handle: std::mem::ManuallyDrop<IntlControlHandle>,
4622 tx_id: u32,
4623}
4624
4625impl std::ops::Drop for IntlWatchResponder {
4629 fn drop(&mut self) {
4630 self.control_handle.shutdown();
4631 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4633 }
4634}
4635
4636impl fidl::endpoints::Responder for IntlWatchResponder {
4637 type ControlHandle = IntlControlHandle;
4638
4639 fn control_handle(&self) -> &IntlControlHandle {
4640 &self.control_handle
4641 }
4642
4643 fn drop_without_shutdown(mut self) {
4644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4646 std::mem::forget(self);
4648 }
4649}
4650
4651impl IntlWatchResponder {
4652 pub fn send(self, mut settings: &IntlSettings) -> Result<(), fidl::Error> {
4656 let _result = self.send_raw(settings);
4657 if _result.is_err() {
4658 self.control_handle.shutdown();
4659 }
4660 self.drop_without_shutdown();
4661 _result
4662 }
4663
4664 pub fn send_no_shutdown_on_err(self, mut settings: &IntlSettings) -> Result<(), fidl::Error> {
4666 let _result = self.send_raw(settings);
4667 self.drop_without_shutdown();
4668 _result
4669 }
4670
4671 fn send_raw(&self, mut settings: &IntlSettings) -> Result<(), fidl::Error> {
4672 self.control_handle.inner.send::<IntlWatchResponse>(
4673 (settings,),
4674 self.tx_id,
4675 0x3c85d6b8a85ab6e3,
4676 fidl::encoding::DynamicFlags::empty(),
4677 )
4678 }
4679}
4680
4681#[must_use = "FIDL methods require a response to be sent"]
4682#[derive(Debug)]
4683pub struct IntlSetResponder {
4684 control_handle: std::mem::ManuallyDrop<IntlControlHandle>,
4685 tx_id: u32,
4686}
4687
4688impl std::ops::Drop for IntlSetResponder {
4692 fn drop(&mut self) {
4693 self.control_handle.shutdown();
4694 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4696 }
4697}
4698
4699impl fidl::endpoints::Responder for IntlSetResponder {
4700 type ControlHandle = IntlControlHandle;
4701
4702 fn control_handle(&self) -> &IntlControlHandle {
4703 &self.control_handle
4704 }
4705
4706 fn drop_without_shutdown(mut self) {
4707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4709 std::mem::forget(self);
4711 }
4712}
4713
4714impl IntlSetResponder {
4715 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4719 let _result = self.send_raw(result);
4720 if _result.is_err() {
4721 self.control_handle.shutdown();
4722 }
4723 self.drop_without_shutdown();
4724 _result
4725 }
4726
4727 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4729 let _result = self.send_raw(result);
4730 self.drop_without_shutdown();
4731 _result
4732 }
4733
4734 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4735 self.control_handle
4736 .inner
4737 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
4738 result,
4739 self.tx_id,
4740 0x273014eb4d880c5a,
4741 fidl::encoding::DynamicFlags::empty(),
4742 )
4743 }
4744}
4745
4746#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4747pub struct KeyboardMarker;
4748
4749impl fidl::endpoints::ProtocolMarker for KeyboardMarker {
4750 type Proxy = KeyboardProxy;
4751 type RequestStream = KeyboardRequestStream;
4752 #[cfg(target_os = "fuchsia")]
4753 type SynchronousProxy = KeyboardSynchronousProxy;
4754
4755 const DEBUG_NAME: &'static str = "fuchsia.settings.Keyboard";
4756}
4757impl fidl::endpoints::DiscoverableProtocolMarker for KeyboardMarker {}
4758
4759pub trait KeyboardProxyInterface: Send + Sync {
4760 type SetResponseFut: std::future::Future<Output = Result<KeyboardSetSetResult, fidl::Error>>
4761 + Send;
4762 fn r#set(&self, settings: &KeyboardSettings) -> Self::SetResponseFut;
4763 type WatchResponseFut: std::future::Future<Output = Result<KeyboardSettings, fidl::Error>>
4764 + Send;
4765 fn r#watch(&self) -> Self::WatchResponseFut;
4766}
4767#[derive(Debug)]
4768#[cfg(target_os = "fuchsia")]
4769pub struct KeyboardSynchronousProxy {
4770 client: fidl::client::sync::Client,
4771}
4772
4773#[cfg(target_os = "fuchsia")]
4774impl fidl::endpoints::SynchronousProxy for KeyboardSynchronousProxy {
4775 type Proxy = KeyboardProxy;
4776 type Protocol = KeyboardMarker;
4777
4778 fn from_channel(inner: fidl::Channel) -> Self {
4779 Self::new(inner)
4780 }
4781
4782 fn into_channel(self) -> fidl::Channel {
4783 self.client.into_channel()
4784 }
4785
4786 fn as_channel(&self) -> &fidl::Channel {
4787 self.client.as_channel()
4788 }
4789}
4790
4791#[cfg(target_os = "fuchsia")]
4792impl KeyboardSynchronousProxy {
4793 pub fn new(channel: fidl::Channel) -> Self {
4794 Self { client: fidl::client::sync::Client::new(channel) }
4795 }
4796
4797 pub fn into_channel(self) -> fidl::Channel {
4798 self.client.into_channel()
4799 }
4800
4801 pub fn wait_for_event(
4804 &self,
4805 deadline: zx::MonotonicInstant,
4806 ) -> Result<KeyboardEvent, fidl::Error> {
4807 KeyboardEvent::decode(self.client.wait_for_event::<KeyboardMarker>(deadline)?)
4808 }
4809
4810 pub fn r#set(
4813 &self,
4814 mut settings: &KeyboardSettings,
4815 ___deadline: zx::MonotonicInstant,
4816 ) -> Result<KeyboardSetSetResult, fidl::Error> {
4817 let _response = self.client.send_query::<
4818 KeyboardSetSetRequest,
4819 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4820 KeyboardMarker,
4821 >(
4822 (settings,),
4823 0x691f4493d263c843,
4824 fidl::encoding::DynamicFlags::empty(),
4825 ___deadline,
4826 )?;
4827 Ok(_response.map(|x| x))
4828 }
4829
4830 pub fn r#watch(
4835 &self,
4836 ___deadline: zx::MonotonicInstant,
4837 ) -> Result<KeyboardSettings, fidl::Error> {
4838 let _response = self
4839 .client
4840 .send_query::<fidl::encoding::EmptyPayload, KeyboardWatchWatchResponse, KeyboardMarker>(
4841 (),
4842 0x357f6213b3a54527,
4843 fidl::encoding::DynamicFlags::empty(),
4844 ___deadline,
4845 )?;
4846 Ok(_response.settings)
4847 }
4848}
4849
4850#[cfg(target_os = "fuchsia")]
4851impl From<KeyboardSynchronousProxy> for zx::NullableHandle {
4852 fn from(value: KeyboardSynchronousProxy) -> Self {
4853 value.into_channel().into()
4854 }
4855}
4856
4857#[cfg(target_os = "fuchsia")]
4858impl From<fidl::Channel> for KeyboardSynchronousProxy {
4859 fn from(value: fidl::Channel) -> Self {
4860 Self::new(value)
4861 }
4862}
4863
4864#[cfg(target_os = "fuchsia")]
4865impl fidl::endpoints::FromClient for KeyboardSynchronousProxy {
4866 type Protocol = KeyboardMarker;
4867
4868 fn from_client(value: fidl::endpoints::ClientEnd<KeyboardMarker>) -> Self {
4869 Self::new(value.into_channel())
4870 }
4871}
4872
4873#[derive(Debug, Clone)]
4874pub struct KeyboardProxy {
4875 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4876}
4877
4878impl fidl::endpoints::Proxy for KeyboardProxy {
4879 type Protocol = KeyboardMarker;
4880
4881 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4882 Self::new(inner)
4883 }
4884
4885 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4886 self.client.into_channel().map_err(|client| Self { client })
4887 }
4888
4889 fn as_channel(&self) -> &::fidl::AsyncChannel {
4890 self.client.as_channel()
4891 }
4892}
4893
4894impl KeyboardProxy {
4895 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4897 let protocol_name = <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4898 Self { client: fidl::client::Client::new(channel, protocol_name) }
4899 }
4900
4901 pub fn take_event_stream(&self) -> KeyboardEventStream {
4907 KeyboardEventStream { event_receiver: self.client.take_event_receiver() }
4908 }
4909
4910 pub fn r#set(
4913 &self,
4914 mut settings: &KeyboardSettings,
4915 ) -> fidl::client::QueryResponseFut<
4916 KeyboardSetSetResult,
4917 fidl::encoding::DefaultFuchsiaResourceDialect,
4918 > {
4919 KeyboardProxyInterface::r#set(self, settings)
4920 }
4921
4922 pub fn r#watch(
4927 &self,
4928 ) -> fidl::client::QueryResponseFut<
4929 KeyboardSettings,
4930 fidl::encoding::DefaultFuchsiaResourceDialect,
4931 > {
4932 KeyboardProxyInterface::r#watch(self)
4933 }
4934}
4935
4936impl KeyboardProxyInterface for KeyboardProxy {
4937 type SetResponseFut = fidl::client::QueryResponseFut<
4938 KeyboardSetSetResult,
4939 fidl::encoding::DefaultFuchsiaResourceDialect,
4940 >;
4941 fn r#set(&self, mut settings: &KeyboardSettings) -> Self::SetResponseFut {
4942 fn _decode(
4943 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4944 ) -> Result<KeyboardSetSetResult, fidl::Error> {
4945 let _response = fidl::client::decode_transaction_body::<
4946 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4947 fidl::encoding::DefaultFuchsiaResourceDialect,
4948 0x691f4493d263c843,
4949 >(_buf?)?;
4950 Ok(_response.map(|x| x))
4951 }
4952 self.client.send_query_and_decode::<KeyboardSetSetRequest, KeyboardSetSetResult>(
4953 (settings,),
4954 0x691f4493d263c843,
4955 fidl::encoding::DynamicFlags::empty(),
4956 _decode,
4957 )
4958 }
4959
4960 type WatchResponseFut = fidl::client::QueryResponseFut<
4961 KeyboardSettings,
4962 fidl::encoding::DefaultFuchsiaResourceDialect,
4963 >;
4964 fn r#watch(&self) -> Self::WatchResponseFut {
4965 fn _decode(
4966 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4967 ) -> Result<KeyboardSettings, fidl::Error> {
4968 let _response = fidl::client::decode_transaction_body::<
4969 KeyboardWatchWatchResponse,
4970 fidl::encoding::DefaultFuchsiaResourceDialect,
4971 0x357f6213b3a54527,
4972 >(_buf?)?;
4973 Ok(_response.settings)
4974 }
4975 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyboardSettings>(
4976 (),
4977 0x357f6213b3a54527,
4978 fidl::encoding::DynamicFlags::empty(),
4979 _decode,
4980 )
4981 }
4982}
4983
4984pub struct KeyboardEventStream {
4985 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4986}
4987
4988impl std::marker::Unpin for KeyboardEventStream {}
4989
4990impl futures::stream::FusedStream for KeyboardEventStream {
4991 fn is_terminated(&self) -> bool {
4992 self.event_receiver.is_terminated()
4993 }
4994}
4995
4996impl futures::Stream for KeyboardEventStream {
4997 type Item = Result<KeyboardEvent, fidl::Error>;
4998
4999 fn poll_next(
5000 mut self: std::pin::Pin<&mut Self>,
5001 cx: &mut std::task::Context<'_>,
5002 ) -> std::task::Poll<Option<Self::Item>> {
5003 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5004 &mut self.event_receiver,
5005 cx
5006 )?) {
5007 Some(buf) => std::task::Poll::Ready(Some(KeyboardEvent::decode(buf))),
5008 None => std::task::Poll::Ready(None),
5009 }
5010 }
5011}
5012
5013#[derive(Debug)]
5014pub enum KeyboardEvent {}
5015
5016impl KeyboardEvent {
5017 fn decode(
5019 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5020 ) -> Result<KeyboardEvent, fidl::Error> {
5021 let (bytes, _handles) = buf.split_mut();
5022 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5023 debug_assert_eq!(tx_header.tx_id, 0);
5024 match tx_header.ordinal {
5025 _ => Err(fidl::Error::UnknownOrdinal {
5026 ordinal: tx_header.ordinal,
5027 protocol_name: <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5028 }),
5029 }
5030 }
5031}
5032
5033pub struct KeyboardRequestStream {
5035 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5036 is_terminated: bool,
5037}
5038
5039impl std::marker::Unpin for KeyboardRequestStream {}
5040
5041impl futures::stream::FusedStream for KeyboardRequestStream {
5042 fn is_terminated(&self) -> bool {
5043 self.is_terminated
5044 }
5045}
5046
5047impl fidl::endpoints::RequestStream for KeyboardRequestStream {
5048 type Protocol = KeyboardMarker;
5049 type ControlHandle = KeyboardControlHandle;
5050
5051 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5052 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5053 }
5054
5055 fn control_handle(&self) -> Self::ControlHandle {
5056 KeyboardControlHandle { inner: self.inner.clone() }
5057 }
5058
5059 fn into_inner(
5060 self,
5061 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5062 {
5063 (self.inner, self.is_terminated)
5064 }
5065
5066 fn from_inner(
5067 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5068 is_terminated: bool,
5069 ) -> Self {
5070 Self { inner, is_terminated }
5071 }
5072}
5073
5074impl futures::Stream for KeyboardRequestStream {
5075 type Item = Result<KeyboardRequest, fidl::Error>;
5076
5077 fn poll_next(
5078 mut self: std::pin::Pin<&mut Self>,
5079 cx: &mut std::task::Context<'_>,
5080 ) -> std::task::Poll<Option<Self::Item>> {
5081 let this = &mut *self;
5082 if this.inner.check_shutdown(cx) {
5083 this.is_terminated = true;
5084 return std::task::Poll::Ready(None);
5085 }
5086 if this.is_terminated {
5087 panic!("polled KeyboardRequestStream after completion");
5088 }
5089 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5090 |bytes, handles| {
5091 match this.inner.channel().read_etc(cx, bytes, handles) {
5092 std::task::Poll::Ready(Ok(())) => {}
5093 std::task::Poll::Pending => return std::task::Poll::Pending,
5094 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5095 this.is_terminated = true;
5096 return std::task::Poll::Ready(None);
5097 }
5098 std::task::Poll::Ready(Err(e)) => {
5099 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5100 e.into(),
5101 ))));
5102 }
5103 }
5104
5105 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5107
5108 std::task::Poll::Ready(Some(match header.ordinal {
5109 0x691f4493d263c843 => {
5110 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5111 let mut req = fidl::new_empty!(
5112 KeyboardSetSetRequest,
5113 fidl::encoding::DefaultFuchsiaResourceDialect
5114 );
5115 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSetSetRequest>(&header, _body_bytes, handles, &mut req)?;
5116 let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
5117 Ok(KeyboardRequest::Set {
5118 settings: req.settings,
5119
5120 responder: KeyboardSetResponder {
5121 control_handle: std::mem::ManuallyDrop::new(control_handle),
5122 tx_id: header.tx_id,
5123 },
5124 })
5125 }
5126 0x357f6213b3a54527 => {
5127 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5128 let mut req = fidl::new_empty!(
5129 fidl::encoding::EmptyPayload,
5130 fidl::encoding::DefaultFuchsiaResourceDialect
5131 );
5132 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5133 let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
5134 Ok(KeyboardRequest::Watch {
5135 responder: KeyboardWatchResponder {
5136 control_handle: std::mem::ManuallyDrop::new(control_handle),
5137 tx_id: header.tx_id,
5138 },
5139 })
5140 }
5141 _ => Err(fidl::Error::UnknownOrdinal {
5142 ordinal: header.ordinal,
5143 protocol_name:
5144 <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5145 }),
5146 }))
5147 },
5148 )
5149 }
5150}
5151
5152#[derive(Debug)]
5154pub enum KeyboardRequest {
5155 Set { settings: KeyboardSettings, responder: KeyboardSetResponder },
5158 Watch { responder: KeyboardWatchResponder },
5163}
5164
5165impl KeyboardRequest {
5166 #[allow(irrefutable_let_patterns)]
5167 pub fn into_set(self) -> Option<(KeyboardSettings, KeyboardSetResponder)> {
5168 if let KeyboardRequest::Set { settings, responder } = self {
5169 Some((settings, responder))
5170 } else {
5171 None
5172 }
5173 }
5174
5175 #[allow(irrefutable_let_patterns)]
5176 pub fn into_watch(self) -> Option<(KeyboardWatchResponder)> {
5177 if let KeyboardRequest::Watch { responder } = self { Some((responder)) } else { None }
5178 }
5179
5180 pub fn method_name(&self) -> &'static str {
5182 match *self {
5183 KeyboardRequest::Set { .. } => "set",
5184 KeyboardRequest::Watch { .. } => "watch",
5185 }
5186 }
5187}
5188
5189#[derive(Debug, Clone)]
5190pub struct KeyboardControlHandle {
5191 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5192}
5193
5194impl KeyboardControlHandle {
5195 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5196 self.inner.shutdown_with_epitaph(status.into())
5197 }
5198}
5199
5200impl fidl::endpoints::ControlHandle for KeyboardControlHandle {
5201 fn shutdown(&self) {
5202 self.inner.shutdown()
5203 }
5204
5205 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5206 self.inner.shutdown_with_epitaph(status)
5207 }
5208
5209 fn is_closed(&self) -> bool {
5210 self.inner.channel().is_closed()
5211 }
5212 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5213 self.inner.channel().on_closed()
5214 }
5215
5216 #[cfg(target_os = "fuchsia")]
5217 fn signal_peer(
5218 &self,
5219 clear_mask: zx::Signals,
5220 set_mask: zx::Signals,
5221 ) -> Result<(), zx_status::Status> {
5222 use fidl::Peered;
5223 self.inner.channel().signal_peer(clear_mask, set_mask)
5224 }
5225}
5226
5227impl KeyboardControlHandle {}
5228
5229#[must_use = "FIDL methods require a response to be sent"]
5230#[derive(Debug)]
5231pub struct KeyboardSetResponder {
5232 control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
5233 tx_id: u32,
5234}
5235
5236impl std::ops::Drop for KeyboardSetResponder {
5240 fn drop(&mut self) {
5241 self.control_handle.shutdown();
5242 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5244 }
5245}
5246
5247impl fidl::endpoints::Responder for KeyboardSetResponder {
5248 type ControlHandle = KeyboardControlHandle;
5249
5250 fn control_handle(&self) -> &KeyboardControlHandle {
5251 &self.control_handle
5252 }
5253
5254 fn drop_without_shutdown(mut self) {
5255 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5257 std::mem::forget(self);
5259 }
5260}
5261
5262impl KeyboardSetResponder {
5263 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5267 let _result = self.send_raw(result);
5268 if _result.is_err() {
5269 self.control_handle.shutdown();
5270 }
5271 self.drop_without_shutdown();
5272 _result
5273 }
5274
5275 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5277 let _result = self.send_raw(result);
5278 self.drop_without_shutdown();
5279 _result
5280 }
5281
5282 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5283 self.control_handle
5284 .inner
5285 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5286 result,
5287 self.tx_id,
5288 0x691f4493d263c843,
5289 fidl::encoding::DynamicFlags::empty(),
5290 )
5291 }
5292}
5293
5294#[must_use = "FIDL methods require a response to be sent"]
5295#[derive(Debug)]
5296pub struct KeyboardWatchResponder {
5297 control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
5298 tx_id: u32,
5299}
5300
5301impl std::ops::Drop for KeyboardWatchResponder {
5305 fn drop(&mut self) {
5306 self.control_handle.shutdown();
5307 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5309 }
5310}
5311
5312impl fidl::endpoints::Responder for KeyboardWatchResponder {
5313 type ControlHandle = KeyboardControlHandle;
5314
5315 fn control_handle(&self) -> &KeyboardControlHandle {
5316 &self.control_handle
5317 }
5318
5319 fn drop_without_shutdown(mut self) {
5320 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5322 std::mem::forget(self);
5324 }
5325}
5326
5327impl KeyboardWatchResponder {
5328 pub fn send(self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
5332 let _result = self.send_raw(settings);
5333 if _result.is_err() {
5334 self.control_handle.shutdown();
5335 }
5336 self.drop_without_shutdown();
5337 _result
5338 }
5339
5340 pub fn send_no_shutdown_on_err(
5342 self,
5343 mut settings: &KeyboardSettings,
5344 ) -> Result<(), fidl::Error> {
5345 let _result = self.send_raw(settings);
5346 self.drop_without_shutdown();
5347 _result
5348 }
5349
5350 fn send_raw(&self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
5351 self.control_handle.inner.send::<KeyboardWatchWatchResponse>(
5352 (settings,),
5353 self.tx_id,
5354 0x357f6213b3a54527,
5355 fidl::encoding::DynamicFlags::empty(),
5356 )
5357 }
5358}
5359
5360#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5361pub struct KeyboardSetMarker;
5362
5363impl fidl::endpoints::ProtocolMarker for KeyboardSetMarker {
5364 type Proxy = KeyboardSetProxy;
5365 type RequestStream = KeyboardSetRequestStream;
5366 #[cfg(target_os = "fuchsia")]
5367 type SynchronousProxy = KeyboardSetSynchronousProxy;
5368
5369 const DEBUG_NAME: &'static str = "(anonymous) KeyboardSet";
5370}
5371pub type KeyboardSetSetResult = Result<(), Error>;
5372
5373pub trait KeyboardSetProxyInterface: Send + Sync {
5374 type SetResponseFut: std::future::Future<Output = Result<KeyboardSetSetResult, fidl::Error>>
5375 + Send;
5376 fn r#set(&self, settings: &KeyboardSettings) -> Self::SetResponseFut;
5377}
5378#[derive(Debug)]
5379#[cfg(target_os = "fuchsia")]
5380pub struct KeyboardSetSynchronousProxy {
5381 client: fidl::client::sync::Client,
5382}
5383
5384#[cfg(target_os = "fuchsia")]
5385impl fidl::endpoints::SynchronousProxy for KeyboardSetSynchronousProxy {
5386 type Proxy = KeyboardSetProxy;
5387 type Protocol = KeyboardSetMarker;
5388
5389 fn from_channel(inner: fidl::Channel) -> Self {
5390 Self::new(inner)
5391 }
5392
5393 fn into_channel(self) -> fidl::Channel {
5394 self.client.into_channel()
5395 }
5396
5397 fn as_channel(&self) -> &fidl::Channel {
5398 self.client.as_channel()
5399 }
5400}
5401
5402#[cfg(target_os = "fuchsia")]
5403impl KeyboardSetSynchronousProxy {
5404 pub fn new(channel: fidl::Channel) -> Self {
5405 Self { client: fidl::client::sync::Client::new(channel) }
5406 }
5407
5408 pub fn into_channel(self) -> fidl::Channel {
5409 self.client.into_channel()
5410 }
5411
5412 pub fn wait_for_event(
5415 &self,
5416 deadline: zx::MonotonicInstant,
5417 ) -> Result<KeyboardSetEvent, fidl::Error> {
5418 KeyboardSetEvent::decode(self.client.wait_for_event::<KeyboardSetMarker>(deadline)?)
5419 }
5420
5421 pub fn r#set(
5424 &self,
5425 mut settings: &KeyboardSettings,
5426 ___deadline: zx::MonotonicInstant,
5427 ) -> Result<KeyboardSetSetResult, fidl::Error> {
5428 let _response = self.client.send_query::<
5429 KeyboardSetSetRequest,
5430 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5431 KeyboardSetMarker,
5432 >(
5433 (settings,),
5434 0x691f4493d263c843,
5435 fidl::encoding::DynamicFlags::empty(),
5436 ___deadline,
5437 )?;
5438 Ok(_response.map(|x| x))
5439 }
5440}
5441
5442#[cfg(target_os = "fuchsia")]
5443impl From<KeyboardSetSynchronousProxy> for zx::NullableHandle {
5444 fn from(value: KeyboardSetSynchronousProxy) -> Self {
5445 value.into_channel().into()
5446 }
5447}
5448
5449#[cfg(target_os = "fuchsia")]
5450impl From<fidl::Channel> for KeyboardSetSynchronousProxy {
5451 fn from(value: fidl::Channel) -> Self {
5452 Self::new(value)
5453 }
5454}
5455
5456#[cfg(target_os = "fuchsia")]
5457impl fidl::endpoints::FromClient for KeyboardSetSynchronousProxy {
5458 type Protocol = KeyboardSetMarker;
5459
5460 fn from_client(value: fidl::endpoints::ClientEnd<KeyboardSetMarker>) -> Self {
5461 Self::new(value.into_channel())
5462 }
5463}
5464
5465#[derive(Debug, Clone)]
5466pub struct KeyboardSetProxy {
5467 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5468}
5469
5470impl fidl::endpoints::Proxy for KeyboardSetProxy {
5471 type Protocol = KeyboardSetMarker;
5472
5473 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5474 Self::new(inner)
5475 }
5476
5477 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5478 self.client.into_channel().map_err(|client| Self { client })
5479 }
5480
5481 fn as_channel(&self) -> &::fidl::AsyncChannel {
5482 self.client.as_channel()
5483 }
5484}
5485
5486impl KeyboardSetProxy {
5487 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5489 let protocol_name = <KeyboardSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5490 Self { client: fidl::client::Client::new(channel, protocol_name) }
5491 }
5492
5493 pub fn take_event_stream(&self) -> KeyboardSetEventStream {
5499 KeyboardSetEventStream { event_receiver: self.client.take_event_receiver() }
5500 }
5501
5502 pub fn r#set(
5505 &self,
5506 mut settings: &KeyboardSettings,
5507 ) -> fidl::client::QueryResponseFut<
5508 KeyboardSetSetResult,
5509 fidl::encoding::DefaultFuchsiaResourceDialect,
5510 > {
5511 KeyboardSetProxyInterface::r#set(self, settings)
5512 }
5513}
5514
5515impl KeyboardSetProxyInterface for KeyboardSetProxy {
5516 type SetResponseFut = fidl::client::QueryResponseFut<
5517 KeyboardSetSetResult,
5518 fidl::encoding::DefaultFuchsiaResourceDialect,
5519 >;
5520 fn r#set(&self, mut settings: &KeyboardSettings) -> Self::SetResponseFut {
5521 fn _decode(
5522 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5523 ) -> Result<KeyboardSetSetResult, fidl::Error> {
5524 let _response = fidl::client::decode_transaction_body::<
5525 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5526 fidl::encoding::DefaultFuchsiaResourceDialect,
5527 0x691f4493d263c843,
5528 >(_buf?)?;
5529 Ok(_response.map(|x| x))
5530 }
5531 self.client.send_query_and_decode::<KeyboardSetSetRequest, KeyboardSetSetResult>(
5532 (settings,),
5533 0x691f4493d263c843,
5534 fidl::encoding::DynamicFlags::empty(),
5535 _decode,
5536 )
5537 }
5538}
5539
5540pub struct KeyboardSetEventStream {
5541 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5542}
5543
5544impl std::marker::Unpin for KeyboardSetEventStream {}
5545
5546impl futures::stream::FusedStream for KeyboardSetEventStream {
5547 fn is_terminated(&self) -> bool {
5548 self.event_receiver.is_terminated()
5549 }
5550}
5551
5552impl futures::Stream for KeyboardSetEventStream {
5553 type Item = Result<KeyboardSetEvent, fidl::Error>;
5554
5555 fn poll_next(
5556 mut self: std::pin::Pin<&mut Self>,
5557 cx: &mut std::task::Context<'_>,
5558 ) -> std::task::Poll<Option<Self::Item>> {
5559 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5560 &mut self.event_receiver,
5561 cx
5562 )?) {
5563 Some(buf) => std::task::Poll::Ready(Some(KeyboardSetEvent::decode(buf))),
5564 None => std::task::Poll::Ready(None),
5565 }
5566 }
5567}
5568
5569#[derive(Debug)]
5570pub enum KeyboardSetEvent {}
5571
5572impl KeyboardSetEvent {
5573 fn decode(
5575 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5576 ) -> Result<KeyboardSetEvent, fidl::Error> {
5577 let (bytes, _handles) = buf.split_mut();
5578 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5579 debug_assert_eq!(tx_header.tx_id, 0);
5580 match tx_header.ordinal {
5581 _ => Err(fidl::Error::UnknownOrdinal {
5582 ordinal: tx_header.ordinal,
5583 protocol_name: <KeyboardSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5584 }),
5585 }
5586 }
5587}
5588
5589pub struct KeyboardSetRequestStream {
5591 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5592 is_terminated: bool,
5593}
5594
5595impl std::marker::Unpin for KeyboardSetRequestStream {}
5596
5597impl futures::stream::FusedStream for KeyboardSetRequestStream {
5598 fn is_terminated(&self) -> bool {
5599 self.is_terminated
5600 }
5601}
5602
5603impl fidl::endpoints::RequestStream for KeyboardSetRequestStream {
5604 type Protocol = KeyboardSetMarker;
5605 type ControlHandle = KeyboardSetControlHandle;
5606
5607 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5608 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5609 }
5610
5611 fn control_handle(&self) -> Self::ControlHandle {
5612 KeyboardSetControlHandle { inner: self.inner.clone() }
5613 }
5614
5615 fn into_inner(
5616 self,
5617 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5618 {
5619 (self.inner, self.is_terminated)
5620 }
5621
5622 fn from_inner(
5623 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5624 is_terminated: bool,
5625 ) -> Self {
5626 Self { inner, is_terminated }
5627 }
5628}
5629
5630impl futures::Stream for KeyboardSetRequestStream {
5631 type Item = Result<KeyboardSetRequest, fidl::Error>;
5632
5633 fn poll_next(
5634 mut self: std::pin::Pin<&mut Self>,
5635 cx: &mut std::task::Context<'_>,
5636 ) -> std::task::Poll<Option<Self::Item>> {
5637 let this = &mut *self;
5638 if this.inner.check_shutdown(cx) {
5639 this.is_terminated = true;
5640 return std::task::Poll::Ready(None);
5641 }
5642 if this.is_terminated {
5643 panic!("polled KeyboardSetRequestStream after completion");
5644 }
5645 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5646 |bytes, handles| {
5647 match this.inner.channel().read_etc(cx, bytes, handles) {
5648 std::task::Poll::Ready(Ok(())) => {}
5649 std::task::Poll::Pending => return std::task::Poll::Pending,
5650 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5651 this.is_terminated = true;
5652 return std::task::Poll::Ready(None);
5653 }
5654 std::task::Poll::Ready(Err(e)) => {
5655 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5656 e.into(),
5657 ))));
5658 }
5659 }
5660
5661 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5663
5664 std::task::Poll::Ready(Some(match header.ordinal {
5665 0x691f4493d263c843 => {
5666 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5667 let mut req = fidl::new_empty!(
5668 KeyboardSetSetRequest,
5669 fidl::encoding::DefaultFuchsiaResourceDialect
5670 );
5671 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSetSetRequest>(&header, _body_bytes, handles, &mut req)?;
5672 let control_handle = KeyboardSetControlHandle { inner: this.inner.clone() };
5673 Ok(KeyboardSetRequest::Set {
5674 settings: req.settings,
5675
5676 responder: KeyboardSetSetResponder {
5677 control_handle: std::mem::ManuallyDrop::new(control_handle),
5678 tx_id: header.tx_id,
5679 },
5680 })
5681 }
5682 _ => Err(fidl::Error::UnknownOrdinal {
5683 ordinal: header.ordinal,
5684 protocol_name:
5685 <KeyboardSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5686 }),
5687 }))
5688 },
5689 )
5690 }
5691}
5692
5693#[derive(Debug)]
5695pub enum KeyboardSetRequest {
5696 Set { settings: KeyboardSettings, responder: KeyboardSetSetResponder },
5699}
5700
5701impl KeyboardSetRequest {
5702 #[allow(irrefutable_let_patterns)]
5703 pub fn into_set(self) -> Option<(KeyboardSettings, KeyboardSetSetResponder)> {
5704 if let KeyboardSetRequest::Set { settings, responder } = self {
5705 Some((settings, responder))
5706 } else {
5707 None
5708 }
5709 }
5710
5711 pub fn method_name(&self) -> &'static str {
5713 match *self {
5714 KeyboardSetRequest::Set { .. } => "set",
5715 }
5716 }
5717}
5718
5719#[derive(Debug, Clone)]
5720pub struct KeyboardSetControlHandle {
5721 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5722}
5723
5724impl KeyboardSetControlHandle {
5725 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5726 self.inner.shutdown_with_epitaph(status.into())
5727 }
5728}
5729
5730impl fidl::endpoints::ControlHandle for KeyboardSetControlHandle {
5731 fn shutdown(&self) {
5732 self.inner.shutdown()
5733 }
5734
5735 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5736 self.inner.shutdown_with_epitaph(status)
5737 }
5738
5739 fn is_closed(&self) -> bool {
5740 self.inner.channel().is_closed()
5741 }
5742 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5743 self.inner.channel().on_closed()
5744 }
5745
5746 #[cfg(target_os = "fuchsia")]
5747 fn signal_peer(
5748 &self,
5749 clear_mask: zx::Signals,
5750 set_mask: zx::Signals,
5751 ) -> Result<(), zx_status::Status> {
5752 use fidl::Peered;
5753 self.inner.channel().signal_peer(clear_mask, set_mask)
5754 }
5755}
5756
5757impl KeyboardSetControlHandle {}
5758
5759#[must_use = "FIDL methods require a response to be sent"]
5760#[derive(Debug)]
5761pub struct KeyboardSetSetResponder {
5762 control_handle: std::mem::ManuallyDrop<KeyboardSetControlHandle>,
5763 tx_id: u32,
5764}
5765
5766impl std::ops::Drop for KeyboardSetSetResponder {
5770 fn drop(&mut self) {
5771 self.control_handle.shutdown();
5772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5774 }
5775}
5776
5777impl fidl::endpoints::Responder for KeyboardSetSetResponder {
5778 type ControlHandle = KeyboardSetControlHandle;
5779
5780 fn control_handle(&self) -> &KeyboardSetControlHandle {
5781 &self.control_handle
5782 }
5783
5784 fn drop_without_shutdown(mut self) {
5785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5787 std::mem::forget(self);
5789 }
5790}
5791
5792impl KeyboardSetSetResponder {
5793 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5797 let _result = self.send_raw(result);
5798 if _result.is_err() {
5799 self.control_handle.shutdown();
5800 }
5801 self.drop_without_shutdown();
5802 _result
5803 }
5804
5805 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5807 let _result = self.send_raw(result);
5808 self.drop_without_shutdown();
5809 _result
5810 }
5811
5812 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5813 self.control_handle
5814 .inner
5815 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5816 result,
5817 self.tx_id,
5818 0x691f4493d263c843,
5819 fidl::encoding::DynamicFlags::empty(),
5820 )
5821 }
5822}
5823
5824#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5825pub struct KeyboardWatchMarker;
5826
5827impl fidl::endpoints::ProtocolMarker for KeyboardWatchMarker {
5828 type Proxy = KeyboardWatchProxy;
5829 type RequestStream = KeyboardWatchRequestStream;
5830 #[cfg(target_os = "fuchsia")]
5831 type SynchronousProxy = KeyboardWatchSynchronousProxy;
5832
5833 const DEBUG_NAME: &'static str = "(anonymous) KeyboardWatch";
5834}
5835
5836pub trait KeyboardWatchProxyInterface: Send + Sync {
5837 type WatchResponseFut: std::future::Future<Output = Result<KeyboardSettings, fidl::Error>>
5838 + Send;
5839 fn r#watch(&self) -> Self::WatchResponseFut;
5840}
5841#[derive(Debug)]
5842#[cfg(target_os = "fuchsia")]
5843pub struct KeyboardWatchSynchronousProxy {
5844 client: fidl::client::sync::Client,
5845}
5846
5847#[cfg(target_os = "fuchsia")]
5848impl fidl::endpoints::SynchronousProxy for KeyboardWatchSynchronousProxy {
5849 type Proxy = KeyboardWatchProxy;
5850 type Protocol = KeyboardWatchMarker;
5851
5852 fn from_channel(inner: fidl::Channel) -> Self {
5853 Self::new(inner)
5854 }
5855
5856 fn into_channel(self) -> fidl::Channel {
5857 self.client.into_channel()
5858 }
5859
5860 fn as_channel(&self) -> &fidl::Channel {
5861 self.client.as_channel()
5862 }
5863}
5864
5865#[cfg(target_os = "fuchsia")]
5866impl KeyboardWatchSynchronousProxy {
5867 pub fn new(channel: fidl::Channel) -> Self {
5868 Self { client: fidl::client::sync::Client::new(channel) }
5869 }
5870
5871 pub fn into_channel(self) -> fidl::Channel {
5872 self.client.into_channel()
5873 }
5874
5875 pub fn wait_for_event(
5878 &self,
5879 deadline: zx::MonotonicInstant,
5880 ) -> Result<KeyboardWatchEvent, fidl::Error> {
5881 KeyboardWatchEvent::decode(self.client.wait_for_event::<KeyboardWatchMarker>(deadline)?)
5882 }
5883
5884 pub fn r#watch(
5889 &self,
5890 ___deadline: zx::MonotonicInstant,
5891 ) -> Result<KeyboardSettings, fidl::Error> {
5892 let _response = self.client.send_query::<
5893 fidl::encoding::EmptyPayload,
5894 KeyboardWatchWatchResponse,
5895 KeyboardWatchMarker,
5896 >(
5897 (),
5898 0x357f6213b3a54527,
5899 fidl::encoding::DynamicFlags::empty(),
5900 ___deadline,
5901 )?;
5902 Ok(_response.settings)
5903 }
5904}
5905
5906#[cfg(target_os = "fuchsia")]
5907impl From<KeyboardWatchSynchronousProxy> for zx::NullableHandle {
5908 fn from(value: KeyboardWatchSynchronousProxy) -> Self {
5909 value.into_channel().into()
5910 }
5911}
5912
5913#[cfg(target_os = "fuchsia")]
5914impl From<fidl::Channel> for KeyboardWatchSynchronousProxy {
5915 fn from(value: fidl::Channel) -> Self {
5916 Self::new(value)
5917 }
5918}
5919
5920#[cfg(target_os = "fuchsia")]
5921impl fidl::endpoints::FromClient for KeyboardWatchSynchronousProxy {
5922 type Protocol = KeyboardWatchMarker;
5923
5924 fn from_client(value: fidl::endpoints::ClientEnd<KeyboardWatchMarker>) -> Self {
5925 Self::new(value.into_channel())
5926 }
5927}
5928
5929#[derive(Debug, Clone)]
5930pub struct KeyboardWatchProxy {
5931 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5932}
5933
5934impl fidl::endpoints::Proxy for KeyboardWatchProxy {
5935 type Protocol = KeyboardWatchMarker;
5936
5937 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5938 Self::new(inner)
5939 }
5940
5941 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5942 self.client.into_channel().map_err(|client| Self { client })
5943 }
5944
5945 fn as_channel(&self) -> &::fidl::AsyncChannel {
5946 self.client.as_channel()
5947 }
5948}
5949
5950impl KeyboardWatchProxy {
5951 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5953 let protocol_name = <KeyboardWatchMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5954 Self { client: fidl::client::Client::new(channel, protocol_name) }
5955 }
5956
5957 pub fn take_event_stream(&self) -> KeyboardWatchEventStream {
5963 KeyboardWatchEventStream { event_receiver: self.client.take_event_receiver() }
5964 }
5965
5966 pub fn r#watch(
5971 &self,
5972 ) -> fidl::client::QueryResponseFut<
5973 KeyboardSettings,
5974 fidl::encoding::DefaultFuchsiaResourceDialect,
5975 > {
5976 KeyboardWatchProxyInterface::r#watch(self)
5977 }
5978}
5979
5980impl KeyboardWatchProxyInterface for KeyboardWatchProxy {
5981 type WatchResponseFut = fidl::client::QueryResponseFut<
5982 KeyboardSettings,
5983 fidl::encoding::DefaultFuchsiaResourceDialect,
5984 >;
5985 fn r#watch(&self) -> Self::WatchResponseFut {
5986 fn _decode(
5987 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5988 ) -> Result<KeyboardSettings, fidl::Error> {
5989 let _response = fidl::client::decode_transaction_body::<
5990 KeyboardWatchWatchResponse,
5991 fidl::encoding::DefaultFuchsiaResourceDialect,
5992 0x357f6213b3a54527,
5993 >(_buf?)?;
5994 Ok(_response.settings)
5995 }
5996 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyboardSettings>(
5997 (),
5998 0x357f6213b3a54527,
5999 fidl::encoding::DynamicFlags::empty(),
6000 _decode,
6001 )
6002 }
6003}
6004
6005pub struct KeyboardWatchEventStream {
6006 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6007}
6008
6009impl std::marker::Unpin for KeyboardWatchEventStream {}
6010
6011impl futures::stream::FusedStream for KeyboardWatchEventStream {
6012 fn is_terminated(&self) -> bool {
6013 self.event_receiver.is_terminated()
6014 }
6015}
6016
6017impl futures::Stream for KeyboardWatchEventStream {
6018 type Item = Result<KeyboardWatchEvent, fidl::Error>;
6019
6020 fn poll_next(
6021 mut self: std::pin::Pin<&mut Self>,
6022 cx: &mut std::task::Context<'_>,
6023 ) -> std::task::Poll<Option<Self::Item>> {
6024 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6025 &mut self.event_receiver,
6026 cx
6027 )?) {
6028 Some(buf) => std::task::Poll::Ready(Some(KeyboardWatchEvent::decode(buf))),
6029 None => std::task::Poll::Ready(None),
6030 }
6031 }
6032}
6033
6034#[derive(Debug)]
6035pub enum KeyboardWatchEvent {}
6036
6037impl KeyboardWatchEvent {
6038 fn decode(
6040 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6041 ) -> Result<KeyboardWatchEvent, fidl::Error> {
6042 let (bytes, _handles) = buf.split_mut();
6043 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6044 debug_assert_eq!(tx_header.tx_id, 0);
6045 match tx_header.ordinal {
6046 _ => Err(fidl::Error::UnknownOrdinal {
6047 ordinal: tx_header.ordinal,
6048 protocol_name: <KeyboardWatchMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6049 }),
6050 }
6051 }
6052}
6053
6054pub struct KeyboardWatchRequestStream {
6056 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6057 is_terminated: bool,
6058}
6059
6060impl std::marker::Unpin for KeyboardWatchRequestStream {}
6061
6062impl futures::stream::FusedStream for KeyboardWatchRequestStream {
6063 fn is_terminated(&self) -> bool {
6064 self.is_terminated
6065 }
6066}
6067
6068impl fidl::endpoints::RequestStream for KeyboardWatchRequestStream {
6069 type Protocol = KeyboardWatchMarker;
6070 type ControlHandle = KeyboardWatchControlHandle;
6071
6072 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6073 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6074 }
6075
6076 fn control_handle(&self) -> Self::ControlHandle {
6077 KeyboardWatchControlHandle { inner: self.inner.clone() }
6078 }
6079
6080 fn into_inner(
6081 self,
6082 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6083 {
6084 (self.inner, self.is_terminated)
6085 }
6086
6087 fn from_inner(
6088 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6089 is_terminated: bool,
6090 ) -> Self {
6091 Self { inner, is_terminated }
6092 }
6093}
6094
6095impl futures::Stream for KeyboardWatchRequestStream {
6096 type Item = Result<KeyboardWatchRequest, fidl::Error>;
6097
6098 fn poll_next(
6099 mut self: std::pin::Pin<&mut Self>,
6100 cx: &mut std::task::Context<'_>,
6101 ) -> std::task::Poll<Option<Self::Item>> {
6102 let this = &mut *self;
6103 if this.inner.check_shutdown(cx) {
6104 this.is_terminated = true;
6105 return std::task::Poll::Ready(None);
6106 }
6107 if this.is_terminated {
6108 panic!("polled KeyboardWatchRequestStream after completion");
6109 }
6110 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6111 |bytes, handles| {
6112 match this.inner.channel().read_etc(cx, bytes, handles) {
6113 std::task::Poll::Ready(Ok(())) => {}
6114 std::task::Poll::Pending => return std::task::Poll::Pending,
6115 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6116 this.is_terminated = true;
6117 return std::task::Poll::Ready(None);
6118 }
6119 std::task::Poll::Ready(Err(e)) => {
6120 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6121 e.into(),
6122 ))));
6123 }
6124 }
6125
6126 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6128
6129 std::task::Poll::Ready(Some(match header.ordinal {
6130 0x357f6213b3a54527 => {
6131 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6132 let mut req = fidl::new_empty!(
6133 fidl::encoding::EmptyPayload,
6134 fidl::encoding::DefaultFuchsiaResourceDialect
6135 );
6136 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6137 let control_handle =
6138 KeyboardWatchControlHandle { inner: this.inner.clone() };
6139 Ok(KeyboardWatchRequest::Watch {
6140 responder: KeyboardWatchWatchResponder {
6141 control_handle: std::mem::ManuallyDrop::new(control_handle),
6142 tx_id: header.tx_id,
6143 },
6144 })
6145 }
6146 _ => Err(fidl::Error::UnknownOrdinal {
6147 ordinal: header.ordinal,
6148 protocol_name:
6149 <KeyboardWatchMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6150 }),
6151 }))
6152 },
6153 )
6154 }
6155}
6156
6157#[derive(Debug)]
6159pub enum KeyboardWatchRequest {
6160 Watch { responder: KeyboardWatchWatchResponder },
6165}
6166
6167impl KeyboardWatchRequest {
6168 #[allow(irrefutable_let_patterns)]
6169 pub fn into_watch(self) -> Option<(KeyboardWatchWatchResponder)> {
6170 if let KeyboardWatchRequest::Watch { responder } = self { Some((responder)) } else { None }
6171 }
6172
6173 pub fn method_name(&self) -> &'static str {
6175 match *self {
6176 KeyboardWatchRequest::Watch { .. } => "watch",
6177 }
6178 }
6179}
6180
6181#[derive(Debug, Clone)]
6182pub struct KeyboardWatchControlHandle {
6183 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6184}
6185
6186impl KeyboardWatchControlHandle {
6187 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6188 self.inner.shutdown_with_epitaph(status.into())
6189 }
6190}
6191
6192impl fidl::endpoints::ControlHandle for KeyboardWatchControlHandle {
6193 fn shutdown(&self) {
6194 self.inner.shutdown()
6195 }
6196
6197 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6198 self.inner.shutdown_with_epitaph(status)
6199 }
6200
6201 fn is_closed(&self) -> bool {
6202 self.inner.channel().is_closed()
6203 }
6204 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6205 self.inner.channel().on_closed()
6206 }
6207
6208 #[cfg(target_os = "fuchsia")]
6209 fn signal_peer(
6210 &self,
6211 clear_mask: zx::Signals,
6212 set_mask: zx::Signals,
6213 ) -> Result<(), zx_status::Status> {
6214 use fidl::Peered;
6215 self.inner.channel().signal_peer(clear_mask, set_mask)
6216 }
6217}
6218
6219impl KeyboardWatchControlHandle {}
6220
6221#[must_use = "FIDL methods require a response to be sent"]
6222#[derive(Debug)]
6223pub struct KeyboardWatchWatchResponder {
6224 control_handle: std::mem::ManuallyDrop<KeyboardWatchControlHandle>,
6225 tx_id: u32,
6226}
6227
6228impl std::ops::Drop for KeyboardWatchWatchResponder {
6232 fn drop(&mut self) {
6233 self.control_handle.shutdown();
6234 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6236 }
6237}
6238
6239impl fidl::endpoints::Responder for KeyboardWatchWatchResponder {
6240 type ControlHandle = KeyboardWatchControlHandle;
6241
6242 fn control_handle(&self) -> &KeyboardWatchControlHandle {
6243 &self.control_handle
6244 }
6245
6246 fn drop_without_shutdown(mut self) {
6247 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6249 std::mem::forget(self);
6251 }
6252}
6253
6254impl KeyboardWatchWatchResponder {
6255 pub fn send(self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
6259 let _result = self.send_raw(settings);
6260 if _result.is_err() {
6261 self.control_handle.shutdown();
6262 }
6263 self.drop_without_shutdown();
6264 _result
6265 }
6266
6267 pub fn send_no_shutdown_on_err(
6269 self,
6270 mut settings: &KeyboardSettings,
6271 ) -> Result<(), fidl::Error> {
6272 let _result = self.send_raw(settings);
6273 self.drop_without_shutdown();
6274 _result
6275 }
6276
6277 fn send_raw(&self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
6278 self.control_handle.inner.send::<KeyboardWatchWatchResponse>(
6279 (settings,),
6280 self.tx_id,
6281 0x357f6213b3a54527,
6282 fidl::encoding::DynamicFlags::empty(),
6283 )
6284 }
6285}
6286
6287#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6288pub struct LightMarker;
6289
6290impl fidl::endpoints::ProtocolMarker for LightMarker {
6291 type Proxy = LightProxy;
6292 type RequestStream = LightRequestStream;
6293 #[cfg(target_os = "fuchsia")]
6294 type SynchronousProxy = LightSynchronousProxy;
6295
6296 const DEBUG_NAME: &'static str = "fuchsia.settings.Light";
6297}
6298impl fidl::endpoints::DiscoverableProtocolMarker for LightMarker {}
6299pub type LightSetLightGroupValuesResult = Result<(), LightError>;
6300
6301pub trait LightProxyInterface: Send + Sync {
6302 type WatchLightGroupsResponseFut: std::future::Future<Output = Result<Vec<LightGroup>, fidl::Error>>
6303 + Send;
6304 fn r#watch_light_groups(&self) -> Self::WatchLightGroupsResponseFut;
6305 type WatchLightGroupResponseFut: std::future::Future<Output = Result<LightGroup, fidl::Error>>
6306 + Send;
6307 fn r#watch_light_group(&self, name: &str) -> Self::WatchLightGroupResponseFut;
6308 type SetLightGroupValuesResponseFut: std::future::Future<Output = Result<LightSetLightGroupValuesResult, fidl::Error>>
6309 + Send;
6310 fn r#set_light_group_values(
6311 &self,
6312 name: &str,
6313 state: &[LightState],
6314 ) -> Self::SetLightGroupValuesResponseFut;
6315}
6316#[derive(Debug)]
6317#[cfg(target_os = "fuchsia")]
6318pub struct LightSynchronousProxy {
6319 client: fidl::client::sync::Client,
6320}
6321
6322#[cfg(target_os = "fuchsia")]
6323impl fidl::endpoints::SynchronousProxy for LightSynchronousProxy {
6324 type Proxy = LightProxy;
6325 type Protocol = LightMarker;
6326
6327 fn from_channel(inner: fidl::Channel) -> Self {
6328 Self::new(inner)
6329 }
6330
6331 fn into_channel(self) -> fidl::Channel {
6332 self.client.into_channel()
6333 }
6334
6335 fn as_channel(&self) -> &fidl::Channel {
6336 self.client.as_channel()
6337 }
6338}
6339
6340#[cfg(target_os = "fuchsia")]
6341impl LightSynchronousProxy {
6342 pub fn new(channel: fidl::Channel) -> Self {
6343 Self { client: fidl::client::sync::Client::new(channel) }
6344 }
6345
6346 pub fn into_channel(self) -> fidl::Channel {
6347 self.client.into_channel()
6348 }
6349
6350 pub fn wait_for_event(
6353 &self,
6354 deadline: zx::MonotonicInstant,
6355 ) -> Result<LightEvent, fidl::Error> {
6356 LightEvent::decode(self.client.wait_for_event::<LightMarker>(deadline)?)
6357 }
6358
6359 pub fn r#watch_light_groups(
6366 &self,
6367 ___deadline: zx::MonotonicInstant,
6368 ) -> Result<Vec<LightGroup>, fidl::Error> {
6369 let _response = self
6370 .client
6371 .send_query::<fidl::encoding::EmptyPayload, LightWatchLightGroupsResponse, LightMarker>(
6372 (),
6373 0x3f506de229db5930,
6374 fidl::encoding::DynamicFlags::empty(),
6375 ___deadline,
6376 )?;
6377 Ok(_response.groups)
6378 }
6379
6380 pub fn r#watch_light_group(
6388 &self,
6389 mut name: &str,
6390 ___deadline: zx::MonotonicInstant,
6391 ) -> Result<LightGroup, fidl::Error> {
6392 let _response = self
6393 .client
6394 .send_query::<LightWatchLightGroupRequest, LightWatchLightGroupResponse, LightMarker>(
6395 (name,),
6396 0x3ef0331c388d56a3,
6397 fidl::encoding::DynamicFlags::empty(),
6398 ___deadline,
6399 )?;
6400 Ok(_response.group)
6401 }
6402
6403 pub fn r#set_light_group_values(
6412 &self,
6413 mut name: &str,
6414 mut state: &[LightState],
6415 ___deadline: zx::MonotonicInstant,
6416 ) -> Result<LightSetLightGroupValuesResult, fidl::Error> {
6417 let _response = self.client.send_query::<
6418 LightSetLightGroupValuesRequest,
6419 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LightError>,
6420 LightMarker,
6421 >(
6422 (name, state,),
6423 0x15d9b62431fdf8d5,
6424 fidl::encoding::DynamicFlags::empty(),
6425 ___deadline,
6426 )?;
6427 Ok(_response.map(|x| x))
6428 }
6429}
6430
6431#[cfg(target_os = "fuchsia")]
6432impl From<LightSynchronousProxy> for zx::NullableHandle {
6433 fn from(value: LightSynchronousProxy) -> Self {
6434 value.into_channel().into()
6435 }
6436}
6437
6438#[cfg(target_os = "fuchsia")]
6439impl From<fidl::Channel> for LightSynchronousProxy {
6440 fn from(value: fidl::Channel) -> Self {
6441 Self::new(value)
6442 }
6443}
6444
6445#[cfg(target_os = "fuchsia")]
6446impl fidl::endpoints::FromClient for LightSynchronousProxy {
6447 type Protocol = LightMarker;
6448
6449 fn from_client(value: fidl::endpoints::ClientEnd<LightMarker>) -> Self {
6450 Self::new(value.into_channel())
6451 }
6452}
6453
6454#[derive(Debug, Clone)]
6455pub struct LightProxy {
6456 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6457}
6458
6459impl fidl::endpoints::Proxy for LightProxy {
6460 type Protocol = LightMarker;
6461
6462 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6463 Self::new(inner)
6464 }
6465
6466 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6467 self.client.into_channel().map_err(|client| Self { client })
6468 }
6469
6470 fn as_channel(&self) -> &::fidl::AsyncChannel {
6471 self.client.as_channel()
6472 }
6473}
6474
6475impl LightProxy {
6476 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6478 let protocol_name = <LightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6479 Self { client: fidl::client::Client::new(channel, protocol_name) }
6480 }
6481
6482 pub fn take_event_stream(&self) -> LightEventStream {
6488 LightEventStream { event_receiver: self.client.take_event_receiver() }
6489 }
6490
6491 pub fn r#watch_light_groups(
6498 &self,
6499 ) -> fidl::client::QueryResponseFut<
6500 Vec<LightGroup>,
6501 fidl::encoding::DefaultFuchsiaResourceDialect,
6502 > {
6503 LightProxyInterface::r#watch_light_groups(self)
6504 }
6505
6506 pub fn r#watch_light_group(
6514 &self,
6515 mut name: &str,
6516 ) -> fidl::client::QueryResponseFut<LightGroup, fidl::encoding::DefaultFuchsiaResourceDialect>
6517 {
6518 LightProxyInterface::r#watch_light_group(self, name)
6519 }
6520
6521 pub fn r#set_light_group_values(
6530 &self,
6531 mut name: &str,
6532 mut state: &[LightState],
6533 ) -> fidl::client::QueryResponseFut<
6534 LightSetLightGroupValuesResult,
6535 fidl::encoding::DefaultFuchsiaResourceDialect,
6536 > {
6537 LightProxyInterface::r#set_light_group_values(self, name, state)
6538 }
6539}
6540
6541impl LightProxyInterface for LightProxy {
6542 type WatchLightGroupsResponseFut = fidl::client::QueryResponseFut<
6543 Vec<LightGroup>,
6544 fidl::encoding::DefaultFuchsiaResourceDialect,
6545 >;
6546 fn r#watch_light_groups(&self) -> Self::WatchLightGroupsResponseFut {
6547 fn _decode(
6548 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6549 ) -> Result<Vec<LightGroup>, fidl::Error> {
6550 let _response = fidl::client::decode_transaction_body::<
6551 LightWatchLightGroupsResponse,
6552 fidl::encoding::DefaultFuchsiaResourceDialect,
6553 0x3f506de229db5930,
6554 >(_buf?)?;
6555 Ok(_response.groups)
6556 }
6557 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<LightGroup>>(
6558 (),
6559 0x3f506de229db5930,
6560 fidl::encoding::DynamicFlags::empty(),
6561 _decode,
6562 )
6563 }
6564
6565 type WatchLightGroupResponseFut =
6566 fidl::client::QueryResponseFut<LightGroup, fidl::encoding::DefaultFuchsiaResourceDialect>;
6567 fn r#watch_light_group(&self, mut name: &str) -> Self::WatchLightGroupResponseFut {
6568 fn _decode(
6569 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6570 ) -> Result<LightGroup, fidl::Error> {
6571 let _response = fidl::client::decode_transaction_body::<
6572 LightWatchLightGroupResponse,
6573 fidl::encoding::DefaultFuchsiaResourceDialect,
6574 0x3ef0331c388d56a3,
6575 >(_buf?)?;
6576 Ok(_response.group)
6577 }
6578 self.client.send_query_and_decode::<LightWatchLightGroupRequest, LightGroup>(
6579 (name,),
6580 0x3ef0331c388d56a3,
6581 fidl::encoding::DynamicFlags::empty(),
6582 _decode,
6583 )
6584 }
6585
6586 type SetLightGroupValuesResponseFut = fidl::client::QueryResponseFut<
6587 LightSetLightGroupValuesResult,
6588 fidl::encoding::DefaultFuchsiaResourceDialect,
6589 >;
6590 fn r#set_light_group_values(
6591 &self,
6592 mut name: &str,
6593 mut state: &[LightState],
6594 ) -> Self::SetLightGroupValuesResponseFut {
6595 fn _decode(
6596 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6597 ) -> Result<LightSetLightGroupValuesResult, fidl::Error> {
6598 let _response = fidl::client::decode_transaction_body::<
6599 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LightError>,
6600 fidl::encoding::DefaultFuchsiaResourceDialect,
6601 0x15d9b62431fdf8d5,
6602 >(_buf?)?;
6603 Ok(_response.map(|x| x))
6604 }
6605 self.client.send_query_and_decode::<
6606 LightSetLightGroupValuesRequest,
6607 LightSetLightGroupValuesResult,
6608 >(
6609 (name, state,),
6610 0x15d9b62431fdf8d5,
6611 fidl::encoding::DynamicFlags::empty(),
6612 _decode,
6613 )
6614 }
6615}
6616
6617pub struct LightEventStream {
6618 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6619}
6620
6621impl std::marker::Unpin for LightEventStream {}
6622
6623impl futures::stream::FusedStream for LightEventStream {
6624 fn is_terminated(&self) -> bool {
6625 self.event_receiver.is_terminated()
6626 }
6627}
6628
6629impl futures::Stream for LightEventStream {
6630 type Item = Result<LightEvent, fidl::Error>;
6631
6632 fn poll_next(
6633 mut self: std::pin::Pin<&mut Self>,
6634 cx: &mut std::task::Context<'_>,
6635 ) -> std::task::Poll<Option<Self::Item>> {
6636 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6637 &mut self.event_receiver,
6638 cx
6639 )?) {
6640 Some(buf) => std::task::Poll::Ready(Some(LightEvent::decode(buf))),
6641 None => std::task::Poll::Ready(None),
6642 }
6643 }
6644}
6645
6646#[derive(Debug)]
6647pub enum LightEvent {}
6648
6649impl LightEvent {
6650 fn decode(
6652 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6653 ) -> Result<LightEvent, fidl::Error> {
6654 let (bytes, _handles) = buf.split_mut();
6655 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6656 debug_assert_eq!(tx_header.tx_id, 0);
6657 match tx_header.ordinal {
6658 _ => Err(fidl::Error::UnknownOrdinal {
6659 ordinal: tx_header.ordinal,
6660 protocol_name: <LightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6661 }),
6662 }
6663 }
6664}
6665
6666pub struct LightRequestStream {
6668 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6669 is_terminated: bool,
6670}
6671
6672impl std::marker::Unpin for LightRequestStream {}
6673
6674impl futures::stream::FusedStream for LightRequestStream {
6675 fn is_terminated(&self) -> bool {
6676 self.is_terminated
6677 }
6678}
6679
6680impl fidl::endpoints::RequestStream for LightRequestStream {
6681 type Protocol = LightMarker;
6682 type ControlHandle = LightControlHandle;
6683
6684 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6685 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6686 }
6687
6688 fn control_handle(&self) -> Self::ControlHandle {
6689 LightControlHandle { inner: self.inner.clone() }
6690 }
6691
6692 fn into_inner(
6693 self,
6694 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6695 {
6696 (self.inner, self.is_terminated)
6697 }
6698
6699 fn from_inner(
6700 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6701 is_terminated: bool,
6702 ) -> Self {
6703 Self { inner, is_terminated }
6704 }
6705}
6706
6707impl futures::Stream for LightRequestStream {
6708 type Item = Result<LightRequest, fidl::Error>;
6709
6710 fn poll_next(
6711 mut self: std::pin::Pin<&mut Self>,
6712 cx: &mut std::task::Context<'_>,
6713 ) -> std::task::Poll<Option<Self::Item>> {
6714 let this = &mut *self;
6715 if this.inner.check_shutdown(cx) {
6716 this.is_terminated = true;
6717 return std::task::Poll::Ready(None);
6718 }
6719 if this.is_terminated {
6720 panic!("polled LightRequestStream after completion");
6721 }
6722 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6723 |bytes, handles| {
6724 match this.inner.channel().read_etc(cx, bytes, handles) {
6725 std::task::Poll::Ready(Ok(())) => {}
6726 std::task::Poll::Pending => return std::task::Poll::Pending,
6727 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6728 this.is_terminated = true;
6729 return std::task::Poll::Ready(None);
6730 }
6731 std::task::Poll::Ready(Err(e)) => {
6732 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6733 e.into(),
6734 ))));
6735 }
6736 }
6737
6738 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6740
6741 std::task::Poll::Ready(Some(match header.ordinal {
6742 0x3f506de229db5930 => {
6743 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6744 let mut req = fidl::new_empty!(
6745 fidl::encoding::EmptyPayload,
6746 fidl::encoding::DefaultFuchsiaResourceDialect
6747 );
6748 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6749 let control_handle = LightControlHandle { inner: this.inner.clone() };
6750 Ok(LightRequest::WatchLightGroups {
6751 responder: LightWatchLightGroupsResponder {
6752 control_handle: std::mem::ManuallyDrop::new(control_handle),
6753 tx_id: header.tx_id,
6754 },
6755 })
6756 }
6757 0x3ef0331c388d56a3 => {
6758 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6759 let mut req = fidl::new_empty!(
6760 LightWatchLightGroupRequest,
6761 fidl::encoding::DefaultFuchsiaResourceDialect
6762 );
6763 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LightWatchLightGroupRequest>(&header, _body_bytes, handles, &mut req)?;
6764 let control_handle = LightControlHandle { inner: this.inner.clone() };
6765 Ok(LightRequest::WatchLightGroup {
6766 name: req.name,
6767
6768 responder: LightWatchLightGroupResponder {
6769 control_handle: std::mem::ManuallyDrop::new(control_handle),
6770 tx_id: header.tx_id,
6771 },
6772 })
6773 }
6774 0x15d9b62431fdf8d5 => {
6775 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6776 let mut req = fidl::new_empty!(
6777 LightSetLightGroupValuesRequest,
6778 fidl::encoding::DefaultFuchsiaResourceDialect
6779 );
6780 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LightSetLightGroupValuesRequest>(&header, _body_bytes, handles, &mut req)?;
6781 let control_handle = LightControlHandle { inner: this.inner.clone() };
6782 Ok(LightRequest::SetLightGroupValues {
6783 name: req.name,
6784 state: req.state,
6785
6786 responder: LightSetLightGroupValuesResponder {
6787 control_handle: std::mem::ManuallyDrop::new(control_handle),
6788 tx_id: header.tx_id,
6789 },
6790 })
6791 }
6792 _ => Err(fidl::Error::UnknownOrdinal {
6793 ordinal: header.ordinal,
6794 protocol_name: <LightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6795 }),
6796 }))
6797 },
6798 )
6799 }
6800}
6801
6802#[derive(Debug)]
6803pub enum LightRequest {
6804 WatchLightGroups { responder: LightWatchLightGroupsResponder },
6811 WatchLightGroup { name: String, responder: LightWatchLightGroupResponder },
6819 SetLightGroupValues {
6828 name: String,
6829 state: Vec<LightState>,
6830 responder: LightSetLightGroupValuesResponder,
6831 },
6832}
6833
6834impl LightRequest {
6835 #[allow(irrefutable_let_patterns)]
6836 pub fn into_watch_light_groups(self) -> Option<(LightWatchLightGroupsResponder)> {
6837 if let LightRequest::WatchLightGroups { responder } = self {
6838 Some((responder))
6839 } else {
6840 None
6841 }
6842 }
6843
6844 #[allow(irrefutable_let_patterns)]
6845 pub fn into_watch_light_group(self) -> Option<(String, LightWatchLightGroupResponder)> {
6846 if let LightRequest::WatchLightGroup { name, responder } = self {
6847 Some((name, responder))
6848 } else {
6849 None
6850 }
6851 }
6852
6853 #[allow(irrefutable_let_patterns)]
6854 pub fn into_set_light_group_values(
6855 self,
6856 ) -> Option<(String, Vec<LightState>, LightSetLightGroupValuesResponder)> {
6857 if let LightRequest::SetLightGroupValues { name, state, responder } = self {
6858 Some((name, state, responder))
6859 } else {
6860 None
6861 }
6862 }
6863
6864 pub fn method_name(&self) -> &'static str {
6866 match *self {
6867 LightRequest::WatchLightGroups { .. } => "watch_light_groups",
6868 LightRequest::WatchLightGroup { .. } => "watch_light_group",
6869 LightRequest::SetLightGroupValues { .. } => "set_light_group_values",
6870 }
6871 }
6872}
6873
6874#[derive(Debug, Clone)]
6875pub struct LightControlHandle {
6876 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6877}
6878
6879impl LightControlHandle {
6880 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6881 self.inner.shutdown_with_epitaph(status.into())
6882 }
6883}
6884
6885impl fidl::endpoints::ControlHandle for LightControlHandle {
6886 fn shutdown(&self) {
6887 self.inner.shutdown()
6888 }
6889
6890 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6891 self.inner.shutdown_with_epitaph(status)
6892 }
6893
6894 fn is_closed(&self) -> bool {
6895 self.inner.channel().is_closed()
6896 }
6897 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6898 self.inner.channel().on_closed()
6899 }
6900
6901 #[cfg(target_os = "fuchsia")]
6902 fn signal_peer(
6903 &self,
6904 clear_mask: zx::Signals,
6905 set_mask: zx::Signals,
6906 ) -> Result<(), zx_status::Status> {
6907 use fidl::Peered;
6908 self.inner.channel().signal_peer(clear_mask, set_mask)
6909 }
6910}
6911
6912impl LightControlHandle {}
6913
6914#[must_use = "FIDL methods require a response to be sent"]
6915#[derive(Debug)]
6916pub struct LightWatchLightGroupsResponder {
6917 control_handle: std::mem::ManuallyDrop<LightControlHandle>,
6918 tx_id: u32,
6919}
6920
6921impl std::ops::Drop for LightWatchLightGroupsResponder {
6925 fn drop(&mut self) {
6926 self.control_handle.shutdown();
6927 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6929 }
6930}
6931
6932impl fidl::endpoints::Responder for LightWatchLightGroupsResponder {
6933 type ControlHandle = LightControlHandle;
6934
6935 fn control_handle(&self) -> &LightControlHandle {
6936 &self.control_handle
6937 }
6938
6939 fn drop_without_shutdown(mut self) {
6940 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6942 std::mem::forget(self);
6944 }
6945}
6946
6947impl LightWatchLightGroupsResponder {
6948 pub fn send(self, mut groups: &[LightGroup]) -> Result<(), fidl::Error> {
6952 let _result = self.send_raw(groups);
6953 if _result.is_err() {
6954 self.control_handle.shutdown();
6955 }
6956 self.drop_without_shutdown();
6957 _result
6958 }
6959
6960 pub fn send_no_shutdown_on_err(self, mut groups: &[LightGroup]) -> Result<(), fidl::Error> {
6962 let _result = self.send_raw(groups);
6963 self.drop_without_shutdown();
6964 _result
6965 }
6966
6967 fn send_raw(&self, mut groups: &[LightGroup]) -> Result<(), fidl::Error> {
6968 self.control_handle.inner.send::<LightWatchLightGroupsResponse>(
6969 (groups,),
6970 self.tx_id,
6971 0x3f506de229db5930,
6972 fidl::encoding::DynamicFlags::empty(),
6973 )
6974 }
6975}
6976
6977#[must_use = "FIDL methods require a response to be sent"]
6978#[derive(Debug)]
6979pub struct LightWatchLightGroupResponder {
6980 control_handle: std::mem::ManuallyDrop<LightControlHandle>,
6981 tx_id: u32,
6982}
6983
6984impl std::ops::Drop for LightWatchLightGroupResponder {
6988 fn drop(&mut self) {
6989 self.control_handle.shutdown();
6990 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6992 }
6993}
6994
6995impl fidl::endpoints::Responder for LightWatchLightGroupResponder {
6996 type ControlHandle = LightControlHandle;
6997
6998 fn control_handle(&self) -> &LightControlHandle {
6999 &self.control_handle
7000 }
7001
7002 fn drop_without_shutdown(mut self) {
7003 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7005 std::mem::forget(self);
7007 }
7008}
7009
7010impl LightWatchLightGroupResponder {
7011 pub fn send(self, mut group: &LightGroup) -> Result<(), fidl::Error> {
7015 let _result = self.send_raw(group);
7016 if _result.is_err() {
7017 self.control_handle.shutdown();
7018 }
7019 self.drop_without_shutdown();
7020 _result
7021 }
7022
7023 pub fn send_no_shutdown_on_err(self, mut group: &LightGroup) -> Result<(), fidl::Error> {
7025 let _result = self.send_raw(group);
7026 self.drop_without_shutdown();
7027 _result
7028 }
7029
7030 fn send_raw(&self, mut group: &LightGroup) -> Result<(), fidl::Error> {
7031 self.control_handle.inner.send::<LightWatchLightGroupResponse>(
7032 (group,),
7033 self.tx_id,
7034 0x3ef0331c388d56a3,
7035 fidl::encoding::DynamicFlags::empty(),
7036 )
7037 }
7038}
7039
7040#[must_use = "FIDL methods require a response to be sent"]
7041#[derive(Debug)]
7042pub struct LightSetLightGroupValuesResponder {
7043 control_handle: std::mem::ManuallyDrop<LightControlHandle>,
7044 tx_id: u32,
7045}
7046
7047impl std::ops::Drop for LightSetLightGroupValuesResponder {
7051 fn drop(&mut self) {
7052 self.control_handle.shutdown();
7053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7055 }
7056}
7057
7058impl fidl::endpoints::Responder for LightSetLightGroupValuesResponder {
7059 type ControlHandle = LightControlHandle;
7060
7061 fn control_handle(&self) -> &LightControlHandle {
7062 &self.control_handle
7063 }
7064
7065 fn drop_without_shutdown(mut self) {
7066 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7068 std::mem::forget(self);
7070 }
7071}
7072
7073impl LightSetLightGroupValuesResponder {
7074 pub fn send(self, mut result: Result<(), LightError>) -> Result<(), fidl::Error> {
7078 let _result = self.send_raw(result);
7079 if _result.is_err() {
7080 self.control_handle.shutdown();
7081 }
7082 self.drop_without_shutdown();
7083 _result
7084 }
7085
7086 pub fn send_no_shutdown_on_err(
7088 self,
7089 mut result: Result<(), LightError>,
7090 ) -> Result<(), fidl::Error> {
7091 let _result = self.send_raw(result);
7092 self.drop_without_shutdown();
7093 _result
7094 }
7095
7096 fn send_raw(&self, mut result: Result<(), LightError>) -> Result<(), fidl::Error> {
7097 self.control_handle
7098 .inner
7099 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LightError>>(
7100 result,
7101 self.tx_id,
7102 0x15d9b62431fdf8d5,
7103 fidl::encoding::DynamicFlags::empty(),
7104 )
7105 }
7106}
7107
7108#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7109pub struct NightModeMarker;
7110
7111impl fidl::endpoints::ProtocolMarker for NightModeMarker {
7112 type Proxy = NightModeProxy;
7113 type RequestStream = NightModeRequestStream;
7114 #[cfg(target_os = "fuchsia")]
7115 type SynchronousProxy = NightModeSynchronousProxy;
7116
7117 const DEBUG_NAME: &'static str = "fuchsia.settings.NightMode";
7118}
7119impl fidl::endpoints::DiscoverableProtocolMarker for NightModeMarker {}
7120pub type NightModeSetResult = Result<(), Error>;
7121
7122pub trait NightModeProxyInterface: Send + Sync {
7123 type WatchResponseFut: std::future::Future<Output = Result<NightModeSettings, fidl::Error>>
7124 + Send;
7125 fn r#watch(&self) -> Self::WatchResponseFut;
7126 type SetResponseFut: std::future::Future<Output = Result<NightModeSetResult, fidl::Error>>
7127 + Send;
7128 fn r#set(&self, settings: &NightModeSettings) -> Self::SetResponseFut;
7129}
7130#[derive(Debug)]
7131#[cfg(target_os = "fuchsia")]
7132pub struct NightModeSynchronousProxy {
7133 client: fidl::client::sync::Client,
7134}
7135
7136#[cfg(target_os = "fuchsia")]
7137impl fidl::endpoints::SynchronousProxy for NightModeSynchronousProxy {
7138 type Proxy = NightModeProxy;
7139 type Protocol = NightModeMarker;
7140
7141 fn from_channel(inner: fidl::Channel) -> Self {
7142 Self::new(inner)
7143 }
7144
7145 fn into_channel(self) -> fidl::Channel {
7146 self.client.into_channel()
7147 }
7148
7149 fn as_channel(&self) -> &fidl::Channel {
7150 self.client.as_channel()
7151 }
7152}
7153
7154#[cfg(target_os = "fuchsia")]
7155impl NightModeSynchronousProxy {
7156 pub fn new(channel: fidl::Channel) -> Self {
7157 Self { client: fidl::client::sync::Client::new(channel) }
7158 }
7159
7160 pub fn into_channel(self) -> fidl::Channel {
7161 self.client.into_channel()
7162 }
7163
7164 pub fn wait_for_event(
7167 &self,
7168 deadline: zx::MonotonicInstant,
7169 ) -> Result<NightModeEvent, fidl::Error> {
7170 NightModeEvent::decode(self.client.wait_for_event::<NightModeMarker>(deadline)?)
7171 }
7172
7173 pub fn r#watch(
7179 &self,
7180 ___deadline: zx::MonotonicInstant,
7181 ) -> Result<NightModeSettings, fidl::Error> {
7182 let _response = self
7183 .client
7184 .send_query::<fidl::encoding::EmptyPayload, NightModeWatchResponse, NightModeMarker>(
7185 (),
7186 0x7e1509bf8c7582f6,
7187 fidl::encoding::DynamicFlags::empty(),
7188 ___deadline,
7189 )?;
7190 Ok(_response.settings)
7191 }
7192
7193 pub fn r#set(
7196 &self,
7197 mut settings: &NightModeSettings,
7198 ___deadline: zx::MonotonicInstant,
7199 ) -> Result<NightModeSetResult, fidl::Error> {
7200 let _response = self.client.send_query::<NightModeSetRequest, fidl::encoding::ResultType<
7201 fidl::encoding::EmptyStruct,
7202 Error,
7203 >, NightModeMarker>(
7204 (settings,),
7205 0x28c3d78ab05b55cd,
7206 fidl::encoding::DynamicFlags::empty(),
7207 ___deadline,
7208 )?;
7209 Ok(_response.map(|x| x))
7210 }
7211}
7212
7213#[cfg(target_os = "fuchsia")]
7214impl From<NightModeSynchronousProxy> for zx::NullableHandle {
7215 fn from(value: NightModeSynchronousProxy) -> Self {
7216 value.into_channel().into()
7217 }
7218}
7219
7220#[cfg(target_os = "fuchsia")]
7221impl From<fidl::Channel> for NightModeSynchronousProxy {
7222 fn from(value: fidl::Channel) -> Self {
7223 Self::new(value)
7224 }
7225}
7226
7227#[cfg(target_os = "fuchsia")]
7228impl fidl::endpoints::FromClient for NightModeSynchronousProxy {
7229 type Protocol = NightModeMarker;
7230
7231 fn from_client(value: fidl::endpoints::ClientEnd<NightModeMarker>) -> Self {
7232 Self::new(value.into_channel())
7233 }
7234}
7235
7236#[derive(Debug, Clone)]
7237pub struct NightModeProxy {
7238 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7239}
7240
7241impl fidl::endpoints::Proxy for NightModeProxy {
7242 type Protocol = NightModeMarker;
7243
7244 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7245 Self::new(inner)
7246 }
7247
7248 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7249 self.client.into_channel().map_err(|client| Self { client })
7250 }
7251
7252 fn as_channel(&self) -> &::fidl::AsyncChannel {
7253 self.client.as_channel()
7254 }
7255}
7256
7257impl NightModeProxy {
7258 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7260 let protocol_name = <NightModeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7261 Self { client: fidl::client::Client::new(channel, protocol_name) }
7262 }
7263
7264 pub fn take_event_stream(&self) -> NightModeEventStream {
7270 NightModeEventStream { event_receiver: self.client.take_event_receiver() }
7271 }
7272
7273 pub fn r#watch(
7279 &self,
7280 ) -> fidl::client::QueryResponseFut<
7281 NightModeSettings,
7282 fidl::encoding::DefaultFuchsiaResourceDialect,
7283 > {
7284 NightModeProxyInterface::r#watch(self)
7285 }
7286
7287 pub fn r#set(
7290 &self,
7291 mut settings: &NightModeSettings,
7292 ) -> fidl::client::QueryResponseFut<
7293 NightModeSetResult,
7294 fidl::encoding::DefaultFuchsiaResourceDialect,
7295 > {
7296 NightModeProxyInterface::r#set(self, settings)
7297 }
7298}
7299
7300impl NightModeProxyInterface for NightModeProxy {
7301 type WatchResponseFut = fidl::client::QueryResponseFut<
7302 NightModeSettings,
7303 fidl::encoding::DefaultFuchsiaResourceDialect,
7304 >;
7305 fn r#watch(&self) -> Self::WatchResponseFut {
7306 fn _decode(
7307 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7308 ) -> Result<NightModeSettings, fidl::Error> {
7309 let _response = fidl::client::decode_transaction_body::<
7310 NightModeWatchResponse,
7311 fidl::encoding::DefaultFuchsiaResourceDialect,
7312 0x7e1509bf8c7582f6,
7313 >(_buf?)?;
7314 Ok(_response.settings)
7315 }
7316 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NightModeSettings>(
7317 (),
7318 0x7e1509bf8c7582f6,
7319 fidl::encoding::DynamicFlags::empty(),
7320 _decode,
7321 )
7322 }
7323
7324 type SetResponseFut = fidl::client::QueryResponseFut<
7325 NightModeSetResult,
7326 fidl::encoding::DefaultFuchsiaResourceDialect,
7327 >;
7328 fn r#set(&self, mut settings: &NightModeSettings) -> Self::SetResponseFut {
7329 fn _decode(
7330 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7331 ) -> Result<NightModeSetResult, fidl::Error> {
7332 let _response = fidl::client::decode_transaction_body::<
7333 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7334 fidl::encoding::DefaultFuchsiaResourceDialect,
7335 0x28c3d78ab05b55cd,
7336 >(_buf?)?;
7337 Ok(_response.map(|x| x))
7338 }
7339 self.client.send_query_and_decode::<NightModeSetRequest, NightModeSetResult>(
7340 (settings,),
7341 0x28c3d78ab05b55cd,
7342 fidl::encoding::DynamicFlags::empty(),
7343 _decode,
7344 )
7345 }
7346}
7347
7348pub struct NightModeEventStream {
7349 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7350}
7351
7352impl std::marker::Unpin for NightModeEventStream {}
7353
7354impl futures::stream::FusedStream for NightModeEventStream {
7355 fn is_terminated(&self) -> bool {
7356 self.event_receiver.is_terminated()
7357 }
7358}
7359
7360impl futures::Stream for NightModeEventStream {
7361 type Item = Result<NightModeEvent, fidl::Error>;
7362
7363 fn poll_next(
7364 mut self: std::pin::Pin<&mut Self>,
7365 cx: &mut std::task::Context<'_>,
7366 ) -> std::task::Poll<Option<Self::Item>> {
7367 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7368 &mut self.event_receiver,
7369 cx
7370 )?) {
7371 Some(buf) => std::task::Poll::Ready(Some(NightModeEvent::decode(buf))),
7372 None => std::task::Poll::Ready(None),
7373 }
7374 }
7375}
7376
7377#[derive(Debug)]
7378pub enum NightModeEvent {}
7379
7380impl NightModeEvent {
7381 fn decode(
7383 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7384 ) -> Result<NightModeEvent, fidl::Error> {
7385 let (bytes, _handles) = buf.split_mut();
7386 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7387 debug_assert_eq!(tx_header.tx_id, 0);
7388 match tx_header.ordinal {
7389 _ => Err(fidl::Error::UnknownOrdinal {
7390 ordinal: tx_header.ordinal,
7391 protocol_name: <NightModeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7392 }),
7393 }
7394 }
7395}
7396
7397pub struct NightModeRequestStream {
7399 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7400 is_terminated: bool,
7401}
7402
7403impl std::marker::Unpin for NightModeRequestStream {}
7404
7405impl futures::stream::FusedStream for NightModeRequestStream {
7406 fn is_terminated(&self) -> bool {
7407 self.is_terminated
7408 }
7409}
7410
7411impl fidl::endpoints::RequestStream for NightModeRequestStream {
7412 type Protocol = NightModeMarker;
7413 type ControlHandle = NightModeControlHandle;
7414
7415 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7416 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7417 }
7418
7419 fn control_handle(&self) -> Self::ControlHandle {
7420 NightModeControlHandle { inner: self.inner.clone() }
7421 }
7422
7423 fn into_inner(
7424 self,
7425 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7426 {
7427 (self.inner, self.is_terminated)
7428 }
7429
7430 fn from_inner(
7431 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7432 is_terminated: bool,
7433 ) -> Self {
7434 Self { inner, is_terminated }
7435 }
7436}
7437
7438impl futures::Stream for NightModeRequestStream {
7439 type Item = Result<NightModeRequest, fidl::Error>;
7440
7441 fn poll_next(
7442 mut self: std::pin::Pin<&mut Self>,
7443 cx: &mut std::task::Context<'_>,
7444 ) -> std::task::Poll<Option<Self::Item>> {
7445 let this = &mut *self;
7446 if this.inner.check_shutdown(cx) {
7447 this.is_terminated = true;
7448 return std::task::Poll::Ready(None);
7449 }
7450 if this.is_terminated {
7451 panic!("polled NightModeRequestStream after completion");
7452 }
7453 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7454 |bytes, handles| {
7455 match this.inner.channel().read_etc(cx, bytes, handles) {
7456 std::task::Poll::Ready(Ok(())) => {}
7457 std::task::Poll::Pending => return std::task::Poll::Pending,
7458 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7459 this.is_terminated = true;
7460 return std::task::Poll::Ready(None);
7461 }
7462 std::task::Poll::Ready(Err(e)) => {
7463 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7464 e.into(),
7465 ))));
7466 }
7467 }
7468
7469 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7471
7472 std::task::Poll::Ready(Some(match header.ordinal {
7473 0x7e1509bf8c7582f6 => {
7474 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7475 let mut req = fidl::new_empty!(
7476 fidl::encoding::EmptyPayload,
7477 fidl::encoding::DefaultFuchsiaResourceDialect
7478 );
7479 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7480 let control_handle = NightModeControlHandle { inner: this.inner.clone() };
7481 Ok(NightModeRequest::Watch {
7482 responder: NightModeWatchResponder {
7483 control_handle: std::mem::ManuallyDrop::new(control_handle),
7484 tx_id: header.tx_id,
7485 },
7486 })
7487 }
7488 0x28c3d78ab05b55cd => {
7489 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7490 let mut req = fidl::new_empty!(
7491 NightModeSetRequest,
7492 fidl::encoding::DefaultFuchsiaResourceDialect
7493 );
7494 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NightModeSetRequest>(&header, _body_bytes, handles, &mut req)?;
7495 let control_handle = NightModeControlHandle { inner: this.inner.clone() };
7496 Ok(NightModeRequest::Set {
7497 settings: req.settings,
7498
7499 responder: NightModeSetResponder {
7500 control_handle: std::mem::ManuallyDrop::new(control_handle),
7501 tx_id: header.tx_id,
7502 },
7503 })
7504 }
7505 _ => Err(fidl::Error::UnknownOrdinal {
7506 ordinal: header.ordinal,
7507 protocol_name:
7508 <NightModeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7509 }),
7510 }))
7511 },
7512 )
7513 }
7514}
7515
7516#[derive(Debug)]
7527pub enum NightModeRequest {
7528 Watch { responder: NightModeWatchResponder },
7534 Set { settings: NightModeSettings, responder: NightModeSetResponder },
7537}
7538
7539impl NightModeRequest {
7540 #[allow(irrefutable_let_patterns)]
7541 pub fn into_watch(self) -> Option<(NightModeWatchResponder)> {
7542 if let NightModeRequest::Watch { responder } = self { Some((responder)) } else { None }
7543 }
7544
7545 #[allow(irrefutable_let_patterns)]
7546 pub fn into_set(self) -> Option<(NightModeSettings, NightModeSetResponder)> {
7547 if let NightModeRequest::Set { settings, responder } = self {
7548 Some((settings, responder))
7549 } else {
7550 None
7551 }
7552 }
7553
7554 pub fn method_name(&self) -> &'static str {
7556 match *self {
7557 NightModeRequest::Watch { .. } => "watch",
7558 NightModeRequest::Set { .. } => "set",
7559 }
7560 }
7561}
7562
7563#[derive(Debug, Clone)]
7564pub struct NightModeControlHandle {
7565 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7566}
7567
7568impl NightModeControlHandle {
7569 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7570 self.inner.shutdown_with_epitaph(status.into())
7571 }
7572}
7573
7574impl fidl::endpoints::ControlHandle for NightModeControlHandle {
7575 fn shutdown(&self) {
7576 self.inner.shutdown()
7577 }
7578
7579 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7580 self.inner.shutdown_with_epitaph(status)
7581 }
7582
7583 fn is_closed(&self) -> bool {
7584 self.inner.channel().is_closed()
7585 }
7586 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7587 self.inner.channel().on_closed()
7588 }
7589
7590 #[cfg(target_os = "fuchsia")]
7591 fn signal_peer(
7592 &self,
7593 clear_mask: zx::Signals,
7594 set_mask: zx::Signals,
7595 ) -> Result<(), zx_status::Status> {
7596 use fidl::Peered;
7597 self.inner.channel().signal_peer(clear_mask, set_mask)
7598 }
7599}
7600
7601impl NightModeControlHandle {}
7602
7603#[must_use = "FIDL methods require a response to be sent"]
7604#[derive(Debug)]
7605pub struct NightModeWatchResponder {
7606 control_handle: std::mem::ManuallyDrop<NightModeControlHandle>,
7607 tx_id: u32,
7608}
7609
7610impl std::ops::Drop for NightModeWatchResponder {
7614 fn drop(&mut self) {
7615 self.control_handle.shutdown();
7616 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7618 }
7619}
7620
7621impl fidl::endpoints::Responder for NightModeWatchResponder {
7622 type ControlHandle = NightModeControlHandle;
7623
7624 fn control_handle(&self) -> &NightModeControlHandle {
7625 &self.control_handle
7626 }
7627
7628 fn drop_without_shutdown(mut self) {
7629 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7631 std::mem::forget(self);
7633 }
7634}
7635
7636impl NightModeWatchResponder {
7637 pub fn send(self, mut settings: &NightModeSettings) -> Result<(), fidl::Error> {
7641 let _result = self.send_raw(settings);
7642 if _result.is_err() {
7643 self.control_handle.shutdown();
7644 }
7645 self.drop_without_shutdown();
7646 _result
7647 }
7648
7649 pub fn send_no_shutdown_on_err(
7651 self,
7652 mut settings: &NightModeSettings,
7653 ) -> Result<(), fidl::Error> {
7654 let _result = self.send_raw(settings);
7655 self.drop_without_shutdown();
7656 _result
7657 }
7658
7659 fn send_raw(&self, mut settings: &NightModeSettings) -> Result<(), fidl::Error> {
7660 self.control_handle.inner.send::<NightModeWatchResponse>(
7661 (settings,),
7662 self.tx_id,
7663 0x7e1509bf8c7582f6,
7664 fidl::encoding::DynamicFlags::empty(),
7665 )
7666 }
7667}
7668
7669#[must_use = "FIDL methods require a response to be sent"]
7670#[derive(Debug)]
7671pub struct NightModeSetResponder {
7672 control_handle: std::mem::ManuallyDrop<NightModeControlHandle>,
7673 tx_id: u32,
7674}
7675
7676impl std::ops::Drop for NightModeSetResponder {
7680 fn drop(&mut self) {
7681 self.control_handle.shutdown();
7682 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7684 }
7685}
7686
7687impl fidl::endpoints::Responder for NightModeSetResponder {
7688 type ControlHandle = NightModeControlHandle;
7689
7690 fn control_handle(&self) -> &NightModeControlHandle {
7691 &self.control_handle
7692 }
7693
7694 fn drop_without_shutdown(mut self) {
7695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7697 std::mem::forget(self);
7699 }
7700}
7701
7702impl NightModeSetResponder {
7703 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7707 let _result = self.send_raw(result);
7708 if _result.is_err() {
7709 self.control_handle.shutdown();
7710 }
7711 self.drop_without_shutdown();
7712 _result
7713 }
7714
7715 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7717 let _result = self.send_raw(result);
7718 self.drop_without_shutdown();
7719 _result
7720 }
7721
7722 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7723 self.control_handle
7724 .inner
7725 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7726 result,
7727 self.tx_id,
7728 0x28c3d78ab05b55cd,
7729 fidl::encoding::DynamicFlags::empty(),
7730 )
7731 }
7732}
7733
7734#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7735pub struct PrivacyMarker;
7736
7737impl fidl::endpoints::ProtocolMarker for PrivacyMarker {
7738 type Proxy = PrivacyProxy;
7739 type RequestStream = PrivacyRequestStream;
7740 #[cfg(target_os = "fuchsia")]
7741 type SynchronousProxy = PrivacySynchronousProxy;
7742
7743 const DEBUG_NAME: &'static str = "fuchsia.settings.Privacy";
7744}
7745impl fidl::endpoints::DiscoverableProtocolMarker for PrivacyMarker {}
7746pub type PrivacySetResult = Result<(), Error>;
7747
7748pub trait PrivacyProxyInterface: Send + Sync {
7749 type WatchResponseFut: std::future::Future<Output = Result<PrivacySettings, fidl::Error>> + Send;
7750 fn r#watch(&self) -> Self::WatchResponseFut;
7751 type SetResponseFut: std::future::Future<Output = Result<PrivacySetResult, fidl::Error>> + Send;
7752 fn r#set(&self, settings: &PrivacySettings) -> Self::SetResponseFut;
7753}
7754#[derive(Debug)]
7755#[cfg(target_os = "fuchsia")]
7756pub struct PrivacySynchronousProxy {
7757 client: fidl::client::sync::Client,
7758}
7759
7760#[cfg(target_os = "fuchsia")]
7761impl fidl::endpoints::SynchronousProxy for PrivacySynchronousProxy {
7762 type Proxy = PrivacyProxy;
7763 type Protocol = PrivacyMarker;
7764
7765 fn from_channel(inner: fidl::Channel) -> Self {
7766 Self::new(inner)
7767 }
7768
7769 fn into_channel(self) -> fidl::Channel {
7770 self.client.into_channel()
7771 }
7772
7773 fn as_channel(&self) -> &fidl::Channel {
7774 self.client.as_channel()
7775 }
7776}
7777
7778#[cfg(target_os = "fuchsia")]
7779impl PrivacySynchronousProxy {
7780 pub fn new(channel: fidl::Channel) -> Self {
7781 Self { client: fidl::client::sync::Client::new(channel) }
7782 }
7783
7784 pub fn into_channel(self) -> fidl::Channel {
7785 self.client.into_channel()
7786 }
7787
7788 pub fn wait_for_event(
7791 &self,
7792 deadline: zx::MonotonicInstant,
7793 ) -> Result<PrivacyEvent, fidl::Error> {
7794 PrivacyEvent::decode(self.client.wait_for_event::<PrivacyMarker>(deadline)?)
7795 }
7796
7797 pub fn r#watch(
7805 &self,
7806 ___deadline: zx::MonotonicInstant,
7807 ) -> Result<PrivacySettings, fidl::Error> {
7808 let _response = self
7809 .client
7810 .send_query::<fidl::encoding::EmptyPayload, PrivacyWatchResponse, PrivacyMarker>(
7811 (),
7812 0x1cb0c420ed81f47c,
7813 fidl::encoding::DynamicFlags::empty(),
7814 ___deadline,
7815 )?;
7816 Ok(_response.settings)
7817 }
7818
7819 pub fn r#set(
7823 &self,
7824 mut settings: &PrivacySettings,
7825 ___deadline: zx::MonotonicInstant,
7826 ) -> Result<PrivacySetResult, fidl::Error> {
7827 let _response = self.client.send_query::<PrivacySetRequest, fidl::encoding::ResultType<
7828 fidl::encoding::EmptyStruct,
7829 Error,
7830 >, PrivacyMarker>(
7831 (settings,),
7832 0xe2f4a1c85885537,
7833 fidl::encoding::DynamicFlags::empty(),
7834 ___deadline,
7835 )?;
7836 Ok(_response.map(|x| x))
7837 }
7838}
7839
7840#[cfg(target_os = "fuchsia")]
7841impl From<PrivacySynchronousProxy> for zx::NullableHandle {
7842 fn from(value: PrivacySynchronousProxy) -> Self {
7843 value.into_channel().into()
7844 }
7845}
7846
7847#[cfg(target_os = "fuchsia")]
7848impl From<fidl::Channel> for PrivacySynchronousProxy {
7849 fn from(value: fidl::Channel) -> Self {
7850 Self::new(value)
7851 }
7852}
7853
7854#[cfg(target_os = "fuchsia")]
7855impl fidl::endpoints::FromClient for PrivacySynchronousProxy {
7856 type Protocol = PrivacyMarker;
7857
7858 fn from_client(value: fidl::endpoints::ClientEnd<PrivacyMarker>) -> Self {
7859 Self::new(value.into_channel())
7860 }
7861}
7862
7863#[derive(Debug, Clone)]
7864pub struct PrivacyProxy {
7865 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7866}
7867
7868impl fidl::endpoints::Proxy for PrivacyProxy {
7869 type Protocol = PrivacyMarker;
7870
7871 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7872 Self::new(inner)
7873 }
7874
7875 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7876 self.client.into_channel().map_err(|client| Self { client })
7877 }
7878
7879 fn as_channel(&self) -> &::fidl::AsyncChannel {
7880 self.client.as_channel()
7881 }
7882}
7883
7884impl PrivacyProxy {
7885 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7887 let protocol_name = <PrivacyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7888 Self { client: fidl::client::Client::new(channel, protocol_name) }
7889 }
7890
7891 pub fn take_event_stream(&self) -> PrivacyEventStream {
7897 PrivacyEventStream { event_receiver: self.client.take_event_receiver() }
7898 }
7899
7900 pub fn r#watch(
7908 &self,
7909 ) -> fidl::client::QueryResponseFut<
7910 PrivacySettings,
7911 fidl::encoding::DefaultFuchsiaResourceDialect,
7912 > {
7913 PrivacyProxyInterface::r#watch(self)
7914 }
7915
7916 pub fn r#set(
7920 &self,
7921 mut settings: &PrivacySettings,
7922 ) -> fidl::client::QueryResponseFut<
7923 PrivacySetResult,
7924 fidl::encoding::DefaultFuchsiaResourceDialect,
7925 > {
7926 PrivacyProxyInterface::r#set(self, settings)
7927 }
7928}
7929
7930impl PrivacyProxyInterface for PrivacyProxy {
7931 type WatchResponseFut = fidl::client::QueryResponseFut<
7932 PrivacySettings,
7933 fidl::encoding::DefaultFuchsiaResourceDialect,
7934 >;
7935 fn r#watch(&self) -> Self::WatchResponseFut {
7936 fn _decode(
7937 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7938 ) -> Result<PrivacySettings, fidl::Error> {
7939 let _response = fidl::client::decode_transaction_body::<
7940 PrivacyWatchResponse,
7941 fidl::encoding::DefaultFuchsiaResourceDialect,
7942 0x1cb0c420ed81f47c,
7943 >(_buf?)?;
7944 Ok(_response.settings)
7945 }
7946 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PrivacySettings>(
7947 (),
7948 0x1cb0c420ed81f47c,
7949 fidl::encoding::DynamicFlags::empty(),
7950 _decode,
7951 )
7952 }
7953
7954 type SetResponseFut = fidl::client::QueryResponseFut<
7955 PrivacySetResult,
7956 fidl::encoding::DefaultFuchsiaResourceDialect,
7957 >;
7958 fn r#set(&self, mut settings: &PrivacySettings) -> Self::SetResponseFut {
7959 fn _decode(
7960 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7961 ) -> Result<PrivacySetResult, fidl::Error> {
7962 let _response = fidl::client::decode_transaction_body::<
7963 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7964 fidl::encoding::DefaultFuchsiaResourceDialect,
7965 0xe2f4a1c85885537,
7966 >(_buf?)?;
7967 Ok(_response.map(|x| x))
7968 }
7969 self.client.send_query_and_decode::<PrivacySetRequest, PrivacySetResult>(
7970 (settings,),
7971 0xe2f4a1c85885537,
7972 fidl::encoding::DynamicFlags::empty(),
7973 _decode,
7974 )
7975 }
7976}
7977
7978pub struct PrivacyEventStream {
7979 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7980}
7981
7982impl std::marker::Unpin for PrivacyEventStream {}
7983
7984impl futures::stream::FusedStream for PrivacyEventStream {
7985 fn is_terminated(&self) -> bool {
7986 self.event_receiver.is_terminated()
7987 }
7988}
7989
7990impl futures::Stream for PrivacyEventStream {
7991 type Item = Result<PrivacyEvent, fidl::Error>;
7992
7993 fn poll_next(
7994 mut self: std::pin::Pin<&mut Self>,
7995 cx: &mut std::task::Context<'_>,
7996 ) -> std::task::Poll<Option<Self::Item>> {
7997 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7998 &mut self.event_receiver,
7999 cx
8000 )?) {
8001 Some(buf) => std::task::Poll::Ready(Some(PrivacyEvent::decode(buf))),
8002 None => std::task::Poll::Ready(None),
8003 }
8004 }
8005}
8006
8007#[derive(Debug)]
8008pub enum PrivacyEvent {}
8009
8010impl PrivacyEvent {
8011 fn decode(
8013 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8014 ) -> Result<PrivacyEvent, fidl::Error> {
8015 let (bytes, _handles) = buf.split_mut();
8016 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8017 debug_assert_eq!(tx_header.tx_id, 0);
8018 match tx_header.ordinal {
8019 _ => Err(fidl::Error::UnknownOrdinal {
8020 ordinal: tx_header.ordinal,
8021 protocol_name: <PrivacyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8022 }),
8023 }
8024 }
8025}
8026
8027pub struct PrivacyRequestStream {
8029 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8030 is_terminated: bool,
8031}
8032
8033impl std::marker::Unpin for PrivacyRequestStream {}
8034
8035impl futures::stream::FusedStream for PrivacyRequestStream {
8036 fn is_terminated(&self) -> bool {
8037 self.is_terminated
8038 }
8039}
8040
8041impl fidl::endpoints::RequestStream for PrivacyRequestStream {
8042 type Protocol = PrivacyMarker;
8043 type ControlHandle = PrivacyControlHandle;
8044
8045 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8046 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8047 }
8048
8049 fn control_handle(&self) -> Self::ControlHandle {
8050 PrivacyControlHandle { inner: self.inner.clone() }
8051 }
8052
8053 fn into_inner(
8054 self,
8055 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8056 {
8057 (self.inner, self.is_terminated)
8058 }
8059
8060 fn from_inner(
8061 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8062 is_terminated: bool,
8063 ) -> Self {
8064 Self { inner, is_terminated }
8065 }
8066}
8067
8068impl futures::Stream for PrivacyRequestStream {
8069 type Item = Result<PrivacyRequest, fidl::Error>;
8070
8071 fn poll_next(
8072 mut self: std::pin::Pin<&mut Self>,
8073 cx: &mut std::task::Context<'_>,
8074 ) -> std::task::Poll<Option<Self::Item>> {
8075 let this = &mut *self;
8076 if this.inner.check_shutdown(cx) {
8077 this.is_terminated = true;
8078 return std::task::Poll::Ready(None);
8079 }
8080 if this.is_terminated {
8081 panic!("polled PrivacyRequestStream after completion");
8082 }
8083 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8084 |bytes, handles| {
8085 match this.inner.channel().read_etc(cx, bytes, handles) {
8086 std::task::Poll::Ready(Ok(())) => {}
8087 std::task::Poll::Pending => return std::task::Poll::Pending,
8088 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8089 this.is_terminated = true;
8090 return std::task::Poll::Ready(None);
8091 }
8092 std::task::Poll::Ready(Err(e)) => {
8093 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8094 e.into(),
8095 ))));
8096 }
8097 }
8098
8099 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8101
8102 std::task::Poll::Ready(Some(match header.ordinal {
8103 0x1cb0c420ed81f47c => {
8104 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8105 let mut req = fidl::new_empty!(
8106 fidl::encoding::EmptyPayload,
8107 fidl::encoding::DefaultFuchsiaResourceDialect
8108 );
8109 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8110 let control_handle = PrivacyControlHandle { inner: this.inner.clone() };
8111 Ok(PrivacyRequest::Watch {
8112 responder: PrivacyWatchResponder {
8113 control_handle: std::mem::ManuallyDrop::new(control_handle),
8114 tx_id: header.tx_id,
8115 },
8116 })
8117 }
8118 0xe2f4a1c85885537 => {
8119 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8120 let mut req = fidl::new_empty!(
8121 PrivacySetRequest,
8122 fidl::encoding::DefaultFuchsiaResourceDialect
8123 );
8124 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrivacySetRequest>(&header, _body_bytes, handles, &mut req)?;
8125 let control_handle = PrivacyControlHandle { inner: this.inner.clone() };
8126 Ok(PrivacyRequest::Set {
8127 settings: req.settings,
8128
8129 responder: PrivacySetResponder {
8130 control_handle: std::mem::ManuallyDrop::new(control_handle),
8131 tx_id: header.tx_id,
8132 },
8133 })
8134 }
8135 _ => Err(fidl::Error::UnknownOrdinal {
8136 ordinal: header.ordinal,
8137 protocol_name:
8138 <PrivacyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8139 }),
8140 }))
8141 },
8142 )
8143 }
8144}
8145
8146#[derive(Debug)]
8151pub enum PrivacyRequest {
8152 Watch { responder: PrivacyWatchResponder },
8160 Set { settings: PrivacySettings, responder: PrivacySetResponder },
8164}
8165
8166impl PrivacyRequest {
8167 #[allow(irrefutable_let_patterns)]
8168 pub fn into_watch(self) -> Option<(PrivacyWatchResponder)> {
8169 if let PrivacyRequest::Watch { responder } = self { Some((responder)) } else { None }
8170 }
8171
8172 #[allow(irrefutable_let_patterns)]
8173 pub fn into_set(self) -> Option<(PrivacySettings, PrivacySetResponder)> {
8174 if let PrivacyRequest::Set { settings, responder } = self {
8175 Some((settings, responder))
8176 } else {
8177 None
8178 }
8179 }
8180
8181 pub fn method_name(&self) -> &'static str {
8183 match *self {
8184 PrivacyRequest::Watch { .. } => "watch",
8185 PrivacyRequest::Set { .. } => "set",
8186 }
8187 }
8188}
8189
8190#[derive(Debug, Clone)]
8191pub struct PrivacyControlHandle {
8192 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8193}
8194
8195impl PrivacyControlHandle {
8196 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8197 self.inner.shutdown_with_epitaph(status.into())
8198 }
8199}
8200
8201impl fidl::endpoints::ControlHandle for PrivacyControlHandle {
8202 fn shutdown(&self) {
8203 self.inner.shutdown()
8204 }
8205
8206 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8207 self.inner.shutdown_with_epitaph(status)
8208 }
8209
8210 fn is_closed(&self) -> bool {
8211 self.inner.channel().is_closed()
8212 }
8213 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8214 self.inner.channel().on_closed()
8215 }
8216
8217 #[cfg(target_os = "fuchsia")]
8218 fn signal_peer(
8219 &self,
8220 clear_mask: zx::Signals,
8221 set_mask: zx::Signals,
8222 ) -> Result<(), zx_status::Status> {
8223 use fidl::Peered;
8224 self.inner.channel().signal_peer(clear_mask, set_mask)
8225 }
8226}
8227
8228impl PrivacyControlHandle {}
8229
8230#[must_use = "FIDL methods require a response to be sent"]
8231#[derive(Debug)]
8232pub struct PrivacyWatchResponder {
8233 control_handle: std::mem::ManuallyDrop<PrivacyControlHandle>,
8234 tx_id: u32,
8235}
8236
8237impl std::ops::Drop for PrivacyWatchResponder {
8241 fn drop(&mut self) {
8242 self.control_handle.shutdown();
8243 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8245 }
8246}
8247
8248impl fidl::endpoints::Responder for PrivacyWatchResponder {
8249 type ControlHandle = PrivacyControlHandle;
8250
8251 fn control_handle(&self) -> &PrivacyControlHandle {
8252 &self.control_handle
8253 }
8254
8255 fn drop_without_shutdown(mut self) {
8256 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8258 std::mem::forget(self);
8260 }
8261}
8262
8263impl PrivacyWatchResponder {
8264 pub fn send(self, mut settings: &PrivacySettings) -> Result<(), fidl::Error> {
8268 let _result = self.send_raw(settings);
8269 if _result.is_err() {
8270 self.control_handle.shutdown();
8271 }
8272 self.drop_without_shutdown();
8273 _result
8274 }
8275
8276 pub fn send_no_shutdown_on_err(
8278 self,
8279 mut settings: &PrivacySettings,
8280 ) -> Result<(), fidl::Error> {
8281 let _result = self.send_raw(settings);
8282 self.drop_without_shutdown();
8283 _result
8284 }
8285
8286 fn send_raw(&self, mut settings: &PrivacySettings) -> Result<(), fidl::Error> {
8287 self.control_handle.inner.send::<PrivacyWatchResponse>(
8288 (settings,),
8289 self.tx_id,
8290 0x1cb0c420ed81f47c,
8291 fidl::encoding::DynamicFlags::empty(),
8292 )
8293 }
8294}
8295
8296#[must_use = "FIDL methods require a response to be sent"]
8297#[derive(Debug)]
8298pub struct PrivacySetResponder {
8299 control_handle: std::mem::ManuallyDrop<PrivacyControlHandle>,
8300 tx_id: u32,
8301}
8302
8303impl std::ops::Drop for PrivacySetResponder {
8307 fn drop(&mut self) {
8308 self.control_handle.shutdown();
8309 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8311 }
8312}
8313
8314impl fidl::endpoints::Responder for PrivacySetResponder {
8315 type ControlHandle = PrivacyControlHandle;
8316
8317 fn control_handle(&self) -> &PrivacyControlHandle {
8318 &self.control_handle
8319 }
8320
8321 fn drop_without_shutdown(mut self) {
8322 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8324 std::mem::forget(self);
8326 }
8327}
8328
8329impl PrivacySetResponder {
8330 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8334 let _result = self.send_raw(result);
8335 if _result.is_err() {
8336 self.control_handle.shutdown();
8337 }
8338 self.drop_without_shutdown();
8339 _result
8340 }
8341
8342 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8344 let _result = self.send_raw(result);
8345 self.drop_without_shutdown();
8346 _result
8347 }
8348
8349 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8350 self.control_handle
8351 .inner
8352 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
8353 result,
8354 self.tx_id,
8355 0xe2f4a1c85885537,
8356 fidl::encoding::DynamicFlags::empty(),
8357 )
8358 }
8359}
8360
8361#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8362pub struct SetupMarker;
8363
8364impl fidl::endpoints::ProtocolMarker for SetupMarker {
8365 type Proxy = SetupProxy;
8366 type RequestStream = SetupRequestStream;
8367 #[cfg(target_os = "fuchsia")]
8368 type SynchronousProxy = SetupSynchronousProxy;
8369
8370 const DEBUG_NAME: &'static str = "fuchsia.settings.Setup";
8371}
8372impl fidl::endpoints::DiscoverableProtocolMarker for SetupMarker {}
8373pub type SetupSetResult = Result<(), Error>;
8374
8375pub trait SetupProxyInterface: Send + Sync {
8376 type WatchResponseFut: std::future::Future<Output = Result<SetupSettings, fidl::Error>> + Send;
8377 fn r#watch(&self) -> Self::WatchResponseFut;
8378 type SetResponseFut: std::future::Future<Output = Result<SetupSetResult, fidl::Error>> + Send;
8379 fn r#set(&self, settings: &SetupSettings, reboot_device: bool) -> Self::SetResponseFut;
8380}
8381#[derive(Debug)]
8382#[cfg(target_os = "fuchsia")]
8383pub struct SetupSynchronousProxy {
8384 client: fidl::client::sync::Client,
8385}
8386
8387#[cfg(target_os = "fuchsia")]
8388impl fidl::endpoints::SynchronousProxy for SetupSynchronousProxy {
8389 type Proxy = SetupProxy;
8390 type Protocol = SetupMarker;
8391
8392 fn from_channel(inner: fidl::Channel) -> Self {
8393 Self::new(inner)
8394 }
8395
8396 fn into_channel(self) -> fidl::Channel {
8397 self.client.into_channel()
8398 }
8399
8400 fn as_channel(&self) -> &fidl::Channel {
8401 self.client.as_channel()
8402 }
8403}
8404
8405#[cfg(target_os = "fuchsia")]
8406impl SetupSynchronousProxy {
8407 pub fn new(channel: fidl::Channel) -> Self {
8408 Self { client: fidl::client::sync::Client::new(channel) }
8409 }
8410
8411 pub fn into_channel(self) -> fidl::Channel {
8412 self.client.into_channel()
8413 }
8414
8415 pub fn wait_for_event(
8418 &self,
8419 deadline: zx::MonotonicInstant,
8420 ) -> Result<SetupEvent, fidl::Error> {
8421 SetupEvent::decode(self.client.wait_for_event::<SetupMarker>(deadline)?)
8422 }
8423
8424 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<SetupSettings, fidl::Error> {
8430 let _response = self
8431 .client
8432 .send_query::<fidl::encoding::EmptyPayload, SetupWatchResponse, SetupMarker>(
8433 (),
8434 0xd3893c0e63c0a6e,
8435 fidl::encoding::DynamicFlags::empty(),
8436 ___deadline,
8437 )?;
8438 Ok(_response.settings)
8439 }
8440
8441 pub fn r#set(
8446 &self,
8447 mut settings: &SetupSettings,
8448 mut reboot_device: bool,
8449 ___deadline: zx::MonotonicInstant,
8450 ) -> Result<SetupSetResult, fidl::Error> {
8451 let _response = self.client.send_query::<SetupSetRequest, fidl::encoding::ResultType<
8452 fidl::encoding::EmptyStruct,
8453 Error,
8454 >, SetupMarker>(
8455 (settings, reboot_device),
8456 0x66a20be769388128,
8457 fidl::encoding::DynamicFlags::empty(),
8458 ___deadline,
8459 )?;
8460 Ok(_response.map(|x| x))
8461 }
8462}
8463
8464#[cfg(target_os = "fuchsia")]
8465impl From<SetupSynchronousProxy> for zx::NullableHandle {
8466 fn from(value: SetupSynchronousProxy) -> Self {
8467 value.into_channel().into()
8468 }
8469}
8470
8471#[cfg(target_os = "fuchsia")]
8472impl From<fidl::Channel> for SetupSynchronousProxy {
8473 fn from(value: fidl::Channel) -> Self {
8474 Self::new(value)
8475 }
8476}
8477
8478#[cfg(target_os = "fuchsia")]
8479impl fidl::endpoints::FromClient for SetupSynchronousProxy {
8480 type Protocol = SetupMarker;
8481
8482 fn from_client(value: fidl::endpoints::ClientEnd<SetupMarker>) -> Self {
8483 Self::new(value.into_channel())
8484 }
8485}
8486
8487#[derive(Debug, Clone)]
8488pub struct SetupProxy {
8489 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8490}
8491
8492impl fidl::endpoints::Proxy for SetupProxy {
8493 type Protocol = SetupMarker;
8494
8495 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8496 Self::new(inner)
8497 }
8498
8499 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8500 self.client.into_channel().map_err(|client| Self { client })
8501 }
8502
8503 fn as_channel(&self) -> &::fidl::AsyncChannel {
8504 self.client.as_channel()
8505 }
8506}
8507
8508impl SetupProxy {
8509 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8511 let protocol_name = <SetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8512 Self { client: fidl::client::Client::new(channel, protocol_name) }
8513 }
8514
8515 pub fn take_event_stream(&self) -> SetupEventStream {
8521 SetupEventStream { event_receiver: self.client.take_event_receiver() }
8522 }
8523
8524 pub fn r#watch(
8530 &self,
8531 ) -> fidl::client::QueryResponseFut<SetupSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
8532 {
8533 SetupProxyInterface::r#watch(self)
8534 }
8535
8536 pub fn r#set(
8541 &self,
8542 mut settings: &SetupSettings,
8543 mut reboot_device: bool,
8544 ) -> fidl::client::QueryResponseFut<SetupSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
8545 {
8546 SetupProxyInterface::r#set(self, settings, reboot_device)
8547 }
8548}
8549
8550impl SetupProxyInterface for SetupProxy {
8551 type WatchResponseFut = fidl::client::QueryResponseFut<
8552 SetupSettings,
8553 fidl::encoding::DefaultFuchsiaResourceDialect,
8554 >;
8555 fn r#watch(&self) -> Self::WatchResponseFut {
8556 fn _decode(
8557 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8558 ) -> Result<SetupSettings, fidl::Error> {
8559 let _response = fidl::client::decode_transaction_body::<
8560 SetupWatchResponse,
8561 fidl::encoding::DefaultFuchsiaResourceDialect,
8562 0xd3893c0e63c0a6e,
8563 >(_buf?)?;
8564 Ok(_response.settings)
8565 }
8566 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SetupSettings>(
8567 (),
8568 0xd3893c0e63c0a6e,
8569 fidl::encoding::DynamicFlags::empty(),
8570 _decode,
8571 )
8572 }
8573
8574 type SetResponseFut = fidl::client::QueryResponseFut<
8575 SetupSetResult,
8576 fidl::encoding::DefaultFuchsiaResourceDialect,
8577 >;
8578 fn r#set(&self, mut settings: &SetupSettings, mut reboot_device: bool) -> Self::SetResponseFut {
8579 fn _decode(
8580 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8581 ) -> Result<SetupSetResult, fidl::Error> {
8582 let _response = fidl::client::decode_transaction_body::<
8583 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
8584 fidl::encoding::DefaultFuchsiaResourceDialect,
8585 0x66a20be769388128,
8586 >(_buf?)?;
8587 Ok(_response.map(|x| x))
8588 }
8589 self.client.send_query_and_decode::<SetupSetRequest, SetupSetResult>(
8590 (settings, reboot_device),
8591 0x66a20be769388128,
8592 fidl::encoding::DynamicFlags::empty(),
8593 _decode,
8594 )
8595 }
8596}
8597
8598pub struct SetupEventStream {
8599 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8600}
8601
8602impl std::marker::Unpin for SetupEventStream {}
8603
8604impl futures::stream::FusedStream for SetupEventStream {
8605 fn is_terminated(&self) -> bool {
8606 self.event_receiver.is_terminated()
8607 }
8608}
8609
8610impl futures::Stream for SetupEventStream {
8611 type Item = Result<SetupEvent, fidl::Error>;
8612
8613 fn poll_next(
8614 mut self: std::pin::Pin<&mut Self>,
8615 cx: &mut std::task::Context<'_>,
8616 ) -> std::task::Poll<Option<Self::Item>> {
8617 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8618 &mut self.event_receiver,
8619 cx
8620 )?) {
8621 Some(buf) => std::task::Poll::Ready(Some(SetupEvent::decode(buf))),
8622 None => std::task::Poll::Ready(None),
8623 }
8624 }
8625}
8626
8627#[derive(Debug)]
8628pub enum SetupEvent {}
8629
8630impl SetupEvent {
8631 fn decode(
8633 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8634 ) -> Result<SetupEvent, fidl::Error> {
8635 let (bytes, _handles) = buf.split_mut();
8636 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8637 debug_assert_eq!(tx_header.tx_id, 0);
8638 match tx_header.ordinal {
8639 _ => Err(fidl::Error::UnknownOrdinal {
8640 ordinal: tx_header.ordinal,
8641 protocol_name: <SetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8642 }),
8643 }
8644 }
8645}
8646
8647pub struct SetupRequestStream {
8649 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8650 is_terminated: bool,
8651}
8652
8653impl std::marker::Unpin for SetupRequestStream {}
8654
8655impl futures::stream::FusedStream for SetupRequestStream {
8656 fn is_terminated(&self) -> bool {
8657 self.is_terminated
8658 }
8659}
8660
8661impl fidl::endpoints::RequestStream for SetupRequestStream {
8662 type Protocol = SetupMarker;
8663 type ControlHandle = SetupControlHandle;
8664
8665 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8666 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8667 }
8668
8669 fn control_handle(&self) -> Self::ControlHandle {
8670 SetupControlHandle { inner: self.inner.clone() }
8671 }
8672
8673 fn into_inner(
8674 self,
8675 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8676 {
8677 (self.inner, self.is_terminated)
8678 }
8679
8680 fn from_inner(
8681 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8682 is_terminated: bool,
8683 ) -> Self {
8684 Self { inner, is_terminated }
8685 }
8686}
8687
8688impl futures::Stream for SetupRequestStream {
8689 type Item = Result<SetupRequest, fidl::Error>;
8690
8691 fn poll_next(
8692 mut self: std::pin::Pin<&mut Self>,
8693 cx: &mut std::task::Context<'_>,
8694 ) -> std::task::Poll<Option<Self::Item>> {
8695 let this = &mut *self;
8696 if this.inner.check_shutdown(cx) {
8697 this.is_terminated = true;
8698 return std::task::Poll::Ready(None);
8699 }
8700 if this.is_terminated {
8701 panic!("polled SetupRequestStream after completion");
8702 }
8703 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8704 |bytes, handles| {
8705 match this.inner.channel().read_etc(cx, bytes, handles) {
8706 std::task::Poll::Ready(Ok(())) => {}
8707 std::task::Poll::Pending => return std::task::Poll::Pending,
8708 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8709 this.is_terminated = true;
8710 return std::task::Poll::Ready(None);
8711 }
8712 std::task::Poll::Ready(Err(e)) => {
8713 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8714 e.into(),
8715 ))));
8716 }
8717 }
8718
8719 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8721
8722 std::task::Poll::Ready(Some(match header.ordinal {
8723 0xd3893c0e63c0a6e => {
8724 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8725 let mut req = fidl::new_empty!(
8726 fidl::encoding::EmptyPayload,
8727 fidl::encoding::DefaultFuchsiaResourceDialect
8728 );
8729 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8730 let control_handle = SetupControlHandle { inner: this.inner.clone() };
8731 Ok(SetupRequest::Watch {
8732 responder: SetupWatchResponder {
8733 control_handle: std::mem::ManuallyDrop::new(control_handle),
8734 tx_id: header.tx_id,
8735 },
8736 })
8737 }
8738 0x66a20be769388128 => {
8739 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8740 let mut req = fidl::new_empty!(
8741 SetupSetRequest,
8742 fidl::encoding::DefaultFuchsiaResourceDialect
8743 );
8744 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetupSetRequest>(&header, _body_bytes, handles, &mut req)?;
8745 let control_handle = SetupControlHandle { inner: this.inner.clone() };
8746 Ok(SetupRequest::Set {
8747 settings: req.settings,
8748 reboot_device: req.reboot_device,
8749
8750 responder: SetupSetResponder {
8751 control_handle: std::mem::ManuallyDrop::new(control_handle),
8752 tx_id: header.tx_id,
8753 },
8754 })
8755 }
8756 _ => Err(fidl::Error::UnknownOrdinal {
8757 ordinal: header.ordinal,
8758 protocol_name: <SetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8759 }),
8760 }))
8761 },
8762 )
8763 }
8764}
8765
8766#[derive(Debug)]
8771pub enum SetupRequest {
8772 Watch { responder: SetupWatchResponder },
8778 Set { settings: SetupSettings, reboot_device: bool, responder: SetupSetResponder },
8783}
8784
8785impl SetupRequest {
8786 #[allow(irrefutable_let_patterns)]
8787 pub fn into_watch(self) -> Option<(SetupWatchResponder)> {
8788 if let SetupRequest::Watch { responder } = self { Some((responder)) } else { None }
8789 }
8790
8791 #[allow(irrefutable_let_patterns)]
8792 pub fn into_set(self) -> Option<(SetupSettings, bool, SetupSetResponder)> {
8793 if let SetupRequest::Set { settings, reboot_device, responder } = self {
8794 Some((settings, reboot_device, responder))
8795 } else {
8796 None
8797 }
8798 }
8799
8800 pub fn method_name(&self) -> &'static str {
8802 match *self {
8803 SetupRequest::Watch { .. } => "watch",
8804 SetupRequest::Set { .. } => "set",
8805 }
8806 }
8807}
8808
8809#[derive(Debug, Clone)]
8810pub struct SetupControlHandle {
8811 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8812}
8813
8814impl SetupControlHandle {
8815 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8816 self.inner.shutdown_with_epitaph(status.into())
8817 }
8818}
8819
8820impl fidl::endpoints::ControlHandle for SetupControlHandle {
8821 fn shutdown(&self) {
8822 self.inner.shutdown()
8823 }
8824
8825 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8826 self.inner.shutdown_with_epitaph(status)
8827 }
8828
8829 fn is_closed(&self) -> bool {
8830 self.inner.channel().is_closed()
8831 }
8832 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8833 self.inner.channel().on_closed()
8834 }
8835
8836 #[cfg(target_os = "fuchsia")]
8837 fn signal_peer(
8838 &self,
8839 clear_mask: zx::Signals,
8840 set_mask: zx::Signals,
8841 ) -> Result<(), zx_status::Status> {
8842 use fidl::Peered;
8843 self.inner.channel().signal_peer(clear_mask, set_mask)
8844 }
8845}
8846
8847impl SetupControlHandle {}
8848
8849#[must_use = "FIDL methods require a response to be sent"]
8850#[derive(Debug)]
8851pub struct SetupWatchResponder {
8852 control_handle: std::mem::ManuallyDrop<SetupControlHandle>,
8853 tx_id: u32,
8854}
8855
8856impl std::ops::Drop for SetupWatchResponder {
8860 fn drop(&mut self) {
8861 self.control_handle.shutdown();
8862 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8864 }
8865}
8866
8867impl fidl::endpoints::Responder for SetupWatchResponder {
8868 type ControlHandle = SetupControlHandle;
8869
8870 fn control_handle(&self) -> &SetupControlHandle {
8871 &self.control_handle
8872 }
8873
8874 fn drop_without_shutdown(mut self) {
8875 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8877 std::mem::forget(self);
8879 }
8880}
8881
8882impl SetupWatchResponder {
8883 pub fn send(self, mut settings: &SetupSettings) -> Result<(), fidl::Error> {
8887 let _result = self.send_raw(settings);
8888 if _result.is_err() {
8889 self.control_handle.shutdown();
8890 }
8891 self.drop_without_shutdown();
8892 _result
8893 }
8894
8895 pub fn send_no_shutdown_on_err(self, mut settings: &SetupSettings) -> Result<(), fidl::Error> {
8897 let _result = self.send_raw(settings);
8898 self.drop_without_shutdown();
8899 _result
8900 }
8901
8902 fn send_raw(&self, mut settings: &SetupSettings) -> Result<(), fidl::Error> {
8903 self.control_handle.inner.send::<SetupWatchResponse>(
8904 (settings,),
8905 self.tx_id,
8906 0xd3893c0e63c0a6e,
8907 fidl::encoding::DynamicFlags::empty(),
8908 )
8909 }
8910}
8911
8912#[must_use = "FIDL methods require a response to be sent"]
8913#[derive(Debug)]
8914pub struct SetupSetResponder {
8915 control_handle: std::mem::ManuallyDrop<SetupControlHandle>,
8916 tx_id: u32,
8917}
8918
8919impl std::ops::Drop for SetupSetResponder {
8923 fn drop(&mut self) {
8924 self.control_handle.shutdown();
8925 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8927 }
8928}
8929
8930impl fidl::endpoints::Responder for SetupSetResponder {
8931 type ControlHandle = SetupControlHandle;
8932
8933 fn control_handle(&self) -> &SetupControlHandle {
8934 &self.control_handle
8935 }
8936
8937 fn drop_without_shutdown(mut self) {
8938 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8940 std::mem::forget(self);
8942 }
8943}
8944
8945impl SetupSetResponder {
8946 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8950 let _result = self.send_raw(result);
8951 if _result.is_err() {
8952 self.control_handle.shutdown();
8953 }
8954 self.drop_without_shutdown();
8955 _result
8956 }
8957
8958 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8960 let _result = self.send_raw(result);
8961 self.drop_without_shutdown();
8962 _result
8963 }
8964
8965 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8966 self.control_handle
8967 .inner
8968 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
8969 result,
8970 self.tx_id,
8971 0x66a20be769388128,
8972 fidl::encoding::DynamicFlags::empty(),
8973 )
8974 }
8975}
8976
8977mod internal {
8978 use super::*;
8979}