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