fidl_fuchsia_session_scene/
fidl_fuchsia_session_scene.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// The possible errors from the `PresentRootView` family of requests.
14#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub enum PresentRootViewError {
16    /// An error occurred while processing the request.
17    InternalError,
18    #[doc(hidden)]
19    __SourceBreaking { unknown_ordinal: u32 },
20}
21
22/// Pattern that matches an unknown `PresentRootViewError` member.
23#[macro_export]
24macro_rules! PresentRootViewErrorUnknown {
25    () => {
26        _
27    };
28}
29
30impl PresentRootViewError {
31    #[inline]
32    pub fn from_primitive(prim: u32) -> Option<Self> {
33        match prim {
34            1 => Some(Self::InternalError),
35            _ => None,
36        }
37    }
38
39    #[inline]
40    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
41        match prim {
42            1 => Self::InternalError,
43            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
44        }
45    }
46
47    #[inline]
48    pub fn unknown() -> Self {
49        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
50    }
51
52    #[inline]
53    pub const fn into_primitive(self) -> u32 {
54        match self {
55            Self::InternalError => 1,
56            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
57        }
58    }
59
60    #[inline]
61    pub fn is_unknown(&self) -> bool {
62        match self {
63            Self::__SourceBreaking { unknown_ordinal: _ } => true,
64            _ => false,
65        }
66    }
67}
68
69#[derive(Debug, PartialEq)]
70pub struct ManagerPresentRootViewLegacyRequest {
71    pub view_holder_token: fidl_fuchsia_ui_views::ViewHolderToken,
72    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
76    for ManagerPresentRootViewLegacyRequest
77{
78}
79
80#[derive(Debug, PartialEq)]
81pub struct ManagerPresentRootViewRequest {
82    pub viewport_creation_token: fidl_fuchsia_ui_views::ViewportCreationToken,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
86    for ManagerPresentRootViewRequest
87{
88}
89
90#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct ManagerSetRootViewRequest {
92    pub view_provider: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ManagerSetRootViewRequest {}
96
97#[derive(Debug, PartialEq)]
98pub struct ManagerSetRootViewResponse {
99    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103    for ManagerSetRootViewResponse
104{
105}
106
107#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
108pub struct ManagerMarker;
109
110impl fidl::endpoints::ProtocolMarker for ManagerMarker {
111    type Proxy = ManagerProxy;
112    type RequestStream = ManagerRequestStream;
113    #[cfg(target_os = "fuchsia")]
114    type SynchronousProxy = ManagerSynchronousProxy;
115
116    const DEBUG_NAME: &'static str = "fuchsia.session.scene.Manager";
117}
118impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
119pub type ManagerSetRootViewResult = Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>;
120pub type ManagerPresentRootViewLegacyResult = Result<(), PresentRootViewError>;
121pub type ManagerPresentRootViewResult = Result<(), PresentRootViewError>;
122
123pub trait ManagerProxyInterface: Send + Sync {
124    type SetRootViewResponseFut: std::future::Future<Output = Result<ManagerSetRootViewResult, fidl::Error>>
125        + Send;
126    fn r#set_root_view(
127        &self,
128        view_provider: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
129    ) -> Self::SetRootViewResponseFut;
130    type PresentRootViewLegacyResponseFut: std::future::Future<Output = Result<ManagerPresentRootViewLegacyResult, fidl::Error>>
131        + Send;
132    fn r#present_root_view_legacy(
133        &self,
134        view_holder_token: fidl_fuchsia_ui_views::ViewHolderToken,
135        view_ref: fidl_fuchsia_ui_views::ViewRef,
136    ) -> Self::PresentRootViewLegacyResponseFut;
137    type PresentRootViewResponseFut: std::future::Future<Output = Result<ManagerPresentRootViewResult, fidl::Error>>
138        + Send;
139    fn r#present_root_view(
140        &self,
141        viewport_creation_token: fidl_fuchsia_ui_views::ViewportCreationToken,
142    ) -> Self::PresentRootViewResponseFut;
143}
144#[derive(Debug)]
145#[cfg(target_os = "fuchsia")]
146pub struct ManagerSynchronousProxy {
147    client: fidl::client::sync::Client,
148}
149
150#[cfg(target_os = "fuchsia")]
151impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
152    type Proxy = ManagerProxy;
153    type Protocol = ManagerMarker;
154
155    fn from_channel(inner: fidl::Channel) -> Self {
156        Self::new(inner)
157    }
158
159    fn into_channel(self) -> fidl::Channel {
160        self.client.into_channel()
161    }
162
163    fn as_channel(&self) -> &fidl::Channel {
164        self.client.as_channel()
165    }
166}
167
168#[cfg(target_os = "fuchsia")]
169impl ManagerSynchronousProxy {
170    pub fn new(channel: fidl::Channel) -> Self {
171        let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
172        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
173    }
174
175    pub fn into_channel(self) -> fidl::Channel {
176        self.client.into_channel()
177    }
178
179    /// Waits until an event arrives and returns it. It is safe for other
180    /// threads to make concurrent requests while waiting for an event.
181    pub fn wait_for_event(
182        &self,
183        deadline: zx::MonotonicInstant,
184    ) -> Result<ManagerEvent, fidl::Error> {
185        ManagerEvent::decode(self.client.wait_for_event(deadline)?)
186    }
187
188    /// Sets the root view of the scene graph to the view provided by `view_provider`.
189    ///
190    /// Subsequent calls will replace the view tree with the one starting at the new root view.
191    /// The root view is shared between all clients of `Manager`.
192    ///
193    /// Returns a `fuchsia.ui.views.ViewRef` referencing the view provided by `view_provider`.
194    /// If this ViewRef cannot be returned (e.g. in Flatland case, if the ViewCreationToken is
195    /// dropped before it is given to Scenic), then the connection to the `Manager` will be closed.
196    ///
197    /// The client can expect that:
198    ///
199    /// (1) Its root view will be focused once it's connected to the scene.
200    /// (2) The logical size and position of its root view match the display.
201    ///
202    /// TODO(https://fxbug.dev/42055565): Fix this situation.
203    /// NOTE: the ViewRef is only returned after the child view is connected to the scene graph.
204    /// Therefore, the caller must guarantee that the child view will eventually be connected before
205    /// waiting for the ViewRef; if the child view doesn't connect, it is possible to deadlock.
206    pub fn r#set_root_view(
207        &self,
208        mut view_provider: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
209        ___deadline: zx::MonotonicInstant,
210    ) -> Result<ManagerSetRootViewResult, fidl::Error> {
211        let _response =
212            self.client.send_query::<ManagerSetRootViewRequest, fidl::encoding::ResultType<
213                ManagerSetRootViewResponse,
214                PresentRootViewError,
215            >>(
216                (view_provider,),
217                0x3095976368270dc4,
218                fidl::encoding::DynamicFlags::empty(),
219                ___deadline,
220            )?;
221        Ok(_response.map(|x| x.view_ref))
222    }
223
224    /// Presents a view tree to the display, via the provided view holder token.
225    ///
226    /// This call will present the view using the legacy GFX API.
227    ///
228    /// Subsequent calls will replace the view tree with the one starting at the new root viewport.
229    /// The root view is shared between all clients of `Manager`.
230    ///
231    /// The client can expect that:
232    ///
233    /// (1) Its root view will be focused once it's connected to the scene.
234    /// (2) The logical size and position of its root view match the display.
235    ///
236    /// TODO(https://fxbug.dev/42055565): Fix this situation.
237    /// NOTE: this method returns only after the child view is connected to the scene graph.
238    /// Therefore, the caller must guarantee that the child view will eventually be connected before
239    /// waiting for the return; if the child view doesn't connect, it is possible to deadlock.
240    pub fn r#present_root_view_legacy(
241        &self,
242        mut view_holder_token: fidl_fuchsia_ui_views::ViewHolderToken,
243        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
244        ___deadline: zx::MonotonicInstant,
245    ) -> Result<ManagerPresentRootViewLegacyResult, fidl::Error> {
246        let _response = self.client.send_query::<
247            ManagerPresentRootViewLegacyRequest,
248            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PresentRootViewError>,
249        >(
250            (&mut view_holder_token, &mut view_ref,),
251            0x17729b456a2eff7,
252            fidl::encoding::DynamicFlags::empty(),
253            ___deadline,
254        )?;
255        Ok(_response.map(|x| x))
256    }
257
258    /// Presents a view tree to the display, via the provided viewport token.
259    ///
260    /// Subsequent calls will replace the view tree with the one starting at the new root viewport.
261    /// The root view is shared between all clients of `Manager`.
262    ///
263    /// The client can expect that:
264    ///
265    /// (1) Its root view will be focused once it's connected to the scene.
266    /// (2) The logical size and position of its root view match the display.
267    ///
268    /// TODO(https://fxbug.dev/42055565): Fix this situation.
269    /// NOTE: this method returns only after the child view is connected to the scene graph.
270    /// Therefore, the caller must guarantee that the child view will eventually be connected before
271    /// waiting for the return; if the child view doesn't connect, it is possible to deadlock.
272    pub fn r#present_root_view(
273        &self,
274        mut viewport_creation_token: fidl_fuchsia_ui_views::ViewportCreationToken,
275        ___deadline: zx::MonotonicInstant,
276    ) -> Result<ManagerPresentRootViewResult, fidl::Error> {
277        let _response =
278            self.client.send_query::<ManagerPresentRootViewRequest, fidl::encoding::ResultType<
279                fidl::encoding::EmptyStruct,
280                PresentRootViewError,
281            >>(
282                (&mut viewport_creation_token,),
283                0x51e070bb675a18df,
284                fidl::encoding::DynamicFlags::empty(),
285                ___deadline,
286            )?;
287        Ok(_response.map(|x| x))
288    }
289}
290
291#[derive(Debug, Clone)]
292pub struct ManagerProxy {
293    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
294}
295
296impl fidl::endpoints::Proxy for ManagerProxy {
297    type Protocol = ManagerMarker;
298
299    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
300        Self::new(inner)
301    }
302
303    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
304        self.client.into_channel().map_err(|client| Self { client })
305    }
306
307    fn as_channel(&self) -> &::fidl::AsyncChannel {
308        self.client.as_channel()
309    }
310}
311
312impl ManagerProxy {
313    /// Create a new Proxy for fuchsia.session.scene/Manager.
314    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
315        let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
316        Self { client: fidl::client::Client::new(channel, protocol_name) }
317    }
318
319    /// Get a Stream of events from the remote end of the protocol.
320    ///
321    /// # Panics
322    ///
323    /// Panics if the event stream was already taken.
324    pub fn take_event_stream(&self) -> ManagerEventStream {
325        ManagerEventStream { event_receiver: self.client.take_event_receiver() }
326    }
327
328    /// Sets the root view of the scene graph to the view provided by `view_provider`.
329    ///
330    /// Subsequent calls will replace the view tree with the one starting at the new root view.
331    /// The root view is shared between all clients of `Manager`.
332    ///
333    /// Returns a `fuchsia.ui.views.ViewRef` referencing the view provided by `view_provider`.
334    /// If this ViewRef cannot be returned (e.g. in Flatland case, if the ViewCreationToken is
335    /// dropped before it is given to Scenic), then the connection to the `Manager` will be closed.
336    ///
337    /// The client can expect that:
338    ///
339    /// (1) Its root view will be focused once it's connected to the scene.
340    /// (2) The logical size and position of its root view match the display.
341    ///
342    /// TODO(https://fxbug.dev/42055565): Fix this situation.
343    /// NOTE: the ViewRef is only returned after the child view is connected to the scene graph.
344    /// Therefore, the caller must guarantee that the child view will eventually be connected before
345    /// waiting for the ViewRef; if the child view doesn't connect, it is possible to deadlock.
346    pub fn r#set_root_view(
347        &self,
348        mut view_provider: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
349    ) -> fidl::client::QueryResponseFut<
350        ManagerSetRootViewResult,
351        fidl::encoding::DefaultFuchsiaResourceDialect,
352    > {
353        ManagerProxyInterface::r#set_root_view(self, view_provider)
354    }
355
356    /// Presents a view tree to the display, via the provided view holder token.
357    ///
358    /// This call will present the view using the legacy GFX API.
359    ///
360    /// Subsequent calls will replace the view tree with the one starting at the new root viewport.
361    /// The root view is shared between all clients of `Manager`.
362    ///
363    /// The client can expect that:
364    ///
365    /// (1) Its root view will be focused once it's connected to the scene.
366    /// (2) The logical size and position of its root view match the display.
367    ///
368    /// TODO(https://fxbug.dev/42055565): Fix this situation.
369    /// NOTE: this method returns only after the child view is connected to the scene graph.
370    /// Therefore, the caller must guarantee that the child view will eventually be connected before
371    /// waiting for the return; if the child view doesn't connect, it is possible to deadlock.
372    pub fn r#present_root_view_legacy(
373        &self,
374        mut view_holder_token: fidl_fuchsia_ui_views::ViewHolderToken,
375        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
376    ) -> fidl::client::QueryResponseFut<
377        ManagerPresentRootViewLegacyResult,
378        fidl::encoding::DefaultFuchsiaResourceDialect,
379    > {
380        ManagerProxyInterface::r#present_root_view_legacy(self, view_holder_token, view_ref)
381    }
382
383    /// Presents a view tree to the display, via the provided viewport token.
384    ///
385    /// Subsequent calls will replace the view tree with the one starting at the new root viewport.
386    /// The root view is shared between all clients of `Manager`.
387    ///
388    /// The client can expect that:
389    ///
390    /// (1) Its root view will be focused once it's connected to the scene.
391    /// (2) The logical size and position of its root view match the display.
392    ///
393    /// TODO(https://fxbug.dev/42055565): Fix this situation.
394    /// NOTE: this method returns only after the child view is connected to the scene graph.
395    /// Therefore, the caller must guarantee that the child view will eventually be connected before
396    /// waiting for the return; if the child view doesn't connect, it is possible to deadlock.
397    pub fn r#present_root_view(
398        &self,
399        mut viewport_creation_token: fidl_fuchsia_ui_views::ViewportCreationToken,
400    ) -> fidl::client::QueryResponseFut<
401        ManagerPresentRootViewResult,
402        fidl::encoding::DefaultFuchsiaResourceDialect,
403    > {
404        ManagerProxyInterface::r#present_root_view(self, viewport_creation_token)
405    }
406}
407
408impl ManagerProxyInterface for ManagerProxy {
409    type SetRootViewResponseFut = fidl::client::QueryResponseFut<
410        ManagerSetRootViewResult,
411        fidl::encoding::DefaultFuchsiaResourceDialect,
412    >;
413    fn r#set_root_view(
414        &self,
415        mut view_provider: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
416    ) -> Self::SetRootViewResponseFut {
417        fn _decode(
418            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
419        ) -> Result<ManagerSetRootViewResult, fidl::Error> {
420            let _response = fidl::client::decode_transaction_body::<
421                fidl::encoding::ResultType<ManagerSetRootViewResponse, PresentRootViewError>,
422                fidl::encoding::DefaultFuchsiaResourceDialect,
423                0x3095976368270dc4,
424            >(_buf?)?;
425            Ok(_response.map(|x| x.view_ref))
426        }
427        self.client.send_query_and_decode::<ManagerSetRootViewRequest, ManagerSetRootViewResult>(
428            (view_provider,),
429            0x3095976368270dc4,
430            fidl::encoding::DynamicFlags::empty(),
431            _decode,
432        )
433    }
434
435    type PresentRootViewLegacyResponseFut = fidl::client::QueryResponseFut<
436        ManagerPresentRootViewLegacyResult,
437        fidl::encoding::DefaultFuchsiaResourceDialect,
438    >;
439    fn r#present_root_view_legacy(
440        &self,
441        mut view_holder_token: fidl_fuchsia_ui_views::ViewHolderToken,
442        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
443    ) -> Self::PresentRootViewLegacyResponseFut {
444        fn _decode(
445            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
446        ) -> Result<ManagerPresentRootViewLegacyResult, fidl::Error> {
447            let _response = fidl::client::decode_transaction_body::<
448                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PresentRootViewError>,
449                fidl::encoding::DefaultFuchsiaResourceDialect,
450                0x17729b456a2eff7,
451            >(_buf?)?;
452            Ok(_response.map(|x| x))
453        }
454        self.client.send_query_and_decode::<
455            ManagerPresentRootViewLegacyRequest,
456            ManagerPresentRootViewLegacyResult,
457        >(
458            (&mut view_holder_token, &mut view_ref,),
459            0x17729b456a2eff7,
460            fidl::encoding::DynamicFlags::empty(),
461            _decode,
462        )
463    }
464
465    type PresentRootViewResponseFut = fidl::client::QueryResponseFut<
466        ManagerPresentRootViewResult,
467        fidl::encoding::DefaultFuchsiaResourceDialect,
468    >;
469    fn r#present_root_view(
470        &self,
471        mut viewport_creation_token: fidl_fuchsia_ui_views::ViewportCreationToken,
472    ) -> Self::PresentRootViewResponseFut {
473        fn _decode(
474            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
475        ) -> Result<ManagerPresentRootViewResult, fidl::Error> {
476            let _response = fidl::client::decode_transaction_body::<
477                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PresentRootViewError>,
478                fidl::encoding::DefaultFuchsiaResourceDialect,
479                0x51e070bb675a18df,
480            >(_buf?)?;
481            Ok(_response.map(|x| x))
482        }
483        self.client
484            .send_query_and_decode::<ManagerPresentRootViewRequest, ManagerPresentRootViewResult>(
485                (&mut viewport_creation_token,),
486                0x51e070bb675a18df,
487                fidl::encoding::DynamicFlags::empty(),
488                _decode,
489            )
490    }
491}
492
493pub struct ManagerEventStream {
494    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
495}
496
497impl std::marker::Unpin for ManagerEventStream {}
498
499impl futures::stream::FusedStream for ManagerEventStream {
500    fn is_terminated(&self) -> bool {
501        self.event_receiver.is_terminated()
502    }
503}
504
505impl futures::Stream for ManagerEventStream {
506    type Item = Result<ManagerEvent, fidl::Error>;
507
508    fn poll_next(
509        mut self: std::pin::Pin<&mut Self>,
510        cx: &mut std::task::Context<'_>,
511    ) -> std::task::Poll<Option<Self::Item>> {
512        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
513            &mut self.event_receiver,
514            cx
515        )?) {
516            Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
517            None => std::task::Poll::Ready(None),
518        }
519    }
520}
521
522#[derive(Debug)]
523pub enum ManagerEvent {}
524
525impl ManagerEvent {
526    /// Decodes a message buffer as a [`ManagerEvent`].
527    fn decode(
528        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
529    ) -> Result<ManagerEvent, fidl::Error> {
530        let (bytes, _handles) = buf.split_mut();
531        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
532        debug_assert_eq!(tx_header.tx_id, 0);
533        match tx_header.ordinal {
534            _ => Err(fidl::Error::UnknownOrdinal {
535                ordinal: tx_header.ordinal,
536                protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
537            }),
538        }
539    }
540}
541
542/// A Stream of incoming requests for fuchsia.session.scene/Manager.
543pub struct ManagerRequestStream {
544    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
545    is_terminated: bool,
546}
547
548impl std::marker::Unpin for ManagerRequestStream {}
549
550impl futures::stream::FusedStream for ManagerRequestStream {
551    fn is_terminated(&self) -> bool {
552        self.is_terminated
553    }
554}
555
556impl fidl::endpoints::RequestStream for ManagerRequestStream {
557    type Protocol = ManagerMarker;
558    type ControlHandle = ManagerControlHandle;
559
560    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
561        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
562    }
563
564    fn control_handle(&self) -> Self::ControlHandle {
565        ManagerControlHandle { inner: self.inner.clone() }
566    }
567
568    fn into_inner(
569        self,
570    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
571    {
572        (self.inner, self.is_terminated)
573    }
574
575    fn from_inner(
576        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
577        is_terminated: bool,
578    ) -> Self {
579        Self { inner, is_terminated }
580    }
581}
582
583impl futures::Stream for ManagerRequestStream {
584    type Item = Result<ManagerRequest, fidl::Error>;
585
586    fn poll_next(
587        mut self: std::pin::Pin<&mut Self>,
588        cx: &mut std::task::Context<'_>,
589    ) -> std::task::Poll<Option<Self::Item>> {
590        let this = &mut *self;
591        if this.inner.check_shutdown(cx) {
592            this.is_terminated = true;
593            return std::task::Poll::Ready(None);
594        }
595        if this.is_terminated {
596            panic!("polled ManagerRequestStream after completion");
597        }
598        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
599            |bytes, handles| {
600                match this.inner.channel().read_etc(cx, bytes, handles) {
601                    std::task::Poll::Ready(Ok(())) => {}
602                    std::task::Poll::Pending => return std::task::Poll::Pending,
603                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
604                        this.is_terminated = true;
605                        return std::task::Poll::Ready(None);
606                    }
607                    std::task::Poll::Ready(Err(e)) => {
608                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
609                            e.into(),
610                        ))))
611                    }
612                }
613
614                // A message has been received from the channel
615                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
616
617                std::task::Poll::Ready(Some(match header.ordinal {
618                    0x3095976368270dc4 => {
619                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
620                        let mut req = fidl::new_empty!(
621                            ManagerSetRootViewRequest,
622                            fidl::encoding::DefaultFuchsiaResourceDialect
623                        );
624                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerSetRootViewRequest>(&header, _body_bytes, handles, &mut req)?;
625                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
626                        Ok(ManagerRequest::SetRootView {
627                            view_provider: req.view_provider,
628
629                            responder: ManagerSetRootViewResponder {
630                                control_handle: std::mem::ManuallyDrop::new(control_handle),
631                                tx_id: header.tx_id,
632                            },
633                        })
634                    }
635                    0x17729b456a2eff7 => {
636                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
637                        let mut req = fidl::new_empty!(
638                            ManagerPresentRootViewLegacyRequest,
639                            fidl::encoding::DefaultFuchsiaResourceDialect
640                        );
641                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerPresentRootViewLegacyRequest>(&header, _body_bytes, handles, &mut req)?;
642                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
643                        Ok(ManagerRequest::PresentRootViewLegacy {
644                            view_holder_token: req.view_holder_token,
645                            view_ref: req.view_ref,
646
647                            responder: ManagerPresentRootViewLegacyResponder {
648                                control_handle: std::mem::ManuallyDrop::new(control_handle),
649                                tx_id: header.tx_id,
650                            },
651                        })
652                    }
653                    0x51e070bb675a18df => {
654                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
655                        let mut req = fidl::new_empty!(
656                            ManagerPresentRootViewRequest,
657                            fidl::encoding::DefaultFuchsiaResourceDialect
658                        );
659                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerPresentRootViewRequest>(&header, _body_bytes, handles, &mut req)?;
660                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
661                        Ok(ManagerRequest::PresentRootView {
662                            viewport_creation_token: req.viewport_creation_token,
663
664                            responder: ManagerPresentRootViewResponder {
665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
666                                tx_id: header.tx_id,
667                            },
668                        })
669                    }
670                    _ => Err(fidl::Error::UnknownOrdinal {
671                        ordinal: header.ordinal,
672                        protocol_name:
673                            <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
674                    }),
675                }))
676            },
677        )
678    }
679}
680
681/// A protocol used to manage the scene graph of the session.
682///
683/// This protocol is exposed by the `scene_manager` component. The `scene_manager`
684/// component configures and constructs a scene graph in Scenic. A product may
685/// use the `scene_manager` to reduce Scenic-related configuration code in their session.
686#[derive(Debug)]
687pub enum ManagerRequest {
688    /// Sets the root view of the scene graph to the view provided by `view_provider`.
689    ///
690    /// Subsequent calls will replace the view tree with the one starting at the new root view.
691    /// The root view is shared between all clients of `Manager`.
692    ///
693    /// Returns a `fuchsia.ui.views.ViewRef` referencing the view provided by `view_provider`.
694    /// If this ViewRef cannot be returned (e.g. in Flatland case, if the ViewCreationToken is
695    /// dropped before it is given to Scenic), then the connection to the `Manager` will be closed.
696    ///
697    /// The client can expect that:
698    ///
699    /// (1) Its root view will be focused once it's connected to the scene.
700    /// (2) The logical size and position of its root view match the display.
701    ///
702    /// TODO(https://fxbug.dev/42055565): Fix this situation.
703    /// NOTE: the ViewRef is only returned after the child view is connected to the scene graph.
704    /// Therefore, the caller must guarantee that the child view will eventually be connected before
705    /// waiting for the ViewRef; if the child view doesn't connect, it is possible to deadlock.
706    SetRootView {
707        view_provider: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
708        responder: ManagerSetRootViewResponder,
709    },
710    /// Presents a view tree to the display, via the provided view holder token.
711    ///
712    /// This call will present the view using the legacy GFX API.
713    ///
714    /// Subsequent calls will replace the view tree with the one starting at the new root viewport.
715    /// The root view is shared between all clients of `Manager`.
716    ///
717    /// The client can expect that:
718    ///
719    /// (1) Its root view will be focused once it's connected to the scene.
720    /// (2) The logical size and position of its root view match the display.
721    ///
722    /// TODO(https://fxbug.dev/42055565): Fix this situation.
723    /// NOTE: this method returns only after the child view is connected to the scene graph.
724    /// Therefore, the caller must guarantee that the child view will eventually be connected before
725    /// waiting for the return; if the child view doesn't connect, it is possible to deadlock.
726    PresentRootViewLegacy {
727        view_holder_token: fidl_fuchsia_ui_views::ViewHolderToken,
728        view_ref: fidl_fuchsia_ui_views::ViewRef,
729        responder: ManagerPresentRootViewLegacyResponder,
730    },
731    /// Presents a view tree to the display, via the provided viewport token.
732    ///
733    /// Subsequent calls will replace the view tree with the one starting at the new root viewport.
734    /// The root view is shared between all clients of `Manager`.
735    ///
736    /// The client can expect that:
737    ///
738    /// (1) Its root view will be focused once it's connected to the scene.
739    /// (2) The logical size and position of its root view match the display.
740    ///
741    /// TODO(https://fxbug.dev/42055565): Fix this situation.
742    /// NOTE: this method returns only after the child view is connected to the scene graph.
743    /// Therefore, the caller must guarantee that the child view will eventually be connected before
744    /// waiting for the return; if the child view doesn't connect, it is possible to deadlock.
745    PresentRootView {
746        viewport_creation_token: fidl_fuchsia_ui_views::ViewportCreationToken,
747        responder: ManagerPresentRootViewResponder,
748    },
749}
750
751impl ManagerRequest {
752    #[allow(irrefutable_let_patterns)]
753    pub fn into_set_root_view(
754        self,
755    ) -> Option<(
756        fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
757        ManagerSetRootViewResponder,
758    )> {
759        if let ManagerRequest::SetRootView { view_provider, responder } = self {
760            Some((view_provider, responder))
761        } else {
762            None
763        }
764    }
765
766    #[allow(irrefutable_let_patterns)]
767    pub fn into_present_root_view_legacy(
768        self,
769    ) -> Option<(
770        fidl_fuchsia_ui_views::ViewHolderToken,
771        fidl_fuchsia_ui_views::ViewRef,
772        ManagerPresentRootViewLegacyResponder,
773    )> {
774        if let ManagerRequest::PresentRootViewLegacy { view_holder_token, view_ref, responder } =
775            self
776        {
777            Some((view_holder_token, view_ref, responder))
778        } else {
779            None
780        }
781    }
782
783    #[allow(irrefutable_let_patterns)]
784    pub fn into_present_root_view(
785        self,
786    ) -> Option<(fidl_fuchsia_ui_views::ViewportCreationToken, ManagerPresentRootViewResponder)>
787    {
788        if let ManagerRequest::PresentRootView { viewport_creation_token, responder } = self {
789            Some((viewport_creation_token, responder))
790        } else {
791            None
792        }
793    }
794
795    /// Name of the method defined in FIDL
796    pub fn method_name(&self) -> &'static str {
797        match *self {
798            ManagerRequest::SetRootView { .. } => "set_root_view",
799            ManagerRequest::PresentRootViewLegacy { .. } => "present_root_view_legacy",
800            ManagerRequest::PresentRootView { .. } => "present_root_view",
801        }
802    }
803}
804
805#[derive(Debug, Clone)]
806pub struct ManagerControlHandle {
807    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
808}
809
810impl fidl::endpoints::ControlHandle for ManagerControlHandle {
811    fn shutdown(&self) {
812        self.inner.shutdown()
813    }
814    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
815        self.inner.shutdown_with_epitaph(status)
816    }
817
818    fn is_closed(&self) -> bool {
819        self.inner.channel().is_closed()
820    }
821    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
822        self.inner.channel().on_closed()
823    }
824
825    #[cfg(target_os = "fuchsia")]
826    fn signal_peer(
827        &self,
828        clear_mask: zx::Signals,
829        set_mask: zx::Signals,
830    ) -> Result<(), zx_status::Status> {
831        use fidl::Peered;
832        self.inner.channel().signal_peer(clear_mask, set_mask)
833    }
834}
835
836impl ManagerControlHandle {}
837
838#[must_use = "FIDL methods require a response to be sent"]
839#[derive(Debug)]
840pub struct ManagerSetRootViewResponder {
841    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
842    tx_id: u32,
843}
844
845/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
846/// if the responder is dropped without sending a response, so that the client
847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
848impl std::ops::Drop for ManagerSetRootViewResponder {
849    fn drop(&mut self) {
850        self.control_handle.shutdown();
851        // Safety: drops once, never accessed again
852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
853    }
854}
855
856impl fidl::endpoints::Responder for ManagerSetRootViewResponder {
857    type ControlHandle = ManagerControlHandle;
858
859    fn control_handle(&self) -> &ManagerControlHandle {
860        &self.control_handle
861    }
862
863    fn drop_without_shutdown(mut self) {
864        // Safety: drops once, never accessed again due to mem::forget
865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
866        // Prevent Drop from running (which would shut down the channel)
867        std::mem::forget(self);
868    }
869}
870
871impl ManagerSetRootViewResponder {
872    /// Sends a response to the FIDL transaction.
873    ///
874    /// Sets the channel to shutdown if an error occurs.
875    pub fn send(
876        self,
877        mut result: Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>,
878    ) -> Result<(), fidl::Error> {
879        let _result = self.send_raw(result);
880        if _result.is_err() {
881            self.control_handle.shutdown();
882        }
883        self.drop_without_shutdown();
884        _result
885    }
886
887    /// Similar to "send" but does not shutdown the channel if an error occurs.
888    pub fn send_no_shutdown_on_err(
889        self,
890        mut result: Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>,
891    ) -> Result<(), fidl::Error> {
892        let _result = self.send_raw(result);
893        self.drop_without_shutdown();
894        _result
895    }
896
897    fn send_raw(
898        &self,
899        mut result: Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>,
900    ) -> Result<(), fidl::Error> {
901        self.control_handle.inner.send::<fidl::encoding::ResultType<
902            ManagerSetRootViewResponse,
903            PresentRootViewError,
904        >>(
905            result.as_mut().map_err(|e| *e).map(|view_ref| (view_ref,)),
906            self.tx_id,
907            0x3095976368270dc4,
908            fidl::encoding::DynamicFlags::empty(),
909        )
910    }
911}
912
913#[must_use = "FIDL methods require a response to be sent"]
914#[derive(Debug)]
915pub struct ManagerPresentRootViewLegacyResponder {
916    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
917    tx_id: u32,
918}
919
920/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
921/// if the responder is dropped without sending a response, so that the client
922/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
923impl std::ops::Drop for ManagerPresentRootViewLegacyResponder {
924    fn drop(&mut self) {
925        self.control_handle.shutdown();
926        // Safety: drops once, never accessed again
927        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
928    }
929}
930
931impl fidl::endpoints::Responder for ManagerPresentRootViewLegacyResponder {
932    type ControlHandle = ManagerControlHandle;
933
934    fn control_handle(&self) -> &ManagerControlHandle {
935        &self.control_handle
936    }
937
938    fn drop_without_shutdown(mut self) {
939        // Safety: drops once, never accessed again due to mem::forget
940        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
941        // Prevent Drop from running (which would shut down the channel)
942        std::mem::forget(self);
943    }
944}
945
946impl ManagerPresentRootViewLegacyResponder {
947    /// Sends a response to the FIDL transaction.
948    ///
949    /// Sets the channel to shutdown if an error occurs.
950    pub fn send(self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
951        let _result = self.send_raw(result);
952        if _result.is_err() {
953            self.control_handle.shutdown();
954        }
955        self.drop_without_shutdown();
956        _result
957    }
958
959    /// Similar to "send" but does not shutdown the channel if an error occurs.
960    pub fn send_no_shutdown_on_err(
961        self,
962        mut result: Result<(), PresentRootViewError>,
963    ) -> Result<(), fidl::Error> {
964        let _result = self.send_raw(result);
965        self.drop_without_shutdown();
966        _result
967    }
968
969    fn send_raw(&self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
970        self.control_handle.inner.send::<fidl::encoding::ResultType<
971            fidl::encoding::EmptyStruct,
972            PresentRootViewError,
973        >>(
974            result,
975            self.tx_id,
976            0x17729b456a2eff7,
977            fidl::encoding::DynamicFlags::empty(),
978        )
979    }
980}
981
982#[must_use = "FIDL methods require a response to be sent"]
983#[derive(Debug)]
984pub struct ManagerPresentRootViewResponder {
985    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
986    tx_id: u32,
987}
988
989/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
990/// if the responder is dropped without sending a response, so that the client
991/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
992impl std::ops::Drop for ManagerPresentRootViewResponder {
993    fn drop(&mut self) {
994        self.control_handle.shutdown();
995        // Safety: drops once, never accessed again
996        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
997    }
998}
999
1000impl fidl::endpoints::Responder for ManagerPresentRootViewResponder {
1001    type ControlHandle = ManagerControlHandle;
1002
1003    fn control_handle(&self) -> &ManagerControlHandle {
1004        &self.control_handle
1005    }
1006
1007    fn drop_without_shutdown(mut self) {
1008        // Safety: drops once, never accessed again due to mem::forget
1009        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1010        // Prevent Drop from running (which would shut down the channel)
1011        std::mem::forget(self);
1012    }
1013}
1014
1015impl ManagerPresentRootViewResponder {
1016    /// Sends a response to the FIDL transaction.
1017    ///
1018    /// Sets the channel to shutdown if an error occurs.
1019    pub fn send(self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
1020        let _result = self.send_raw(result);
1021        if _result.is_err() {
1022            self.control_handle.shutdown();
1023        }
1024        self.drop_without_shutdown();
1025        _result
1026    }
1027
1028    /// Similar to "send" but does not shutdown the channel if an error occurs.
1029    pub fn send_no_shutdown_on_err(
1030        self,
1031        mut result: Result<(), PresentRootViewError>,
1032    ) -> Result<(), fidl::Error> {
1033        let _result = self.send_raw(result);
1034        self.drop_without_shutdown();
1035        _result
1036    }
1037
1038    fn send_raw(&self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
1039        self.control_handle.inner.send::<fidl::encoding::ResultType<
1040            fidl::encoding::EmptyStruct,
1041            PresentRootViewError,
1042        >>(
1043            result,
1044            self.tx_id,
1045            0x51e070bb675a18df,
1046            fidl::encoding::DynamicFlags::empty(),
1047        )
1048    }
1049}
1050
1051mod internal {
1052    use super::*;
1053    unsafe impl fidl::encoding::TypeMarker for PresentRootViewError {
1054        type Owned = Self;
1055
1056        #[inline(always)]
1057        fn inline_align(_context: fidl::encoding::Context) -> usize {
1058            std::mem::align_of::<u32>()
1059        }
1060
1061        #[inline(always)]
1062        fn inline_size(_context: fidl::encoding::Context) -> usize {
1063            std::mem::size_of::<u32>()
1064        }
1065
1066        #[inline(always)]
1067        fn encode_is_copy() -> bool {
1068            false
1069        }
1070
1071        #[inline(always)]
1072        fn decode_is_copy() -> bool {
1073            false
1074        }
1075    }
1076
1077    impl fidl::encoding::ValueTypeMarker for PresentRootViewError {
1078        type Borrowed<'a> = Self;
1079        #[inline(always)]
1080        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1081            *value
1082        }
1083    }
1084
1085    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1086        for PresentRootViewError
1087    {
1088        #[inline]
1089        unsafe fn encode(
1090            self,
1091            encoder: &mut fidl::encoding::Encoder<'_, D>,
1092            offset: usize,
1093            _depth: fidl::encoding::Depth,
1094        ) -> fidl::Result<()> {
1095            encoder.debug_check_bounds::<Self>(offset);
1096            encoder.write_num(self.into_primitive(), offset);
1097            Ok(())
1098        }
1099    }
1100
1101    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentRootViewError {
1102        #[inline(always)]
1103        fn new_empty() -> Self {
1104            Self::unknown()
1105        }
1106
1107        #[inline]
1108        unsafe fn decode(
1109            &mut self,
1110            decoder: &mut fidl::encoding::Decoder<'_, D>,
1111            offset: usize,
1112            _depth: fidl::encoding::Depth,
1113        ) -> fidl::Result<()> {
1114            decoder.debug_check_bounds::<Self>(offset);
1115            let prim = decoder.read_num::<u32>(offset);
1116
1117            *self = Self::from_primitive_allow_unknown(prim);
1118            Ok(())
1119        }
1120    }
1121
1122    impl fidl::encoding::ResourceTypeMarker for ManagerPresentRootViewLegacyRequest {
1123        type Borrowed<'a> = &'a mut Self;
1124        fn take_or_borrow<'a>(
1125            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1126        ) -> Self::Borrowed<'a> {
1127            value
1128        }
1129    }
1130
1131    unsafe impl fidl::encoding::TypeMarker for ManagerPresentRootViewLegacyRequest {
1132        type Owned = Self;
1133
1134        #[inline(always)]
1135        fn inline_align(_context: fidl::encoding::Context) -> usize {
1136            4
1137        }
1138
1139        #[inline(always)]
1140        fn inline_size(_context: fidl::encoding::Context) -> usize {
1141            8
1142        }
1143    }
1144
1145    unsafe impl
1146        fidl::encoding::Encode<
1147            ManagerPresentRootViewLegacyRequest,
1148            fidl::encoding::DefaultFuchsiaResourceDialect,
1149        > for &mut ManagerPresentRootViewLegacyRequest
1150    {
1151        #[inline]
1152        unsafe fn encode(
1153            self,
1154            encoder: &mut fidl::encoding::Encoder<
1155                '_,
1156                fidl::encoding::DefaultFuchsiaResourceDialect,
1157            >,
1158            offset: usize,
1159            _depth: fidl::encoding::Depth,
1160        ) -> fidl::Result<()> {
1161            encoder.debug_check_bounds::<ManagerPresentRootViewLegacyRequest>(offset);
1162            // Delegate to tuple encoding.
1163            fidl::encoding::Encode::<ManagerPresentRootViewLegacyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1164                (
1165                    <fidl_fuchsia_ui_views::ViewHolderToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_holder_token),
1166                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
1167                ),
1168                encoder, offset, _depth
1169            )
1170        }
1171    }
1172    unsafe impl<
1173            T0: fidl::encoding::Encode<
1174                fidl_fuchsia_ui_views::ViewHolderToken,
1175                fidl::encoding::DefaultFuchsiaResourceDialect,
1176            >,
1177            T1: fidl::encoding::Encode<
1178                fidl_fuchsia_ui_views::ViewRef,
1179                fidl::encoding::DefaultFuchsiaResourceDialect,
1180            >,
1181        >
1182        fidl::encoding::Encode<
1183            ManagerPresentRootViewLegacyRequest,
1184            fidl::encoding::DefaultFuchsiaResourceDialect,
1185        > for (T0, T1)
1186    {
1187        #[inline]
1188        unsafe fn encode(
1189            self,
1190            encoder: &mut fidl::encoding::Encoder<
1191                '_,
1192                fidl::encoding::DefaultFuchsiaResourceDialect,
1193            >,
1194            offset: usize,
1195            depth: fidl::encoding::Depth,
1196        ) -> fidl::Result<()> {
1197            encoder.debug_check_bounds::<ManagerPresentRootViewLegacyRequest>(offset);
1198            // Zero out padding regions. There's no need to apply masks
1199            // because the unmasked parts will be overwritten by fields.
1200            // Write the fields.
1201            self.0.encode(encoder, offset + 0, depth)?;
1202            self.1.encode(encoder, offset + 4, depth)?;
1203            Ok(())
1204        }
1205    }
1206
1207    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1208        for ManagerPresentRootViewLegacyRequest
1209    {
1210        #[inline(always)]
1211        fn new_empty() -> Self {
1212            Self {
1213                view_holder_token: fidl::new_empty!(
1214                    fidl_fuchsia_ui_views::ViewHolderToken,
1215                    fidl::encoding::DefaultFuchsiaResourceDialect
1216                ),
1217                view_ref: fidl::new_empty!(
1218                    fidl_fuchsia_ui_views::ViewRef,
1219                    fidl::encoding::DefaultFuchsiaResourceDialect
1220                ),
1221            }
1222        }
1223
1224        #[inline]
1225        unsafe fn decode(
1226            &mut self,
1227            decoder: &mut fidl::encoding::Decoder<
1228                '_,
1229                fidl::encoding::DefaultFuchsiaResourceDialect,
1230            >,
1231            offset: usize,
1232            _depth: fidl::encoding::Depth,
1233        ) -> fidl::Result<()> {
1234            decoder.debug_check_bounds::<Self>(offset);
1235            // Verify that padding bytes are zero.
1236            fidl::decode!(
1237                fidl_fuchsia_ui_views::ViewHolderToken,
1238                fidl::encoding::DefaultFuchsiaResourceDialect,
1239                &mut self.view_holder_token,
1240                decoder,
1241                offset + 0,
1242                _depth
1243            )?;
1244            fidl::decode!(
1245                fidl_fuchsia_ui_views::ViewRef,
1246                fidl::encoding::DefaultFuchsiaResourceDialect,
1247                &mut self.view_ref,
1248                decoder,
1249                offset + 4,
1250                _depth
1251            )?;
1252            Ok(())
1253        }
1254    }
1255
1256    impl fidl::encoding::ResourceTypeMarker for ManagerPresentRootViewRequest {
1257        type Borrowed<'a> = &'a mut Self;
1258        fn take_or_borrow<'a>(
1259            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1260        ) -> Self::Borrowed<'a> {
1261            value
1262        }
1263    }
1264
1265    unsafe impl fidl::encoding::TypeMarker for ManagerPresentRootViewRequest {
1266        type Owned = Self;
1267
1268        #[inline(always)]
1269        fn inline_align(_context: fidl::encoding::Context) -> usize {
1270            4
1271        }
1272
1273        #[inline(always)]
1274        fn inline_size(_context: fidl::encoding::Context) -> usize {
1275            4
1276        }
1277    }
1278
1279    unsafe impl
1280        fidl::encoding::Encode<
1281            ManagerPresentRootViewRequest,
1282            fidl::encoding::DefaultFuchsiaResourceDialect,
1283        > for &mut ManagerPresentRootViewRequest
1284    {
1285        #[inline]
1286        unsafe fn encode(
1287            self,
1288            encoder: &mut fidl::encoding::Encoder<
1289                '_,
1290                fidl::encoding::DefaultFuchsiaResourceDialect,
1291            >,
1292            offset: usize,
1293            _depth: fidl::encoding::Depth,
1294        ) -> fidl::Result<()> {
1295            encoder.debug_check_bounds::<ManagerPresentRootViewRequest>(offset);
1296            // Delegate to tuple encoding.
1297            fidl::encoding::Encode::<ManagerPresentRootViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1298                (
1299                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.viewport_creation_token),
1300                ),
1301                encoder, offset, _depth
1302            )
1303        }
1304    }
1305    unsafe impl<
1306            T0: fidl::encoding::Encode<
1307                fidl_fuchsia_ui_views::ViewportCreationToken,
1308                fidl::encoding::DefaultFuchsiaResourceDialect,
1309            >,
1310        >
1311        fidl::encoding::Encode<
1312            ManagerPresentRootViewRequest,
1313            fidl::encoding::DefaultFuchsiaResourceDialect,
1314        > for (T0,)
1315    {
1316        #[inline]
1317        unsafe fn encode(
1318            self,
1319            encoder: &mut fidl::encoding::Encoder<
1320                '_,
1321                fidl::encoding::DefaultFuchsiaResourceDialect,
1322            >,
1323            offset: usize,
1324            depth: fidl::encoding::Depth,
1325        ) -> fidl::Result<()> {
1326            encoder.debug_check_bounds::<ManagerPresentRootViewRequest>(offset);
1327            // Zero out padding regions. There's no need to apply masks
1328            // because the unmasked parts will be overwritten by fields.
1329            // Write the fields.
1330            self.0.encode(encoder, offset + 0, depth)?;
1331            Ok(())
1332        }
1333    }
1334
1335    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1336        for ManagerPresentRootViewRequest
1337    {
1338        #[inline(always)]
1339        fn new_empty() -> Self {
1340            Self {
1341                viewport_creation_token: fidl::new_empty!(
1342                    fidl_fuchsia_ui_views::ViewportCreationToken,
1343                    fidl::encoding::DefaultFuchsiaResourceDialect
1344                ),
1345            }
1346        }
1347
1348        #[inline]
1349        unsafe fn decode(
1350            &mut self,
1351            decoder: &mut fidl::encoding::Decoder<
1352                '_,
1353                fidl::encoding::DefaultFuchsiaResourceDialect,
1354            >,
1355            offset: usize,
1356            _depth: fidl::encoding::Depth,
1357        ) -> fidl::Result<()> {
1358            decoder.debug_check_bounds::<Self>(offset);
1359            // Verify that padding bytes are zero.
1360            fidl::decode!(
1361                fidl_fuchsia_ui_views::ViewportCreationToken,
1362                fidl::encoding::DefaultFuchsiaResourceDialect,
1363                &mut self.viewport_creation_token,
1364                decoder,
1365                offset + 0,
1366                _depth
1367            )?;
1368            Ok(())
1369        }
1370    }
1371
1372    impl fidl::encoding::ResourceTypeMarker for ManagerSetRootViewRequest {
1373        type Borrowed<'a> = &'a mut Self;
1374        fn take_or_borrow<'a>(
1375            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1376        ) -> Self::Borrowed<'a> {
1377            value
1378        }
1379    }
1380
1381    unsafe impl fidl::encoding::TypeMarker for ManagerSetRootViewRequest {
1382        type Owned = Self;
1383
1384        #[inline(always)]
1385        fn inline_align(_context: fidl::encoding::Context) -> usize {
1386            4
1387        }
1388
1389        #[inline(always)]
1390        fn inline_size(_context: fidl::encoding::Context) -> usize {
1391            4
1392        }
1393    }
1394
1395    unsafe impl
1396        fidl::encoding::Encode<
1397            ManagerSetRootViewRequest,
1398            fidl::encoding::DefaultFuchsiaResourceDialect,
1399        > for &mut ManagerSetRootViewRequest
1400    {
1401        #[inline]
1402        unsafe fn encode(
1403            self,
1404            encoder: &mut fidl::encoding::Encoder<
1405                '_,
1406                fidl::encoding::DefaultFuchsiaResourceDialect,
1407            >,
1408            offset: usize,
1409            _depth: fidl::encoding::Depth,
1410        ) -> fidl::Result<()> {
1411            encoder.debug_check_bounds::<ManagerSetRootViewRequest>(offset);
1412            // Delegate to tuple encoding.
1413            fidl::encoding::Encode::<
1414                ManagerSetRootViewRequest,
1415                fidl::encoding::DefaultFuchsiaResourceDialect,
1416            >::encode(
1417                (<fidl::encoding::Endpoint<
1418                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1419                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1420                    &mut self.view_provider
1421                ),),
1422                encoder,
1423                offset,
1424                _depth,
1425            )
1426        }
1427    }
1428    unsafe impl<
1429            T0: fidl::encoding::Encode<
1430                fidl::encoding::Endpoint<
1431                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1432                >,
1433                fidl::encoding::DefaultFuchsiaResourceDialect,
1434            >,
1435        >
1436        fidl::encoding::Encode<
1437            ManagerSetRootViewRequest,
1438            fidl::encoding::DefaultFuchsiaResourceDialect,
1439        > for (T0,)
1440    {
1441        #[inline]
1442        unsafe fn encode(
1443            self,
1444            encoder: &mut fidl::encoding::Encoder<
1445                '_,
1446                fidl::encoding::DefaultFuchsiaResourceDialect,
1447            >,
1448            offset: usize,
1449            depth: fidl::encoding::Depth,
1450        ) -> fidl::Result<()> {
1451            encoder.debug_check_bounds::<ManagerSetRootViewRequest>(offset);
1452            // Zero out padding regions. There's no need to apply masks
1453            // because the unmasked parts will be overwritten by fields.
1454            // Write the fields.
1455            self.0.encode(encoder, offset + 0, depth)?;
1456            Ok(())
1457        }
1458    }
1459
1460    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1461        for ManagerSetRootViewRequest
1462    {
1463        #[inline(always)]
1464        fn new_empty() -> Self {
1465            Self {
1466                view_provider: fidl::new_empty!(
1467                    fidl::encoding::Endpoint<
1468                        fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1469                    >,
1470                    fidl::encoding::DefaultFuchsiaResourceDialect
1471                ),
1472            }
1473        }
1474
1475        #[inline]
1476        unsafe fn decode(
1477            &mut self,
1478            decoder: &mut fidl::encoding::Decoder<
1479                '_,
1480                fidl::encoding::DefaultFuchsiaResourceDialect,
1481            >,
1482            offset: usize,
1483            _depth: fidl::encoding::Depth,
1484        ) -> fidl::Result<()> {
1485            decoder.debug_check_bounds::<Self>(offset);
1486            // Verify that padding bytes are zero.
1487            fidl::decode!(
1488                fidl::encoding::Endpoint<
1489                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1490                >,
1491                fidl::encoding::DefaultFuchsiaResourceDialect,
1492                &mut self.view_provider,
1493                decoder,
1494                offset + 0,
1495                _depth
1496            )?;
1497            Ok(())
1498        }
1499    }
1500
1501    impl fidl::encoding::ResourceTypeMarker for ManagerSetRootViewResponse {
1502        type Borrowed<'a> = &'a mut Self;
1503        fn take_or_borrow<'a>(
1504            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1505        ) -> Self::Borrowed<'a> {
1506            value
1507        }
1508    }
1509
1510    unsafe impl fidl::encoding::TypeMarker for ManagerSetRootViewResponse {
1511        type Owned = Self;
1512
1513        #[inline(always)]
1514        fn inline_align(_context: fidl::encoding::Context) -> usize {
1515            4
1516        }
1517
1518        #[inline(always)]
1519        fn inline_size(_context: fidl::encoding::Context) -> usize {
1520            4
1521        }
1522    }
1523
1524    unsafe impl
1525        fidl::encoding::Encode<
1526            ManagerSetRootViewResponse,
1527            fidl::encoding::DefaultFuchsiaResourceDialect,
1528        > for &mut ManagerSetRootViewResponse
1529    {
1530        #[inline]
1531        unsafe fn encode(
1532            self,
1533            encoder: &mut fidl::encoding::Encoder<
1534                '_,
1535                fidl::encoding::DefaultFuchsiaResourceDialect,
1536            >,
1537            offset: usize,
1538            _depth: fidl::encoding::Depth,
1539        ) -> fidl::Result<()> {
1540            encoder.debug_check_bounds::<ManagerSetRootViewResponse>(offset);
1541            // Delegate to tuple encoding.
1542            fidl::encoding::Encode::<ManagerSetRootViewResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1543                (
1544                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
1545                ),
1546                encoder, offset, _depth
1547            )
1548        }
1549    }
1550    unsafe impl<
1551            T0: fidl::encoding::Encode<
1552                fidl_fuchsia_ui_views::ViewRef,
1553                fidl::encoding::DefaultFuchsiaResourceDialect,
1554            >,
1555        >
1556        fidl::encoding::Encode<
1557            ManagerSetRootViewResponse,
1558            fidl::encoding::DefaultFuchsiaResourceDialect,
1559        > for (T0,)
1560    {
1561        #[inline]
1562        unsafe fn encode(
1563            self,
1564            encoder: &mut fidl::encoding::Encoder<
1565                '_,
1566                fidl::encoding::DefaultFuchsiaResourceDialect,
1567            >,
1568            offset: usize,
1569            depth: fidl::encoding::Depth,
1570        ) -> fidl::Result<()> {
1571            encoder.debug_check_bounds::<ManagerSetRootViewResponse>(offset);
1572            // Zero out padding regions. There's no need to apply masks
1573            // because the unmasked parts will be overwritten by fields.
1574            // Write the fields.
1575            self.0.encode(encoder, offset + 0, depth)?;
1576            Ok(())
1577        }
1578    }
1579
1580    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1581        for ManagerSetRootViewResponse
1582    {
1583        #[inline(always)]
1584        fn new_empty() -> Self {
1585            Self {
1586                view_ref: fidl::new_empty!(
1587                    fidl_fuchsia_ui_views::ViewRef,
1588                    fidl::encoding::DefaultFuchsiaResourceDialect
1589                ),
1590            }
1591        }
1592
1593        #[inline]
1594        unsafe fn decode(
1595            &mut self,
1596            decoder: &mut fidl::encoding::Decoder<
1597                '_,
1598                fidl::encoding::DefaultFuchsiaResourceDialect,
1599            >,
1600            offset: usize,
1601            _depth: fidl::encoding::Depth,
1602        ) -> fidl::Result<()> {
1603            decoder.debug_check_bounds::<Self>(offset);
1604            // Verify that padding bytes are zero.
1605            fidl::decode!(
1606                fidl_fuchsia_ui_views::ViewRef,
1607                fidl::encoding::DefaultFuchsiaResourceDialect,
1608                &mut self.view_ref,
1609                decoder,
1610                offset + 0,
1611                _depth
1612            )?;
1613            Ok(())
1614        }
1615    }
1616}