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_accessibility_scene_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ProviderCreateViewRequest {
16 pub a11y_view_token: fidl_fuchsia_ui_views::ViewCreationToken,
17 pub proxy_viewport_token: fidl_fuchsia_ui_views::ViewportCreationToken,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderCreateViewRequest {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct ProviderMarker;
24
25impl fidl::endpoints::ProtocolMarker for ProviderMarker {
26 type Proxy = ProviderProxy;
27 type RequestStream = ProviderRequestStream;
28 #[cfg(target_os = "fuchsia")]
29 type SynchronousProxy = ProviderSynchronousProxy;
30
31 const DEBUG_NAME: &'static str = "fuchsia.accessibility.scene.Provider";
32}
33impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
34
35pub trait ProviderProxyInterface: Send + Sync {
36 fn r#create_view(
37 &self,
38 a11y_view_token: fidl_fuchsia_ui_views::ViewCreationToken,
39 proxy_viewport_token: fidl_fuchsia_ui_views::ViewportCreationToken,
40 ) -> Result<(), fidl::Error>;
41}
42#[derive(Debug)]
43#[cfg(target_os = "fuchsia")]
44pub struct ProviderSynchronousProxy {
45 client: fidl::client::sync::Client,
46}
47
48#[cfg(target_os = "fuchsia")]
49impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
50 type Proxy = ProviderProxy;
51 type Protocol = ProviderMarker;
52
53 fn from_channel(inner: fidl::Channel) -> Self {
54 Self::new(inner)
55 }
56
57 fn into_channel(self) -> fidl::Channel {
58 self.client.into_channel()
59 }
60
61 fn as_channel(&self) -> &fidl::Channel {
62 self.client.as_channel()
63 }
64}
65
66#[cfg(target_os = "fuchsia")]
67impl ProviderSynchronousProxy {
68 pub fn new(channel: fidl::Channel) -> Self {
69 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
70 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
71 }
72
73 pub fn into_channel(self) -> fidl::Channel {
74 self.client.into_channel()
75 }
76
77 pub fn wait_for_event(
80 &self,
81 deadline: zx::MonotonicInstant,
82 ) -> Result<ProviderEvent, fidl::Error> {
83 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
84 }
85
86 pub fn r#create_view(
137 &self,
138 mut a11y_view_token: fidl_fuchsia_ui_views::ViewCreationToken,
139 mut proxy_viewport_token: fidl_fuchsia_ui_views::ViewportCreationToken,
140 ) -> Result<(), fidl::Error> {
141 self.client.send::<ProviderCreateViewRequest>(
142 (&mut a11y_view_token, &mut proxy_viewport_token),
143 0x406435c9e8281daf,
144 fidl::encoding::DynamicFlags::empty(),
145 )
146 }
147}
148
149#[cfg(target_os = "fuchsia")]
150impl From<ProviderSynchronousProxy> for zx::Handle {
151 fn from(value: ProviderSynchronousProxy) -> Self {
152 value.into_channel().into()
153 }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl From<fidl::Channel> for ProviderSynchronousProxy {
158 fn from(value: fidl::Channel) -> Self {
159 Self::new(value)
160 }
161}
162
163#[derive(Debug, Clone)]
164pub struct ProviderProxy {
165 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
166}
167
168impl fidl::endpoints::Proxy for ProviderProxy {
169 type Protocol = ProviderMarker;
170
171 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
172 Self::new(inner)
173 }
174
175 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
176 self.client.into_channel().map_err(|client| Self { client })
177 }
178
179 fn as_channel(&self) -> &::fidl::AsyncChannel {
180 self.client.as_channel()
181 }
182}
183
184impl ProviderProxy {
185 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
187 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
188 Self { client: fidl::client::Client::new(channel, protocol_name) }
189 }
190
191 pub fn take_event_stream(&self) -> ProviderEventStream {
197 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
198 }
199
200 pub fn r#create_view(
251 &self,
252 mut a11y_view_token: fidl_fuchsia_ui_views::ViewCreationToken,
253 mut proxy_viewport_token: fidl_fuchsia_ui_views::ViewportCreationToken,
254 ) -> Result<(), fidl::Error> {
255 ProviderProxyInterface::r#create_view(self, a11y_view_token, proxy_viewport_token)
256 }
257}
258
259impl ProviderProxyInterface for ProviderProxy {
260 fn r#create_view(
261 &self,
262 mut a11y_view_token: fidl_fuchsia_ui_views::ViewCreationToken,
263 mut proxy_viewport_token: fidl_fuchsia_ui_views::ViewportCreationToken,
264 ) -> Result<(), fidl::Error> {
265 self.client.send::<ProviderCreateViewRequest>(
266 (&mut a11y_view_token, &mut proxy_viewport_token),
267 0x406435c9e8281daf,
268 fidl::encoding::DynamicFlags::empty(),
269 )
270 }
271}
272
273pub struct ProviderEventStream {
274 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
275}
276
277impl std::marker::Unpin for ProviderEventStream {}
278
279impl futures::stream::FusedStream for ProviderEventStream {
280 fn is_terminated(&self) -> bool {
281 self.event_receiver.is_terminated()
282 }
283}
284
285impl futures::Stream for ProviderEventStream {
286 type Item = Result<ProviderEvent, fidl::Error>;
287
288 fn poll_next(
289 mut self: std::pin::Pin<&mut Self>,
290 cx: &mut std::task::Context<'_>,
291 ) -> std::task::Poll<Option<Self::Item>> {
292 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
293 &mut self.event_receiver,
294 cx
295 )?) {
296 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
297 None => std::task::Poll::Ready(None),
298 }
299 }
300}
301
302#[derive(Debug)]
303pub enum ProviderEvent {}
304
305impl ProviderEvent {
306 fn decode(
308 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
309 ) -> Result<ProviderEvent, fidl::Error> {
310 let (bytes, _handles) = buf.split_mut();
311 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
312 debug_assert_eq!(tx_header.tx_id, 0);
313 match tx_header.ordinal {
314 _ => Err(fidl::Error::UnknownOrdinal {
315 ordinal: tx_header.ordinal,
316 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
317 }),
318 }
319 }
320}
321
322pub struct ProviderRequestStream {
324 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
325 is_terminated: bool,
326}
327
328impl std::marker::Unpin for ProviderRequestStream {}
329
330impl futures::stream::FusedStream for ProviderRequestStream {
331 fn is_terminated(&self) -> bool {
332 self.is_terminated
333 }
334}
335
336impl fidl::endpoints::RequestStream for ProviderRequestStream {
337 type Protocol = ProviderMarker;
338 type ControlHandle = ProviderControlHandle;
339
340 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
341 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
342 }
343
344 fn control_handle(&self) -> Self::ControlHandle {
345 ProviderControlHandle { inner: self.inner.clone() }
346 }
347
348 fn into_inner(
349 self,
350 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
351 {
352 (self.inner, self.is_terminated)
353 }
354
355 fn from_inner(
356 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
357 is_terminated: bool,
358 ) -> Self {
359 Self { inner, is_terminated }
360 }
361}
362
363impl futures::Stream for ProviderRequestStream {
364 type Item = Result<ProviderRequest, fidl::Error>;
365
366 fn poll_next(
367 mut self: std::pin::Pin<&mut Self>,
368 cx: &mut std::task::Context<'_>,
369 ) -> std::task::Poll<Option<Self::Item>> {
370 let this = &mut *self;
371 if this.inner.check_shutdown(cx) {
372 this.is_terminated = true;
373 return std::task::Poll::Ready(None);
374 }
375 if this.is_terminated {
376 panic!("polled ProviderRequestStream after completion");
377 }
378 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
379 |bytes, handles| {
380 match this.inner.channel().read_etc(cx, bytes, handles) {
381 std::task::Poll::Ready(Ok(())) => {}
382 std::task::Poll::Pending => return std::task::Poll::Pending,
383 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
384 this.is_terminated = true;
385 return std::task::Poll::Ready(None);
386 }
387 std::task::Poll::Ready(Err(e)) => {
388 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
389 e.into(),
390 ))))
391 }
392 }
393
394 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
396
397 std::task::Poll::Ready(Some(match header.ordinal {
398 0x406435c9e8281daf => {
399 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
400 let mut req = fidl::new_empty!(
401 ProviderCreateViewRequest,
402 fidl::encoding::DefaultFuchsiaResourceDialect
403 );
404 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
405 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
406 Ok(ProviderRequest::CreateView {
407 a11y_view_token: req.a11y_view_token,
408 proxy_viewport_token: req.proxy_viewport_token,
409
410 control_handle,
411 })
412 }
413 _ => Err(fidl::Error::UnknownOrdinal {
414 ordinal: header.ordinal,
415 protocol_name:
416 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
417 }),
418 }))
419 },
420 )
421 }
422}
423
424#[derive(Debug)]
425pub enum ProviderRequest {
426 CreateView {
477 a11y_view_token: fidl_fuchsia_ui_views::ViewCreationToken,
478 proxy_viewport_token: fidl_fuchsia_ui_views::ViewportCreationToken,
479 control_handle: ProviderControlHandle,
480 },
481}
482
483impl ProviderRequest {
484 #[allow(irrefutable_let_patterns)]
485 pub fn into_create_view(
486 self,
487 ) -> Option<(
488 fidl_fuchsia_ui_views::ViewCreationToken,
489 fidl_fuchsia_ui_views::ViewportCreationToken,
490 ProviderControlHandle,
491 )> {
492 if let ProviderRequest::CreateView {
493 a11y_view_token,
494 proxy_viewport_token,
495 control_handle,
496 } = self
497 {
498 Some((a11y_view_token, proxy_viewport_token, control_handle))
499 } else {
500 None
501 }
502 }
503
504 pub fn method_name(&self) -> &'static str {
506 match *self {
507 ProviderRequest::CreateView { .. } => "create_view",
508 }
509 }
510}
511
512#[derive(Debug, Clone)]
513pub struct ProviderControlHandle {
514 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
515}
516
517impl fidl::endpoints::ControlHandle for ProviderControlHandle {
518 fn shutdown(&self) {
519 self.inner.shutdown()
520 }
521 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
522 self.inner.shutdown_with_epitaph(status)
523 }
524
525 fn is_closed(&self) -> bool {
526 self.inner.channel().is_closed()
527 }
528 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
529 self.inner.channel().on_closed()
530 }
531
532 #[cfg(target_os = "fuchsia")]
533 fn signal_peer(
534 &self,
535 clear_mask: zx::Signals,
536 set_mask: zx::Signals,
537 ) -> Result<(), zx_status::Status> {
538 use fidl::Peered;
539 self.inner.channel().signal_peer(clear_mask, set_mask)
540 }
541}
542
543impl ProviderControlHandle {}
544
545mod internal {
546 use super::*;
547
548 impl fidl::encoding::ResourceTypeMarker for ProviderCreateViewRequest {
549 type Borrowed<'a> = &'a mut Self;
550 fn take_or_borrow<'a>(
551 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
552 ) -> Self::Borrowed<'a> {
553 value
554 }
555 }
556
557 unsafe impl fidl::encoding::TypeMarker for ProviderCreateViewRequest {
558 type Owned = Self;
559
560 #[inline(always)]
561 fn inline_align(_context: fidl::encoding::Context) -> usize {
562 4
563 }
564
565 #[inline(always)]
566 fn inline_size(_context: fidl::encoding::Context) -> usize {
567 8
568 }
569 }
570
571 unsafe impl
572 fidl::encoding::Encode<
573 ProviderCreateViewRequest,
574 fidl::encoding::DefaultFuchsiaResourceDialect,
575 > for &mut ProviderCreateViewRequest
576 {
577 #[inline]
578 unsafe fn encode(
579 self,
580 encoder: &mut fidl::encoding::Encoder<
581 '_,
582 fidl::encoding::DefaultFuchsiaResourceDialect,
583 >,
584 offset: usize,
585 _depth: fidl::encoding::Depth,
586 ) -> fidl::Result<()> {
587 encoder.debug_check_bounds::<ProviderCreateViewRequest>(offset);
588 fidl::encoding::Encode::<ProviderCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
590 (
591 <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.a11y_view_token),
592 <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.proxy_viewport_token),
593 ),
594 encoder, offset, _depth
595 )
596 }
597 }
598 unsafe impl<
599 T0: fidl::encoding::Encode<
600 fidl_fuchsia_ui_views::ViewCreationToken,
601 fidl::encoding::DefaultFuchsiaResourceDialect,
602 >,
603 T1: fidl::encoding::Encode<
604 fidl_fuchsia_ui_views::ViewportCreationToken,
605 fidl::encoding::DefaultFuchsiaResourceDialect,
606 >,
607 >
608 fidl::encoding::Encode<
609 ProviderCreateViewRequest,
610 fidl::encoding::DefaultFuchsiaResourceDialect,
611 > for (T0, T1)
612 {
613 #[inline]
614 unsafe fn encode(
615 self,
616 encoder: &mut fidl::encoding::Encoder<
617 '_,
618 fidl::encoding::DefaultFuchsiaResourceDialect,
619 >,
620 offset: usize,
621 depth: fidl::encoding::Depth,
622 ) -> fidl::Result<()> {
623 encoder.debug_check_bounds::<ProviderCreateViewRequest>(offset);
624 self.0.encode(encoder, offset + 0, depth)?;
628 self.1.encode(encoder, offset + 4, depth)?;
629 Ok(())
630 }
631 }
632
633 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
634 for ProviderCreateViewRequest
635 {
636 #[inline(always)]
637 fn new_empty() -> Self {
638 Self {
639 a11y_view_token: fidl::new_empty!(
640 fidl_fuchsia_ui_views::ViewCreationToken,
641 fidl::encoding::DefaultFuchsiaResourceDialect
642 ),
643 proxy_viewport_token: fidl::new_empty!(
644 fidl_fuchsia_ui_views::ViewportCreationToken,
645 fidl::encoding::DefaultFuchsiaResourceDialect
646 ),
647 }
648 }
649
650 #[inline]
651 unsafe fn decode(
652 &mut self,
653 decoder: &mut fidl::encoding::Decoder<
654 '_,
655 fidl::encoding::DefaultFuchsiaResourceDialect,
656 >,
657 offset: usize,
658 _depth: fidl::encoding::Depth,
659 ) -> fidl::Result<()> {
660 decoder.debug_check_bounds::<Self>(offset);
661 fidl::decode!(
663 fidl_fuchsia_ui_views::ViewCreationToken,
664 fidl::encoding::DefaultFuchsiaResourceDialect,
665 &mut self.a11y_view_token,
666 decoder,
667 offset + 0,
668 _depth
669 )?;
670 fidl::decode!(
671 fidl_fuchsia_ui_views::ViewportCreationToken,
672 fidl::encoding::DefaultFuchsiaResourceDialect,
673 &mut self.proxy_viewport_token,
674 decoder,
675 offset + 4,
676 _depth
677 )?;
678 Ok(())
679 }
680 }
681}