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#[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 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}