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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
783        self.inner.shutdown_with_epitaph(status)
784    }
785
786    fn is_closed(&self) -> bool {
787        self.inner.channel().is_closed()
788    }
789    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
790        self.inner.channel().on_closed()
791    }
792
793    #[cfg(target_os = "fuchsia")]
794    fn signal_peer(
795        &self,
796        clear_mask: zx::Signals,
797        set_mask: zx::Signals,
798    ) -> Result<(), zx_status::Status> {
799        use fidl::Peered;
800        self.inner.channel().signal_peer(clear_mask, set_mask)
801    }
802}
803
804impl ManagerControlHandle {}
805
806#[must_use = "FIDL methods require a response to be sent"]
807#[derive(Debug)]
808pub struct ManagerSetRootViewResponder {
809    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
810    tx_id: u32,
811}
812
813/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
814/// if the responder is dropped without sending a response, so that the client
815/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
816impl std::ops::Drop for ManagerSetRootViewResponder {
817    fn drop(&mut self) {
818        self.control_handle.shutdown();
819        // Safety: drops once, never accessed again
820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
821    }
822}
823
824impl fidl::endpoints::Responder for ManagerSetRootViewResponder {
825    type ControlHandle = ManagerControlHandle;
826
827    fn control_handle(&self) -> &ManagerControlHandle {
828        &self.control_handle
829    }
830
831    fn drop_without_shutdown(mut self) {
832        // Safety: drops once, never accessed again due to mem::forget
833        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
834        // Prevent Drop from running (which would shut down the channel)
835        std::mem::forget(self);
836    }
837}
838
839impl ManagerSetRootViewResponder {
840    /// Sends a response to the FIDL transaction.
841    ///
842    /// Sets the channel to shutdown if an error occurs.
843    pub fn send(
844        self,
845        mut result: Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>,
846    ) -> Result<(), fidl::Error> {
847        let _result = self.send_raw(result);
848        if _result.is_err() {
849            self.control_handle.shutdown();
850        }
851        self.drop_without_shutdown();
852        _result
853    }
854
855    /// Similar to "send" but does not shutdown the channel if an error occurs.
856    pub fn send_no_shutdown_on_err(
857        self,
858        mut result: Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>,
859    ) -> Result<(), fidl::Error> {
860        let _result = self.send_raw(result);
861        self.drop_without_shutdown();
862        _result
863    }
864
865    fn send_raw(
866        &self,
867        mut result: Result<fidl_fuchsia_ui_views::ViewRef, PresentRootViewError>,
868    ) -> Result<(), fidl::Error> {
869        self.control_handle.inner.send::<fidl::encoding::ResultType<
870            ManagerSetRootViewResponse,
871            PresentRootViewError,
872        >>(
873            result.as_mut().map_err(|e| *e).map(|view_ref| (view_ref,)),
874            self.tx_id,
875            0x3095976368270dc4,
876            fidl::encoding::DynamicFlags::empty(),
877        )
878    }
879}
880
881#[must_use = "FIDL methods require a response to be sent"]
882#[derive(Debug)]
883pub struct ManagerPresentRootViewLegacyResponder {
884    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
885    tx_id: u32,
886}
887
888/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
889/// if the responder is dropped without sending a response, so that the client
890/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
891impl std::ops::Drop for ManagerPresentRootViewLegacyResponder {
892    fn drop(&mut self) {
893        self.control_handle.shutdown();
894        // Safety: drops once, never accessed again
895        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
896    }
897}
898
899impl fidl::endpoints::Responder for ManagerPresentRootViewLegacyResponder {
900    type ControlHandle = ManagerControlHandle;
901
902    fn control_handle(&self) -> &ManagerControlHandle {
903        &self.control_handle
904    }
905
906    fn drop_without_shutdown(mut self) {
907        // Safety: drops once, never accessed again due to mem::forget
908        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
909        // Prevent Drop from running (which would shut down the channel)
910        std::mem::forget(self);
911    }
912}
913
914impl ManagerPresentRootViewLegacyResponder {
915    /// Sends a response to the FIDL transaction.
916    ///
917    /// Sets the channel to shutdown if an error occurs.
918    pub fn send(self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
919        let _result = self.send_raw(result);
920        if _result.is_err() {
921            self.control_handle.shutdown();
922        }
923        self.drop_without_shutdown();
924        _result
925    }
926
927    /// Similar to "send" but does not shutdown the channel if an error occurs.
928    pub fn send_no_shutdown_on_err(
929        self,
930        mut result: Result<(), PresentRootViewError>,
931    ) -> Result<(), fidl::Error> {
932        let _result = self.send_raw(result);
933        self.drop_without_shutdown();
934        _result
935    }
936
937    fn send_raw(&self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
938        self.control_handle.inner.send::<fidl::encoding::ResultType<
939            fidl::encoding::EmptyStruct,
940            PresentRootViewError,
941        >>(
942            result,
943            self.tx_id,
944            0x17729b456a2eff7,
945            fidl::encoding::DynamicFlags::empty(),
946        )
947    }
948}
949
950#[must_use = "FIDL methods require a response to be sent"]
951#[derive(Debug)]
952pub struct ManagerPresentRootViewResponder {
953    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
954    tx_id: u32,
955}
956
957/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
958/// if the responder is dropped without sending a response, so that the client
959/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
960impl std::ops::Drop for ManagerPresentRootViewResponder {
961    fn drop(&mut self) {
962        self.control_handle.shutdown();
963        // Safety: drops once, never accessed again
964        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
965    }
966}
967
968impl fidl::endpoints::Responder for ManagerPresentRootViewResponder {
969    type ControlHandle = ManagerControlHandle;
970
971    fn control_handle(&self) -> &ManagerControlHandle {
972        &self.control_handle
973    }
974
975    fn drop_without_shutdown(mut self) {
976        // Safety: drops once, never accessed again due to mem::forget
977        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
978        // Prevent Drop from running (which would shut down the channel)
979        std::mem::forget(self);
980    }
981}
982
983impl ManagerPresentRootViewResponder {
984    /// Sends a response to the FIDL transaction.
985    ///
986    /// Sets the channel to shutdown if an error occurs.
987    pub fn send(self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
988        let _result = self.send_raw(result);
989        if _result.is_err() {
990            self.control_handle.shutdown();
991        }
992        self.drop_without_shutdown();
993        _result
994    }
995
996    /// Similar to "send" but does not shutdown the channel if an error occurs.
997    pub fn send_no_shutdown_on_err(
998        self,
999        mut result: Result<(), PresentRootViewError>,
1000    ) -> Result<(), fidl::Error> {
1001        let _result = self.send_raw(result);
1002        self.drop_without_shutdown();
1003        _result
1004    }
1005
1006    fn send_raw(&self, mut result: Result<(), PresentRootViewError>) -> Result<(), fidl::Error> {
1007        self.control_handle.inner.send::<fidl::encoding::ResultType<
1008            fidl::encoding::EmptyStruct,
1009            PresentRootViewError,
1010        >>(
1011            result,
1012            self.tx_id,
1013            0x51e070bb675a18df,
1014            fidl::encoding::DynamicFlags::empty(),
1015        )
1016    }
1017}
1018
1019mod internal {
1020    use super::*;
1021
1022    impl fidl::encoding::ResourceTypeMarker for ManagerPresentRootViewLegacyRequest {
1023        type Borrowed<'a> = &'a mut Self;
1024        fn take_or_borrow<'a>(
1025            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1026        ) -> Self::Borrowed<'a> {
1027            value
1028        }
1029    }
1030
1031    unsafe impl fidl::encoding::TypeMarker for ManagerPresentRootViewLegacyRequest {
1032        type Owned = Self;
1033
1034        #[inline(always)]
1035        fn inline_align(_context: fidl::encoding::Context) -> usize {
1036            4
1037        }
1038
1039        #[inline(always)]
1040        fn inline_size(_context: fidl::encoding::Context) -> usize {
1041            8
1042        }
1043    }
1044
1045    unsafe impl
1046        fidl::encoding::Encode<
1047            ManagerPresentRootViewLegacyRequest,
1048            fidl::encoding::DefaultFuchsiaResourceDialect,
1049        > for &mut ManagerPresentRootViewLegacyRequest
1050    {
1051        #[inline]
1052        unsafe fn encode(
1053            self,
1054            encoder: &mut fidl::encoding::Encoder<
1055                '_,
1056                fidl::encoding::DefaultFuchsiaResourceDialect,
1057            >,
1058            offset: usize,
1059            _depth: fidl::encoding::Depth,
1060        ) -> fidl::Result<()> {
1061            encoder.debug_check_bounds::<ManagerPresentRootViewLegacyRequest>(offset);
1062            // Delegate to tuple encoding.
1063            fidl::encoding::Encode::<ManagerPresentRootViewLegacyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1064                (
1065                    <fidl_fuchsia_ui_views::ViewHolderToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_holder_token),
1066                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
1067                ),
1068                encoder, offset, _depth
1069            )
1070        }
1071    }
1072    unsafe impl<
1073            T0: fidl::encoding::Encode<
1074                fidl_fuchsia_ui_views::ViewHolderToken,
1075                fidl::encoding::DefaultFuchsiaResourceDialect,
1076            >,
1077            T1: fidl::encoding::Encode<
1078                fidl_fuchsia_ui_views::ViewRef,
1079                fidl::encoding::DefaultFuchsiaResourceDialect,
1080            >,
1081        >
1082        fidl::encoding::Encode<
1083            ManagerPresentRootViewLegacyRequest,
1084            fidl::encoding::DefaultFuchsiaResourceDialect,
1085        > for (T0, T1)
1086    {
1087        #[inline]
1088        unsafe fn encode(
1089            self,
1090            encoder: &mut fidl::encoding::Encoder<
1091                '_,
1092                fidl::encoding::DefaultFuchsiaResourceDialect,
1093            >,
1094            offset: usize,
1095            depth: fidl::encoding::Depth,
1096        ) -> fidl::Result<()> {
1097            encoder.debug_check_bounds::<ManagerPresentRootViewLegacyRequest>(offset);
1098            // Zero out padding regions. There's no need to apply masks
1099            // because the unmasked parts will be overwritten by fields.
1100            // Write the fields.
1101            self.0.encode(encoder, offset + 0, depth)?;
1102            self.1.encode(encoder, offset + 4, depth)?;
1103            Ok(())
1104        }
1105    }
1106
1107    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1108        for ManagerPresentRootViewLegacyRequest
1109    {
1110        #[inline(always)]
1111        fn new_empty() -> Self {
1112            Self {
1113                view_holder_token: fidl::new_empty!(
1114                    fidl_fuchsia_ui_views::ViewHolderToken,
1115                    fidl::encoding::DefaultFuchsiaResourceDialect
1116                ),
1117                view_ref: fidl::new_empty!(
1118                    fidl_fuchsia_ui_views::ViewRef,
1119                    fidl::encoding::DefaultFuchsiaResourceDialect
1120                ),
1121            }
1122        }
1123
1124        #[inline]
1125        unsafe fn decode(
1126            &mut self,
1127            decoder: &mut fidl::encoding::Decoder<
1128                '_,
1129                fidl::encoding::DefaultFuchsiaResourceDialect,
1130            >,
1131            offset: usize,
1132            _depth: fidl::encoding::Depth,
1133        ) -> fidl::Result<()> {
1134            decoder.debug_check_bounds::<Self>(offset);
1135            // Verify that padding bytes are zero.
1136            fidl::decode!(
1137                fidl_fuchsia_ui_views::ViewHolderToken,
1138                fidl::encoding::DefaultFuchsiaResourceDialect,
1139                &mut self.view_holder_token,
1140                decoder,
1141                offset + 0,
1142                _depth
1143            )?;
1144            fidl::decode!(
1145                fidl_fuchsia_ui_views::ViewRef,
1146                fidl::encoding::DefaultFuchsiaResourceDialect,
1147                &mut self.view_ref,
1148                decoder,
1149                offset + 4,
1150                _depth
1151            )?;
1152            Ok(())
1153        }
1154    }
1155
1156    impl fidl::encoding::ResourceTypeMarker for ManagerPresentRootViewRequest {
1157        type Borrowed<'a> = &'a mut Self;
1158        fn take_or_borrow<'a>(
1159            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1160        ) -> Self::Borrowed<'a> {
1161            value
1162        }
1163    }
1164
1165    unsafe impl fidl::encoding::TypeMarker for ManagerPresentRootViewRequest {
1166        type Owned = Self;
1167
1168        #[inline(always)]
1169        fn inline_align(_context: fidl::encoding::Context) -> usize {
1170            4
1171        }
1172
1173        #[inline(always)]
1174        fn inline_size(_context: fidl::encoding::Context) -> usize {
1175            4
1176        }
1177    }
1178
1179    unsafe impl
1180        fidl::encoding::Encode<
1181            ManagerPresentRootViewRequest,
1182            fidl::encoding::DefaultFuchsiaResourceDialect,
1183        > for &mut ManagerPresentRootViewRequest
1184    {
1185        #[inline]
1186        unsafe fn encode(
1187            self,
1188            encoder: &mut fidl::encoding::Encoder<
1189                '_,
1190                fidl::encoding::DefaultFuchsiaResourceDialect,
1191            >,
1192            offset: usize,
1193            _depth: fidl::encoding::Depth,
1194        ) -> fidl::Result<()> {
1195            encoder.debug_check_bounds::<ManagerPresentRootViewRequest>(offset);
1196            // Delegate to tuple encoding.
1197            fidl::encoding::Encode::<ManagerPresentRootViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1198                (
1199                    <fidl_fuchsia_ui_views::ViewportCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.viewport_creation_token),
1200                ),
1201                encoder, offset, _depth
1202            )
1203        }
1204    }
1205    unsafe impl<
1206            T0: fidl::encoding::Encode<
1207                fidl_fuchsia_ui_views::ViewportCreationToken,
1208                fidl::encoding::DefaultFuchsiaResourceDialect,
1209            >,
1210        >
1211        fidl::encoding::Encode<
1212            ManagerPresentRootViewRequest,
1213            fidl::encoding::DefaultFuchsiaResourceDialect,
1214        > for (T0,)
1215    {
1216        #[inline]
1217        unsafe fn encode(
1218            self,
1219            encoder: &mut fidl::encoding::Encoder<
1220                '_,
1221                fidl::encoding::DefaultFuchsiaResourceDialect,
1222            >,
1223            offset: usize,
1224            depth: fidl::encoding::Depth,
1225        ) -> fidl::Result<()> {
1226            encoder.debug_check_bounds::<ManagerPresentRootViewRequest>(offset);
1227            // Zero out padding regions. There's no need to apply masks
1228            // because the unmasked parts will be overwritten by fields.
1229            // Write the fields.
1230            self.0.encode(encoder, offset + 0, depth)?;
1231            Ok(())
1232        }
1233    }
1234
1235    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1236        for ManagerPresentRootViewRequest
1237    {
1238        #[inline(always)]
1239        fn new_empty() -> Self {
1240            Self {
1241                viewport_creation_token: fidl::new_empty!(
1242                    fidl_fuchsia_ui_views::ViewportCreationToken,
1243                    fidl::encoding::DefaultFuchsiaResourceDialect
1244                ),
1245            }
1246        }
1247
1248        #[inline]
1249        unsafe fn decode(
1250            &mut self,
1251            decoder: &mut fidl::encoding::Decoder<
1252                '_,
1253                fidl::encoding::DefaultFuchsiaResourceDialect,
1254            >,
1255            offset: usize,
1256            _depth: fidl::encoding::Depth,
1257        ) -> fidl::Result<()> {
1258            decoder.debug_check_bounds::<Self>(offset);
1259            // Verify that padding bytes are zero.
1260            fidl::decode!(
1261                fidl_fuchsia_ui_views::ViewportCreationToken,
1262                fidl::encoding::DefaultFuchsiaResourceDialect,
1263                &mut self.viewport_creation_token,
1264                decoder,
1265                offset + 0,
1266                _depth
1267            )?;
1268            Ok(())
1269        }
1270    }
1271
1272    impl fidl::encoding::ResourceTypeMarker for ManagerSetRootViewRequest {
1273        type Borrowed<'a> = &'a mut Self;
1274        fn take_or_borrow<'a>(
1275            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1276        ) -> Self::Borrowed<'a> {
1277            value
1278        }
1279    }
1280
1281    unsafe impl fidl::encoding::TypeMarker for ManagerSetRootViewRequest {
1282        type Owned = Self;
1283
1284        #[inline(always)]
1285        fn inline_align(_context: fidl::encoding::Context) -> usize {
1286            4
1287        }
1288
1289        #[inline(always)]
1290        fn inline_size(_context: fidl::encoding::Context) -> usize {
1291            4
1292        }
1293    }
1294
1295    unsafe impl
1296        fidl::encoding::Encode<
1297            ManagerSetRootViewRequest,
1298            fidl::encoding::DefaultFuchsiaResourceDialect,
1299        > for &mut ManagerSetRootViewRequest
1300    {
1301        #[inline]
1302        unsafe fn encode(
1303            self,
1304            encoder: &mut fidl::encoding::Encoder<
1305                '_,
1306                fidl::encoding::DefaultFuchsiaResourceDialect,
1307            >,
1308            offset: usize,
1309            _depth: fidl::encoding::Depth,
1310        ) -> fidl::Result<()> {
1311            encoder.debug_check_bounds::<ManagerSetRootViewRequest>(offset);
1312            // Delegate to tuple encoding.
1313            fidl::encoding::Encode::<
1314                ManagerSetRootViewRequest,
1315                fidl::encoding::DefaultFuchsiaResourceDialect,
1316            >::encode(
1317                (<fidl::encoding::Endpoint<
1318                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1319                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1320                    &mut self.view_provider
1321                ),),
1322                encoder,
1323                offset,
1324                _depth,
1325            )
1326        }
1327    }
1328    unsafe impl<
1329            T0: fidl::encoding::Encode<
1330                fidl::encoding::Endpoint<
1331                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1332                >,
1333                fidl::encoding::DefaultFuchsiaResourceDialect,
1334            >,
1335        >
1336        fidl::encoding::Encode<
1337            ManagerSetRootViewRequest,
1338            fidl::encoding::DefaultFuchsiaResourceDialect,
1339        > for (T0,)
1340    {
1341        #[inline]
1342        unsafe fn encode(
1343            self,
1344            encoder: &mut fidl::encoding::Encoder<
1345                '_,
1346                fidl::encoding::DefaultFuchsiaResourceDialect,
1347            >,
1348            offset: usize,
1349            depth: fidl::encoding::Depth,
1350        ) -> fidl::Result<()> {
1351            encoder.debug_check_bounds::<ManagerSetRootViewRequest>(offset);
1352            // Zero out padding regions. There's no need to apply masks
1353            // because the unmasked parts will be overwritten by fields.
1354            // Write the fields.
1355            self.0.encode(encoder, offset + 0, depth)?;
1356            Ok(())
1357        }
1358    }
1359
1360    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1361        for ManagerSetRootViewRequest
1362    {
1363        #[inline(always)]
1364        fn new_empty() -> Self {
1365            Self {
1366                view_provider: fidl::new_empty!(
1367                    fidl::encoding::Endpoint<
1368                        fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1369                    >,
1370                    fidl::encoding::DefaultFuchsiaResourceDialect
1371                ),
1372            }
1373        }
1374
1375        #[inline]
1376        unsafe fn decode(
1377            &mut self,
1378            decoder: &mut fidl::encoding::Decoder<
1379                '_,
1380                fidl::encoding::DefaultFuchsiaResourceDialect,
1381            >,
1382            offset: usize,
1383            _depth: fidl::encoding::Depth,
1384        ) -> fidl::Result<()> {
1385            decoder.debug_check_bounds::<Self>(offset);
1386            // Verify that padding bytes are zero.
1387            fidl::decode!(
1388                fidl::encoding::Endpoint<
1389                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_app::ViewProviderMarker>,
1390                >,
1391                fidl::encoding::DefaultFuchsiaResourceDialect,
1392                &mut self.view_provider,
1393                decoder,
1394                offset + 0,
1395                _depth
1396            )?;
1397            Ok(())
1398        }
1399    }
1400
1401    impl fidl::encoding::ResourceTypeMarker for ManagerSetRootViewResponse {
1402        type Borrowed<'a> = &'a mut Self;
1403        fn take_or_borrow<'a>(
1404            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1405        ) -> Self::Borrowed<'a> {
1406            value
1407        }
1408    }
1409
1410    unsafe impl fidl::encoding::TypeMarker for ManagerSetRootViewResponse {
1411        type Owned = Self;
1412
1413        #[inline(always)]
1414        fn inline_align(_context: fidl::encoding::Context) -> usize {
1415            4
1416        }
1417
1418        #[inline(always)]
1419        fn inline_size(_context: fidl::encoding::Context) -> usize {
1420            4
1421        }
1422    }
1423
1424    unsafe impl
1425        fidl::encoding::Encode<
1426            ManagerSetRootViewResponse,
1427            fidl::encoding::DefaultFuchsiaResourceDialect,
1428        > for &mut ManagerSetRootViewResponse
1429    {
1430        #[inline]
1431        unsafe fn encode(
1432            self,
1433            encoder: &mut fidl::encoding::Encoder<
1434                '_,
1435                fidl::encoding::DefaultFuchsiaResourceDialect,
1436            >,
1437            offset: usize,
1438            _depth: fidl::encoding::Depth,
1439        ) -> fidl::Result<()> {
1440            encoder.debug_check_bounds::<ManagerSetRootViewResponse>(offset);
1441            // Delegate to tuple encoding.
1442            fidl::encoding::Encode::<ManagerSetRootViewResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1443                (
1444                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
1445                ),
1446                encoder, offset, _depth
1447            )
1448        }
1449    }
1450    unsafe impl<
1451            T0: fidl::encoding::Encode<
1452                fidl_fuchsia_ui_views::ViewRef,
1453                fidl::encoding::DefaultFuchsiaResourceDialect,
1454            >,
1455        >
1456        fidl::encoding::Encode<
1457            ManagerSetRootViewResponse,
1458            fidl::encoding::DefaultFuchsiaResourceDialect,
1459        > for (T0,)
1460    {
1461        #[inline]
1462        unsafe fn encode(
1463            self,
1464            encoder: &mut fidl::encoding::Encoder<
1465                '_,
1466                fidl::encoding::DefaultFuchsiaResourceDialect,
1467            >,
1468            offset: usize,
1469            depth: fidl::encoding::Depth,
1470        ) -> fidl::Result<()> {
1471            encoder.debug_check_bounds::<ManagerSetRootViewResponse>(offset);
1472            // Zero out padding regions. There's no need to apply masks
1473            // because the unmasked parts will be overwritten by fields.
1474            // Write the fields.
1475            self.0.encode(encoder, offset + 0, depth)?;
1476            Ok(())
1477        }
1478    }
1479
1480    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1481        for ManagerSetRootViewResponse
1482    {
1483        #[inline(always)]
1484        fn new_empty() -> Self {
1485            Self {
1486                view_ref: fidl::new_empty!(
1487                    fidl_fuchsia_ui_views::ViewRef,
1488                    fidl::encoding::DefaultFuchsiaResourceDialect
1489                ),
1490            }
1491        }
1492
1493        #[inline]
1494        unsafe fn decode(
1495            &mut self,
1496            decoder: &mut fidl::encoding::Decoder<
1497                '_,
1498                fidl::encoding::DefaultFuchsiaResourceDialect,
1499            >,
1500            offset: usize,
1501            _depth: fidl::encoding::Depth,
1502        ) -> fidl::Result<()> {
1503            decoder.debug_check_bounds::<Self>(offset);
1504            // Verify that padding bytes are zero.
1505            fidl::decode!(
1506                fidl_fuchsia_ui_views::ViewRef,
1507                fidl::encoding::DefaultFuchsiaResourceDialect,
1508                &mut self.view_ref,
1509                decoder,
1510                offset + 0,
1511                _depth
1512            )?;
1513            Ok(())
1514        }
1515    }
1516}