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