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