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_ui_focus_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct FocusChainListenerOnFocusChangeRequest {
16 pub focus_chain: FocusChain,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for FocusChainListenerOnFocusChangeRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct FocusChainListenerRegistryRegisterRequest {
26 pub listener: fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for FocusChainListenerRegistryRegisterRequest
31{
32}
33
34#[derive(Debug, Default, PartialEq)]
39pub struct FocusChain {
40 pub focus_chain: Option<Vec<fidl_fuchsia_ui_views::ViewRef>>,
62 #[doc(hidden)]
63 pub __source_breaking: fidl::marker::SourceBreaking,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FocusChain {}
67
68#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
69pub struct FocusChainListenerMarker;
70
71impl fidl::endpoints::ProtocolMarker for FocusChainListenerMarker {
72 type Proxy = FocusChainListenerProxy;
73 type RequestStream = FocusChainListenerRequestStream;
74 #[cfg(target_os = "fuchsia")]
75 type SynchronousProxy = FocusChainListenerSynchronousProxy;
76
77 const DEBUG_NAME: &'static str = "(anonymous) FocusChainListener";
78}
79
80pub trait FocusChainListenerProxyInterface: Send + Sync {
81 type OnFocusChangeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
82 fn r#on_focus_change(&self, focus_chain: FocusChain) -> Self::OnFocusChangeResponseFut;
83}
84#[derive(Debug)]
85#[cfg(target_os = "fuchsia")]
86pub struct FocusChainListenerSynchronousProxy {
87 client: fidl::client::sync::Client,
88}
89
90#[cfg(target_os = "fuchsia")]
91impl fidl::endpoints::SynchronousProxy for FocusChainListenerSynchronousProxy {
92 type Proxy = FocusChainListenerProxy;
93 type Protocol = FocusChainListenerMarker;
94
95 fn from_channel(inner: fidl::Channel) -> Self {
96 Self::new(inner)
97 }
98
99 fn into_channel(self) -> fidl::Channel {
100 self.client.into_channel()
101 }
102
103 fn as_channel(&self) -> &fidl::Channel {
104 self.client.as_channel()
105 }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl FocusChainListenerSynchronousProxy {
110 pub fn new(channel: fidl::Channel) -> Self {
111 Self { client: fidl::client::sync::Client::new(channel) }
112 }
113
114 pub fn into_channel(self) -> fidl::Channel {
115 self.client.into_channel()
116 }
117
118 pub fn wait_for_event(
121 &self,
122 deadline: zx::MonotonicInstant,
123 ) -> Result<FocusChainListenerEvent, fidl::Error> {
124 FocusChainListenerEvent::decode(
125 self.client.wait_for_event::<FocusChainListenerMarker>(deadline)?,
126 )
127 }
128
129 pub fn r#on_focus_change(
133 &self,
134 mut focus_chain: FocusChain,
135 ___deadline: zx::MonotonicInstant,
136 ) -> Result<(), fidl::Error> {
137 let _response = self.client.send_query::<
138 FocusChainListenerOnFocusChangeRequest,
139 fidl::encoding::EmptyPayload,
140 FocusChainListenerMarker,
141 >(
142 (&mut focus_chain,),
143 0x2ffe3dec9ff7a04a,
144 fidl::encoding::DynamicFlags::empty(),
145 ___deadline,
146 )?;
147 Ok(_response)
148 }
149}
150
151#[cfg(target_os = "fuchsia")]
152impl From<FocusChainListenerSynchronousProxy> for zx::NullableHandle {
153 fn from(value: FocusChainListenerSynchronousProxy) -> Self {
154 value.into_channel().into()
155 }
156}
157
158#[cfg(target_os = "fuchsia")]
159impl From<fidl::Channel> for FocusChainListenerSynchronousProxy {
160 fn from(value: fidl::Channel) -> Self {
161 Self::new(value)
162 }
163}
164
165#[cfg(target_os = "fuchsia")]
166impl fidl::endpoints::FromClient for FocusChainListenerSynchronousProxy {
167 type Protocol = FocusChainListenerMarker;
168
169 fn from_client(value: fidl::endpoints::ClientEnd<FocusChainListenerMarker>) -> Self {
170 Self::new(value.into_channel())
171 }
172}
173
174#[derive(Debug, Clone)]
175pub struct FocusChainListenerProxy {
176 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
177}
178
179impl fidl::endpoints::Proxy for FocusChainListenerProxy {
180 type Protocol = FocusChainListenerMarker;
181
182 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
183 Self::new(inner)
184 }
185
186 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
187 self.client.into_channel().map_err(|client| Self { client })
188 }
189
190 fn as_channel(&self) -> &::fidl::AsyncChannel {
191 self.client.as_channel()
192 }
193}
194
195impl FocusChainListenerProxy {
196 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
198 let protocol_name =
199 <FocusChainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
200 Self { client: fidl::client::Client::new(channel, protocol_name) }
201 }
202
203 pub fn take_event_stream(&self) -> FocusChainListenerEventStream {
209 FocusChainListenerEventStream { event_receiver: self.client.take_event_receiver() }
210 }
211
212 pub fn r#on_focus_change(
216 &self,
217 mut focus_chain: FocusChain,
218 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
219 FocusChainListenerProxyInterface::r#on_focus_change(self, focus_chain)
220 }
221}
222
223impl FocusChainListenerProxyInterface for FocusChainListenerProxy {
224 type OnFocusChangeResponseFut =
225 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
226 fn r#on_focus_change(&self, mut focus_chain: FocusChain) -> Self::OnFocusChangeResponseFut {
227 fn _decode(
228 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
229 ) -> Result<(), fidl::Error> {
230 let _response = fidl::client::decode_transaction_body::<
231 fidl::encoding::EmptyPayload,
232 fidl::encoding::DefaultFuchsiaResourceDialect,
233 0x2ffe3dec9ff7a04a,
234 >(_buf?)?;
235 Ok(_response)
236 }
237 self.client.send_query_and_decode::<FocusChainListenerOnFocusChangeRequest, ()>(
238 (&mut focus_chain,),
239 0x2ffe3dec9ff7a04a,
240 fidl::encoding::DynamicFlags::empty(),
241 _decode,
242 )
243 }
244}
245
246pub struct FocusChainListenerEventStream {
247 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
248}
249
250impl std::marker::Unpin for FocusChainListenerEventStream {}
251
252impl futures::stream::FusedStream for FocusChainListenerEventStream {
253 fn is_terminated(&self) -> bool {
254 self.event_receiver.is_terminated()
255 }
256}
257
258impl futures::Stream for FocusChainListenerEventStream {
259 type Item = Result<FocusChainListenerEvent, fidl::Error>;
260
261 fn poll_next(
262 mut self: std::pin::Pin<&mut Self>,
263 cx: &mut std::task::Context<'_>,
264 ) -> std::task::Poll<Option<Self::Item>> {
265 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
266 &mut self.event_receiver,
267 cx
268 )?) {
269 Some(buf) => std::task::Poll::Ready(Some(FocusChainListenerEvent::decode(buf))),
270 None => std::task::Poll::Ready(None),
271 }
272 }
273}
274
275#[derive(Debug)]
276pub enum FocusChainListenerEvent {}
277
278impl FocusChainListenerEvent {
279 fn decode(
281 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
282 ) -> Result<FocusChainListenerEvent, fidl::Error> {
283 let (bytes, _handles) = buf.split_mut();
284 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
285 debug_assert_eq!(tx_header.tx_id, 0);
286 match tx_header.ordinal {
287 _ => Err(fidl::Error::UnknownOrdinal {
288 ordinal: tx_header.ordinal,
289 protocol_name:
290 <FocusChainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
291 }),
292 }
293 }
294}
295
296pub struct FocusChainListenerRequestStream {
298 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
299 is_terminated: bool,
300}
301
302impl std::marker::Unpin for FocusChainListenerRequestStream {}
303
304impl futures::stream::FusedStream for FocusChainListenerRequestStream {
305 fn is_terminated(&self) -> bool {
306 self.is_terminated
307 }
308}
309
310impl fidl::endpoints::RequestStream for FocusChainListenerRequestStream {
311 type Protocol = FocusChainListenerMarker;
312 type ControlHandle = FocusChainListenerControlHandle;
313
314 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
315 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
316 }
317
318 fn control_handle(&self) -> Self::ControlHandle {
319 FocusChainListenerControlHandle { inner: self.inner.clone() }
320 }
321
322 fn into_inner(
323 self,
324 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
325 {
326 (self.inner, self.is_terminated)
327 }
328
329 fn from_inner(
330 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
331 is_terminated: bool,
332 ) -> Self {
333 Self { inner, is_terminated }
334 }
335}
336
337impl futures::Stream for FocusChainListenerRequestStream {
338 type Item = Result<FocusChainListenerRequest, fidl::Error>;
339
340 fn poll_next(
341 mut self: std::pin::Pin<&mut Self>,
342 cx: &mut std::task::Context<'_>,
343 ) -> std::task::Poll<Option<Self::Item>> {
344 let this = &mut *self;
345 if this.inner.check_shutdown(cx) {
346 this.is_terminated = true;
347 return std::task::Poll::Ready(None);
348 }
349 if this.is_terminated {
350 panic!("polled FocusChainListenerRequestStream after completion");
351 }
352 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
353 |bytes, handles| {
354 match this.inner.channel().read_etc(cx, bytes, handles) {
355 std::task::Poll::Ready(Ok(())) => {}
356 std::task::Poll::Pending => return std::task::Poll::Pending,
357 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
358 this.is_terminated = true;
359 return std::task::Poll::Ready(None);
360 }
361 std::task::Poll::Ready(Err(e)) => {
362 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
363 e.into(),
364 ))));
365 }
366 }
367
368 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
370
371 std::task::Poll::Ready(Some(match header.ordinal {
372 0x2ffe3dec9ff7a04a => {
373 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
374 let mut req = fidl::new_empty!(FocusChainListenerOnFocusChangeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
375 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FocusChainListenerOnFocusChangeRequest>(&header, _body_bytes, handles, &mut req)?;
376 let control_handle = FocusChainListenerControlHandle {
377 inner: this.inner.clone(),
378 };
379 Ok(FocusChainListenerRequest::OnFocusChange {focus_chain: req.focus_chain,
380
381 responder: FocusChainListenerOnFocusChangeResponder {
382 control_handle: std::mem::ManuallyDrop::new(control_handle),
383 tx_id: header.tx_id,
384 },
385 })
386 }
387 _ => Err(fidl::Error::UnknownOrdinal {
388 ordinal: header.ordinal,
389 protocol_name: <FocusChainListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
390 }),
391 }))
392 },
393 )
394 }
395}
396
397#[derive(Debug)]
399pub enum FocusChainListenerRequest {
400 OnFocusChange { focus_chain: FocusChain, responder: FocusChainListenerOnFocusChangeResponder },
404}
405
406impl FocusChainListenerRequest {
407 #[allow(irrefutable_let_patterns)]
408 pub fn into_on_focus_change(
409 self,
410 ) -> Option<(FocusChain, FocusChainListenerOnFocusChangeResponder)> {
411 if let FocusChainListenerRequest::OnFocusChange { focus_chain, responder } = self {
412 Some((focus_chain, responder))
413 } else {
414 None
415 }
416 }
417
418 pub fn method_name(&self) -> &'static str {
420 match *self {
421 FocusChainListenerRequest::OnFocusChange { .. } => "on_focus_change",
422 }
423 }
424}
425
426#[derive(Debug, Clone)]
427pub struct FocusChainListenerControlHandle {
428 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
429}
430
431impl FocusChainListenerControlHandle {
432 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
433 self.inner.shutdown_with_epitaph(status.into())
434 }
435}
436
437impl fidl::endpoints::ControlHandle for FocusChainListenerControlHandle {
438 fn shutdown(&self) {
439 self.inner.shutdown()
440 }
441
442 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
443 self.inner.shutdown_with_epitaph(status)
444 }
445
446 fn is_closed(&self) -> bool {
447 self.inner.channel().is_closed()
448 }
449 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
450 self.inner.channel().on_closed()
451 }
452
453 #[cfg(target_os = "fuchsia")]
454 fn signal_peer(
455 &self,
456 clear_mask: zx::Signals,
457 set_mask: zx::Signals,
458 ) -> Result<(), zx_status::Status> {
459 use fidl::Peered;
460 self.inner.channel().signal_peer(clear_mask, set_mask)
461 }
462}
463
464impl FocusChainListenerControlHandle {}
465
466#[must_use = "FIDL methods require a response to be sent"]
467#[derive(Debug)]
468pub struct FocusChainListenerOnFocusChangeResponder {
469 control_handle: std::mem::ManuallyDrop<FocusChainListenerControlHandle>,
470 tx_id: u32,
471}
472
473impl std::ops::Drop for FocusChainListenerOnFocusChangeResponder {
477 fn drop(&mut self) {
478 self.control_handle.shutdown();
479 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
481 }
482}
483
484impl fidl::endpoints::Responder for FocusChainListenerOnFocusChangeResponder {
485 type ControlHandle = FocusChainListenerControlHandle;
486
487 fn control_handle(&self) -> &FocusChainListenerControlHandle {
488 &self.control_handle
489 }
490
491 fn drop_without_shutdown(mut self) {
492 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
494 std::mem::forget(self);
496 }
497}
498
499impl FocusChainListenerOnFocusChangeResponder {
500 pub fn send(self) -> Result<(), fidl::Error> {
504 let _result = self.send_raw();
505 if _result.is_err() {
506 self.control_handle.shutdown();
507 }
508 self.drop_without_shutdown();
509 _result
510 }
511
512 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
514 let _result = self.send_raw();
515 self.drop_without_shutdown();
516 _result
517 }
518
519 fn send_raw(&self) -> Result<(), fidl::Error> {
520 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
521 (),
522 self.tx_id,
523 0x2ffe3dec9ff7a04a,
524 fidl::encoding::DynamicFlags::empty(),
525 )
526 }
527}
528
529#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
530pub struct FocusChainListenerRegistryMarker;
531
532impl fidl::endpoints::ProtocolMarker for FocusChainListenerRegistryMarker {
533 type Proxy = FocusChainListenerRegistryProxy;
534 type RequestStream = FocusChainListenerRegistryRequestStream;
535 #[cfg(target_os = "fuchsia")]
536 type SynchronousProxy = FocusChainListenerRegistrySynchronousProxy;
537
538 const DEBUG_NAME: &'static str = "fuchsia.ui.focus.FocusChainListenerRegistry";
539}
540impl fidl::endpoints::DiscoverableProtocolMarker for FocusChainListenerRegistryMarker {}
541
542pub trait FocusChainListenerRegistryProxyInterface: Send + Sync {
543 fn r#register(
544 &self,
545 listener: fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
546 ) -> Result<(), fidl::Error>;
547}
548#[derive(Debug)]
549#[cfg(target_os = "fuchsia")]
550pub struct FocusChainListenerRegistrySynchronousProxy {
551 client: fidl::client::sync::Client,
552}
553
554#[cfg(target_os = "fuchsia")]
555impl fidl::endpoints::SynchronousProxy for FocusChainListenerRegistrySynchronousProxy {
556 type Proxy = FocusChainListenerRegistryProxy;
557 type Protocol = FocusChainListenerRegistryMarker;
558
559 fn from_channel(inner: fidl::Channel) -> Self {
560 Self::new(inner)
561 }
562
563 fn into_channel(self) -> fidl::Channel {
564 self.client.into_channel()
565 }
566
567 fn as_channel(&self) -> &fidl::Channel {
568 self.client.as_channel()
569 }
570}
571
572#[cfg(target_os = "fuchsia")]
573impl FocusChainListenerRegistrySynchronousProxy {
574 pub fn new(channel: fidl::Channel) -> Self {
575 Self { client: fidl::client::sync::Client::new(channel) }
576 }
577
578 pub fn into_channel(self) -> fidl::Channel {
579 self.client.into_channel()
580 }
581
582 pub fn wait_for_event(
585 &self,
586 deadline: zx::MonotonicInstant,
587 ) -> Result<FocusChainListenerRegistryEvent, fidl::Error> {
588 FocusChainListenerRegistryEvent::decode(
589 self.client.wait_for_event::<FocusChainListenerRegistryMarker>(deadline)?,
590 )
591 }
592
593 pub fn r#register(
594 &self,
595 mut listener: fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
596 ) -> Result<(), fidl::Error> {
597 self.client.send::<FocusChainListenerRegistryRegisterRequest>(
598 (listener,),
599 0x177be5ba0da6faa3,
600 fidl::encoding::DynamicFlags::empty(),
601 )
602 }
603}
604
605#[cfg(target_os = "fuchsia")]
606impl From<FocusChainListenerRegistrySynchronousProxy> for zx::NullableHandle {
607 fn from(value: FocusChainListenerRegistrySynchronousProxy) -> Self {
608 value.into_channel().into()
609 }
610}
611
612#[cfg(target_os = "fuchsia")]
613impl From<fidl::Channel> for FocusChainListenerRegistrySynchronousProxy {
614 fn from(value: fidl::Channel) -> Self {
615 Self::new(value)
616 }
617}
618
619#[cfg(target_os = "fuchsia")]
620impl fidl::endpoints::FromClient for FocusChainListenerRegistrySynchronousProxy {
621 type Protocol = FocusChainListenerRegistryMarker;
622
623 fn from_client(value: fidl::endpoints::ClientEnd<FocusChainListenerRegistryMarker>) -> Self {
624 Self::new(value.into_channel())
625 }
626}
627
628#[derive(Debug, Clone)]
629pub struct FocusChainListenerRegistryProxy {
630 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
631}
632
633impl fidl::endpoints::Proxy for FocusChainListenerRegistryProxy {
634 type Protocol = FocusChainListenerRegistryMarker;
635
636 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
637 Self::new(inner)
638 }
639
640 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
641 self.client.into_channel().map_err(|client| Self { client })
642 }
643
644 fn as_channel(&self) -> &::fidl::AsyncChannel {
645 self.client.as_channel()
646 }
647}
648
649impl FocusChainListenerRegistryProxy {
650 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
652 let protocol_name =
653 <FocusChainListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
654 Self { client: fidl::client::Client::new(channel, protocol_name) }
655 }
656
657 pub fn take_event_stream(&self) -> FocusChainListenerRegistryEventStream {
663 FocusChainListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
664 }
665
666 pub fn r#register(
667 &self,
668 mut listener: fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
669 ) -> Result<(), fidl::Error> {
670 FocusChainListenerRegistryProxyInterface::r#register(self, listener)
671 }
672}
673
674impl FocusChainListenerRegistryProxyInterface for FocusChainListenerRegistryProxy {
675 fn r#register(
676 &self,
677 mut listener: fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
678 ) -> Result<(), fidl::Error> {
679 self.client.send::<FocusChainListenerRegistryRegisterRequest>(
680 (listener,),
681 0x177be5ba0da6faa3,
682 fidl::encoding::DynamicFlags::empty(),
683 )
684 }
685}
686
687pub struct FocusChainListenerRegistryEventStream {
688 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
689}
690
691impl std::marker::Unpin for FocusChainListenerRegistryEventStream {}
692
693impl futures::stream::FusedStream for FocusChainListenerRegistryEventStream {
694 fn is_terminated(&self) -> bool {
695 self.event_receiver.is_terminated()
696 }
697}
698
699impl futures::Stream for FocusChainListenerRegistryEventStream {
700 type Item = Result<FocusChainListenerRegistryEvent, fidl::Error>;
701
702 fn poll_next(
703 mut self: std::pin::Pin<&mut Self>,
704 cx: &mut std::task::Context<'_>,
705 ) -> std::task::Poll<Option<Self::Item>> {
706 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
707 &mut self.event_receiver,
708 cx
709 )?) {
710 Some(buf) => std::task::Poll::Ready(Some(FocusChainListenerRegistryEvent::decode(buf))),
711 None => std::task::Poll::Ready(None),
712 }
713 }
714}
715
716#[derive(Debug)]
717pub enum FocusChainListenerRegistryEvent {}
718
719impl FocusChainListenerRegistryEvent {
720 fn decode(
722 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
723 ) -> Result<FocusChainListenerRegistryEvent, fidl::Error> {
724 let (bytes, _handles) = buf.split_mut();
725 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
726 debug_assert_eq!(tx_header.tx_id, 0);
727 match tx_header.ordinal {
728 _ => Err(fidl::Error::UnknownOrdinal {
729 ordinal: tx_header.ordinal,
730 protocol_name: <FocusChainListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
731 })
732 }
733 }
734}
735
736pub struct FocusChainListenerRegistryRequestStream {
738 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
739 is_terminated: bool,
740}
741
742impl std::marker::Unpin for FocusChainListenerRegistryRequestStream {}
743
744impl futures::stream::FusedStream for FocusChainListenerRegistryRequestStream {
745 fn is_terminated(&self) -> bool {
746 self.is_terminated
747 }
748}
749
750impl fidl::endpoints::RequestStream for FocusChainListenerRegistryRequestStream {
751 type Protocol = FocusChainListenerRegistryMarker;
752 type ControlHandle = FocusChainListenerRegistryControlHandle;
753
754 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
755 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
756 }
757
758 fn control_handle(&self) -> Self::ControlHandle {
759 FocusChainListenerRegistryControlHandle { inner: self.inner.clone() }
760 }
761
762 fn into_inner(
763 self,
764 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
765 {
766 (self.inner, self.is_terminated)
767 }
768
769 fn from_inner(
770 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
771 is_terminated: bool,
772 ) -> Self {
773 Self { inner, is_terminated }
774 }
775}
776
777impl futures::Stream for FocusChainListenerRegistryRequestStream {
778 type Item = Result<FocusChainListenerRegistryRequest, fidl::Error>;
779
780 fn poll_next(
781 mut self: std::pin::Pin<&mut Self>,
782 cx: &mut std::task::Context<'_>,
783 ) -> std::task::Poll<Option<Self::Item>> {
784 let this = &mut *self;
785 if this.inner.check_shutdown(cx) {
786 this.is_terminated = true;
787 return std::task::Poll::Ready(None);
788 }
789 if this.is_terminated {
790 panic!("polled FocusChainListenerRegistryRequestStream after completion");
791 }
792 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
793 |bytes, handles| {
794 match this.inner.channel().read_etc(cx, bytes, handles) {
795 std::task::Poll::Ready(Ok(())) => {}
796 std::task::Poll::Pending => return std::task::Poll::Pending,
797 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
798 this.is_terminated = true;
799 return std::task::Poll::Ready(None);
800 }
801 std::task::Poll::Ready(Err(e)) => {
802 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
803 e.into(),
804 ))));
805 }
806 }
807
808 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
810
811 std::task::Poll::Ready(Some(match header.ordinal {
812 0x177be5ba0da6faa3 => {
813 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
814 let mut req = fidl::new_empty!(FocusChainListenerRegistryRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
815 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FocusChainListenerRegistryRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
816 let control_handle = FocusChainListenerRegistryControlHandle {
817 inner: this.inner.clone(),
818 };
819 Ok(FocusChainListenerRegistryRequest::Register {listener: req.listener,
820
821 control_handle,
822 })
823 }
824 _ => Err(fidl::Error::UnknownOrdinal {
825 ordinal: header.ordinal,
826 protocol_name: <FocusChainListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
827 }),
828 }))
829 },
830 )
831 }
832}
833
834#[derive(Debug)]
836pub enum FocusChainListenerRegistryRequest {
837 Register {
838 listener: fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
839 control_handle: FocusChainListenerRegistryControlHandle,
840 },
841}
842
843impl FocusChainListenerRegistryRequest {
844 #[allow(irrefutable_let_patterns)]
845 pub fn into_register(
846 self,
847 ) -> Option<(
848 fidl::endpoints::ClientEnd<FocusChainListenerMarker>,
849 FocusChainListenerRegistryControlHandle,
850 )> {
851 if let FocusChainListenerRegistryRequest::Register { listener, control_handle } = self {
852 Some((listener, control_handle))
853 } else {
854 None
855 }
856 }
857
858 pub fn method_name(&self) -> &'static str {
860 match *self {
861 FocusChainListenerRegistryRequest::Register { .. } => "register",
862 }
863 }
864}
865
866#[derive(Debug, Clone)]
867pub struct FocusChainListenerRegistryControlHandle {
868 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
869}
870
871impl FocusChainListenerRegistryControlHandle {
872 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
873 self.inner.shutdown_with_epitaph(status.into())
874 }
875}
876
877impl fidl::endpoints::ControlHandle for FocusChainListenerRegistryControlHandle {
878 fn shutdown(&self) {
879 self.inner.shutdown()
880 }
881
882 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
883 self.inner.shutdown_with_epitaph(status)
884 }
885
886 fn is_closed(&self) -> bool {
887 self.inner.channel().is_closed()
888 }
889 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
890 self.inner.channel().on_closed()
891 }
892
893 #[cfg(target_os = "fuchsia")]
894 fn signal_peer(
895 &self,
896 clear_mask: zx::Signals,
897 set_mask: zx::Signals,
898 ) -> Result<(), zx_status::Status> {
899 use fidl::Peered;
900 self.inner.channel().signal_peer(clear_mask, set_mask)
901 }
902}
903
904impl FocusChainListenerRegistryControlHandle {}
905
906#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
907pub struct FocusChainProviderMarker;
908
909impl fidl::endpoints::ProtocolMarker for FocusChainProviderMarker {
910 type Proxy = FocusChainProviderProxy;
911 type RequestStream = FocusChainProviderRequestStream;
912 #[cfg(target_os = "fuchsia")]
913 type SynchronousProxy = FocusChainProviderSynchronousProxy;
914
915 const DEBUG_NAME: &'static str = "fuchsia.ui.focus.FocusChainProvider";
916}
917impl fidl::endpoints::DiscoverableProtocolMarker for FocusChainProviderMarker {}
918
919pub trait FocusChainProviderProxyInterface: Send + Sync {
920 type WatchFocusKoidChainResponseFut: std::future::Future<Output = Result<FocusKoidChain, fidl::Error>>
921 + Send;
922 fn r#watch_focus_koid_chain(
923 &self,
924 payload: &FocusChainProviderWatchFocusKoidChainRequest,
925 ) -> Self::WatchFocusKoidChainResponseFut;
926}
927#[derive(Debug)]
928#[cfg(target_os = "fuchsia")]
929pub struct FocusChainProviderSynchronousProxy {
930 client: fidl::client::sync::Client,
931}
932
933#[cfg(target_os = "fuchsia")]
934impl fidl::endpoints::SynchronousProxy for FocusChainProviderSynchronousProxy {
935 type Proxy = FocusChainProviderProxy;
936 type Protocol = FocusChainProviderMarker;
937
938 fn from_channel(inner: fidl::Channel) -> Self {
939 Self::new(inner)
940 }
941
942 fn into_channel(self) -> fidl::Channel {
943 self.client.into_channel()
944 }
945
946 fn as_channel(&self) -> &fidl::Channel {
947 self.client.as_channel()
948 }
949}
950
951#[cfg(target_os = "fuchsia")]
952impl FocusChainProviderSynchronousProxy {
953 pub fn new(channel: fidl::Channel) -> Self {
954 Self { client: fidl::client::sync::Client::new(channel) }
955 }
956
957 pub fn into_channel(self) -> fidl::Channel {
958 self.client.into_channel()
959 }
960
961 pub fn wait_for_event(
964 &self,
965 deadline: zx::MonotonicInstant,
966 ) -> Result<FocusChainProviderEvent, fidl::Error> {
967 FocusChainProviderEvent::decode(
968 self.client.wait_for_event::<FocusChainProviderMarker>(deadline)?,
969 )
970 }
971
972 pub fn r#watch_focus_koid_chain(
982 &self,
983 mut payload: &FocusChainProviderWatchFocusKoidChainRequest,
984 ___deadline: zx::MonotonicInstant,
985 ) -> Result<FocusKoidChain, fidl::Error> {
986 let _response = self.client.send_query::<
987 FocusChainProviderWatchFocusKoidChainRequest,
988 FocusKoidChain,
989 FocusChainProviderMarker,
990 >(
991 payload,
992 0x726d2fdae53c1ab7,
993 fidl::encoding::DynamicFlags::empty(),
994 ___deadline,
995 )?;
996 Ok(_response)
997 }
998}
999
1000#[cfg(target_os = "fuchsia")]
1001impl From<FocusChainProviderSynchronousProxy> for zx::NullableHandle {
1002 fn from(value: FocusChainProviderSynchronousProxy) -> Self {
1003 value.into_channel().into()
1004 }
1005}
1006
1007#[cfg(target_os = "fuchsia")]
1008impl From<fidl::Channel> for FocusChainProviderSynchronousProxy {
1009 fn from(value: fidl::Channel) -> Self {
1010 Self::new(value)
1011 }
1012}
1013
1014#[cfg(target_os = "fuchsia")]
1015impl fidl::endpoints::FromClient for FocusChainProviderSynchronousProxy {
1016 type Protocol = FocusChainProviderMarker;
1017
1018 fn from_client(value: fidl::endpoints::ClientEnd<FocusChainProviderMarker>) -> Self {
1019 Self::new(value.into_channel())
1020 }
1021}
1022
1023#[derive(Debug, Clone)]
1024pub struct FocusChainProviderProxy {
1025 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1026}
1027
1028impl fidl::endpoints::Proxy for FocusChainProviderProxy {
1029 type Protocol = FocusChainProviderMarker;
1030
1031 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1032 Self::new(inner)
1033 }
1034
1035 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1036 self.client.into_channel().map_err(|client| Self { client })
1037 }
1038
1039 fn as_channel(&self) -> &::fidl::AsyncChannel {
1040 self.client.as_channel()
1041 }
1042}
1043
1044impl FocusChainProviderProxy {
1045 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1047 let protocol_name =
1048 <FocusChainProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1049 Self { client: fidl::client::Client::new(channel, protocol_name) }
1050 }
1051
1052 pub fn take_event_stream(&self) -> FocusChainProviderEventStream {
1058 FocusChainProviderEventStream { event_receiver: self.client.take_event_receiver() }
1059 }
1060
1061 pub fn r#watch_focus_koid_chain(
1071 &self,
1072 mut payload: &FocusChainProviderWatchFocusKoidChainRequest,
1073 ) -> fidl::client::QueryResponseFut<FocusKoidChain, fidl::encoding::DefaultFuchsiaResourceDialect>
1074 {
1075 FocusChainProviderProxyInterface::r#watch_focus_koid_chain(self, payload)
1076 }
1077}
1078
1079impl FocusChainProviderProxyInterface for FocusChainProviderProxy {
1080 type WatchFocusKoidChainResponseFut = fidl::client::QueryResponseFut<
1081 FocusKoidChain,
1082 fidl::encoding::DefaultFuchsiaResourceDialect,
1083 >;
1084 fn r#watch_focus_koid_chain(
1085 &self,
1086 mut payload: &FocusChainProviderWatchFocusKoidChainRequest,
1087 ) -> Self::WatchFocusKoidChainResponseFut {
1088 fn _decode(
1089 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1090 ) -> Result<FocusKoidChain, fidl::Error> {
1091 let _response = fidl::client::decode_transaction_body::<
1092 FocusKoidChain,
1093 fidl::encoding::DefaultFuchsiaResourceDialect,
1094 0x726d2fdae53c1ab7,
1095 >(_buf?)?;
1096 Ok(_response)
1097 }
1098 self.client
1099 .send_query_and_decode::<FocusChainProviderWatchFocusKoidChainRequest, FocusKoidChain>(
1100 payload,
1101 0x726d2fdae53c1ab7,
1102 fidl::encoding::DynamicFlags::empty(),
1103 _decode,
1104 )
1105 }
1106}
1107
1108pub struct FocusChainProviderEventStream {
1109 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1110}
1111
1112impl std::marker::Unpin for FocusChainProviderEventStream {}
1113
1114impl futures::stream::FusedStream for FocusChainProviderEventStream {
1115 fn is_terminated(&self) -> bool {
1116 self.event_receiver.is_terminated()
1117 }
1118}
1119
1120impl futures::Stream for FocusChainProviderEventStream {
1121 type Item = Result<FocusChainProviderEvent, fidl::Error>;
1122
1123 fn poll_next(
1124 mut self: std::pin::Pin<&mut Self>,
1125 cx: &mut std::task::Context<'_>,
1126 ) -> std::task::Poll<Option<Self::Item>> {
1127 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1128 &mut self.event_receiver,
1129 cx
1130 )?) {
1131 Some(buf) => std::task::Poll::Ready(Some(FocusChainProviderEvent::decode(buf))),
1132 None => std::task::Poll::Ready(None),
1133 }
1134 }
1135}
1136
1137#[derive(Debug)]
1138pub enum FocusChainProviderEvent {}
1139
1140impl FocusChainProviderEvent {
1141 fn decode(
1143 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1144 ) -> Result<FocusChainProviderEvent, fidl::Error> {
1145 let (bytes, _handles) = buf.split_mut();
1146 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1147 debug_assert_eq!(tx_header.tx_id, 0);
1148 match tx_header.ordinal {
1149 _ => Err(fidl::Error::UnknownOrdinal {
1150 ordinal: tx_header.ordinal,
1151 protocol_name:
1152 <FocusChainProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1153 }),
1154 }
1155 }
1156}
1157
1158pub struct FocusChainProviderRequestStream {
1160 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1161 is_terminated: bool,
1162}
1163
1164impl std::marker::Unpin for FocusChainProviderRequestStream {}
1165
1166impl futures::stream::FusedStream for FocusChainProviderRequestStream {
1167 fn is_terminated(&self) -> bool {
1168 self.is_terminated
1169 }
1170}
1171
1172impl fidl::endpoints::RequestStream for FocusChainProviderRequestStream {
1173 type Protocol = FocusChainProviderMarker;
1174 type ControlHandle = FocusChainProviderControlHandle;
1175
1176 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1177 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1178 }
1179
1180 fn control_handle(&self) -> Self::ControlHandle {
1181 FocusChainProviderControlHandle { inner: self.inner.clone() }
1182 }
1183
1184 fn into_inner(
1185 self,
1186 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1187 {
1188 (self.inner, self.is_terminated)
1189 }
1190
1191 fn from_inner(
1192 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1193 is_terminated: bool,
1194 ) -> Self {
1195 Self { inner, is_terminated }
1196 }
1197}
1198
1199impl futures::Stream for FocusChainProviderRequestStream {
1200 type Item = Result<FocusChainProviderRequest, fidl::Error>;
1201
1202 fn poll_next(
1203 mut self: std::pin::Pin<&mut Self>,
1204 cx: &mut std::task::Context<'_>,
1205 ) -> std::task::Poll<Option<Self::Item>> {
1206 let this = &mut *self;
1207 if this.inner.check_shutdown(cx) {
1208 this.is_terminated = true;
1209 return std::task::Poll::Ready(None);
1210 }
1211 if this.is_terminated {
1212 panic!("polled FocusChainProviderRequestStream after completion");
1213 }
1214 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1215 |bytes, handles| {
1216 match this.inner.channel().read_etc(cx, bytes, handles) {
1217 std::task::Poll::Ready(Ok(())) => {}
1218 std::task::Poll::Pending => return std::task::Poll::Pending,
1219 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1220 this.is_terminated = true;
1221 return std::task::Poll::Ready(None);
1222 }
1223 std::task::Poll::Ready(Err(e)) => {
1224 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1225 e.into(),
1226 ))));
1227 }
1228 }
1229
1230 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1232
1233 std::task::Poll::Ready(Some(match header.ordinal {
1234 0x726d2fdae53c1ab7 => {
1235 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1236 let mut req = fidl::new_empty!(FocusChainProviderWatchFocusKoidChainRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1237 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FocusChainProviderWatchFocusKoidChainRequest>(&header, _body_bytes, handles, &mut req)?;
1238 let control_handle = FocusChainProviderControlHandle {
1239 inner: this.inner.clone(),
1240 };
1241 Ok(FocusChainProviderRequest::WatchFocusKoidChain {payload: req,
1242 responder: FocusChainProviderWatchFocusKoidChainResponder {
1243 control_handle: std::mem::ManuallyDrop::new(control_handle),
1244 tx_id: header.tx_id,
1245 },
1246 })
1247 }
1248 _ => Err(fidl::Error::UnknownOrdinal {
1249 ordinal: header.ordinal,
1250 protocol_name: <FocusChainProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1251 }),
1252 }))
1253 },
1254 )
1255 }
1256}
1257
1258#[derive(Debug)]
1264pub enum FocusChainProviderRequest {
1265 WatchFocusKoidChain {
1275 payload: FocusChainProviderWatchFocusKoidChainRequest,
1276 responder: FocusChainProviderWatchFocusKoidChainResponder,
1277 },
1278}
1279
1280impl FocusChainProviderRequest {
1281 #[allow(irrefutable_let_patterns)]
1282 pub fn into_watch_focus_koid_chain(
1283 self,
1284 ) -> Option<(
1285 FocusChainProviderWatchFocusKoidChainRequest,
1286 FocusChainProviderWatchFocusKoidChainResponder,
1287 )> {
1288 if let FocusChainProviderRequest::WatchFocusKoidChain { payload, responder } = self {
1289 Some((payload, responder))
1290 } else {
1291 None
1292 }
1293 }
1294
1295 pub fn method_name(&self) -> &'static str {
1297 match *self {
1298 FocusChainProviderRequest::WatchFocusKoidChain { .. } => "watch_focus_koid_chain",
1299 }
1300 }
1301}
1302
1303#[derive(Debug, Clone)]
1304pub struct FocusChainProviderControlHandle {
1305 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1306}
1307
1308impl FocusChainProviderControlHandle {
1309 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1310 self.inner.shutdown_with_epitaph(status.into())
1311 }
1312}
1313
1314impl fidl::endpoints::ControlHandle for FocusChainProviderControlHandle {
1315 fn shutdown(&self) {
1316 self.inner.shutdown()
1317 }
1318
1319 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1320 self.inner.shutdown_with_epitaph(status)
1321 }
1322
1323 fn is_closed(&self) -> bool {
1324 self.inner.channel().is_closed()
1325 }
1326 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1327 self.inner.channel().on_closed()
1328 }
1329
1330 #[cfg(target_os = "fuchsia")]
1331 fn signal_peer(
1332 &self,
1333 clear_mask: zx::Signals,
1334 set_mask: zx::Signals,
1335 ) -> Result<(), zx_status::Status> {
1336 use fidl::Peered;
1337 self.inner.channel().signal_peer(clear_mask, set_mask)
1338 }
1339}
1340
1341impl FocusChainProviderControlHandle {}
1342
1343#[must_use = "FIDL methods require a response to be sent"]
1344#[derive(Debug)]
1345pub struct FocusChainProviderWatchFocusKoidChainResponder {
1346 control_handle: std::mem::ManuallyDrop<FocusChainProviderControlHandle>,
1347 tx_id: u32,
1348}
1349
1350impl std::ops::Drop for FocusChainProviderWatchFocusKoidChainResponder {
1354 fn drop(&mut self) {
1355 self.control_handle.shutdown();
1356 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1358 }
1359}
1360
1361impl fidl::endpoints::Responder for FocusChainProviderWatchFocusKoidChainResponder {
1362 type ControlHandle = FocusChainProviderControlHandle;
1363
1364 fn control_handle(&self) -> &FocusChainProviderControlHandle {
1365 &self.control_handle
1366 }
1367
1368 fn drop_without_shutdown(mut self) {
1369 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371 std::mem::forget(self);
1373 }
1374}
1375
1376impl FocusChainProviderWatchFocusKoidChainResponder {
1377 pub fn send(self, mut payload: &FocusKoidChain) -> Result<(), fidl::Error> {
1381 let _result = self.send_raw(payload);
1382 if _result.is_err() {
1383 self.control_handle.shutdown();
1384 }
1385 self.drop_without_shutdown();
1386 _result
1387 }
1388
1389 pub fn send_no_shutdown_on_err(self, mut payload: &FocusKoidChain) -> Result<(), fidl::Error> {
1391 let _result = self.send_raw(payload);
1392 self.drop_without_shutdown();
1393 _result
1394 }
1395
1396 fn send_raw(&self, mut payload: &FocusKoidChain) -> Result<(), fidl::Error> {
1397 self.control_handle.inner.send::<FocusKoidChain>(
1398 payload,
1399 self.tx_id,
1400 0x726d2fdae53c1ab7,
1401 fidl::encoding::DynamicFlags::empty(),
1402 )
1403 }
1404}
1405
1406mod internal {
1407 use super::*;
1408
1409 impl fidl::encoding::ResourceTypeMarker for FocusChainListenerOnFocusChangeRequest {
1410 type Borrowed<'a> = &'a mut Self;
1411 fn take_or_borrow<'a>(
1412 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1413 ) -> Self::Borrowed<'a> {
1414 value
1415 }
1416 }
1417
1418 unsafe impl fidl::encoding::TypeMarker for FocusChainListenerOnFocusChangeRequest {
1419 type Owned = Self;
1420
1421 #[inline(always)]
1422 fn inline_align(_context: fidl::encoding::Context) -> usize {
1423 8
1424 }
1425
1426 #[inline(always)]
1427 fn inline_size(_context: fidl::encoding::Context) -> usize {
1428 16
1429 }
1430 }
1431
1432 unsafe impl
1433 fidl::encoding::Encode<
1434 FocusChainListenerOnFocusChangeRequest,
1435 fidl::encoding::DefaultFuchsiaResourceDialect,
1436 > for &mut FocusChainListenerOnFocusChangeRequest
1437 {
1438 #[inline]
1439 unsafe fn encode(
1440 self,
1441 encoder: &mut fidl::encoding::Encoder<
1442 '_,
1443 fidl::encoding::DefaultFuchsiaResourceDialect,
1444 >,
1445 offset: usize,
1446 _depth: fidl::encoding::Depth,
1447 ) -> fidl::Result<()> {
1448 encoder.debug_check_bounds::<FocusChainListenerOnFocusChangeRequest>(offset);
1449 fidl::encoding::Encode::<
1451 FocusChainListenerOnFocusChangeRequest,
1452 fidl::encoding::DefaultFuchsiaResourceDialect,
1453 >::encode(
1454 (<FocusChain as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1455 &mut self.focus_chain,
1456 ),),
1457 encoder,
1458 offset,
1459 _depth,
1460 )
1461 }
1462 }
1463 unsafe impl<
1464 T0: fidl::encoding::Encode<FocusChain, fidl::encoding::DefaultFuchsiaResourceDialect>,
1465 >
1466 fidl::encoding::Encode<
1467 FocusChainListenerOnFocusChangeRequest,
1468 fidl::encoding::DefaultFuchsiaResourceDialect,
1469 > for (T0,)
1470 {
1471 #[inline]
1472 unsafe fn encode(
1473 self,
1474 encoder: &mut fidl::encoding::Encoder<
1475 '_,
1476 fidl::encoding::DefaultFuchsiaResourceDialect,
1477 >,
1478 offset: usize,
1479 depth: fidl::encoding::Depth,
1480 ) -> fidl::Result<()> {
1481 encoder.debug_check_bounds::<FocusChainListenerOnFocusChangeRequest>(offset);
1482 self.0.encode(encoder, offset + 0, depth)?;
1486 Ok(())
1487 }
1488 }
1489
1490 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1491 for FocusChainListenerOnFocusChangeRequest
1492 {
1493 #[inline(always)]
1494 fn new_empty() -> Self {
1495 Self {
1496 focus_chain: fidl::new_empty!(
1497 FocusChain,
1498 fidl::encoding::DefaultFuchsiaResourceDialect
1499 ),
1500 }
1501 }
1502
1503 #[inline]
1504 unsafe fn decode(
1505 &mut self,
1506 decoder: &mut fidl::encoding::Decoder<
1507 '_,
1508 fidl::encoding::DefaultFuchsiaResourceDialect,
1509 >,
1510 offset: usize,
1511 _depth: fidl::encoding::Depth,
1512 ) -> fidl::Result<()> {
1513 decoder.debug_check_bounds::<Self>(offset);
1514 fidl::decode!(
1516 FocusChain,
1517 fidl::encoding::DefaultFuchsiaResourceDialect,
1518 &mut self.focus_chain,
1519 decoder,
1520 offset + 0,
1521 _depth
1522 )?;
1523 Ok(())
1524 }
1525 }
1526
1527 impl fidl::encoding::ResourceTypeMarker for FocusChainListenerRegistryRegisterRequest {
1528 type Borrowed<'a> = &'a mut Self;
1529 fn take_or_borrow<'a>(
1530 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1531 ) -> Self::Borrowed<'a> {
1532 value
1533 }
1534 }
1535
1536 unsafe impl fidl::encoding::TypeMarker for FocusChainListenerRegistryRegisterRequest {
1537 type Owned = Self;
1538
1539 #[inline(always)]
1540 fn inline_align(_context: fidl::encoding::Context) -> usize {
1541 4
1542 }
1543
1544 #[inline(always)]
1545 fn inline_size(_context: fidl::encoding::Context) -> usize {
1546 4
1547 }
1548 }
1549
1550 unsafe impl
1551 fidl::encoding::Encode<
1552 FocusChainListenerRegistryRegisterRequest,
1553 fidl::encoding::DefaultFuchsiaResourceDialect,
1554 > for &mut FocusChainListenerRegistryRegisterRequest
1555 {
1556 #[inline]
1557 unsafe fn encode(
1558 self,
1559 encoder: &mut fidl::encoding::Encoder<
1560 '_,
1561 fidl::encoding::DefaultFuchsiaResourceDialect,
1562 >,
1563 offset: usize,
1564 _depth: fidl::encoding::Depth,
1565 ) -> fidl::Result<()> {
1566 encoder.debug_check_bounds::<FocusChainListenerRegistryRegisterRequest>(offset);
1567 fidl::encoding::Encode::<FocusChainListenerRegistryRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1569 (
1570 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FocusChainListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
1571 ),
1572 encoder, offset, _depth
1573 )
1574 }
1575 }
1576 unsafe impl<
1577 T0: fidl::encoding::Encode<
1578 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FocusChainListenerMarker>>,
1579 fidl::encoding::DefaultFuchsiaResourceDialect,
1580 >,
1581 >
1582 fidl::encoding::Encode<
1583 FocusChainListenerRegistryRegisterRequest,
1584 fidl::encoding::DefaultFuchsiaResourceDialect,
1585 > for (T0,)
1586 {
1587 #[inline]
1588 unsafe fn encode(
1589 self,
1590 encoder: &mut fidl::encoding::Encoder<
1591 '_,
1592 fidl::encoding::DefaultFuchsiaResourceDialect,
1593 >,
1594 offset: usize,
1595 depth: fidl::encoding::Depth,
1596 ) -> fidl::Result<()> {
1597 encoder.debug_check_bounds::<FocusChainListenerRegistryRegisterRequest>(offset);
1598 self.0.encode(encoder, offset + 0, depth)?;
1602 Ok(())
1603 }
1604 }
1605
1606 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1607 for FocusChainListenerRegistryRegisterRequest
1608 {
1609 #[inline(always)]
1610 fn new_empty() -> Self {
1611 Self {
1612 listener: fidl::new_empty!(
1613 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FocusChainListenerMarker>>,
1614 fidl::encoding::DefaultFuchsiaResourceDialect
1615 ),
1616 }
1617 }
1618
1619 #[inline]
1620 unsafe fn decode(
1621 &mut self,
1622 decoder: &mut fidl::encoding::Decoder<
1623 '_,
1624 fidl::encoding::DefaultFuchsiaResourceDialect,
1625 >,
1626 offset: usize,
1627 _depth: fidl::encoding::Depth,
1628 ) -> fidl::Result<()> {
1629 decoder.debug_check_bounds::<Self>(offset);
1630 fidl::decode!(
1632 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FocusChainListenerMarker>>,
1633 fidl::encoding::DefaultFuchsiaResourceDialect,
1634 &mut self.listener,
1635 decoder,
1636 offset + 0,
1637 _depth
1638 )?;
1639 Ok(())
1640 }
1641 }
1642
1643 impl FocusChain {
1644 #[inline(always)]
1645 fn max_ordinal_present(&self) -> u64 {
1646 if let Some(_) = self.focus_chain {
1647 return 1;
1648 }
1649 0
1650 }
1651 }
1652
1653 impl fidl::encoding::ResourceTypeMarker for FocusChain {
1654 type Borrowed<'a> = &'a mut Self;
1655 fn take_or_borrow<'a>(
1656 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1657 ) -> Self::Borrowed<'a> {
1658 value
1659 }
1660 }
1661
1662 unsafe impl fidl::encoding::TypeMarker for FocusChain {
1663 type Owned = Self;
1664
1665 #[inline(always)]
1666 fn inline_align(_context: fidl::encoding::Context) -> usize {
1667 8
1668 }
1669
1670 #[inline(always)]
1671 fn inline_size(_context: fidl::encoding::Context) -> usize {
1672 16
1673 }
1674 }
1675
1676 unsafe impl fidl::encoding::Encode<FocusChain, fidl::encoding::DefaultFuchsiaResourceDialect>
1677 for &mut FocusChain
1678 {
1679 unsafe fn encode(
1680 self,
1681 encoder: &mut fidl::encoding::Encoder<
1682 '_,
1683 fidl::encoding::DefaultFuchsiaResourceDialect,
1684 >,
1685 offset: usize,
1686 mut depth: fidl::encoding::Depth,
1687 ) -> fidl::Result<()> {
1688 encoder.debug_check_bounds::<FocusChain>(offset);
1689 let max_ordinal: u64 = self.max_ordinal_present();
1691 encoder.write_num(max_ordinal, offset);
1692 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1693 if max_ordinal == 0 {
1695 return Ok(());
1696 }
1697 depth.increment()?;
1698 let envelope_size = 8;
1699 let bytes_len = max_ordinal as usize * envelope_size;
1700 #[allow(unused_variables)]
1701 let offset = encoder.out_of_line_offset(bytes_len);
1702 let mut _prev_end_offset: usize = 0;
1703 if 1 > max_ordinal {
1704 return Ok(());
1705 }
1706
1707 let cur_offset: usize = (1 - 1) * envelope_size;
1710
1711 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1713
1714 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_ui_views::ViewRef>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1719 self.focus_chain.as_mut().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_ui_views::ViewRef> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1720 encoder, offset + cur_offset, depth
1721 )?;
1722
1723 _prev_end_offset = cur_offset + envelope_size;
1724
1725 Ok(())
1726 }
1727 }
1728
1729 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FocusChain {
1730 #[inline(always)]
1731 fn new_empty() -> Self {
1732 Self::default()
1733 }
1734
1735 unsafe fn decode(
1736 &mut self,
1737 decoder: &mut fidl::encoding::Decoder<
1738 '_,
1739 fidl::encoding::DefaultFuchsiaResourceDialect,
1740 >,
1741 offset: usize,
1742 mut depth: fidl::encoding::Depth,
1743 ) -> fidl::Result<()> {
1744 decoder.debug_check_bounds::<Self>(offset);
1745 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1746 None => return Err(fidl::Error::NotNullable),
1747 Some(len) => len,
1748 };
1749 if len == 0 {
1751 return Ok(());
1752 };
1753 depth.increment()?;
1754 let envelope_size = 8;
1755 let bytes_len = len * envelope_size;
1756 let offset = decoder.out_of_line_offset(bytes_len)?;
1757 let mut _next_ordinal_to_read = 0;
1759 let mut next_offset = offset;
1760 let end_offset = offset + bytes_len;
1761 _next_ordinal_to_read += 1;
1762 if next_offset >= end_offset {
1763 return Ok(());
1764 }
1765
1766 while _next_ordinal_to_read < 1 {
1768 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1769 _next_ordinal_to_read += 1;
1770 next_offset += envelope_size;
1771 }
1772
1773 let next_out_of_line = decoder.next_out_of_line();
1774 let handles_before = decoder.remaining_handles();
1775 if let Some((inlined, num_bytes, num_handles)) =
1776 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1777 {
1778 let member_inline_size = <fidl::encoding::UnboundedVector<
1779 fidl_fuchsia_ui_views::ViewRef,
1780 > as fidl::encoding::TypeMarker>::inline_size(
1781 decoder.context
1782 );
1783 if inlined != (member_inline_size <= 4) {
1784 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1785 }
1786 let inner_offset;
1787 let mut inner_depth = depth.clone();
1788 if inlined {
1789 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1790 inner_offset = next_offset;
1791 } else {
1792 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1793 inner_depth.increment()?;
1794 }
1795 let val_ref = self.focus_chain.get_or_insert_with(|| {
1796 fidl::new_empty!(
1797 fidl::encoding::UnboundedVector<fidl_fuchsia_ui_views::ViewRef>,
1798 fidl::encoding::DefaultFuchsiaResourceDialect
1799 )
1800 });
1801 fidl::decode!(
1802 fidl::encoding::UnboundedVector<fidl_fuchsia_ui_views::ViewRef>,
1803 fidl::encoding::DefaultFuchsiaResourceDialect,
1804 val_ref,
1805 decoder,
1806 inner_offset,
1807 inner_depth
1808 )?;
1809 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1810 {
1811 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1812 }
1813 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1814 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1815 }
1816 }
1817
1818 next_offset += envelope_size;
1819
1820 while next_offset < end_offset {
1822 _next_ordinal_to_read += 1;
1823 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1824 next_offset += envelope_size;
1825 }
1826
1827 Ok(())
1828 }
1829 }
1830}