Skip to main content

fidl_fuchsia_hardware_tee/
fidl_fuchsia_hardware_tee.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_hardware_tee_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct DeviceConnectorConnectToApplicationRequest {
16    pub application_uuid: fidl_fuchsia_tee::Uuid,
17    pub service_provider:
18        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>>,
19    pub application_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23    for DeviceConnectorConnectToApplicationRequest
24{
25}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct DeviceConnectorConnectToDeviceInfoRequest {
29    pub device_info_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33    for DeviceConnectorConnectToDeviceInfoRequest
34{
35}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct DeviceConnectorMarker;
39
40impl fidl::endpoints::ProtocolMarker for DeviceConnectorMarker {
41    type Proxy = DeviceConnectorProxy;
42    type RequestStream = DeviceConnectorRequestStream;
43    #[cfg(target_os = "fuchsia")]
44    type SynchronousProxy = DeviceConnectorSynchronousProxy;
45
46    const DEBUG_NAME: &'static str = "(anonymous) DeviceConnector";
47}
48
49pub trait DeviceConnectorProxyInterface: Send + Sync {
50    fn r#connect_to_device_info(
51        &self,
52        device_info_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
53    ) -> Result<(), fidl::Error>;
54    fn r#connect_to_application(
55        &self,
56        application_uuid: &fidl_fuchsia_tee::Uuid,
57        service_provider: Option<
58            fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
59        >,
60        application_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
61    ) -> Result<(), fidl::Error>;
62}
63#[derive(Debug)]
64#[cfg(target_os = "fuchsia")]
65pub struct DeviceConnectorSynchronousProxy {
66    client: fidl::client::sync::Client,
67}
68
69#[cfg(target_os = "fuchsia")]
70impl fidl::endpoints::SynchronousProxy for DeviceConnectorSynchronousProxy {
71    type Proxy = DeviceConnectorProxy;
72    type Protocol = DeviceConnectorMarker;
73
74    fn from_channel(inner: fidl::Channel) -> Self {
75        Self::new(inner)
76    }
77
78    fn into_channel(self) -> fidl::Channel {
79        self.client.into_channel()
80    }
81
82    fn as_channel(&self) -> &fidl::Channel {
83        self.client.as_channel()
84    }
85}
86
87#[cfg(target_os = "fuchsia")]
88impl DeviceConnectorSynchronousProxy {
89    pub fn new(channel: fidl::Channel) -> Self {
90        Self { client: fidl::client::sync::Client::new(channel) }
91    }
92
93    pub fn into_channel(self) -> fidl::Channel {
94        self.client.into_channel()
95    }
96
97    /// Waits until an event arrives and returns it. It is safe for other
98    /// threads to make concurrent requests while waiting for an event.
99    pub fn wait_for_event(
100        &self,
101        deadline: zx::MonotonicInstant,
102    ) -> Result<DeviceConnectorEvent, fidl::Error> {
103        DeviceConnectorEvent::decode(self.client.wait_for_event::<DeviceConnectorMarker>(deadline)?)
104    }
105
106    /// Requests a `DeviceInfo` connection to the TEE driver to enumerate device info.
107    ///
108    /// The sole caller of this should be the TEE Manager.
109    pub fn r#connect_to_device_info(
110        &self,
111        mut device_info_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
112    ) -> Result<(), fidl::Error> {
113        self.client.send::<DeviceConnectorConnectToDeviceInfoRequest>(
114            (device_info_request,),
115            0x5fa3623fd14f786,
116            fidl::encoding::DynamicFlags::empty(),
117        )
118    }
119
120    /// Requests an `Application` connection from the TEE driver while the caller provides a client
121    /// channel end to a `Provider` server that supports the driver on any RPCs.
122    ///
123    /// The sole caller of this should be the TEE Manager.
124    pub fn r#connect_to_application(
125        &self,
126        mut application_uuid: &fidl_fuchsia_tee::Uuid,
127        mut service_provider: Option<
128            fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
129        >,
130        mut application_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
131    ) -> Result<(), fidl::Error> {
132        self.client.send::<DeviceConnectorConnectToApplicationRequest>(
133            (application_uuid, service_provider, application_request),
134            0x6e7f7e307df7816a,
135            fidl::encoding::DynamicFlags::empty(),
136        )
137    }
138}
139
140#[cfg(target_os = "fuchsia")]
141impl From<DeviceConnectorSynchronousProxy> for zx::NullableHandle {
142    fn from(value: DeviceConnectorSynchronousProxy) -> Self {
143        value.into_channel().into()
144    }
145}
146
147#[cfg(target_os = "fuchsia")]
148impl From<fidl::Channel> for DeviceConnectorSynchronousProxy {
149    fn from(value: fidl::Channel) -> Self {
150        Self::new(value)
151    }
152}
153
154#[cfg(target_os = "fuchsia")]
155impl fidl::endpoints::FromClient for DeviceConnectorSynchronousProxy {
156    type Protocol = DeviceConnectorMarker;
157
158    fn from_client(value: fidl::endpoints::ClientEnd<DeviceConnectorMarker>) -> Self {
159        Self::new(value.into_channel())
160    }
161}
162
163#[derive(Debug, Clone)]
164pub struct DeviceConnectorProxy {
165    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
166}
167
168impl fidl::endpoints::Proxy for DeviceConnectorProxy {
169    type Protocol = DeviceConnectorMarker;
170
171    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
172        Self::new(inner)
173    }
174
175    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
176        self.client.into_channel().map_err(|client| Self { client })
177    }
178
179    fn as_channel(&self) -> &::fidl::AsyncChannel {
180        self.client.as_channel()
181    }
182}
183
184impl DeviceConnectorProxy {
185    /// Create a new Proxy for fuchsia.hardware.tee/DeviceConnector.
186    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
187        let protocol_name = <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
188        Self { client: fidl::client::Client::new(channel, protocol_name) }
189    }
190
191    /// Get a Stream of events from the remote end of the protocol.
192    ///
193    /// # Panics
194    ///
195    /// Panics if the event stream was already taken.
196    pub fn take_event_stream(&self) -> DeviceConnectorEventStream {
197        DeviceConnectorEventStream { event_receiver: self.client.take_event_receiver() }
198    }
199
200    /// Requests a `DeviceInfo` connection to the TEE driver to enumerate device info.
201    ///
202    /// The sole caller of this should be the TEE Manager.
203    pub fn r#connect_to_device_info(
204        &self,
205        mut device_info_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
206    ) -> Result<(), fidl::Error> {
207        DeviceConnectorProxyInterface::r#connect_to_device_info(self, device_info_request)
208    }
209
210    /// Requests an `Application` connection from the TEE driver while the caller provides a client
211    /// channel end to a `Provider` server that supports the driver on any RPCs.
212    ///
213    /// The sole caller of this should be the TEE Manager.
214    pub fn r#connect_to_application(
215        &self,
216        mut application_uuid: &fidl_fuchsia_tee::Uuid,
217        mut service_provider: Option<
218            fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
219        >,
220        mut application_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
221    ) -> Result<(), fidl::Error> {
222        DeviceConnectorProxyInterface::r#connect_to_application(
223            self,
224            application_uuid,
225            service_provider,
226            application_request,
227        )
228    }
229}
230
231impl DeviceConnectorProxyInterface for DeviceConnectorProxy {
232    fn r#connect_to_device_info(
233        &self,
234        mut device_info_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
235    ) -> Result<(), fidl::Error> {
236        self.client.send::<DeviceConnectorConnectToDeviceInfoRequest>(
237            (device_info_request,),
238            0x5fa3623fd14f786,
239            fidl::encoding::DynamicFlags::empty(),
240        )
241    }
242
243    fn r#connect_to_application(
244        &self,
245        mut application_uuid: &fidl_fuchsia_tee::Uuid,
246        mut service_provider: Option<
247            fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
248        >,
249        mut application_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
250    ) -> Result<(), fidl::Error> {
251        self.client.send::<DeviceConnectorConnectToApplicationRequest>(
252            (application_uuid, service_provider, application_request),
253            0x6e7f7e307df7816a,
254            fidl::encoding::DynamicFlags::empty(),
255        )
256    }
257}
258
259pub struct DeviceConnectorEventStream {
260    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
261}
262
263impl std::marker::Unpin for DeviceConnectorEventStream {}
264
265impl futures::stream::FusedStream for DeviceConnectorEventStream {
266    fn is_terminated(&self) -> bool {
267        self.event_receiver.is_terminated()
268    }
269}
270
271impl futures::Stream for DeviceConnectorEventStream {
272    type Item = Result<DeviceConnectorEvent, fidl::Error>;
273
274    fn poll_next(
275        mut self: std::pin::Pin<&mut Self>,
276        cx: &mut std::task::Context<'_>,
277    ) -> std::task::Poll<Option<Self::Item>> {
278        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
279            &mut self.event_receiver,
280            cx
281        )?) {
282            Some(buf) => std::task::Poll::Ready(Some(DeviceConnectorEvent::decode(buf))),
283            None => std::task::Poll::Ready(None),
284        }
285    }
286}
287
288#[derive(Debug)]
289pub enum DeviceConnectorEvent {}
290
291impl DeviceConnectorEvent {
292    /// Decodes a message buffer as a [`DeviceConnectorEvent`].
293    fn decode(
294        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
295    ) -> Result<DeviceConnectorEvent, fidl::Error> {
296        let (bytes, _handles) = buf.split_mut();
297        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
298        debug_assert_eq!(tx_header.tx_id, 0);
299        match tx_header.ordinal {
300            _ => Err(fidl::Error::UnknownOrdinal {
301                ordinal: tx_header.ordinal,
302                protocol_name:
303                    <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
304            }),
305        }
306    }
307}
308
309/// A Stream of incoming requests for fuchsia.hardware.tee/DeviceConnector.
310pub struct DeviceConnectorRequestStream {
311    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
312    is_terminated: bool,
313}
314
315impl std::marker::Unpin for DeviceConnectorRequestStream {}
316
317impl futures::stream::FusedStream for DeviceConnectorRequestStream {
318    fn is_terminated(&self) -> bool {
319        self.is_terminated
320    }
321}
322
323impl fidl::endpoints::RequestStream for DeviceConnectorRequestStream {
324    type Protocol = DeviceConnectorMarker;
325    type ControlHandle = DeviceConnectorControlHandle;
326
327    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
328        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
329    }
330
331    fn control_handle(&self) -> Self::ControlHandle {
332        DeviceConnectorControlHandle { inner: self.inner.clone() }
333    }
334
335    fn into_inner(
336        self,
337    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
338    {
339        (self.inner, self.is_terminated)
340    }
341
342    fn from_inner(
343        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
344        is_terminated: bool,
345    ) -> Self {
346        Self { inner, is_terminated }
347    }
348}
349
350impl futures::Stream for DeviceConnectorRequestStream {
351    type Item = Result<DeviceConnectorRequest, fidl::Error>;
352
353    fn poll_next(
354        mut self: std::pin::Pin<&mut Self>,
355        cx: &mut std::task::Context<'_>,
356    ) -> std::task::Poll<Option<Self::Item>> {
357        let this = &mut *self;
358        if this.inner.check_shutdown(cx) {
359            this.is_terminated = true;
360            return std::task::Poll::Ready(None);
361        }
362        if this.is_terminated {
363            panic!("polled DeviceConnectorRequestStream after completion");
364        }
365        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
366            |bytes, handles| {
367                match this.inner.channel().read_etc(cx, bytes, handles) {
368                    std::task::Poll::Ready(Ok(())) => {}
369                    std::task::Poll::Pending => return std::task::Poll::Pending,
370                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
371                        this.is_terminated = true;
372                        return std::task::Poll::Ready(None);
373                    }
374                    std::task::Poll::Ready(Err(e)) => {
375                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
376                            e.into(),
377                        ))));
378                    }
379                }
380
381                // A message has been received from the channel
382                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
383
384                std::task::Poll::Ready(Some(match header.ordinal {
385                    0x5fa3623fd14f786 => {
386                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
387                        let mut req = fidl::new_empty!(
388                            DeviceConnectorConnectToDeviceInfoRequest,
389                            fidl::encoding::DefaultFuchsiaResourceDialect
390                        );
391                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnectorConnectToDeviceInfoRequest>(&header, _body_bytes, handles, &mut req)?;
392                        let control_handle =
393                            DeviceConnectorControlHandle { inner: this.inner.clone() };
394                        Ok(DeviceConnectorRequest::ConnectToDeviceInfo {
395                            device_info_request: req.device_info_request,
396
397                            control_handle,
398                        })
399                    }
400                    0x6e7f7e307df7816a => {
401                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
402                        let mut req = fidl::new_empty!(
403                            DeviceConnectorConnectToApplicationRequest,
404                            fidl::encoding::DefaultFuchsiaResourceDialect
405                        );
406                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnectorConnectToApplicationRequest>(&header, _body_bytes, handles, &mut req)?;
407                        let control_handle =
408                            DeviceConnectorControlHandle { inner: this.inner.clone() };
409                        Ok(DeviceConnectorRequest::ConnectToApplication {
410                            application_uuid: req.application_uuid,
411                            service_provider: req.service_provider,
412                            application_request: req.application_request,
413
414                            control_handle,
415                        })
416                    }
417                    _ => Err(fidl::Error::UnknownOrdinal {
418                        ordinal: header.ordinal,
419                        protocol_name:
420                            <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
421                    }),
422                }))
423            },
424        )
425    }
426}
427
428/// Protocol used by the TEE Manager to proxy requests for TEE access to the driver.
429#[derive(Debug)]
430pub enum DeviceConnectorRequest {
431    /// Requests a `DeviceInfo` connection to the TEE driver to enumerate device info.
432    ///
433    /// The sole caller of this should be the TEE Manager.
434    ConnectToDeviceInfo {
435        device_info_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
436        control_handle: DeviceConnectorControlHandle,
437    },
438    /// Requests an `Application` connection from the TEE driver while the caller provides a client
439    /// channel end to a `Provider` server that supports the driver on any RPCs.
440    ///
441    /// The sole caller of this should be the TEE Manager.
442    ConnectToApplication {
443        application_uuid: fidl_fuchsia_tee::Uuid,
444        service_provider:
445            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>>,
446        application_request: fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
447        control_handle: DeviceConnectorControlHandle,
448    },
449}
450
451impl DeviceConnectorRequest {
452    #[allow(irrefutable_let_patterns)]
453    pub fn into_connect_to_device_info(
454        self,
455    ) -> Option<(
456        fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
457        DeviceConnectorControlHandle,
458    )> {
459        if let DeviceConnectorRequest::ConnectToDeviceInfo { device_info_request, control_handle } =
460            self
461        {
462            Some((device_info_request, control_handle))
463        } else {
464            None
465        }
466    }
467
468    #[allow(irrefutable_let_patterns)]
469    pub fn into_connect_to_application(
470        self,
471    ) -> Option<(
472        fidl_fuchsia_tee::Uuid,
473        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>>,
474        fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
475        DeviceConnectorControlHandle,
476    )> {
477        if let DeviceConnectorRequest::ConnectToApplication {
478            application_uuid,
479            service_provider,
480            application_request,
481            control_handle,
482        } = self
483        {
484            Some((application_uuid, service_provider, application_request, control_handle))
485        } else {
486            None
487        }
488    }
489
490    /// Name of the method defined in FIDL
491    pub fn method_name(&self) -> &'static str {
492        match *self {
493            DeviceConnectorRequest::ConnectToDeviceInfo { .. } => "connect_to_device_info",
494            DeviceConnectorRequest::ConnectToApplication { .. } => "connect_to_application",
495        }
496    }
497}
498
499#[derive(Debug, Clone)]
500pub struct DeviceConnectorControlHandle {
501    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
502}
503
504impl DeviceConnectorControlHandle {
505    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
506        self.inner.shutdown_with_epitaph(status.into())
507    }
508}
509
510impl fidl::endpoints::ControlHandle for DeviceConnectorControlHandle {
511    fn shutdown(&self) {
512        self.inner.shutdown()
513    }
514
515    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
516        self.inner.shutdown_with_epitaph(status)
517    }
518
519    fn is_closed(&self) -> bool {
520        self.inner.channel().is_closed()
521    }
522    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
523        self.inner.channel().on_closed()
524    }
525
526    #[cfg(target_os = "fuchsia")]
527    fn signal_peer(
528        &self,
529        clear_mask: zx::Signals,
530        set_mask: zx::Signals,
531    ) -> Result<(), zx_status::Status> {
532        use fidl::Peered;
533        self.inner.channel().signal_peer(clear_mask, set_mask)
534    }
535}
536
537impl DeviceConnectorControlHandle {}
538
539#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
540pub struct ServiceMarker;
541
542#[cfg(target_os = "fuchsia")]
543impl fidl::endpoints::ServiceMarker for ServiceMarker {
544    type Proxy = ServiceProxy;
545    type Request = ServiceRequest;
546    const SERVICE_NAME: &'static str = "fuchsia.hardware.tee.Service";
547}
548
549/// A request for one of the member protocols of Service.
550///
551#[cfg(target_os = "fuchsia")]
552pub enum ServiceRequest {
553    DeviceConnector(DeviceConnectorRequestStream),
554}
555
556#[cfg(target_os = "fuchsia")]
557impl fidl::endpoints::ServiceRequest for ServiceRequest {
558    type Service = ServiceMarker;
559
560    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
561        match name {
562            "device_connector" => Self::DeviceConnector(
563                <DeviceConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
564                    _channel,
565                ),
566            ),
567            _ => panic!("no such member protocol name for service Service"),
568        }
569    }
570
571    fn member_names() -> &'static [&'static str] {
572        &["device_connector"]
573    }
574}
575#[cfg(target_os = "fuchsia")]
576pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
577
578#[cfg(target_os = "fuchsia")]
579impl fidl::endpoints::ServiceProxy for ServiceProxy {
580    type Service = ServiceMarker;
581
582    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
583        Self(opener)
584    }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl ServiceProxy {
589    pub fn connect_to_device_connector(&self) -> Result<DeviceConnectorProxy, fidl::Error> {
590        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceConnectorMarker>();
591        self.connect_channel_to_device_connector(server_end)?;
592        Ok(proxy)
593    }
594
595    /// Like `connect_to_device_connector`, but returns a sync proxy.
596    /// See [`Self::connect_to_device_connector`] for more details.
597    pub fn connect_to_device_connector_sync(
598        &self,
599    ) -> Result<DeviceConnectorSynchronousProxy, fidl::Error> {
600        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceConnectorMarker>();
601        self.connect_channel_to_device_connector(server_end)?;
602        Ok(proxy)
603    }
604
605    /// Like `connect_to_device_connector`, but accepts a server end.
606    /// See [`Self::connect_to_device_connector`] for more details.
607    pub fn connect_channel_to_device_connector(
608        &self,
609        server_end: fidl::endpoints::ServerEnd<DeviceConnectorMarker>,
610    ) -> Result<(), fidl::Error> {
611        self.0.open_member("device_connector", server_end.into_channel())
612    }
613
614    pub fn instance_name(&self) -> &str {
615        self.0.instance_name()
616    }
617}
618
619mod internal {
620    use super::*;
621
622    impl fidl::encoding::ResourceTypeMarker for DeviceConnectorConnectToApplicationRequest {
623        type Borrowed<'a> = &'a mut Self;
624        fn take_or_borrow<'a>(
625            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
626        ) -> Self::Borrowed<'a> {
627            value
628        }
629    }
630
631    unsafe impl fidl::encoding::TypeMarker for DeviceConnectorConnectToApplicationRequest {
632        type Owned = Self;
633
634        #[inline(always)]
635        fn inline_align(_context: fidl::encoding::Context) -> usize {
636            4
637        }
638
639        #[inline(always)]
640        fn inline_size(_context: fidl::encoding::Context) -> usize {
641            24
642        }
643    }
644
645    unsafe impl
646        fidl::encoding::Encode<
647            DeviceConnectorConnectToApplicationRequest,
648            fidl::encoding::DefaultFuchsiaResourceDialect,
649        > for &mut DeviceConnectorConnectToApplicationRequest
650    {
651        #[inline]
652        unsafe fn encode(
653            self,
654            encoder: &mut fidl::encoding::Encoder<
655                '_,
656                fidl::encoding::DefaultFuchsiaResourceDialect,
657            >,
658            offset: usize,
659            _depth: fidl::encoding::Depth,
660        ) -> fidl::Result<()> {
661            encoder.debug_check_bounds::<DeviceConnectorConnectToApplicationRequest>(offset);
662            // Delegate to tuple encoding.
663            fidl::encoding::Encode::<
664                DeviceConnectorConnectToApplicationRequest,
665                fidl::encoding::DefaultFuchsiaResourceDialect,
666            >::encode(
667                (
668                    <fidl_fuchsia_tee::Uuid as fidl::encoding::ValueTypeMarker>::borrow(
669                        &self.application_uuid,
670                    ),
671                    <fidl::encoding::Optional<
672                        fidl::encoding::Endpoint<
673                            fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
674                        >,
675                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
676                        &mut self.service_provider,
677                    ),
678                    <fidl::encoding::Endpoint<
679                        fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
680                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
681                        &mut self.application_request,
682                    ),
683                ),
684                encoder,
685                offset,
686                _depth,
687            )
688        }
689    }
690    unsafe impl<
691        T0: fidl::encoding::Encode<
692                fidl_fuchsia_tee::Uuid,
693                fidl::encoding::DefaultFuchsiaResourceDialect,
694            >,
695        T1: fidl::encoding::Encode<
696                fidl::encoding::Optional<
697                    fidl::encoding::Endpoint<
698                        fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
699                    >,
700                >,
701                fidl::encoding::DefaultFuchsiaResourceDialect,
702            >,
703        T2: fidl::encoding::Encode<
704                fidl::encoding::Endpoint<
705                    fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
706                >,
707                fidl::encoding::DefaultFuchsiaResourceDialect,
708            >,
709    >
710        fidl::encoding::Encode<
711            DeviceConnectorConnectToApplicationRequest,
712            fidl::encoding::DefaultFuchsiaResourceDialect,
713        > for (T0, T1, T2)
714    {
715        #[inline]
716        unsafe fn encode(
717            self,
718            encoder: &mut fidl::encoding::Encoder<
719                '_,
720                fidl::encoding::DefaultFuchsiaResourceDialect,
721            >,
722            offset: usize,
723            depth: fidl::encoding::Depth,
724        ) -> fidl::Result<()> {
725            encoder.debug_check_bounds::<DeviceConnectorConnectToApplicationRequest>(offset);
726            // Zero out padding regions. There's no need to apply masks
727            // because the unmasked parts will be overwritten by fields.
728            // Write the fields.
729            self.0.encode(encoder, offset + 0, depth)?;
730            self.1.encode(encoder, offset + 16, depth)?;
731            self.2.encode(encoder, offset + 20, depth)?;
732            Ok(())
733        }
734    }
735
736    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
737        for DeviceConnectorConnectToApplicationRequest
738    {
739        #[inline(always)]
740        fn new_empty() -> Self {
741            Self {
742                application_uuid: fidl::new_empty!(
743                    fidl_fuchsia_tee::Uuid,
744                    fidl::encoding::DefaultFuchsiaResourceDialect
745                ),
746                service_provider: fidl::new_empty!(
747                    fidl::encoding::Optional<
748                        fidl::encoding::Endpoint<
749                            fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
750                        >,
751                    >,
752                    fidl::encoding::DefaultFuchsiaResourceDialect
753                ),
754                application_request: fidl::new_empty!(
755                    fidl::encoding::Endpoint<
756                        fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
757                    >,
758                    fidl::encoding::DefaultFuchsiaResourceDialect
759                ),
760            }
761        }
762
763        #[inline]
764        unsafe fn decode(
765            &mut self,
766            decoder: &mut fidl::encoding::Decoder<
767                '_,
768                fidl::encoding::DefaultFuchsiaResourceDialect,
769            >,
770            offset: usize,
771            _depth: fidl::encoding::Depth,
772        ) -> fidl::Result<()> {
773            decoder.debug_check_bounds::<Self>(offset);
774            // Verify that padding bytes are zero.
775            fidl::decode!(
776                fidl_fuchsia_tee::Uuid,
777                fidl::encoding::DefaultFuchsiaResourceDialect,
778                &mut self.application_uuid,
779                decoder,
780                offset + 0,
781                _depth
782            )?;
783            fidl::decode!(
784                fidl::encoding::Optional<
785                    fidl::encoding::Endpoint<
786                        fidl::endpoints::ClientEnd<fidl_fuchsia_tee_manager::ProviderMarker>,
787                    >,
788                >,
789                fidl::encoding::DefaultFuchsiaResourceDialect,
790                &mut self.service_provider,
791                decoder,
792                offset + 16,
793                _depth
794            )?;
795            fidl::decode!(
796                fidl::encoding::Endpoint<
797                    fidl::endpoints::ServerEnd<fidl_fuchsia_tee::ApplicationMarker>,
798                >,
799                fidl::encoding::DefaultFuchsiaResourceDialect,
800                &mut self.application_request,
801                decoder,
802                offset + 20,
803                _depth
804            )?;
805            Ok(())
806        }
807    }
808
809    impl fidl::encoding::ResourceTypeMarker for DeviceConnectorConnectToDeviceInfoRequest {
810        type Borrowed<'a> = &'a mut Self;
811        fn take_or_borrow<'a>(
812            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
813        ) -> Self::Borrowed<'a> {
814            value
815        }
816    }
817
818    unsafe impl fidl::encoding::TypeMarker for DeviceConnectorConnectToDeviceInfoRequest {
819        type Owned = Self;
820
821        #[inline(always)]
822        fn inline_align(_context: fidl::encoding::Context) -> usize {
823            4
824        }
825
826        #[inline(always)]
827        fn inline_size(_context: fidl::encoding::Context) -> usize {
828            4
829        }
830    }
831
832    unsafe impl
833        fidl::encoding::Encode<
834            DeviceConnectorConnectToDeviceInfoRequest,
835            fidl::encoding::DefaultFuchsiaResourceDialect,
836        > for &mut DeviceConnectorConnectToDeviceInfoRequest
837    {
838        #[inline]
839        unsafe fn encode(
840            self,
841            encoder: &mut fidl::encoding::Encoder<
842                '_,
843                fidl::encoding::DefaultFuchsiaResourceDialect,
844            >,
845            offset: usize,
846            _depth: fidl::encoding::Depth,
847        ) -> fidl::Result<()> {
848            encoder.debug_check_bounds::<DeviceConnectorConnectToDeviceInfoRequest>(offset);
849            // Delegate to tuple encoding.
850            fidl::encoding::Encode::<
851                DeviceConnectorConnectToDeviceInfoRequest,
852                fidl::encoding::DefaultFuchsiaResourceDialect,
853            >::encode(
854                (<fidl::encoding::Endpoint<
855                    fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
856                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
857                    &mut self.device_info_request,
858                ),),
859                encoder,
860                offset,
861                _depth,
862            )
863        }
864    }
865    unsafe impl<
866        T0: fidl::encoding::Encode<
867                fidl::encoding::Endpoint<
868                    fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
869                >,
870                fidl::encoding::DefaultFuchsiaResourceDialect,
871            >,
872    >
873        fidl::encoding::Encode<
874            DeviceConnectorConnectToDeviceInfoRequest,
875            fidl::encoding::DefaultFuchsiaResourceDialect,
876        > for (T0,)
877    {
878        #[inline]
879        unsafe fn encode(
880            self,
881            encoder: &mut fidl::encoding::Encoder<
882                '_,
883                fidl::encoding::DefaultFuchsiaResourceDialect,
884            >,
885            offset: usize,
886            depth: fidl::encoding::Depth,
887        ) -> fidl::Result<()> {
888            encoder.debug_check_bounds::<DeviceConnectorConnectToDeviceInfoRequest>(offset);
889            // Zero out padding regions. There's no need to apply masks
890            // because the unmasked parts will be overwritten by fields.
891            // Write the fields.
892            self.0.encode(encoder, offset + 0, depth)?;
893            Ok(())
894        }
895    }
896
897    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
898        for DeviceConnectorConnectToDeviceInfoRequest
899    {
900        #[inline(always)]
901        fn new_empty() -> Self {
902            Self {
903                device_info_request: fidl::new_empty!(
904                    fidl::encoding::Endpoint<
905                        fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
906                    >,
907                    fidl::encoding::DefaultFuchsiaResourceDialect
908                ),
909            }
910        }
911
912        #[inline]
913        unsafe fn decode(
914            &mut self,
915            decoder: &mut fidl::encoding::Decoder<
916                '_,
917                fidl::encoding::DefaultFuchsiaResourceDialect,
918            >,
919            offset: usize,
920            _depth: fidl::encoding::Depth,
921        ) -> fidl::Result<()> {
922            decoder.debug_check_bounds::<Self>(offset);
923            // Verify that padding bytes are zero.
924            fidl::decode!(
925                fidl::encoding::Endpoint<
926                    fidl::endpoints::ServerEnd<fidl_fuchsia_tee::DeviceInfoMarker>,
927                >,
928                fidl::encoding::DefaultFuchsiaResourceDialect,
929                &mut self.device_info_request,
930                decoder,
931                offset + 0,
932                _depth
933            )?;
934            Ok(())
935        }
936    }
937}