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