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