Skip to main content

fidl_fuchsia_virtualconsole/
fidl_fuchsia_virtualconsole.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_virtualconsole_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct SessionManagerCreateSessionRequest {
16    pub session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for SessionManagerCreateSessionRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct SessionManagerMarker;
26
27impl fidl::endpoints::ProtocolMarker for SessionManagerMarker {
28    type Proxy = SessionManagerProxy;
29    type RequestStream = SessionManagerRequestStream;
30    #[cfg(target_os = "fuchsia")]
31    type SynchronousProxy = SessionManagerSynchronousProxy;
32
33    const DEBUG_NAME: &'static str = "fuchsia.virtualconsole.SessionManager";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for SessionManagerMarker {}
36
37pub trait SessionManagerProxyInterface: Send + Sync {
38    fn r#create_session(
39        &self,
40        session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
41    ) -> Result<(), fidl::Error>;
42    type HasPrimaryConnectedResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
43        + Send;
44    fn r#has_primary_connected(&self) -> Self::HasPrimaryConnectedResponseFut;
45}
46#[derive(Debug)]
47#[cfg(target_os = "fuchsia")]
48pub struct SessionManagerSynchronousProxy {
49    client: fidl::client::sync::Client,
50}
51
52#[cfg(target_os = "fuchsia")]
53impl fidl::endpoints::SynchronousProxy for SessionManagerSynchronousProxy {
54    type Proxy = SessionManagerProxy;
55    type Protocol = SessionManagerMarker;
56
57    fn from_channel(inner: fidl::Channel) -> Self {
58        Self::new(inner)
59    }
60
61    fn into_channel(self) -> fidl::Channel {
62        self.client.into_channel()
63    }
64
65    fn as_channel(&self) -> &fidl::Channel {
66        self.client.as_channel()
67    }
68}
69
70#[cfg(target_os = "fuchsia")]
71impl SessionManagerSynchronousProxy {
72    pub fn new(channel: fidl::Channel) -> Self {
73        Self { client: fidl::client::sync::Client::new(channel) }
74    }
75
76    pub fn into_channel(self) -> fidl::Channel {
77        self.client.into_channel()
78    }
79
80    /// Waits until an event arrives and returns it. It is safe for other
81    /// threads to make concurrent requests while waiting for an event.
82    pub fn wait_for_event(
83        &self,
84        deadline: zx::MonotonicInstant,
85    ) -> Result<SessionManagerEvent, fidl::Error> {
86        SessionManagerEvent::decode(self.client.wait_for_event::<SessionManagerMarker>(deadline)?)
87    }
88
89    /// Create a new virtual console session.
90    pub fn r#create_session(
91        &self,
92        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
93    ) -> Result<(), fidl::Error> {
94        self.client.send::<SessionManagerCreateSessionRequest>(
95            (session,),
96            0x70a8a74a19cc4b52,
97            fidl::encoding::DynamicFlags::empty(),
98        )
99    }
100
101    /// Returns true if virtcon currently has a display that it can display something on.
102    pub fn r#has_primary_connected(
103        &self,
104        ___deadline: zx::MonotonicInstant,
105    ) -> Result<bool, fidl::Error> {
106        let _response = self.client.send_query::<
107            fidl::encoding::EmptyPayload,
108            SessionManagerHasPrimaryConnectedResponse,
109            SessionManagerMarker,
110        >(
111            (),
112            0x723fdb4c1469fa36,
113            fidl::encoding::DynamicFlags::empty(),
114            ___deadline,
115        )?;
116        Ok(_response.connected)
117    }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<SessionManagerSynchronousProxy> for zx::NullableHandle {
122    fn from(value: SessionManagerSynchronousProxy) -> Self {
123        value.into_channel().into()
124    }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl From<fidl::Channel> for SessionManagerSynchronousProxy {
129    fn from(value: fidl::Channel) -> Self {
130        Self::new(value)
131    }
132}
133
134#[cfg(target_os = "fuchsia")]
135impl fidl::endpoints::FromClient for SessionManagerSynchronousProxy {
136    type Protocol = SessionManagerMarker;
137
138    fn from_client(value: fidl::endpoints::ClientEnd<SessionManagerMarker>) -> Self {
139        Self::new(value.into_channel())
140    }
141}
142
143#[derive(Debug, Clone)]
144pub struct SessionManagerProxy {
145    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
146}
147
148impl fidl::endpoints::Proxy for SessionManagerProxy {
149    type Protocol = SessionManagerMarker;
150
151    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
152        Self::new(inner)
153    }
154
155    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
156        self.client.into_channel().map_err(|client| Self { client })
157    }
158
159    fn as_channel(&self) -> &::fidl::AsyncChannel {
160        self.client.as_channel()
161    }
162}
163
164impl SessionManagerProxy {
165    /// Create a new Proxy for fuchsia.virtualconsole/SessionManager.
166    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
167        let protocol_name = <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
168        Self { client: fidl::client::Client::new(channel, protocol_name) }
169    }
170
171    /// Get a Stream of events from the remote end of the protocol.
172    ///
173    /// # Panics
174    ///
175    /// Panics if the event stream was already taken.
176    pub fn take_event_stream(&self) -> SessionManagerEventStream {
177        SessionManagerEventStream { event_receiver: self.client.take_event_receiver() }
178    }
179
180    /// Create a new virtual console session.
181    pub fn r#create_session(
182        &self,
183        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
184    ) -> Result<(), fidl::Error> {
185        SessionManagerProxyInterface::r#create_session(self, session)
186    }
187
188    /// Returns true if virtcon currently has a display that it can display something on.
189    pub fn r#has_primary_connected(
190        &self,
191    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
192        SessionManagerProxyInterface::r#has_primary_connected(self)
193    }
194}
195
196impl SessionManagerProxyInterface for SessionManagerProxy {
197    fn r#create_session(
198        &self,
199        mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
200    ) -> Result<(), fidl::Error> {
201        self.client.send::<SessionManagerCreateSessionRequest>(
202            (session,),
203            0x70a8a74a19cc4b52,
204            fidl::encoding::DynamicFlags::empty(),
205        )
206    }
207
208    type HasPrimaryConnectedResponseFut =
209        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
210    fn r#has_primary_connected(&self) -> Self::HasPrimaryConnectedResponseFut {
211        fn _decode(
212            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
213        ) -> Result<bool, fidl::Error> {
214            let _response = fidl::client::decode_transaction_body::<
215                SessionManagerHasPrimaryConnectedResponse,
216                fidl::encoding::DefaultFuchsiaResourceDialect,
217                0x723fdb4c1469fa36,
218            >(_buf?)?;
219            Ok(_response.connected)
220        }
221        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
222            (),
223            0x723fdb4c1469fa36,
224            fidl::encoding::DynamicFlags::empty(),
225            _decode,
226        )
227    }
228}
229
230pub struct SessionManagerEventStream {
231    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
232}
233
234impl std::marker::Unpin for SessionManagerEventStream {}
235
236impl futures::stream::FusedStream for SessionManagerEventStream {
237    fn is_terminated(&self) -> bool {
238        self.event_receiver.is_terminated()
239    }
240}
241
242impl futures::Stream for SessionManagerEventStream {
243    type Item = Result<SessionManagerEvent, fidl::Error>;
244
245    fn poll_next(
246        mut self: std::pin::Pin<&mut Self>,
247        cx: &mut std::task::Context<'_>,
248    ) -> std::task::Poll<Option<Self::Item>> {
249        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
250            &mut self.event_receiver,
251            cx
252        )?) {
253            Some(buf) => std::task::Poll::Ready(Some(SessionManagerEvent::decode(buf))),
254            None => std::task::Poll::Ready(None),
255        }
256    }
257}
258
259#[derive(Debug)]
260pub enum SessionManagerEvent {}
261
262impl SessionManagerEvent {
263    /// Decodes a message buffer as a [`SessionManagerEvent`].
264    fn decode(
265        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
266    ) -> Result<SessionManagerEvent, fidl::Error> {
267        let (bytes, _handles) = buf.split_mut();
268        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
269        debug_assert_eq!(tx_header.tx_id, 0);
270        match tx_header.ordinal {
271            _ => Err(fidl::Error::UnknownOrdinal {
272                ordinal: tx_header.ordinal,
273                protocol_name:
274                    <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
275            }),
276        }
277    }
278}
279
280/// A Stream of incoming requests for fuchsia.virtualconsole/SessionManager.
281pub struct SessionManagerRequestStream {
282    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
283    is_terminated: bool,
284}
285
286impl std::marker::Unpin for SessionManagerRequestStream {}
287
288impl futures::stream::FusedStream for SessionManagerRequestStream {
289    fn is_terminated(&self) -> bool {
290        self.is_terminated
291    }
292}
293
294impl fidl::endpoints::RequestStream for SessionManagerRequestStream {
295    type Protocol = SessionManagerMarker;
296    type ControlHandle = SessionManagerControlHandle;
297
298    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
299        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
300    }
301
302    fn control_handle(&self) -> Self::ControlHandle {
303        SessionManagerControlHandle { inner: self.inner.clone() }
304    }
305
306    fn into_inner(
307        self,
308    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
309    {
310        (self.inner, self.is_terminated)
311    }
312
313    fn from_inner(
314        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
315        is_terminated: bool,
316    ) -> Self {
317        Self { inner, is_terminated }
318    }
319}
320
321impl futures::Stream for SessionManagerRequestStream {
322    type Item = Result<SessionManagerRequest, fidl::Error>;
323
324    fn poll_next(
325        mut self: std::pin::Pin<&mut Self>,
326        cx: &mut std::task::Context<'_>,
327    ) -> std::task::Poll<Option<Self::Item>> {
328        let this = &mut *self;
329        if this.inner.check_shutdown(cx) {
330            this.is_terminated = true;
331            return std::task::Poll::Ready(None);
332        }
333        if this.is_terminated {
334            panic!("polled SessionManagerRequestStream after completion");
335        }
336        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
337            |bytes, handles| {
338                match this.inner.channel().read_etc(cx, bytes, handles) {
339                    std::task::Poll::Ready(Ok(())) => {}
340                    std::task::Poll::Pending => return std::task::Poll::Pending,
341                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
342                        this.is_terminated = true;
343                        return std::task::Poll::Ready(None);
344                    }
345                    std::task::Poll::Ready(Err(e)) => {
346                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
347                            e.into(),
348                        ))));
349                    }
350                }
351
352                // A message has been received from the channel
353                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
354
355                std::task::Poll::Ready(Some(match header.ordinal {
356                    0x70a8a74a19cc4b52 => {
357                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
358                        let mut req = fidl::new_empty!(
359                            SessionManagerCreateSessionRequest,
360                            fidl::encoding::DefaultFuchsiaResourceDialect
361                        );
362                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerCreateSessionRequest>(&header, _body_bytes, handles, &mut req)?;
363                        let control_handle =
364                            SessionManagerControlHandle { inner: this.inner.clone() };
365                        Ok(SessionManagerRequest::CreateSession {
366                            session: req.session,
367
368                            control_handle,
369                        })
370                    }
371                    0x723fdb4c1469fa36 => {
372                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
373                        let mut req = fidl::new_empty!(
374                            fidl::encoding::EmptyPayload,
375                            fidl::encoding::DefaultFuchsiaResourceDialect
376                        );
377                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
378                        let control_handle =
379                            SessionManagerControlHandle { inner: this.inner.clone() };
380                        Ok(SessionManagerRequest::HasPrimaryConnected {
381                            responder: SessionManagerHasPrimaryConnectedResponder {
382                                control_handle: std::mem::ManuallyDrop::new(control_handle),
383                                tx_id: header.tx_id,
384                            },
385                        })
386                    }
387                    _ => Err(fidl::Error::UnknownOrdinal {
388                        ordinal: header.ordinal,
389                        protocol_name:
390                            <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
391                    }),
392                }))
393            },
394        )
395    }
396}
397
398/// Manages virtual console sessions.
399#[derive(Debug)]
400pub enum SessionManagerRequest {
401    /// Create a new virtual console session.
402    CreateSession {
403        session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
404        control_handle: SessionManagerControlHandle,
405    },
406    /// Returns true if virtcon currently has a display that it can display something on.
407    HasPrimaryConnected { responder: SessionManagerHasPrimaryConnectedResponder },
408}
409
410impl SessionManagerRequest {
411    #[allow(irrefutable_let_patterns)]
412    pub fn into_create_session(
413        self,
414    ) -> Option<(
415        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
416        SessionManagerControlHandle,
417    )> {
418        if let SessionManagerRequest::CreateSession { session, control_handle } = self {
419            Some((session, control_handle))
420        } else {
421            None
422        }
423    }
424
425    #[allow(irrefutable_let_patterns)]
426    pub fn into_has_primary_connected(
427        self,
428    ) -> Option<(SessionManagerHasPrimaryConnectedResponder)> {
429        if let SessionManagerRequest::HasPrimaryConnected { responder } = self {
430            Some((responder))
431        } else {
432            None
433        }
434    }
435
436    /// Name of the method defined in FIDL
437    pub fn method_name(&self) -> &'static str {
438        match *self {
439            SessionManagerRequest::CreateSession { .. } => "create_session",
440            SessionManagerRequest::HasPrimaryConnected { .. } => "has_primary_connected",
441        }
442    }
443}
444
445#[derive(Debug, Clone)]
446pub struct SessionManagerControlHandle {
447    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
448}
449
450impl SessionManagerControlHandle {
451    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
452        self.inner.shutdown_with_epitaph(status.into())
453    }
454}
455
456impl fidl::endpoints::ControlHandle for SessionManagerControlHandle {
457    fn shutdown(&self) {
458        self.inner.shutdown()
459    }
460
461    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
462        self.inner.shutdown_with_epitaph(status)
463    }
464
465    fn is_closed(&self) -> bool {
466        self.inner.channel().is_closed()
467    }
468    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
469        self.inner.channel().on_closed()
470    }
471
472    #[cfg(target_os = "fuchsia")]
473    fn signal_peer(
474        &self,
475        clear_mask: zx::Signals,
476        set_mask: zx::Signals,
477    ) -> Result<(), zx_status::Status> {
478        use fidl::Peered;
479        self.inner.channel().signal_peer(clear_mask, set_mask)
480    }
481}
482
483impl SessionManagerControlHandle {}
484
485#[must_use = "FIDL methods require a response to be sent"]
486#[derive(Debug)]
487pub struct SessionManagerHasPrimaryConnectedResponder {
488    control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
489    tx_id: u32,
490}
491
492/// Set the the channel to be shutdown (see [`SessionManagerControlHandle::shutdown`])
493/// if the responder is dropped without sending a response, so that the client
494/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
495impl std::ops::Drop for SessionManagerHasPrimaryConnectedResponder {
496    fn drop(&mut self) {
497        self.control_handle.shutdown();
498        // Safety: drops once, never accessed again
499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
500    }
501}
502
503impl fidl::endpoints::Responder for SessionManagerHasPrimaryConnectedResponder {
504    type ControlHandle = SessionManagerControlHandle;
505
506    fn control_handle(&self) -> &SessionManagerControlHandle {
507        &self.control_handle
508    }
509
510    fn drop_without_shutdown(mut self) {
511        // Safety: drops once, never accessed again due to mem::forget
512        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
513        // Prevent Drop from running (which would shut down the channel)
514        std::mem::forget(self);
515    }
516}
517
518impl SessionManagerHasPrimaryConnectedResponder {
519    /// Sends a response to the FIDL transaction.
520    ///
521    /// Sets the channel to shutdown if an error occurs.
522    pub fn send(self, mut connected: bool) -> Result<(), fidl::Error> {
523        let _result = self.send_raw(connected);
524        if _result.is_err() {
525            self.control_handle.shutdown();
526        }
527        self.drop_without_shutdown();
528        _result
529    }
530
531    /// Similar to "send" but does not shutdown the channel if an error occurs.
532    pub fn send_no_shutdown_on_err(self, mut connected: bool) -> Result<(), fidl::Error> {
533        let _result = self.send_raw(connected);
534        self.drop_without_shutdown();
535        _result
536    }
537
538    fn send_raw(&self, mut connected: bool) -> Result<(), fidl::Error> {
539        self.control_handle.inner.send::<SessionManagerHasPrimaryConnectedResponse>(
540            (connected,),
541            self.tx_id,
542            0x723fdb4c1469fa36,
543            fidl::encoding::DynamicFlags::empty(),
544        )
545    }
546}
547
548mod internal {
549    use super::*;
550
551    impl fidl::encoding::ResourceTypeMarker for SessionManagerCreateSessionRequest {
552        type Borrowed<'a> = &'a mut Self;
553        fn take_or_borrow<'a>(
554            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
555        ) -> Self::Borrowed<'a> {
556            value
557        }
558    }
559
560    unsafe impl fidl::encoding::TypeMarker for SessionManagerCreateSessionRequest {
561        type Owned = Self;
562
563        #[inline(always)]
564        fn inline_align(_context: fidl::encoding::Context) -> usize {
565            4
566        }
567
568        #[inline(always)]
569        fn inline_size(_context: fidl::encoding::Context) -> usize {
570            4
571        }
572    }
573
574    unsafe impl
575        fidl::encoding::Encode<
576            SessionManagerCreateSessionRequest,
577            fidl::encoding::DefaultFuchsiaResourceDialect,
578        > for &mut SessionManagerCreateSessionRequest
579    {
580        #[inline]
581        unsafe fn encode(
582            self,
583            encoder: &mut fidl::encoding::Encoder<
584                '_,
585                fidl::encoding::DefaultFuchsiaResourceDialect,
586            >,
587            offset: usize,
588            _depth: fidl::encoding::Depth,
589        ) -> fidl::Result<()> {
590            encoder.debug_check_bounds::<SessionManagerCreateSessionRequest>(offset);
591            // Delegate to tuple encoding.
592            fidl::encoding::Encode::<
593                SessionManagerCreateSessionRequest,
594                fidl::encoding::DefaultFuchsiaResourceDialect,
595            >::encode(
596                (<fidl::encoding::Endpoint<
597                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
598                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
599                    &mut self.session
600                ),),
601                encoder,
602                offset,
603                _depth,
604            )
605        }
606    }
607    unsafe impl<
608        T0: fidl::encoding::Encode<
609                fidl::encoding::Endpoint<
610                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
611                >,
612                fidl::encoding::DefaultFuchsiaResourceDialect,
613            >,
614    >
615        fidl::encoding::Encode<
616            SessionManagerCreateSessionRequest,
617            fidl::encoding::DefaultFuchsiaResourceDialect,
618        > for (T0,)
619    {
620        #[inline]
621        unsafe fn encode(
622            self,
623            encoder: &mut fidl::encoding::Encoder<
624                '_,
625                fidl::encoding::DefaultFuchsiaResourceDialect,
626            >,
627            offset: usize,
628            depth: fidl::encoding::Depth,
629        ) -> fidl::Result<()> {
630            encoder.debug_check_bounds::<SessionManagerCreateSessionRequest>(offset);
631            // Zero out padding regions. There's no need to apply masks
632            // because the unmasked parts will be overwritten by fields.
633            // Write the fields.
634            self.0.encode(encoder, offset + 0, depth)?;
635            Ok(())
636        }
637    }
638
639    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
640        for SessionManagerCreateSessionRequest
641    {
642        #[inline(always)]
643        fn new_empty() -> Self {
644            Self {
645                session: fidl::new_empty!(
646                    fidl::encoding::Endpoint<
647                        fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
648                    >,
649                    fidl::encoding::DefaultFuchsiaResourceDialect
650                ),
651            }
652        }
653
654        #[inline]
655        unsafe fn decode(
656            &mut self,
657            decoder: &mut fidl::encoding::Decoder<
658                '_,
659                fidl::encoding::DefaultFuchsiaResourceDialect,
660            >,
661            offset: usize,
662            _depth: fidl::encoding::Depth,
663        ) -> fidl::Result<()> {
664            decoder.debug_check_bounds::<Self>(offset);
665            // Verify that padding bytes are zero.
666            fidl::decode!(
667                fidl::encoding::Endpoint<
668                    fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_pty::DeviceMarker>,
669                >,
670                fidl::encoding::DefaultFuchsiaResourceDialect,
671                &mut self.session,
672                decoder,
673                offset + 0,
674                _depth
675            )?;
676            Ok(())
677        }
678    }
679}