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 fidl::endpoints::ControlHandle for ProviderControlHandle {
526 fn shutdown(&self) {
527 self.inner.shutdown()
528 }
529
530 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
531 self.inner.shutdown_with_epitaph(status)
532 }
533
534 fn is_closed(&self) -> bool {
535 self.inner.channel().is_closed()
536 }
537 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
538 self.inner.channel().on_closed()
539 }
540
541 #[cfg(target_os = "fuchsia")]
542 fn signal_peer(
543 &self,
544 clear_mask: zx::Signals,
545 set_mask: zx::Signals,
546 ) -> Result<(), zx_status::Status> {
547 use fidl::Peered;
548 self.inner.channel().signal_peer(clear_mask, set_mask)
549 }
550}
551
552impl ProviderControlHandle {}
553
554mod internal {
555 use super::*;
556
557 impl fidl::encoding::ResourceTypeMarker for ProviderCreateViewRequest {
558 type Borrowed<'a> = &'a mut Self;
559 fn take_or_borrow<'a>(
560 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
561 ) -> Self::Borrowed<'a> {
562 value
563 }
564 }
565
566 unsafe impl fidl::encoding::TypeMarker for ProviderCreateViewRequest {
567 type Owned = Self;
568
569 #[inline(always)]
570 fn inline_align(_context: fidl::encoding::Context) -> usize {
571 4
572 }
573
574 #[inline(always)]
575 fn inline_size(_context: fidl::encoding::Context) -> usize {
576 8
577 }
578 }
579
580 unsafe impl
581 fidl::encoding::Encode<
582 ProviderCreateViewRequest,
583 fidl::encoding::DefaultFuchsiaResourceDialect,
584 > for &mut ProviderCreateViewRequest
585 {
586 #[inline]
587 unsafe fn encode(
588 self,
589 encoder: &mut fidl::encoding::Encoder<
590 '_,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 >,
593 offset: usize,
594 _depth: fidl::encoding::Depth,
595 ) -> fidl::Result<()> {
596 encoder.debug_check_bounds::<ProviderCreateViewRequest>(offset);
597 fidl::encoding::Encode::<ProviderCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
599 (
600 <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.a11y_view_token),
601 <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.proxy_viewport_token),
602 ),
603 encoder, offset, _depth
604 )
605 }
606 }
607 unsafe impl<
608 T0: fidl::encoding::Encode<
609 fidl_fuchsia_ui_views::ViewCreationToken,
610 fidl::encoding::DefaultFuchsiaResourceDialect,
611 >,
612 T1: fidl::encoding::Encode<
613 fidl_fuchsia_ui_views::ViewportCreationToken,
614 fidl::encoding::DefaultFuchsiaResourceDialect,
615 >,
616 >
617 fidl::encoding::Encode<
618 ProviderCreateViewRequest,
619 fidl::encoding::DefaultFuchsiaResourceDialect,
620 > for (T0, T1)
621 {
622 #[inline]
623 unsafe fn encode(
624 self,
625 encoder: &mut fidl::encoding::Encoder<
626 '_,
627 fidl::encoding::DefaultFuchsiaResourceDialect,
628 >,
629 offset: usize,
630 depth: fidl::encoding::Depth,
631 ) -> fidl::Result<()> {
632 encoder.debug_check_bounds::<ProviderCreateViewRequest>(offset);
633 self.0.encode(encoder, offset + 0, depth)?;
637 self.1.encode(encoder, offset + 4, depth)?;
638 Ok(())
639 }
640 }
641
642 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
643 for ProviderCreateViewRequest
644 {
645 #[inline(always)]
646 fn new_empty() -> Self {
647 Self {
648 a11y_view_token: fidl::new_empty!(
649 fidl_fuchsia_ui_views::ViewCreationToken,
650 fidl::encoding::DefaultFuchsiaResourceDialect
651 ),
652 proxy_viewport_token: fidl::new_empty!(
653 fidl_fuchsia_ui_views::ViewportCreationToken,
654 fidl::encoding::DefaultFuchsiaResourceDialect
655 ),
656 }
657 }
658
659 #[inline]
660 unsafe fn decode(
661 &mut self,
662 decoder: &mut fidl::encoding::Decoder<
663 '_,
664 fidl::encoding::DefaultFuchsiaResourceDialect,
665 >,
666 offset: usize,
667 _depth: fidl::encoding::Depth,
668 ) -> fidl::Result<()> {
669 decoder.debug_check_bounds::<Self>(offset);
670 fidl::decode!(
672 fidl_fuchsia_ui_views::ViewCreationToken,
673 fidl::encoding::DefaultFuchsiaResourceDialect,
674 &mut self.a11y_view_token,
675 decoder,
676 offset + 0,
677 _depth
678 )?;
679 fidl::decode!(
680 fidl_fuchsia_ui_views::ViewportCreationToken,
681 fidl::encoding::DefaultFuchsiaResourceDialect,
682 &mut self.proxy_viewport_token,
683 decoder,
684 offset + 4,
685 _depth
686 )?;
687 Ok(())
688 }
689 }
690}