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