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