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