Skip to main content

fidl_fuchsia_hardware_qualcomm_fastrpc/
fidl_fuchsia_hardware_qualcomm_fastrpc.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_qualcomm_fastrpc_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct RemoteDomainInvokeRequest {
16    /// The remote processor thread that should handle this invocation.
17    pub remote_thread_id: i32,
18    /// The target handle of the invocation.
19    pub handle: u32,
20    /// The method id of the invocation.
21    pub method_id: u32,
22    /// A shared buffer that all |Argument| type entries live in.
23    /// This can be 0 if there is no payload that needs it, which is the case if all
24    /// the arguments are type |VmoArgument| or if there are no input or output arguments.
25    /// This id comes from the |RequestPayloadBufferSet| result.
26    pub payload_buffer_id: u32,
27    /// The list of input arguments for this invocation.
28    pub input_arguments: Vec<ArgumentEntry>,
29    /// The list of output arguments for this invocation.
30    pub output_arguments: Vec<ArgumentEntry>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RemoteDomainInvokeRequest {}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct RemoteDomainGetPayloadBufferSetResponse {
37    pub buffers: Vec<SharedPayloadBuffer>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for RemoteDomainGetPayloadBufferSetResponse
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct SecureFastRpcAttachRootDomainRequest {
47    pub server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51    for SecureFastRpcAttachRootDomainRequest
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct SecureFastRpcCreateStaticDomainRequest {
57    pub name: String,
58    pub memory_size: u32,
59    pub server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63    for SecureFastRpcCreateStaticDomainRequest
64{
65}
66
67#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
68pub struct SecureFastRpcAllocateResponse {
69    pub vmo: fidl::Vmo,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
73    for SecureFastRpcAllocateResponse
74{
75}
76
77/// These buffers are allocated in the driver, and provided to the client for use by their id when
78/// communicating with the driver through the |payload_buffer_id|.
79/// The ids will be non-zero, as 0 will imply no buffer.
80#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81pub struct SharedPayloadBuffer {
82    pub id: u32,
83    pub vmo: fidl::Vmo,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SharedPayloadBuffer {}
87
88/// A FastRPC argument that lives in a standalone vmo.
89#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct VmoArgument {
91    /// The vmo that this argument lives in.
92    pub vmo: fidl::Vmo,
93    /// The start offset of the argument within the vmo.
94    pub offset: u64,
95    /// Length of the argument.
96    pub length: u64,
97}
98
99impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VmoArgument {}
100
101/// A single FastRPC argument.
102#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
103pub enum ArgumentEntry {
104    Argument(Argument),
105    VmoArgument(VmoArgument),
106}
107
108impl ArgumentEntry {
109    #[inline]
110    pub fn ordinal(&self) -> u64 {
111        match *self {
112            Self::Argument(_) => 1,
113            Self::VmoArgument(_) => 2,
114        }
115    }
116}
117
118impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ArgumentEntry {}
119
120#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
121pub struct RemoteDomainMarker;
122
123impl fidl::endpoints::ProtocolMarker for RemoteDomainMarker {
124    type Proxy = RemoteDomainProxy;
125    type RequestStream = RemoteDomainRequestStream;
126    #[cfg(target_os = "fuchsia")]
127    type SynchronousProxy = RemoteDomainSynchronousProxy;
128
129    const DEBUG_NAME: &'static str = "(anonymous) RemoteDomain";
130}
131pub type RemoteDomainGetPayloadBufferSetResult = Result<Vec<SharedPayloadBuffer>, i32>;
132pub type RemoteDomainInvokeResult = Result<(), i32>;
133
134pub trait RemoteDomainProxyInterface: Send + Sync {
135    fn r#close(&self) -> Result<(), fidl::Error>;
136    type GetPayloadBufferSetResponseFut: std::future::Future<Output = Result<RemoteDomainGetPayloadBufferSetResult, fidl::Error>>
137        + Send;
138    fn r#get_payload_buffer_set(&self, count: u8) -> Self::GetPayloadBufferSetResponseFut;
139    type InvokeResponseFut: std::future::Future<Output = Result<RemoteDomainInvokeResult, fidl::Error>>
140        + Send;
141    fn r#invoke(
142        &self,
143        remote_thread_id: i32,
144        handle: u32,
145        method_id: u32,
146        payload_buffer_id: u32,
147        input_arguments: Vec<ArgumentEntry>,
148        output_arguments: Vec<ArgumentEntry>,
149    ) -> Self::InvokeResponseFut;
150}
151#[derive(Debug)]
152#[cfg(target_os = "fuchsia")]
153pub struct RemoteDomainSynchronousProxy {
154    client: fidl::client::sync::Client,
155}
156
157#[cfg(target_os = "fuchsia")]
158impl fidl::endpoints::SynchronousProxy for RemoteDomainSynchronousProxy {
159    type Proxy = RemoteDomainProxy;
160    type Protocol = RemoteDomainMarker;
161
162    fn from_channel(inner: fidl::Channel) -> Self {
163        Self::new(inner)
164    }
165
166    fn into_channel(self) -> fidl::Channel {
167        self.client.into_channel()
168    }
169
170    fn as_channel(&self) -> &fidl::Channel {
171        self.client.as_channel()
172    }
173}
174
175#[cfg(target_os = "fuchsia")]
176impl RemoteDomainSynchronousProxy {
177    pub fn new(channel: fidl::Channel) -> Self {
178        Self { client: fidl::client::sync::Client::new(channel) }
179    }
180
181    pub fn into_channel(self) -> fidl::Channel {
182        self.client.into_channel()
183    }
184
185    /// Waits until an event arrives and returns it. It is safe for other
186    /// threads to make concurrent requests while waiting for an event.
187    pub fn wait_for_event(
188        &self,
189        deadline: zx::MonotonicInstant,
190    ) -> Result<RemoteDomainEvent, fidl::Error> {
191        RemoteDomainEvent::decode(self.client.wait_for_event::<RemoteDomainMarker>(deadline)?)
192    }
193
194    /// Closes down the domain. This will release all resources associated with this domain.
195    /// The server end will close the channel when this is completed.
196    pub fn r#close(&self) -> Result<(), fidl::Error> {
197        self.client.send::<fidl::encoding::EmptyPayload>(
198            (),
199            0x473dffa51d061668,
200            fidl::encoding::DynamicFlags::FLEXIBLE,
201        )
202    }
203
204    /// Requests |count| payload buffers from the driver. The returned vector of buffers should be
205    /// managed by the client entirely. When making an |Invoke| request, the client can provide
206    /// the |id| of the buffer of their chosing inside the |payload_buffer_id|. The client should
207    /// ensure only 1 invoke is active for each of these buffers.
208    pub fn r#get_payload_buffer_set(
209        &self,
210        mut count: u8,
211        ___deadline: zx::MonotonicInstant,
212    ) -> Result<RemoteDomainGetPayloadBufferSetResult, fidl::Error> {
213        let _response = self.client.send_query::<
214            RemoteDomainGetPayloadBufferSetRequest,
215            fidl::encoding::FlexibleResultType<RemoteDomainGetPayloadBufferSetResponse, i32>,
216            RemoteDomainMarker,
217        >(
218            (count,),
219            0x3f056fd2e96d72e5,
220            fidl::encoding::DynamicFlags::FLEXIBLE,
221            ___deadline,
222        )?
223        .into_result::<RemoteDomainMarker>("get_payload_buffer_set")?;
224        Ok(_response.map(|x| x.buffers))
225    }
226
227    /// A user invocation on the remote domain.
228    pub fn r#invoke(
229        &self,
230        mut remote_thread_id: i32,
231        mut handle: u32,
232        mut method_id: u32,
233        mut payload_buffer_id: u32,
234        mut input_arguments: Vec<ArgumentEntry>,
235        mut output_arguments: Vec<ArgumentEntry>,
236        ___deadline: zx::MonotonicInstant,
237    ) -> Result<RemoteDomainInvokeResult, fidl::Error> {
238        let _response = self.client.send_query::<
239            RemoteDomainInvokeRequest,
240            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
241            RemoteDomainMarker,
242        >(
243            (remote_thread_id, handle, method_id, payload_buffer_id, input_arguments.as_mut(), output_arguments.as_mut(),),
244            0x771f1fe030d80529,
245            fidl::encoding::DynamicFlags::FLEXIBLE,
246            ___deadline,
247        )?
248        .into_result::<RemoteDomainMarker>("invoke")?;
249        Ok(_response.map(|x| x))
250    }
251}
252
253#[cfg(target_os = "fuchsia")]
254impl From<RemoteDomainSynchronousProxy> for zx::NullableHandle {
255    fn from(value: RemoteDomainSynchronousProxy) -> Self {
256        value.into_channel().into()
257    }
258}
259
260#[cfg(target_os = "fuchsia")]
261impl From<fidl::Channel> for RemoteDomainSynchronousProxy {
262    fn from(value: fidl::Channel) -> Self {
263        Self::new(value)
264    }
265}
266
267#[cfg(target_os = "fuchsia")]
268impl fidl::endpoints::FromClient for RemoteDomainSynchronousProxy {
269    type Protocol = RemoteDomainMarker;
270
271    fn from_client(value: fidl::endpoints::ClientEnd<RemoteDomainMarker>) -> Self {
272        Self::new(value.into_channel())
273    }
274}
275
276#[derive(Debug, Clone)]
277pub struct RemoteDomainProxy {
278    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
279}
280
281impl fidl::endpoints::Proxy for RemoteDomainProxy {
282    type Protocol = RemoteDomainMarker;
283
284    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
285        Self::new(inner)
286    }
287
288    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
289        self.client.into_channel().map_err(|client| Self { client })
290    }
291
292    fn as_channel(&self) -> &::fidl::AsyncChannel {
293        self.client.as_channel()
294    }
295}
296
297impl RemoteDomainProxy {
298    /// Create a new Proxy for fuchsia.hardware.qualcomm.fastrpc/RemoteDomain.
299    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
300        let protocol_name = <RemoteDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
301        Self { client: fidl::client::Client::new(channel, protocol_name) }
302    }
303
304    /// Get a Stream of events from the remote end of the protocol.
305    ///
306    /// # Panics
307    ///
308    /// Panics if the event stream was already taken.
309    pub fn take_event_stream(&self) -> RemoteDomainEventStream {
310        RemoteDomainEventStream { event_receiver: self.client.take_event_receiver() }
311    }
312
313    /// Closes down the domain. This will release all resources associated with this domain.
314    /// The server end will close the channel when this is completed.
315    pub fn r#close(&self) -> Result<(), fidl::Error> {
316        RemoteDomainProxyInterface::r#close(self)
317    }
318
319    /// Requests |count| payload buffers from the driver. The returned vector of buffers should be
320    /// managed by the client entirely. When making an |Invoke| request, the client can provide
321    /// the |id| of the buffer of their chosing inside the |payload_buffer_id|. The client should
322    /// ensure only 1 invoke is active for each of these buffers.
323    pub fn r#get_payload_buffer_set(
324        &self,
325        mut count: u8,
326    ) -> fidl::client::QueryResponseFut<
327        RemoteDomainGetPayloadBufferSetResult,
328        fidl::encoding::DefaultFuchsiaResourceDialect,
329    > {
330        RemoteDomainProxyInterface::r#get_payload_buffer_set(self, count)
331    }
332
333    /// A user invocation on the remote domain.
334    pub fn r#invoke(
335        &self,
336        mut remote_thread_id: i32,
337        mut handle: u32,
338        mut method_id: u32,
339        mut payload_buffer_id: u32,
340        mut input_arguments: Vec<ArgumentEntry>,
341        mut output_arguments: Vec<ArgumentEntry>,
342    ) -> fidl::client::QueryResponseFut<
343        RemoteDomainInvokeResult,
344        fidl::encoding::DefaultFuchsiaResourceDialect,
345    > {
346        RemoteDomainProxyInterface::r#invoke(
347            self,
348            remote_thread_id,
349            handle,
350            method_id,
351            payload_buffer_id,
352            input_arguments,
353            output_arguments,
354        )
355    }
356}
357
358impl RemoteDomainProxyInterface for RemoteDomainProxy {
359    fn r#close(&self) -> Result<(), fidl::Error> {
360        self.client.send::<fidl::encoding::EmptyPayload>(
361            (),
362            0x473dffa51d061668,
363            fidl::encoding::DynamicFlags::FLEXIBLE,
364        )
365    }
366
367    type GetPayloadBufferSetResponseFut = fidl::client::QueryResponseFut<
368        RemoteDomainGetPayloadBufferSetResult,
369        fidl::encoding::DefaultFuchsiaResourceDialect,
370    >;
371    fn r#get_payload_buffer_set(&self, mut count: u8) -> Self::GetPayloadBufferSetResponseFut {
372        fn _decode(
373            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
374        ) -> Result<RemoteDomainGetPayloadBufferSetResult, fidl::Error> {
375            let _response = fidl::client::decode_transaction_body::<
376                fidl::encoding::FlexibleResultType<RemoteDomainGetPayloadBufferSetResponse, i32>,
377                fidl::encoding::DefaultFuchsiaResourceDialect,
378                0x3f056fd2e96d72e5,
379            >(_buf?)?
380            .into_result::<RemoteDomainMarker>("get_payload_buffer_set")?;
381            Ok(_response.map(|x| x.buffers))
382        }
383        self.client.send_query_and_decode::<
384            RemoteDomainGetPayloadBufferSetRequest,
385            RemoteDomainGetPayloadBufferSetResult,
386        >(
387            (count,),
388            0x3f056fd2e96d72e5,
389            fidl::encoding::DynamicFlags::FLEXIBLE,
390            _decode,
391        )
392    }
393
394    type InvokeResponseFut = fidl::client::QueryResponseFut<
395        RemoteDomainInvokeResult,
396        fidl::encoding::DefaultFuchsiaResourceDialect,
397    >;
398    fn r#invoke(
399        &self,
400        mut remote_thread_id: i32,
401        mut handle: u32,
402        mut method_id: u32,
403        mut payload_buffer_id: u32,
404        mut input_arguments: Vec<ArgumentEntry>,
405        mut output_arguments: Vec<ArgumentEntry>,
406    ) -> Self::InvokeResponseFut {
407        fn _decode(
408            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
409        ) -> Result<RemoteDomainInvokeResult, fidl::Error> {
410            let _response = fidl::client::decode_transaction_body::<
411                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
412                fidl::encoding::DefaultFuchsiaResourceDialect,
413                0x771f1fe030d80529,
414            >(_buf?)?
415            .into_result::<RemoteDomainMarker>("invoke")?;
416            Ok(_response.map(|x| x))
417        }
418        self.client.send_query_and_decode::<RemoteDomainInvokeRequest, RemoteDomainInvokeResult>(
419            (
420                remote_thread_id,
421                handle,
422                method_id,
423                payload_buffer_id,
424                input_arguments.as_mut(),
425                output_arguments.as_mut(),
426            ),
427            0x771f1fe030d80529,
428            fidl::encoding::DynamicFlags::FLEXIBLE,
429            _decode,
430        )
431    }
432}
433
434pub struct RemoteDomainEventStream {
435    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
436}
437
438impl std::marker::Unpin for RemoteDomainEventStream {}
439
440impl futures::stream::FusedStream for RemoteDomainEventStream {
441    fn is_terminated(&self) -> bool {
442        self.event_receiver.is_terminated()
443    }
444}
445
446impl futures::Stream for RemoteDomainEventStream {
447    type Item = Result<RemoteDomainEvent, fidl::Error>;
448
449    fn poll_next(
450        mut self: std::pin::Pin<&mut Self>,
451        cx: &mut std::task::Context<'_>,
452    ) -> std::task::Poll<Option<Self::Item>> {
453        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
454            &mut self.event_receiver,
455            cx
456        )?) {
457            Some(buf) => std::task::Poll::Ready(Some(RemoteDomainEvent::decode(buf))),
458            None => std::task::Poll::Ready(None),
459        }
460    }
461}
462
463#[derive(Debug)]
464pub enum RemoteDomainEvent {
465    #[non_exhaustive]
466    _UnknownEvent {
467        /// Ordinal of the event that was sent.
468        ordinal: u64,
469    },
470}
471
472impl RemoteDomainEvent {
473    /// Decodes a message buffer as a [`RemoteDomainEvent`].
474    fn decode(
475        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
476    ) -> Result<RemoteDomainEvent, fidl::Error> {
477        let (bytes, _handles) = buf.split_mut();
478        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
479        debug_assert_eq!(tx_header.tx_id, 0);
480        match tx_header.ordinal {
481            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
482                Ok(RemoteDomainEvent::_UnknownEvent { ordinal: tx_header.ordinal })
483            }
484            _ => Err(fidl::Error::UnknownOrdinal {
485                ordinal: tx_header.ordinal,
486                protocol_name: <RemoteDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
487            }),
488        }
489    }
490}
491
492/// A Stream of incoming requests for fuchsia.hardware.qualcomm.fastrpc/RemoteDomain.
493pub struct RemoteDomainRequestStream {
494    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
495    is_terminated: bool,
496}
497
498impl std::marker::Unpin for RemoteDomainRequestStream {}
499
500impl futures::stream::FusedStream for RemoteDomainRequestStream {
501    fn is_terminated(&self) -> bool {
502        self.is_terminated
503    }
504}
505
506impl fidl::endpoints::RequestStream for RemoteDomainRequestStream {
507    type Protocol = RemoteDomainMarker;
508    type ControlHandle = RemoteDomainControlHandle;
509
510    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
511        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
512    }
513
514    fn control_handle(&self) -> Self::ControlHandle {
515        RemoteDomainControlHandle { inner: self.inner.clone() }
516    }
517
518    fn into_inner(
519        self,
520    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
521    {
522        (self.inner, self.is_terminated)
523    }
524
525    fn from_inner(
526        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
527        is_terminated: bool,
528    ) -> Self {
529        Self { inner, is_terminated }
530    }
531}
532
533impl futures::Stream for RemoteDomainRequestStream {
534    type Item = Result<RemoteDomainRequest, fidl::Error>;
535
536    fn poll_next(
537        mut self: std::pin::Pin<&mut Self>,
538        cx: &mut std::task::Context<'_>,
539    ) -> std::task::Poll<Option<Self::Item>> {
540        let this = &mut *self;
541        if this.inner.check_shutdown(cx) {
542            this.is_terminated = true;
543            return std::task::Poll::Ready(None);
544        }
545        if this.is_terminated {
546            panic!("polled RemoteDomainRequestStream after completion");
547        }
548        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
549            |bytes, handles| {
550                match this.inner.channel().read_etc(cx, bytes, handles) {
551                    std::task::Poll::Ready(Ok(())) => {}
552                    std::task::Poll::Pending => return std::task::Poll::Pending,
553                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
554                        this.is_terminated = true;
555                        return std::task::Poll::Ready(None);
556                    }
557                    std::task::Poll::Ready(Err(e)) => {
558                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
559                            e.into(),
560                        ))));
561                    }
562                }
563
564                // A message has been received from the channel
565                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
566
567                std::task::Poll::Ready(Some(match header.ordinal {
568                    0x473dffa51d061668 => {
569                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
570                        let mut req = fidl::new_empty!(
571                            fidl::encoding::EmptyPayload,
572                            fidl::encoding::DefaultFuchsiaResourceDialect
573                        );
574                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
575                        let control_handle =
576                            RemoteDomainControlHandle { inner: this.inner.clone() };
577                        Ok(RemoteDomainRequest::Close { control_handle })
578                    }
579                    0x3f056fd2e96d72e5 => {
580                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
581                        let mut req = fidl::new_empty!(
582                            RemoteDomainGetPayloadBufferSetRequest,
583                            fidl::encoding::DefaultFuchsiaResourceDialect
584                        );
585                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteDomainGetPayloadBufferSetRequest>(&header, _body_bytes, handles, &mut req)?;
586                        let control_handle =
587                            RemoteDomainControlHandle { inner: this.inner.clone() };
588                        Ok(RemoteDomainRequest::GetPayloadBufferSet {
589                            count: req.count,
590
591                            responder: RemoteDomainGetPayloadBufferSetResponder {
592                                control_handle: std::mem::ManuallyDrop::new(control_handle),
593                                tx_id: header.tx_id,
594                            },
595                        })
596                    }
597                    0x771f1fe030d80529 => {
598                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
599                        let mut req = fidl::new_empty!(
600                            RemoteDomainInvokeRequest,
601                            fidl::encoding::DefaultFuchsiaResourceDialect
602                        );
603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteDomainInvokeRequest>(&header, _body_bytes, handles, &mut req)?;
604                        let control_handle =
605                            RemoteDomainControlHandle { inner: this.inner.clone() };
606                        Ok(RemoteDomainRequest::Invoke {
607                            remote_thread_id: req.remote_thread_id,
608                            handle: req.handle,
609                            method_id: req.method_id,
610                            payload_buffer_id: req.payload_buffer_id,
611                            input_arguments: req.input_arguments,
612                            output_arguments: req.output_arguments,
613
614                            responder: RemoteDomainInvokeResponder {
615                                control_handle: std::mem::ManuallyDrop::new(control_handle),
616                                tx_id: header.tx_id,
617                            },
618                        })
619                    }
620                    _ if header.tx_id == 0
621                        && header
622                            .dynamic_flags()
623                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
624                    {
625                        Ok(RemoteDomainRequest::_UnknownMethod {
626                            ordinal: header.ordinal,
627                            control_handle: RemoteDomainControlHandle { inner: this.inner.clone() },
628                            method_type: fidl::MethodType::OneWay,
629                        })
630                    }
631                    _ if header
632                        .dynamic_flags()
633                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
634                    {
635                        this.inner.send_framework_err(
636                            fidl::encoding::FrameworkErr::UnknownMethod,
637                            header.tx_id,
638                            header.ordinal,
639                            header.dynamic_flags(),
640                            (bytes, handles),
641                        )?;
642                        Ok(RemoteDomainRequest::_UnknownMethod {
643                            ordinal: header.ordinal,
644                            control_handle: RemoteDomainControlHandle { inner: this.inner.clone() },
645                            method_type: fidl::MethodType::TwoWay,
646                        })
647                    }
648                    _ => Err(fidl::Error::UnknownOrdinal {
649                        ordinal: header.ordinal,
650                        protocol_name:
651                            <RemoteDomainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
652                    }),
653                }))
654            },
655        )
656    }
657}
658
659#[derive(Debug)]
660pub enum RemoteDomainRequest {
661    /// Closes down the domain. This will release all resources associated with this domain.
662    /// The server end will close the channel when this is completed.
663    Close { control_handle: RemoteDomainControlHandle },
664    /// Requests |count| payload buffers from the driver. The returned vector of buffers should be
665    /// managed by the client entirely. When making an |Invoke| request, the client can provide
666    /// the |id| of the buffer of their chosing inside the |payload_buffer_id|. The client should
667    /// ensure only 1 invoke is active for each of these buffers.
668    GetPayloadBufferSet { count: u8, responder: RemoteDomainGetPayloadBufferSetResponder },
669    /// A user invocation on the remote domain.
670    Invoke {
671        remote_thread_id: i32,
672        handle: u32,
673        method_id: u32,
674        payload_buffer_id: u32,
675        input_arguments: Vec<ArgumentEntry>,
676        output_arguments: Vec<ArgumentEntry>,
677        responder: RemoteDomainInvokeResponder,
678    },
679    /// An interaction was received which does not match any known method.
680    #[non_exhaustive]
681    _UnknownMethod {
682        /// Ordinal of the method that was called.
683        ordinal: u64,
684        control_handle: RemoteDomainControlHandle,
685        method_type: fidl::MethodType,
686    },
687}
688
689impl RemoteDomainRequest {
690    #[allow(irrefutable_let_patterns)]
691    pub fn into_close(self) -> Option<(RemoteDomainControlHandle)> {
692        if let RemoteDomainRequest::Close { control_handle } = self {
693            Some((control_handle))
694        } else {
695            None
696        }
697    }
698
699    #[allow(irrefutable_let_patterns)]
700    pub fn into_get_payload_buffer_set(
701        self,
702    ) -> Option<(u8, RemoteDomainGetPayloadBufferSetResponder)> {
703        if let RemoteDomainRequest::GetPayloadBufferSet { count, responder } = self {
704            Some((count, responder))
705        } else {
706            None
707        }
708    }
709
710    #[allow(irrefutable_let_patterns)]
711    pub fn into_invoke(
712        self,
713    ) -> Option<(
714        i32,
715        u32,
716        u32,
717        u32,
718        Vec<ArgumentEntry>,
719        Vec<ArgumentEntry>,
720        RemoteDomainInvokeResponder,
721    )> {
722        if let RemoteDomainRequest::Invoke {
723            remote_thread_id,
724            handle,
725            method_id,
726            payload_buffer_id,
727            input_arguments,
728            output_arguments,
729            responder,
730        } = self
731        {
732            Some((
733                remote_thread_id,
734                handle,
735                method_id,
736                payload_buffer_id,
737                input_arguments,
738                output_arguments,
739                responder,
740            ))
741        } else {
742            None
743        }
744    }
745
746    /// Name of the method defined in FIDL
747    pub fn method_name(&self) -> &'static str {
748        match *self {
749            RemoteDomainRequest::Close { .. } => "close",
750            RemoteDomainRequest::GetPayloadBufferSet { .. } => "get_payload_buffer_set",
751            RemoteDomainRequest::Invoke { .. } => "invoke",
752            RemoteDomainRequest::_UnknownMethod {
753                method_type: fidl::MethodType::OneWay, ..
754            } => "unknown one-way method",
755            RemoteDomainRequest::_UnknownMethod {
756                method_type: fidl::MethodType::TwoWay, ..
757            } => "unknown two-way method",
758        }
759    }
760}
761
762#[derive(Debug, Clone)]
763pub struct RemoteDomainControlHandle {
764    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
765}
766
767impl RemoteDomainControlHandle {
768    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
769        self.inner.shutdown_with_epitaph(status.into())
770    }
771}
772
773impl fidl::endpoints::ControlHandle for RemoteDomainControlHandle {
774    fn shutdown(&self) {
775        self.inner.shutdown()
776    }
777
778    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
779        self.inner.shutdown_with_epitaph(status)
780    }
781
782    fn is_closed(&self) -> bool {
783        self.inner.channel().is_closed()
784    }
785    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
786        self.inner.channel().on_closed()
787    }
788
789    #[cfg(target_os = "fuchsia")]
790    fn signal_peer(
791        &self,
792        clear_mask: zx::Signals,
793        set_mask: zx::Signals,
794    ) -> Result<(), zx_status::Status> {
795        use fidl::Peered;
796        self.inner.channel().signal_peer(clear_mask, set_mask)
797    }
798}
799
800impl RemoteDomainControlHandle {}
801
802#[must_use = "FIDL methods require a response to be sent"]
803#[derive(Debug)]
804pub struct RemoteDomainGetPayloadBufferSetResponder {
805    control_handle: std::mem::ManuallyDrop<RemoteDomainControlHandle>,
806    tx_id: u32,
807}
808
809/// Set the the channel to be shutdown (see [`RemoteDomainControlHandle::shutdown`])
810/// if the responder is dropped without sending a response, so that the client
811/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
812impl std::ops::Drop for RemoteDomainGetPayloadBufferSetResponder {
813    fn drop(&mut self) {
814        self.control_handle.shutdown();
815        // Safety: drops once, never accessed again
816        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
817    }
818}
819
820impl fidl::endpoints::Responder for RemoteDomainGetPayloadBufferSetResponder {
821    type ControlHandle = RemoteDomainControlHandle;
822
823    fn control_handle(&self) -> &RemoteDomainControlHandle {
824        &self.control_handle
825    }
826
827    fn drop_without_shutdown(mut self) {
828        // Safety: drops once, never accessed again due to mem::forget
829        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
830        // Prevent Drop from running (which would shut down the channel)
831        std::mem::forget(self);
832    }
833}
834
835impl RemoteDomainGetPayloadBufferSetResponder {
836    /// Sends a response to the FIDL transaction.
837    ///
838    /// Sets the channel to shutdown if an error occurs.
839    pub fn send(
840        self,
841        mut result: Result<Vec<SharedPayloadBuffer>, i32>,
842    ) -> Result<(), fidl::Error> {
843        let _result = self.send_raw(result);
844        if _result.is_err() {
845            self.control_handle.shutdown();
846        }
847        self.drop_without_shutdown();
848        _result
849    }
850
851    /// Similar to "send" but does not shutdown the channel if an error occurs.
852    pub fn send_no_shutdown_on_err(
853        self,
854        mut result: Result<Vec<SharedPayloadBuffer>, i32>,
855    ) -> Result<(), fidl::Error> {
856        let _result = self.send_raw(result);
857        self.drop_without_shutdown();
858        _result
859    }
860
861    fn send_raw(
862        &self,
863        mut result: Result<Vec<SharedPayloadBuffer>, i32>,
864    ) -> Result<(), fidl::Error> {
865        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
866            RemoteDomainGetPayloadBufferSetResponse,
867            i32,
868        >>(
869            fidl::encoding::FlexibleResult::new(
870                result.as_mut().map_err(|e| *e).map(|buffers| (buffers.as_mut_slice(),)),
871            ),
872            self.tx_id,
873            0x3f056fd2e96d72e5,
874            fidl::encoding::DynamicFlags::FLEXIBLE,
875        )
876    }
877}
878
879#[must_use = "FIDL methods require a response to be sent"]
880#[derive(Debug)]
881pub struct RemoteDomainInvokeResponder {
882    control_handle: std::mem::ManuallyDrop<RemoteDomainControlHandle>,
883    tx_id: u32,
884}
885
886/// Set the the channel to be shutdown (see [`RemoteDomainControlHandle::shutdown`])
887/// if the responder is dropped without sending a response, so that the client
888/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
889impl std::ops::Drop for RemoteDomainInvokeResponder {
890    fn drop(&mut self) {
891        self.control_handle.shutdown();
892        // Safety: drops once, never accessed again
893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
894    }
895}
896
897impl fidl::endpoints::Responder for RemoteDomainInvokeResponder {
898    type ControlHandle = RemoteDomainControlHandle;
899
900    fn control_handle(&self) -> &RemoteDomainControlHandle {
901        &self.control_handle
902    }
903
904    fn drop_without_shutdown(mut self) {
905        // Safety: drops once, never accessed again due to mem::forget
906        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
907        // Prevent Drop from running (which would shut down the channel)
908        std::mem::forget(self);
909    }
910}
911
912impl RemoteDomainInvokeResponder {
913    /// Sends a response to the FIDL transaction.
914    ///
915    /// Sets the channel to shutdown if an error occurs.
916    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
917        let _result = self.send_raw(result);
918        if _result.is_err() {
919            self.control_handle.shutdown();
920        }
921        self.drop_without_shutdown();
922        _result
923    }
924
925    /// Similar to "send" but does not shutdown the channel if an error occurs.
926    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
927        let _result = self.send_raw(result);
928        self.drop_without_shutdown();
929        _result
930    }
931
932    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
933        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
934            fidl::encoding::EmptyStruct,
935            i32,
936        >>(
937            fidl::encoding::FlexibleResult::new(result),
938            self.tx_id,
939            0x771f1fe030d80529,
940            fidl::encoding::DynamicFlags::FLEXIBLE,
941        )
942    }
943}
944
945#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
946pub struct SecureFastRpcMarker;
947
948impl fidl::endpoints::ProtocolMarker for SecureFastRpcMarker {
949    type Proxy = SecureFastRpcProxy;
950    type RequestStream = SecureFastRpcRequestStream;
951    #[cfg(target_os = "fuchsia")]
952    type SynchronousProxy = SecureFastRpcSynchronousProxy;
953
954    const DEBUG_NAME: &'static str = "fuchsia.hardware.qualcomm.fastrpc.SecureFastRpc";
955}
956impl fidl::endpoints::DiscoverableProtocolMarker for SecureFastRpcMarker {}
957pub type SecureFastRpcGetChannelIdResult = Result<u32, i32>;
958pub type SecureFastRpcAllocateResult = Result<fidl::Vmo, i32>;
959pub type SecureFastRpcGetCapabilitiesResult = Result<Vec<u32>, i32>;
960pub type SecureFastRpcAttachRootDomainResult = Result<(), i32>;
961pub type SecureFastRpcCreateStaticDomainResult = Result<(), i32>;
962
963pub trait SecureFastRpcProxyInterface: Send + Sync {
964    type GetChannelIdResponseFut: std::future::Future<Output = Result<SecureFastRpcGetChannelIdResult, fidl::Error>>
965        + Send;
966    fn r#get_channel_id(&self) -> Self::GetChannelIdResponseFut;
967    type AllocateResponseFut: std::future::Future<Output = Result<SecureFastRpcAllocateResult, fidl::Error>>
968        + Send;
969    fn r#allocate(&self, size: u64) -> Self::AllocateResponseFut;
970    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<SecureFastRpcGetCapabilitiesResult, fidl::Error>>
971        + Send;
972    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
973    type AttachRootDomainResponseFut: std::future::Future<Output = Result<SecureFastRpcAttachRootDomainResult, fidl::Error>>
974        + Send;
975    fn r#attach_root_domain(
976        &self,
977        server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
978    ) -> Self::AttachRootDomainResponseFut;
979    type CreateStaticDomainResponseFut: std::future::Future<Output = Result<SecureFastRpcCreateStaticDomainResult, fidl::Error>>
980        + Send;
981    fn r#create_static_domain(
982        &self,
983        name: &str,
984        memory_size: u32,
985        server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
986    ) -> Self::CreateStaticDomainResponseFut;
987}
988#[derive(Debug)]
989#[cfg(target_os = "fuchsia")]
990pub struct SecureFastRpcSynchronousProxy {
991    client: fidl::client::sync::Client,
992}
993
994#[cfg(target_os = "fuchsia")]
995impl fidl::endpoints::SynchronousProxy for SecureFastRpcSynchronousProxy {
996    type Proxy = SecureFastRpcProxy;
997    type Protocol = SecureFastRpcMarker;
998
999    fn from_channel(inner: fidl::Channel) -> Self {
1000        Self::new(inner)
1001    }
1002
1003    fn into_channel(self) -> fidl::Channel {
1004        self.client.into_channel()
1005    }
1006
1007    fn as_channel(&self) -> &fidl::Channel {
1008        self.client.as_channel()
1009    }
1010}
1011
1012#[cfg(target_os = "fuchsia")]
1013impl SecureFastRpcSynchronousProxy {
1014    pub fn new(channel: fidl::Channel) -> Self {
1015        Self { client: fidl::client::sync::Client::new(channel) }
1016    }
1017
1018    pub fn into_channel(self) -> fidl::Channel {
1019        self.client.into_channel()
1020    }
1021
1022    /// Waits until an event arrives and returns it. It is safe for other
1023    /// threads to make concurrent requests while waiting for an event.
1024    pub fn wait_for_event(
1025        &self,
1026        deadline: zx::MonotonicInstant,
1027    ) -> Result<SecureFastRpcEvent, fidl::Error> {
1028        SecureFastRpcEvent::decode(self.client.wait_for_event::<SecureFastRpcMarker>(deadline)?)
1029    }
1030
1031    /// Used to identify the channel id that this device instance talks to.
1032    /// The channel id is associated with the remote processor target.
1033    pub fn r#get_channel_id(
1034        &self,
1035        ___deadline: zx::MonotonicInstant,
1036    ) -> Result<SecureFastRpcGetChannelIdResult, fidl::Error> {
1037        let _response = self.client.send_query::<
1038            fidl::encoding::EmptyPayload,
1039            fidl::encoding::FlexibleResultType<SecureFastRpcGetChannelIdResponse, i32>,
1040            SecureFastRpcMarker,
1041        >(
1042            (),
1043            0x77919bc7c190139a,
1044            fidl::encoding::DynamicFlags::FLEXIBLE,
1045            ___deadline,
1046        )?
1047        .into_result::<SecureFastRpcMarker>("get_channel_id")?;
1048        Ok(_response.map(|x| x.channel_id))
1049    }
1050
1051    /// Allocate a contiguous region of memory of at least |size|. This memory is meant to be used
1052    /// in |VmoArgument| typed arguments in an |InvokeParameters|. This vmo is owned exclusively
1053    /// by the caller.
1054    pub fn r#allocate(
1055        &self,
1056        mut size: u64,
1057        ___deadline: zx::MonotonicInstant,
1058    ) -> Result<SecureFastRpcAllocateResult, fidl::Error> {
1059        let _response = self.client.send_query::<
1060            SecureFastRpcAllocateRequest,
1061            fidl::encoding::FlexibleResultType<SecureFastRpcAllocateResponse, i32>,
1062            SecureFastRpcMarker,
1063        >(
1064            (size,),
1065            0x5443b2d8b251e878,
1066            fidl::encoding::DynamicFlags::FLEXIBLE,
1067            ___deadline,
1068        )?
1069        .into_result::<SecureFastRpcMarker>("allocate")?;
1070        Ok(_response.map(|x| x.vmo))
1071    }
1072
1073    /// Get the vector of capabilities from the remote processor.
1074    pub fn r#get_capabilities(
1075        &self,
1076        ___deadline: zx::MonotonicInstant,
1077    ) -> Result<SecureFastRpcGetCapabilitiesResult, fidl::Error> {
1078        let _response = self.client.send_query::<
1079            fidl::encoding::EmptyPayload,
1080            fidl::encoding::FlexibleResultType<SecureFastRpcGetCapabilitiesResponse, i32>,
1081            SecureFastRpcMarker,
1082        >(
1083            (),
1084            0x69bfeede998f5368,
1085            fidl::encoding::DynamicFlags::FLEXIBLE,
1086            ___deadline,
1087        )?
1088        .into_result::<SecureFastRpcMarker>("get_capabilities")?;
1089        Ok(_response.map(|x| x.capabilities))
1090    }
1091
1092    /// Attaches to the root (Guest OS) protection domain in the remote processor.
1093    /// This domain can access to the memory of its own protection domain,
1094    /// the memory of the user protection domains, and some system registers.
1095    pub fn r#attach_root_domain(
1096        &self,
1097        mut server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1098        ___deadline: zx::MonotonicInstant,
1099    ) -> Result<SecureFastRpcAttachRootDomainResult, fidl::Error> {
1100        let _response = self.client.send_query::<
1101            SecureFastRpcAttachRootDomainRequest,
1102            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1103            SecureFastRpcMarker,
1104        >(
1105            (server,),
1106            0x6bde390dfc4c57ed,
1107            fidl::encoding::DynamicFlags::FLEXIBLE,
1108            ___deadline,
1109        )?
1110        .into_result::<SecureFastRpcMarker>("attach_root_domain")?;
1111        Ok(_response.map(|x| x))
1112    }
1113
1114    /// Creates the static (user) protection domain identified by |name| on the remote processor.
1115    /// This is provided with a memory of size |memory_size|. This protection domain can access
1116    /// only its own memory. Static domains are created for specific use cases like audio.
1117    pub fn r#create_static_domain(
1118        &self,
1119        mut name: &str,
1120        mut memory_size: u32,
1121        mut server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1122        ___deadline: zx::MonotonicInstant,
1123    ) -> Result<SecureFastRpcCreateStaticDomainResult, fidl::Error> {
1124        let _response = self.client.send_query::<
1125            SecureFastRpcCreateStaticDomainRequest,
1126            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1127            SecureFastRpcMarker,
1128        >(
1129            (name, memory_size, server,),
1130            0x740a08a1456bc858,
1131            fidl::encoding::DynamicFlags::FLEXIBLE,
1132            ___deadline,
1133        )?
1134        .into_result::<SecureFastRpcMarker>("create_static_domain")?;
1135        Ok(_response.map(|x| x))
1136    }
1137}
1138
1139#[cfg(target_os = "fuchsia")]
1140impl From<SecureFastRpcSynchronousProxy> for zx::NullableHandle {
1141    fn from(value: SecureFastRpcSynchronousProxy) -> Self {
1142        value.into_channel().into()
1143    }
1144}
1145
1146#[cfg(target_os = "fuchsia")]
1147impl From<fidl::Channel> for SecureFastRpcSynchronousProxy {
1148    fn from(value: fidl::Channel) -> Self {
1149        Self::new(value)
1150    }
1151}
1152
1153#[cfg(target_os = "fuchsia")]
1154impl fidl::endpoints::FromClient for SecureFastRpcSynchronousProxy {
1155    type Protocol = SecureFastRpcMarker;
1156
1157    fn from_client(value: fidl::endpoints::ClientEnd<SecureFastRpcMarker>) -> Self {
1158        Self::new(value.into_channel())
1159    }
1160}
1161
1162#[derive(Debug, Clone)]
1163pub struct SecureFastRpcProxy {
1164    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1165}
1166
1167impl fidl::endpoints::Proxy for SecureFastRpcProxy {
1168    type Protocol = SecureFastRpcMarker;
1169
1170    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1171        Self::new(inner)
1172    }
1173
1174    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1175        self.client.into_channel().map_err(|client| Self { client })
1176    }
1177
1178    fn as_channel(&self) -> &::fidl::AsyncChannel {
1179        self.client.as_channel()
1180    }
1181}
1182
1183impl SecureFastRpcProxy {
1184    /// Create a new Proxy for fuchsia.hardware.qualcomm.fastrpc/SecureFastRpc.
1185    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1186        let protocol_name = <SecureFastRpcMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1187        Self { client: fidl::client::Client::new(channel, protocol_name) }
1188    }
1189
1190    /// Get a Stream of events from the remote end of the protocol.
1191    ///
1192    /// # Panics
1193    ///
1194    /// Panics if the event stream was already taken.
1195    pub fn take_event_stream(&self) -> SecureFastRpcEventStream {
1196        SecureFastRpcEventStream { event_receiver: self.client.take_event_receiver() }
1197    }
1198
1199    /// Used to identify the channel id that this device instance talks to.
1200    /// The channel id is associated with the remote processor target.
1201    pub fn r#get_channel_id(
1202        &self,
1203    ) -> fidl::client::QueryResponseFut<
1204        SecureFastRpcGetChannelIdResult,
1205        fidl::encoding::DefaultFuchsiaResourceDialect,
1206    > {
1207        SecureFastRpcProxyInterface::r#get_channel_id(self)
1208    }
1209
1210    /// Allocate a contiguous region of memory of at least |size|. This memory is meant to be used
1211    /// in |VmoArgument| typed arguments in an |InvokeParameters|. This vmo is owned exclusively
1212    /// by the caller.
1213    pub fn r#allocate(
1214        &self,
1215        mut size: u64,
1216    ) -> fidl::client::QueryResponseFut<
1217        SecureFastRpcAllocateResult,
1218        fidl::encoding::DefaultFuchsiaResourceDialect,
1219    > {
1220        SecureFastRpcProxyInterface::r#allocate(self, size)
1221    }
1222
1223    /// Get the vector of capabilities from the remote processor.
1224    pub fn r#get_capabilities(
1225        &self,
1226    ) -> fidl::client::QueryResponseFut<
1227        SecureFastRpcGetCapabilitiesResult,
1228        fidl::encoding::DefaultFuchsiaResourceDialect,
1229    > {
1230        SecureFastRpcProxyInterface::r#get_capabilities(self)
1231    }
1232
1233    /// Attaches to the root (Guest OS) protection domain in the remote processor.
1234    /// This domain can access to the memory of its own protection domain,
1235    /// the memory of the user protection domains, and some system registers.
1236    pub fn r#attach_root_domain(
1237        &self,
1238        mut server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1239    ) -> fidl::client::QueryResponseFut<
1240        SecureFastRpcAttachRootDomainResult,
1241        fidl::encoding::DefaultFuchsiaResourceDialect,
1242    > {
1243        SecureFastRpcProxyInterface::r#attach_root_domain(self, server)
1244    }
1245
1246    /// Creates the static (user) protection domain identified by |name| on the remote processor.
1247    /// This is provided with a memory of size |memory_size|. This protection domain can access
1248    /// only its own memory. Static domains are created for specific use cases like audio.
1249    pub fn r#create_static_domain(
1250        &self,
1251        mut name: &str,
1252        mut memory_size: u32,
1253        mut server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1254    ) -> fidl::client::QueryResponseFut<
1255        SecureFastRpcCreateStaticDomainResult,
1256        fidl::encoding::DefaultFuchsiaResourceDialect,
1257    > {
1258        SecureFastRpcProxyInterface::r#create_static_domain(self, name, memory_size, server)
1259    }
1260}
1261
1262impl SecureFastRpcProxyInterface for SecureFastRpcProxy {
1263    type GetChannelIdResponseFut = fidl::client::QueryResponseFut<
1264        SecureFastRpcGetChannelIdResult,
1265        fidl::encoding::DefaultFuchsiaResourceDialect,
1266    >;
1267    fn r#get_channel_id(&self) -> Self::GetChannelIdResponseFut {
1268        fn _decode(
1269            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1270        ) -> Result<SecureFastRpcGetChannelIdResult, fidl::Error> {
1271            let _response = fidl::client::decode_transaction_body::<
1272                fidl::encoding::FlexibleResultType<SecureFastRpcGetChannelIdResponse, i32>,
1273                fidl::encoding::DefaultFuchsiaResourceDialect,
1274                0x77919bc7c190139a,
1275            >(_buf?)?
1276            .into_result::<SecureFastRpcMarker>("get_channel_id")?;
1277            Ok(_response.map(|x| x.channel_id))
1278        }
1279        self.client
1280            .send_query_and_decode::<fidl::encoding::EmptyPayload, SecureFastRpcGetChannelIdResult>(
1281                (),
1282                0x77919bc7c190139a,
1283                fidl::encoding::DynamicFlags::FLEXIBLE,
1284                _decode,
1285            )
1286    }
1287
1288    type AllocateResponseFut = fidl::client::QueryResponseFut<
1289        SecureFastRpcAllocateResult,
1290        fidl::encoding::DefaultFuchsiaResourceDialect,
1291    >;
1292    fn r#allocate(&self, mut size: u64) -> Self::AllocateResponseFut {
1293        fn _decode(
1294            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1295        ) -> Result<SecureFastRpcAllocateResult, fidl::Error> {
1296            let _response = fidl::client::decode_transaction_body::<
1297                fidl::encoding::FlexibleResultType<SecureFastRpcAllocateResponse, i32>,
1298                fidl::encoding::DefaultFuchsiaResourceDialect,
1299                0x5443b2d8b251e878,
1300            >(_buf?)?
1301            .into_result::<SecureFastRpcMarker>("allocate")?;
1302            Ok(_response.map(|x| x.vmo))
1303        }
1304        self.client
1305            .send_query_and_decode::<SecureFastRpcAllocateRequest, SecureFastRpcAllocateResult>(
1306                (size,),
1307                0x5443b2d8b251e878,
1308                fidl::encoding::DynamicFlags::FLEXIBLE,
1309                _decode,
1310            )
1311    }
1312
1313    type GetCapabilitiesResponseFut = fidl::client::QueryResponseFut<
1314        SecureFastRpcGetCapabilitiesResult,
1315        fidl::encoding::DefaultFuchsiaResourceDialect,
1316    >;
1317    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
1318        fn _decode(
1319            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1320        ) -> Result<SecureFastRpcGetCapabilitiesResult, fidl::Error> {
1321            let _response = fidl::client::decode_transaction_body::<
1322                fidl::encoding::FlexibleResultType<SecureFastRpcGetCapabilitiesResponse, i32>,
1323                fidl::encoding::DefaultFuchsiaResourceDialect,
1324                0x69bfeede998f5368,
1325            >(_buf?)?
1326            .into_result::<SecureFastRpcMarker>("get_capabilities")?;
1327            Ok(_response.map(|x| x.capabilities))
1328        }
1329        self.client.send_query_and_decode::<
1330            fidl::encoding::EmptyPayload,
1331            SecureFastRpcGetCapabilitiesResult,
1332        >(
1333            (),
1334            0x69bfeede998f5368,
1335            fidl::encoding::DynamicFlags::FLEXIBLE,
1336            _decode,
1337        )
1338    }
1339
1340    type AttachRootDomainResponseFut = fidl::client::QueryResponseFut<
1341        SecureFastRpcAttachRootDomainResult,
1342        fidl::encoding::DefaultFuchsiaResourceDialect,
1343    >;
1344    fn r#attach_root_domain(
1345        &self,
1346        mut server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1347    ) -> Self::AttachRootDomainResponseFut {
1348        fn _decode(
1349            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1350        ) -> Result<SecureFastRpcAttachRootDomainResult, fidl::Error> {
1351            let _response = fidl::client::decode_transaction_body::<
1352                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1353                fidl::encoding::DefaultFuchsiaResourceDialect,
1354                0x6bde390dfc4c57ed,
1355            >(_buf?)?
1356            .into_result::<SecureFastRpcMarker>("attach_root_domain")?;
1357            Ok(_response.map(|x| x))
1358        }
1359        self.client.send_query_and_decode::<
1360            SecureFastRpcAttachRootDomainRequest,
1361            SecureFastRpcAttachRootDomainResult,
1362        >(
1363            (server,),
1364            0x6bde390dfc4c57ed,
1365            fidl::encoding::DynamicFlags::FLEXIBLE,
1366            _decode,
1367        )
1368    }
1369
1370    type CreateStaticDomainResponseFut = fidl::client::QueryResponseFut<
1371        SecureFastRpcCreateStaticDomainResult,
1372        fidl::encoding::DefaultFuchsiaResourceDialect,
1373    >;
1374    fn r#create_static_domain(
1375        &self,
1376        mut name: &str,
1377        mut memory_size: u32,
1378        mut server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1379    ) -> Self::CreateStaticDomainResponseFut {
1380        fn _decode(
1381            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1382        ) -> Result<SecureFastRpcCreateStaticDomainResult, fidl::Error> {
1383            let _response = fidl::client::decode_transaction_body::<
1384                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1385                fidl::encoding::DefaultFuchsiaResourceDialect,
1386                0x740a08a1456bc858,
1387            >(_buf?)?
1388            .into_result::<SecureFastRpcMarker>("create_static_domain")?;
1389            Ok(_response.map(|x| x))
1390        }
1391        self.client.send_query_and_decode::<
1392            SecureFastRpcCreateStaticDomainRequest,
1393            SecureFastRpcCreateStaticDomainResult,
1394        >(
1395            (name, memory_size, server,),
1396            0x740a08a1456bc858,
1397            fidl::encoding::DynamicFlags::FLEXIBLE,
1398            _decode,
1399        )
1400    }
1401}
1402
1403pub struct SecureFastRpcEventStream {
1404    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1405}
1406
1407impl std::marker::Unpin for SecureFastRpcEventStream {}
1408
1409impl futures::stream::FusedStream for SecureFastRpcEventStream {
1410    fn is_terminated(&self) -> bool {
1411        self.event_receiver.is_terminated()
1412    }
1413}
1414
1415impl futures::Stream for SecureFastRpcEventStream {
1416    type Item = Result<SecureFastRpcEvent, fidl::Error>;
1417
1418    fn poll_next(
1419        mut self: std::pin::Pin<&mut Self>,
1420        cx: &mut std::task::Context<'_>,
1421    ) -> std::task::Poll<Option<Self::Item>> {
1422        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1423            &mut self.event_receiver,
1424            cx
1425        )?) {
1426            Some(buf) => std::task::Poll::Ready(Some(SecureFastRpcEvent::decode(buf))),
1427            None => std::task::Poll::Ready(None),
1428        }
1429    }
1430}
1431
1432#[derive(Debug)]
1433pub enum SecureFastRpcEvent {
1434    #[non_exhaustive]
1435    _UnknownEvent {
1436        /// Ordinal of the event that was sent.
1437        ordinal: u64,
1438    },
1439}
1440
1441impl SecureFastRpcEvent {
1442    /// Decodes a message buffer as a [`SecureFastRpcEvent`].
1443    fn decode(
1444        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1445    ) -> Result<SecureFastRpcEvent, fidl::Error> {
1446        let (bytes, _handles) = buf.split_mut();
1447        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1448        debug_assert_eq!(tx_header.tx_id, 0);
1449        match tx_header.ordinal {
1450            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1451                Ok(SecureFastRpcEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1452            }
1453            _ => Err(fidl::Error::UnknownOrdinal {
1454                ordinal: tx_header.ordinal,
1455                protocol_name: <SecureFastRpcMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1456            }),
1457        }
1458    }
1459}
1460
1461/// A Stream of incoming requests for fuchsia.hardware.qualcomm.fastrpc/SecureFastRpc.
1462pub struct SecureFastRpcRequestStream {
1463    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1464    is_terminated: bool,
1465}
1466
1467impl std::marker::Unpin for SecureFastRpcRequestStream {}
1468
1469impl futures::stream::FusedStream for SecureFastRpcRequestStream {
1470    fn is_terminated(&self) -> bool {
1471        self.is_terminated
1472    }
1473}
1474
1475impl fidl::endpoints::RequestStream for SecureFastRpcRequestStream {
1476    type Protocol = SecureFastRpcMarker;
1477    type ControlHandle = SecureFastRpcControlHandle;
1478
1479    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1480        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1481    }
1482
1483    fn control_handle(&self) -> Self::ControlHandle {
1484        SecureFastRpcControlHandle { inner: self.inner.clone() }
1485    }
1486
1487    fn into_inner(
1488        self,
1489    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1490    {
1491        (self.inner, self.is_terminated)
1492    }
1493
1494    fn from_inner(
1495        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1496        is_terminated: bool,
1497    ) -> Self {
1498        Self { inner, is_terminated }
1499    }
1500}
1501
1502impl futures::Stream for SecureFastRpcRequestStream {
1503    type Item = Result<SecureFastRpcRequest, fidl::Error>;
1504
1505    fn poll_next(
1506        mut self: std::pin::Pin<&mut Self>,
1507        cx: &mut std::task::Context<'_>,
1508    ) -> std::task::Poll<Option<Self::Item>> {
1509        let this = &mut *self;
1510        if this.inner.check_shutdown(cx) {
1511            this.is_terminated = true;
1512            return std::task::Poll::Ready(None);
1513        }
1514        if this.is_terminated {
1515            panic!("polled SecureFastRpcRequestStream after completion");
1516        }
1517        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1518            |bytes, handles| {
1519                match this.inner.channel().read_etc(cx, bytes, handles) {
1520                    std::task::Poll::Ready(Ok(())) => {}
1521                    std::task::Poll::Pending => return std::task::Poll::Pending,
1522                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1523                        this.is_terminated = true;
1524                        return std::task::Poll::Ready(None);
1525                    }
1526                    std::task::Poll::Ready(Err(e)) => {
1527                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1528                            e.into(),
1529                        ))));
1530                    }
1531                }
1532
1533                // A message has been received from the channel
1534                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1535
1536                std::task::Poll::Ready(Some(match header.ordinal {
1537                    0x77919bc7c190139a => {
1538                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1539                        let mut req = fidl::new_empty!(
1540                            fidl::encoding::EmptyPayload,
1541                            fidl::encoding::DefaultFuchsiaResourceDialect
1542                        );
1543                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1544                        let control_handle =
1545                            SecureFastRpcControlHandle { inner: this.inner.clone() };
1546                        Ok(SecureFastRpcRequest::GetChannelId {
1547                            responder: SecureFastRpcGetChannelIdResponder {
1548                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1549                                tx_id: header.tx_id,
1550                            },
1551                        })
1552                    }
1553                    0x5443b2d8b251e878 => {
1554                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1555                        let mut req = fidl::new_empty!(
1556                            SecureFastRpcAllocateRequest,
1557                            fidl::encoding::DefaultFuchsiaResourceDialect
1558                        );
1559                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SecureFastRpcAllocateRequest>(&header, _body_bytes, handles, &mut req)?;
1560                        let control_handle =
1561                            SecureFastRpcControlHandle { inner: this.inner.clone() };
1562                        Ok(SecureFastRpcRequest::Allocate {
1563                            size: req.size,
1564
1565                            responder: SecureFastRpcAllocateResponder {
1566                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1567                                tx_id: header.tx_id,
1568                            },
1569                        })
1570                    }
1571                    0x69bfeede998f5368 => {
1572                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1573                        let mut req = fidl::new_empty!(
1574                            fidl::encoding::EmptyPayload,
1575                            fidl::encoding::DefaultFuchsiaResourceDialect
1576                        );
1577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1578                        let control_handle =
1579                            SecureFastRpcControlHandle { inner: this.inner.clone() };
1580                        Ok(SecureFastRpcRequest::GetCapabilities {
1581                            responder: SecureFastRpcGetCapabilitiesResponder {
1582                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1583                                tx_id: header.tx_id,
1584                            },
1585                        })
1586                    }
1587                    0x6bde390dfc4c57ed => {
1588                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1589                        let mut req = fidl::new_empty!(
1590                            SecureFastRpcAttachRootDomainRequest,
1591                            fidl::encoding::DefaultFuchsiaResourceDialect
1592                        );
1593                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SecureFastRpcAttachRootDomainRequest>(&header, _body_bytes, handles, &mut req)?;
1594                        let control_handle =
1595                            SecureFastRpcControlHandle { inner: this.inner.clone() };
1596                        Ok(SecureFastRpcRequest::AttachRootDomain {
1597                            server: req.server,
1598
1599                            responder: SecureFastRpcAttachRootDomainResponder {
1600                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1601                                tx_id: header.tx_id,
1602                            },
1603                        })
1604                    }
1605                    0x740a08a1456bc858 => {
1606                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1607                        let mut req = fidl::new_empty!(
1608                            SecureFastRpcCreateStaticDomainRequest,
1609                            fidl::encoding::DefaultFuchsiaResourceDialect
1610                        );
1611                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SecureFastRpcCreateStaticDomainRequest>(&header, _body_bytes, handles, &mut req)?;
1612                        let control_handle =
1613                            SecureFastRpcControlHandle { inner: this.inner.clone() };
1614                        Ok(SecureFastRpcRequest::CreateStaticDomain {
1615                            name: req.name,
1616                            memory_size: req.memory_size,
1617                            server: req.server,
1618
1619                            responder: SecureFastRpcCreateStaticDomainResponder {
1620                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1621                                tx_id: header.tx_id,
1622                            },
1623                        })
1624                    }
1625                    _ if header.tx_id == 0
1626                        && header
1627                            .dynamic_flags()
1628                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1629                    {
1630                        Ok(SecureFastRpcRequest::_UnknownMethod {
1631                            ordinal: header.ordinal,
1632                            control_handle: SecureFastRpcControlHandle {
1633                                inner: this.inner.clone(),
1634                            },
1635                            method_type: fidl::MethodType::OneWay,
1636                        })
1637                    }
1638                    _ if header
1639                        .dynamic_flags()
1640                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1641                    {
1642                        this.inner.send_framework_err(
1643                            fidl::encoding::FrameworkErr::UnknownMethod,
1644                            header.tx_id,
1645                            header.ordinal,
1646                            header.dynamic_flags(),
1647                            (bytes, handles),
1648                        )?;
1649                        Ok(SecureFastRpcRequest::_UnknownMethod {
1650                            ordinal: header.ordinal,
1651                            control_handle: SecureFastRpcControlHandle {
1652                                inner: this.inner.clone(),
1653                            },
1654                            method_type: fidl::MethodType::TwoWay,
1655                        })
1656                    }
1657                    _ => Err(fidl::Error::UnknownOrdinal {
1658                        ordinal: header.ordinal,
1659                        protocol_name:
1660                            <SecureFastRpcMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1661                    }),
1662                }))
1663            },
1664        )
1665    }
1666}
1667
1668/// This is a secure fastrpc protocol and provides certain privileged operations like attaching
1669/// to the root protection domain in a remote processor. Currently starnix is the only direct user
1670/// of this protocol, therefore we don't need an unsecure variant. If in the future we want to
1671/// provide this to client applications directly, we will need to make sure there is also an
1672/// UnsecureFastRpc protocol.
1673#[derive(Debug)]
1674pub enum SecureFastRpcRequest {
1675    /// Used to identify the channel id that this device instance talks to.
1676    /// The channel id is associated with the remote processor target.
1677    GetChannelId { responder: SecureFastRpcGetChannelIdResponder },
1678    /// Allocate a contiguous region of memory of at least |size|. This memory is meant to be used
1679    /// in |VmoArgument| typed arguments in an |InvokeParameters|. This vmo is owned exclusively
1680    /// by the caller.
1681    Allocate { size: u64, responder: SecureFastRpcAllocateResponder },
1682    /// Get the vector of capabilities from the remote processor.
1683    GetCapabilities { responder: SecureFastRpcGetCapabilitiesResponder },
1684    /// Attaches to the root (Guest OS) protection domain in the remote processor.
1685    /// This domain can access to the memory of its own protection domain,
1686    /// the memory of the user protection domains, and some system registers.
1687    AttachRootDomain {
1688        server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1689        responder: SecureFastRpcAttachRootDomainResponder,
1690    },
1691    /// Creates the static (user) protection domain identified by |name| on the remote processor.
1692    /// This is provided with a memory of size |memory_size|. This protection domain can access
1693    /// only its own memory. Static domains are created for specific use cases like audio.
1694    CreateStaticDomain {
1695        name: String,
1696        memory_size: u32,
1697        server: fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1698        responder: SecureFastRpcCreateStaticDomainResponder,
1699    },
1700    /// An interaction was received which does not match any known method.
1701    #[non_exhaustive]
1702    _UnknownMethod {
1703        /// Ordinal of the method that was called.
1704        ordinal: u64,
1705        control_handle: SecureFastRpcControlHandle,
1706        method_type: fidl::MethodType,
1707    },
1708}
1709
1710impl SecureFastRpcRequest {
1711    #[allow(irrefutable_let_patterns)]
1712    pub fn into_get_channel_id(self) -> Option<(SecureFastRpcGetChannelIdResponder)> {
1713        if let SecureFastRpcRequest::GetChannelId { responder } = self {
1714            Some((responder))
1715        } else {
1716            None
1717        }
1718    }
1719
1720    #[allow(irrefutable_let_patterns)]
1721    pub fn into_allocate(self) -> Option<(u64, SecureFastRpcAllocateResponder)> {
1722        if let SecureFastRpcRequest::Allocate { size, responder } = self {
1723            Some((size, responder))
1724        } else {
1725            None
1726        }
1727    }
1728
1729    #[allow(irrefutable_let_patterns)]
1730    pub fn into_get_capabilities(self) -> Option<(SecureFastRpcGetCapabilitiesResponder)> {
1731        if let SecureFastRpcRequest::GetCapabilities { responder } = self {
1732            Some((responder))
1733        } else {
1734            None
1735        }
1736    }
1737
1738    #[allow(irrefutable_let_patterns)]
1739    pub fn into_attach_root_domain(
1740        self,
1741    ) -> Option<(
1742        fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1743        SecureFastRpcAttachRootDomainResponder,
1744    )> {
1745        if let SecureFastRpcRequest::AttachRootDomain { server, responder } = self {
1746            Some((server, responder))
1747        } else {
1748            None
1749        }
1750    }
1751
1752    #[allow(irrefutable_let_patterns)]
1753    pub fn into_create_static_domain(
1754        self,
1755    ) -> Option<(
1756        String,
1757        u32,
1758        fidl::endpoints::ServerEnd<RemoteDomainMarker>,
1759        SecureFastRpcCreateStaticDomainResponder,
1760    )> {
1761        if let SecureFastRpcRequest::CreateStaticDomain { name, memory_size, server, responder } =
1762            self
1763        {
1764            Some((name, memory_size, server, responder))
1765        } else {
1766            None
1767        }
1768    }
1769
1770    /// Name of the method defined in FIDL
1771    pub fn method_name(&self) -> &'static str {
1772        match *self {
1773            SecureFastRpcRequest::GetChannelId { .. } => "get_channel_id",
1774            SecureFastRpcRequest::Allocate { .. } => "allocate",
1775            SecureFastRpcRequest::GetCapabilities { .. } => "get_capabilities",
1776            SecureFastRpcRequest::AttachRootDomain { .. } => "attach_root_domain",
1777            SecureFastRpcRequest::CreateStaticDomain { .. } => "create_static_domain",
1778            SecureFastRpcRequest::_UnknownMethod {
1779                method_type: fidl::MethodType::OneWay, ..
1780            } => "unknown one-way method",
1781            SecureFastRpcRequest::_UnknownMethod {
1782                method_type: fidl::MethodType::TwoWay, ..
1783            } => "unknown two-way method",
1784        }
1785    }
1786}
1787
1788#[derive(Debug, Clone)]
1789pub struct SecureFastRpcControlHandle {
1790    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1791}
1792
1793impl SecureFastRpcControlHandle {
1794    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1795        self.inner.shutdown_with_epitaph(status.into())
1796    }
1797}
1798
1799impl fidl::endpoints::ControlHandle for SecureFastRpcControlHandle {
1800    fn shutdown(&self) {
1801        self.inner.shutdown()
1802    }
1803
1804    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1805        self.inner.shutdown_with_epitaph(status)
1806    }
1807
1808    fn is_closed(&self) -> bool {
1809        self.inner.channel().is_closed()
1810    }
1811    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1812        self.inner.channel().on_closed()
1813    }
1814
1815    #[cfg(target_os = "fuchsia")]
1816    fn signal_peer(
1817        &self,
1818        clear_mask: zx::Signals,
1819        set_mask: zx::Signals,
1820    ) -> Result<(), zx_status::Status> {
1821        use fidl::Peered;
1822        self.inner.channel().signal_peer(clear_mask, set_mask)
1823    }
1824}
1825
1826impl SecureFastRpcControlHandle {}
1827
1828#[must_use = "FIDL methods require a response to be sent"]
1829#[derive(Debug)]
1830pub struct SecureFastRpcGetChannelIdResponder {
1831    control_handle: std::mem::ManuallyDrop<SecureFastRpcControlHandle>,
1832    tx_id: u32,
1833}
1834
1835/// Set the the channel to be shutdown (see [`SecureFastRpcControlHandle::shutdown`])
1836/// if the responder is dropped without sending a response, so that the client
1837/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1838impl std::ops::Drop for SecureFastRpcGetChannelIdResponder {
1839    fn drop(&mut self) {
1840        self.control_handle.shutdown();
1841        // Safety: drops once, never accessed again
1842        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1843    }
1844}
1845
1846impl fidl::endpoints::Responder for SecureFastRpcGetChannelIdResponder {
1847    type ControlHandle = SecureFastRpcControlHandle;
1848
1849    fn control_handle(&self) -> &SecureFastRpcControlHandle {
1850        &self.control_handle
1851    }
1852
1853    fn drop_without_shutdown(mut self) {
1854        // Safety: drops once, never accessed again due to mem::forget
1855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1856        // Prevent Drop from running (which would shut down the channel)
1857        std::mem::forget(self);
1858    }
1859}
1860
1861impl SecureFastRpcGetChannelIdResponder {
1862    /// Sends a response to the FIDL transaction.
1863    ///
1864    /// Sets the channel to shutdown if an error occurs.
1865    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1866        let _result = self.send_raw(result);
1867        if _result.is_err() {
1868            self.control_handle.shutdown();
1869        }
1870        self.drop_without_shutdown();
1871        _result
1872    }
1873
1874    /// Similar to "send" but does not shutdown the channel if an error occurs.
1875    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1876        let _result = self.send_raw(result);
1877        self.drop_without_shutdown();
1878        _result
1879    }
1880
1881    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1882        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1883            SecureFastRpcGetChannelIdResponse,
1884            i32,
1885        >>(
1886            fidl::encoding::FlexibleResult::new(result.map(|channel_id| (channel_id,))),
1887            self.tx_id,
1888            0x77919bc7c190139a,
1889            fidl::encoding::DynamicFlags::FLEXIBLE,
1890        )
1891    }
1892}
1893
1894#[must_use = "FIDL methods require a response to be sent"]
1895#[derive(Debug)]
1896pub struct SecureFastRpcAllocateResponder {
1897    control_handle: std::mem::ManuallyDrop<SecureFastRpcControlHandle>,
1898    tx_id: u32,
1899}
1900
1901/// Set the the channel to be shutdown (see [`SecureFastRpcControlHandle::shutdown`])
1902/// if the responder is dropped without sending a response, so that the client
1903/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1904impl std::ops::Drop for SecureFastRpcAllocateResponder {
1905    fn drop(&mut self) {
1906        self.control_handle.shutdown();
1907        // Safety: drops once, never accessed again
1908        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1909    }
1910}
1911
1912impl fidl::endpoints::Responder for SecureFastRpcAllocateResponder {
1913    type ControlHandle = SecureFastRpcControlHandle;
1914
1915    fn control_handle(&self) -> &SecureFastRpcControlHandle {
1916        &self.control_handle
1917    }
1918
1919    fn drop_without_shutdown(mut self) {
1920        // Safety: drops once, never accessed again due to mem::forget
1921        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1922        // Prevent Drop from running (which would shut down the channel)
1923        std::mem::forget(self);
1924    }
1925}
1926
1927impl SecureFastRpcAllocateResponder {
1928    /// Sends a response to the FIDL transaction.
1929    ///
1930    /// Sets the channel to shutdown if an error occurs.
1931    pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1932        let _result = self.send_raw(result);
1933        if _result.is_err() {
1934            self.control_handle.shutdown();
1935        }
1936        self.drop_without_shutdown();
1937        _result
1938    }
1939
1940    /// Similar to "send" but does not shutdown the channel if an error occurs.
1941    pub fn send_no_shutdown_on_err(
1942        self,
1943        mut result: Result<fidl::Vmo, i32>,
1944    ) -> Result<(), fidl::Error> {
1945        let _result = self.send_raw(result);
1946        self.drop_without_shutdown();
1947        _result
1948    }
1949
1950    fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1951        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1952            SecureFastRpcAllocateResponse,
1953            i32,
1954        >>(
1955            fidl::encoding::FlexibleResult::new(result.map(|vmo| (vmo,))),
1956            self.tx_id,
1957            0x5443b2d8b251e878,
1958            fidl::encoding::DynamicFlags::FLEXIBLE,
1959        )
1960    }
1961}
1962
1963#[must_use = "FIDL methods require a response to be sent"]
1964#[derive(Debug)]
1965pub struct SecureFastRpcGetCapabilitiesResponder {
1966    control_handle: std::mem::ManuallyDrop<SecureFastRpcControlHandle>,
1967    tx_id: u32,
1968}
1969
1970/// Set the the channel to be shutdown (see [`SecureFastRpcControlHandle::shutdown`])
1971/// if the responder is dropped without sending a response, so that the client
1972/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1973impl std::ops::Drop for SecureFastRpcGetCapabilitiesResponder {
1974    fn drop(&mut self) {
1975        self.control_handle.shutdown();
1976        // Safety: drops once, never accessed again
1977        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1978    }
1979}
1980
1981impl fidl::endpoints::Responder for SecureFastRpcGetCapabilitiesResponder {
1982    type ControlHandle = SecureFastRpcControlHandle;
1983
1984    fn control_handle(&self) -> &SecureFastRpcControlHandle {
1985        &self.control_handle
1986    }
1987
1988    fn drop_without_shutdown(mut self) {
1989        // Safety: drops once, never accessed again due to mem::forget
1990        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1991        // Prevent Drop from running (which would shut down the channel)
1992        std::mem::forget(self);
1993    }
1994}
1995
1996impl SecureFastRpcGetCapabilitiesResponder {
1997    /// Sends a response to the FIDL transaction.
1998    ///
1999    /// Sets the channel to shutdown if an error occurs.
2000    pub fn send(self, mut result: Result<&[u32], i32>) -> Result<(), fidl::Error> {
2001        let _result = self.send_raw(result);
2002        if _result.is_err() {
2003            self.control_handle.shutdown();
2004        }
2005        self.drop_without_shutdown();
2006        _result
2007    }
2008
2009    /// Similar to "send" but does not shutdown the channel if an error occurs.
2010    pub fn send_no_shutdown_on_err(
2011        self,
2012        mut result: Result<&[u32], i32>,
2013    ) -> Result<(), fidl::Error> {
2014        let _result = self.send_raw(result);
2015        self.drop_without_shutdown();
2016        _result
2017    }
2018
2019    fn send_raw(&self, mut result: Result<&[u32], i32>) -> Result<(), fidl::Error> {
2020        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2021            SecureFastRpcGetCapabilitiesResponse,
2022            i32,
2023        >>(
2024            fidl::encoding::FlexibleResult::new(result.map(|capabilities| (capabilities,))),
2025            self.tx_id,
2026            0x69bfeede998f5368,
2027            fidl::encoding::DynamicFlags::FLEXIBLE,
2028        )
2029    }
2030}
2031
2032#[must_use = "FIDL methods require a response to be sent"]
2033#[derive(Debug)]
2034pub struct SecureFastRpcAttachRootDomainResponder {
2035    control_handle: std::mem::ManuallyDrop<SecureFastRpcControlHandle>,
2036    tx_id: u32,
2037}
2038
2039/// Set the the channel to be shutdown (see [`SecureFastRpcControlHandle::shutdown`])
2040/// if the responder is dropped without sending a response, so that the client
2041/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2042impl std::ops::Drop for SecureFastRpcAttachRootDomainResponder {
2043    fn drop(&mut self) {
2044        self.control_handle.shutdown();
2045        // Safety: drops once, never accessed again
2046        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2047    }
2048}
2049
2050impl fidl::endpoints::Responder for SecureFastRpcAttachRootDomainResponder {
2051    type ControlHandle = SecureFastRpcControlHandle;
2052
2053    fn control_handle(&self) -> &SecureFastRpcControlHandle {
2054        &self.control_handle
2055    }
2056
2057    fn drop_without_shutdown(mut self) {
2058        // Safety: drops once, never accessed again due to mem::forget
2059        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2060        // Prevent Drop from running (which would shut down the channel)
2061        std::mem::forget(self);
2062    }
2063}
2064
2065impl SecureFastRpcAttachRootDomainResponder {
2066    /// Sends a response to the FIDL transaction.
2067    ///
2068    /// Sets the channel to shutdown if an error occurs.
2069    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2070        let _result = self.send_raw(result);
2071        if _result.is_err() {
2072            self.control_handle.shutdown();
2073        }
2074        self.drop_without_shutdown();
2075        _result
2076    }
2077
2078    /// Similar to "send" but does not shutdown the channel if an error occurs.
2079    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2080        let _result = self.send_raw(result);
2081        self.drop_without_shutdown();
2082        _result
2083    }
2084
2085    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2086        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2087            fidl::encoding::EmptyStruct,
2088            i32,
2089        >>(
2090            fidl::encoding::FlexibleResult::new(result),
2091            self.tx_id,
2092            0x6bde390dfc4c57ed,
2093            fidl::encoding::DynamicFlags::FLEXIBLE,
2094        )
2095    }
2096}
2097
2098#[must_use = "FIDL methods require a response to be sent"]
2099#[derive(Debug)]
2100pub struct SecureFastRpcCreateStaticDomainResponder {
2101    control_handle: std::mem::ManuallyDrop<SecureFastRpcControlHandle>,
2102    tx_id: u32,
2103}
2104
2105/// Set the the channel to be shutdown (see [`SecureFastRpcControlHandle::shutdown`])
2106/// if the responder is dropped without sending a response, so that the client
2107/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2108impl std::ops::Drop for SecureFastRpcCreateStaticDomainResponder {
2109    fn drop(&mut self) {
2110        self.control_handle.shutdown();
2111        // Safety: drops once, never accessed again
2112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2113    }
2114}
2115
2116impl fidl::endpoints::Responder for SecureFastRpcCreateStaticDomainResponder {
2117    type ControlHandle = SecureFastRpcControlHandle;
2118
2119    fn control_handle(&self) -> &SecureFastRpcControlHandle {
2120        &self.control_handle
2121    }
2122
2123    fn drop_without_shutdown(mut self) {
2124        // Safety: drops once, never accessed again due to mem::forget
2125        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2126        // Prevent Drop from running (which would shut down the channel)
2127        std::mem::forget(self);
2128    }
2129}
2130
2131impl SecureFastRpcCreateStaticDomainResponder {
2132    /// Sends a response to the FIDL transaction.
2133    ///
2134    /// Sets the channel to shutdown if an error occurs.
2135    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2136        let _result = self.send_raw(result);
2137        if _result.is_err() {
2138            self.control_handle.shutdown();
2139        }
2140        self.drop_without_shutdown();
2141        _result
2142    }
2143
2144    /// Similar to "send" but does not shutdown the channel if an error occurs.
2145    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2146        let _result = self.send_raw(result);
2147        self.drop_without_shutdown();
2148        _result
2149    }
2150
2151    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2152        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2153            fidl::encoding::EmptyStruct,
2154            i32,
2155        >>(
2156            fidl::encoding::FlexibleResult::new(result),
2157            self.tx_id,
2158            0x740a08a1456bc858,
2159            fidl::encoding::DynamicFlags::FLEXIBLE,
2160        )
2161    }
2162}
2163
2164#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2165pub struct SecureServiceMarker;
2166
2167#[cfg(target_os = "fuchsia")]
2168impl fidl::endpoints::ServiceMarker for SecureServiceMarker {
2169    type Proxy = SecureServiceProxy;
2170    type Request = SecureServiceRequest;
2171    const SERVICE_NAME: &'static str = "fuchsia.hardware.qualcomm.fastrpc.SecureService";
2172}
2173
2174/// A request for one of the member protocols of SecureService.
2175///
2176#[cfg(target_os = "fuchsia")]
2177pub enum SecureServiceRequest {
2178    Device(SecureFastRpcRequestStream),
2179}
2180
2181#[cfg(target_os = "fuchsia")]
2182impl fidl::endpoints::ServiceRequest for SecureServiceRequest {
2183    type Service = SecureServiceMarker;
2184
2185    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2186        match name {
2187            "device" => Self::Device(
2188                <SecureFastRpcRequestStream as fidl::endpoints::RequestStream>::from_channel(
2189                    _channel,
2190                ),
2191            ),
2192            _ => panic!("no such member protocol name for service SecureService"),
2193        }
2194    }
2195
2196    fn member_names() -> &'static [&'static str] {
2197        &["device"]
2198    }
2199}
2200#[cfg(target_os = "fuchsia")]
2201pub struct SecureServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2202
2203#[cfg(target_os = "fuchsia")]
2204impl fidl::endpoints::ServiceProxy for SecureServiceProxy {
2205    type Service = SecureServiceMarker;
2206
2207    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2208        Self(opener)
2209    }
2210}
2211
2212#[cfg(target_os = "fuchsia")]
2213impl SecureServiceProxy {
2214    pub fn connect_to_device(&self) -> Result<SecureFastRpcProxy, fidl::Error> {
2215        let (proxy, server_end) = fidl::endpoints::create_proxy::<SecureFastRpcMarker>();
2216        self.connect_channel_to_device(server_end)?;
2217        Ok(proxy)
2218    }
2219
2220    /// Like `connect_to_device`, but returns a sync proxy.
2221    /// See [`Self::connect_to_device`] for more details.
2222    pub fn connect_to_device_sync(&self) -> Result<SecureFastRpcSynchronousProxy, fidl::Error> {
2223        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<SecureFastRpcMarker>();
2224        self.connect_channel_to_device(server_end)?;
2225        Ok(proxy)
2226    }
2227
2228    /// Like `connect_to_device`, but accepts a server end.
2229    /// See [`Self::connect_to_device`] for more details.
2230    pub fn connect_channel_to_device(
2231        &self,
2232        server_end: fidl::endpoints::ServerEnd<SecureFastRpcMarker>,
2233    ) -> Result<(), fidl::Error> {
2234        self.0.open_member("device", server_end.into_channel())
2235    }
2236
2237    pub fn instance_name(&self) -> &str {
2238        self.0.instance_name()
2239    }
2240}
2241
2242mod internal {
2243    use super::*;
2244
2245    impl fidl::encoding::ResourceTypeMarker for RemoteDomainInvokeRequest {
2246        type Borrowed<'a> = &'a mut Self;
2247        fn take_or_borrow<'a>(
2248            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2249        ) -> Self::Borrowed<'a> {
2250            value
2251        }
2252    }
2253
2254    unsafe impl fidl::encoding::TypeMarker for RemoteDomainInvokeRequest {
2255        type Owned = Self;
2256
2257        #[inline(always)]
2258        fn inline_align(_context: fidl::encoding::Context) -> usize {
2259            8
2260        }
2261
2262        #[inline(always)]
2263        fn inline_size(_context: fidl::encoding::Context) -> usize {
2264            48
2265        }
2266    }
2267
2268    unsafe impl
2269        fidl::encoding::Encode<
2270            RemoteDomainInvokeRequest,
2271            fidl::encoding::DefaultFuchsiaResourceDialect,
2272        > for &mut RemoteDomainInvokeRequest
2273    {
2274        #[inline]
2275        unsafe fn encode(
2276            self,
2277            encoder: &mut fidl::encoding::Encoder<
2278                '_,
2279                fidl::encoding::DefaultFuchsiaResourceDialect,
2280            >,
2281            offset: usize,
2282            _depth: fidl::encoding::Depth,
2283        ) -> fidl::Result<()> {
2284            encoder.debug_check_bounds::<RemoteDomainInvokeRequest>(offset);
2285            // Delegate to tuple encoding.
2286            fidl::encoding::Encode::<RemoteDomainInvokeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2287                (
2288                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_thread_id),
2289                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
2290                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.method_id),
2291                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.payload_buffer_id),
2292                    <fidl::encoding::UnboundedVector<ArgumentEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.input_arguments),
2293                    <fidl::encoding::UnboundedVector<ArgumentEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output_arguments),
2294                ),
2295                encoder, offset, _depth
2296            )
2297        }
2298    }
2299    unsafe impl<
2300        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2301        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2302        T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2303        T3: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2304        T4: fidl::encoding::Encode<
2305                fidl::encoding::UnboundedVector<ArgumentEntry>,
2306                fidl::encoding::DefaultFuchsiaResourceDialect,
2307            >,
2308        T5: fidl::encoding::Encode<
2309                fidl::encoding::UnboundedVector<ArgumentEntry>,
2310                fidl::encoding::DefaultFuchsiaResourceDialect,
2311            >,
2312    >
2313        fidl::encoding::Encode<
2314            RemoteDomainInvokeRequest,
2315            fidl::encoding::DefaultFuchsiaResourceDialect,
2316        > for (T0, T1, T2, T3, T4, T5)
2317    {
2318        #[inline]
2319        unsafe fn encode(
2320            self,
2321            encoder: &mut fidl::encoding::Encoder<
2322                '_,
2323                fidl::encoding::DefaultFuchsiaResourceDialect,
2324            >,
2325            offset: usize,
2326            depth: fidl::encoding::Depth,
2327        ) -> fidl::Result<()> {
2328            encoder.debug_check_bounds::<RemoteDomainInvokeRequest>(offset);
2329            // Zero out padding regions. There's no need to apply masks
2330            // because the unmasked parts will be overwritten by fields.
2331            // Write the fields.
2332            self.0.encode(encoder, offset + 0, depth)?;
2333            self.1.encode(encoder, offset + 4, depth)?;
2334            self.2.encode(encoder, offset + 8, depth)?;
2335            self.3.encode(encoder, offset + 12, depth)?;
2336            self.4.encode(encoder, offset + 16, depth)?;
2337            self.5.encode(encoder, offset + 32, depth)?;
2338            Ok(())
2339        }
2340    }
2341
2342    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2343        for RemoteDomainInvokeRequest
2344    {
2345        #[inline(always)]
2346        fn new_empty() -> Self {
2347            Self {
2348                remote_thread_id: fidl::new_empty!(
2349                    i32,
2350                    fidl::encoding::DefaultFuchsiaResourceDialect
2351                ),
2352                handle: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2353                method_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2354                payload_buffer_id: fidl::new_empty!(
2355                    u32,
2356                    fidl::encoding::DefaultFuchsiaResourceDialect
2357                ),
2358                input_arguments: fidl::new_empty!(
2359                    fidl::encoding::UnboundedVector<ArgumentEntry>,
2360                    fidl::encoding::DefaultFuchsiaResourceDialect
2361                ),
2362                output_arguments: fidl::new_empty!(
2363                    fidl::encoding::UnboundedVector<ArgumentEntry>,
2364                    fidl::encoding::DefaultFuchsiaResourceDialect
2365                ),
2366            }
2367        }
2368
2369        #[inline]
2370        unsafe fn decode(
2371            &mut self,
2372            decoder: &mut fidl::encoding::Decoder<
2373                '_,
2374                fidl::encoding::DefaultFuchsiaResourceDialect,
2375            >,
2376            offset: usize,
2377            _depth: fidl::encoding::Depth,
2378        ) -> fidl::Result<()> {
2379            decoder.debug_check_bounds::<Self>(offset);
2380            // Verify that padding bytes are zero.
2381            fidl::decode!(
2382                i32,
2383                fidl::encoding::DefaultFuchsiaResourceDialect,
2384                &mut self.remote_thread_id,
2385                decoder,
2386                offset + 0,
2387                _depth
2388            )?;
2389            fidl::decode!(
2390                u32,
2391                fidl::encoding::DefaultFuchsiaResourceDialect,
2392                &mut self.handle,
2393                decoder,
2394                offset + 4,
2395                _depth
2396            )?;
2397            fidl::decode!(
2398                u32,
2399                fidl::encoding::DefaultFuchsiaResourceDialect,
2400                &mut self.method_id,
2401                decoder,
2402                offset + 8,
2403                _depth
2404            )?;
2405            fidl::decode!(
2406                u32,
2407                fidl::encoding::DefaultFuchsiaResourceDialect,
2408                &mut self.payload_buffer_id,
2409                decoder,
2410                offset + 12,
2411                _depth
2412            )?;
2413            fidl::decode!(
2414                fidl::encoding::UnboundedVector<ArgumentEntry>,
2415                fidl::encoding::DefaultFuchsiaResourceDialect,
2416                &mut self.input_arguments,
2417                decoder,
2418                offset + 16,
2419                _depth
2420            )?;
2421            fidl::decode!(
2422                fidl::encoding::UnboundedVector<ArgumentEntry>,
2423                fidl::encoding::DefaultFuchsiaResourceDialect,
2424                &mut self.output_arguments,
2425                decoder,
2426                offset + 32,
2427                _depth
2428            )?;
2429            Ok(())
2430        }
2431    }
2432
2433    impl fidl::encoding::ResourceTypeMarker for RemoteDomainGetPayloadBufferSetResponse {
2434        type Borrowed<'a> = &'a mut Self;
2435        fn take_or_borrow<'a>(
2436            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2437        ) -> Self::Borrowed<'a> {
2438            value
2439        }
2440    }
2441
2442    unsafe impl fidl::encoding::TypeMarker for RemoteDomainGetPayloadBufferSetResponse {
2443        type Owned = Self;
2444
2445        #[inline(always)]
2446        fn inline_align(_context: fidl::encoding::Context) -> usize {
2447            8
2448        }
2449
2450        #[inline(always)]
2451        fn inline_size(_context: fidl::encoding::Context) -> usize {
2452            16
2453        }
2454    }
2455
2456    unsafe impl
2457        fidl::encoding::Encode<
2458            RemoteDomainGetPayloadBufferSetResponse,
2459            fidl::encoding::DefaultFuchsiaResourceDialect,
2460        > for &mut RemoteDomainGetPayloadBufferSetResponse
2461    {
2462        #[inline]
2463        unsafe fn encode(
2464            self,
2465            encoder: &mut fidl::encoding::Encoder<
2466                '_,
2467                fidl::encoding::DefaultFuchsiaResourceDialect,
2468            >,
2469            offset: usize,
2470            _depth: fidl::encoding::Depth,
2471        ) -> fidl::Result<()> {
2472            encoder.debug_check_bounds::<RemoteDomainGetPayloadBufferSetResponse>(offset);
2473            // Delegate to tuple encoding.
2474            fidl::encoding::Encode::<RemoteDomainGetPayloadBufferSetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2475                (
2476                    <fidl::encoding::Vector<SharedPayloadBuffer, 100> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffers),
2477                ),
2478                encoder, offset, _depth
2479            )
2480        }
2481    }
2482    unsafe impl<
2483        T0: fidl::encoding::Encode<
2484                fidl::encoding::Vector<SharedPayloadBuffer, 100>,
2485                fidl::encoding::DefaultFuchsiaResourceDialect,
2486            >,
2487    >
2488        fidl::encoding::Encode<
2489            RemoteDomainGetPayloadBufferSetResponse,
2490            fidl::encoding::DefaultFuchsiaResourceDialect,
2491        > for (T0,)
2492    {
2493        #[inline]
2494        unsafe fn encode(
2495            self,
2496            encoder: &mut fidl::encoding::Encoder<
2497                '_,
2498                fidl::encoding::DefaultFuchsiaResourceDialect,
2499            >,
2500            offset: usize,
2501            depth: fidl::encoding::Depth,
2502        ) -> fidl::Result<()> {
2503            encoder.debug_check_bounds::<RemoteDomainGetPayloadBufferSetResponse>(offset);
2504            // Zero out padding regions. There's no need to apply masks
2505            // because the unmasked parts will be overwritten by fields.
2506            // Write the fields.
2507            self.0.encode(encoder, offset + 0, depth)?;
2508            Ok(())
2509        }
2510    }
2511
2512    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2513        for RemoteDomainGetPayloadBufferSetResponse
2514    {
2515        #[inline(always)]
2516        fn new_empty() -> Self {
2517            Self {
2518                buffers: fidl::new_empty!(fidl::encoding::Vector<SharedPayloadBuffer, 100>, fidl::encoding::DefaultFuchsiaResourceDialect),
2519            }
2520        }
2521
2522        #[inline]
2523        unsafe fn decode(
2524            &mut self,
2525            decoder: &mut fidl::encoding::Decoder<
2526                '_,
2527                fidl::encoding::DefaultFuchsiaResourceDialect,
2528            >,
2529            offset: usize,
2530            _depth: fidl::encoding::Depth,
2531        ) -> fidl::Result<()> {
2532            decoder.debug_check_bounds::<Self>(offset);
2533            // Verify that padding bytes are zero.
2534            fidl::decode!(fidl::encoding::Vector<SharedPayloadBuffer, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.buffers, decoder, offset + 0, _depth)?;
2535            Ok(())
2536        }
2537    }
2538
2539    impl fidl::encoding::ResourceTypeMarker for SecureFastRpcAttachRootDomainRequest {
2540        type Borrowed<'a> = &'a mut Self;
2541        fn take_or_borrow<'a>(
2542            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2543        ) -> Self::Borrowed<'a> {
2544            value
2545        }
2546    }
2547
2548    unsafe impl fidl::encoding::TypeMarker for SecureFastRpcAttachRootDomainRequest {
2549        type Owned = Self;
2550
2551        #[inline(always)]
2552        fn inline_align(_context: fidl::encoding::Context) -> usize {
2553            4
2554        }
2555
2556        #[inline(always)]
2557        fn inline_size(_context: fidl::encoding::Context) -> usize {
2558            4
2559        }
2560    }
2561
2562    unsafe impl
2563        fidl::encoding::Encode<
2564            SecureFastRpcAttachRootDomainRequest,
2565            fidl::encoding::DefaultFuchsiaResourceDialect,
2566        > for &mut SecureFastRpcAttachRootDomainRequest
2567    {
2568        #[inline]
2569        unsafe fn encode(
2570            self,
2571            encoder: &mut fidl::encoding::Encoder<
2572                '_,
2573                fidl::encoding::DefaultFuchsiaResourceDialect,
2574            >,
2575            offset: usize,
2576            _depth: fidl::encoding::Depth,
2577        ) -> fidl::Result<()> {
2578            encoder.debug_check_bounds::<SecureFastRpcAttachRootDomainRequest>(offset);
2579            // Delegate to tuple encoding.
2580            fidl::encoding::Encode::<SecureFastRpcAttachRootDomainRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2581                (
2582                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
2583                ),
2584                encoder, offset, _depth
2585            )
2586        }
2587    }
2588    unsafe impl<
2589        T0: fidl::encoding::Encode<
2590                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>>,
2591                fidl::encoding::DefaultFuchsiaResourceDialect,
2592            >,
2593    >
2594        fidl::encoding::Encode<
2595            SecureFastRpcAttachRootDomainRequest,
2596            fidl::encoding::DefaultFuchsiaResourceDialect,
2597        > for (T0,)
2598    {
2599        #[inline]
2600        unsafe fn encode(
2601            self,
2602            encoder: &mut fidl::encoding::Encoder<
2603                '_,
2604                fidl::encoding::DefaultFuchsiaResourceDialect,
2605            >,
2606            offset: usize,
2607            depth: fidl::encoding::Depth,
2608        ) -> fidl::Result<()> {
2609            encoder.debug_check_bounds::<SecureFastRpcAttachRootDomainRequest>(offset);
2610            // Zero out padding regions. There's no need to apply masks
2611            // because the unmasked parts will be overwritten by fields.
2612            // Write the fields.
2613            self.0.encode(encoder, offset + 0, depth)?;
2614            Ok(())
2615        }
2616    }
2617
2618    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2619        for SecureFastRpcAttachRootDomainRequest
2620    {
2621        #[inline(always)]
2622        fn new_empty() -> Self {
2623            Self {
2624                server: fidl::new_empty!(
2625                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>>,
2626                    fidl::encoding::DefaultFuchsiaResourceDialect
2627                ),
2628            }
2629        }
2630
2631        #[inline]
2632        unsafe fn decode(
2633            &mut self,
2634            decoder: &mut fidl::encoding::Decoder<
2635                '_,
2636                fidl::encoding::DefaultFuchsiaResourceDialect,
2637            >,
2638            offset: usize,
2639            _depth: fidl::encoding::Depth,
2640        ) -> fidl::Result<()> {
2641            decoder.debug_check_bounds::<Self>(offset);
2642            // Verify that padding bytes are zero.
2643            fidl::decode!(
2644                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>>,
2645                fidl::encoding::DefaultFuchsiaResourceDialect,
2646                &mut self.server,
2647                decoder,
2648                offset + 0,
2649                _depth
2650            )?;
2651            Ok(())
2652        }
2653    }
2654
2655    impl fidl::encoding::ResourceTypeMarker for SecureFastRpcCreateStaticDomainRequest {
2656        type Borrowed<'a> = &'a mut Self;
2657        fn take_or_borrow<'a>(
2658            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2659        ) -> Self::Borrowed<'a> {
2660            value
2661        }
2662    }
2663
2664    unsafe impl fidl::encoding::TypeMarker for SecureFastRpcCreateStaticDomainRequest {
2665        type Owned = Self;
2666
2667        #[inline(always)]
2668        fn inline_align(_context: fidl::encoding::Context) -> usize {
2669            8
2670        }
2671
2672        #[inline(always)]
2673        fn inline_size(_context: fidl::encoding::Context) -> usize {
2674            24
2675        }
2676    }
2677
2678    unsafe impl
2679        fidl::encoding::Encode<
2680            SecureFastRpcCreateStaticDomainRequest,
2681            fidl::encoding::DefaultFuchsiaResourceDialect,
2682        > for &mut SecureFastRpcCreateStaticDomainRequest
2683    {
2684        #[inline]
2685        unsafe fn encode(
2686            self,
2687            encoder: &mut fidl::encoding::Encoder<
2688                '_,
2689                fidl::encoding::DefaultFuchsiaResourceDialect,
2690            >,
2691            offset: usize,
2692            _depth: fidl::encoding::Depth,
2693        ) -> fidl::Result<()> {
2694            encoder.debug_check_bounds::<SecureFastRpcCreateStaticDomainRequest>(offset);
2695            // Delegate to tuple encoding.
2696            fidl::encoding::Encode::<SecureFastRpcCreateStaticDomainRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2697                (
2698                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2699                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.memory_size),
2700                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
2701                ),
2702                encoder, offset, _depth
2703            )
2704        }
2705    }
2706    unsafe impl<
2707        T0: fidl::encoding::Encode<
2708                fidl::encoding::UnboundedString,
2709                fidl::encoding::DefaultFuchsiaResourceDialect,
2710            >,
2711        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2712        T2: fidl::encoding::Encode<
2713                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>>,
2714                fidl::encoding::DefaultFuchsiaResourceDialect,
2715            >,
2716    >
2717        fidl::encoding::Encode<
2718            SecureFastRpcCreateStaticDomainRequest,
2719            fidl::encoding::DefaultFuchsiaResourceDialect,
2720        > for (T0, T1, T2)
2721    {
2722        #[inline]
2723        unsafe fn encode(
2724            self,
2725            encoder: &mut fidl::encoding::Encoder<
2726                '_,
2727                fidl::encoding::DefaultFuchsiaResourceDialect,
2728            >,
2729            offset: usize,
2730            depth: fidl::encoding::Depth,
2731        ) -> fidl::Result<()> {
2732            encoder.debug_check_bounds::<SecureFastRpcCreateStaticDomainRequest>(offset);
2733            // Zero out padding regions. There's no need to apply masks
2734            // because the unmasked parts will be overwritten by fields.
2735            // Write the fields.
2736            self.0.encode(encoder, offset + 0, depth)?;
2737            self.1.encode(encoder, offset + 16, depth)?;
2738            self.2.encode(encoder, offset + 20, depth)?;
2739            Ok(())
2740        }
2741    }
2742
2743    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2744        for SecureFastRpcCreateStaticDomainRequest
2745    {
2746        #[inline(always)]
2747        fn new_empty() -> Self {
2748            Self {
2749                name: fidl::new_empty!(
2750                    fidl::encoding::UnboundedString,
2751                    fidl::encoding::DefaultFuchsiaResourceDialect
2752                ),
2753                memory_size: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2754                server: fidl::new_empty!(
2755                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>>,
2756                    fidl::encoding::DefaultFuchsiaResourceDialect
2757                ),
2758            }
2759        }
2760
2761        #[inline]
2762        unsafe fn decode(
2763            &mut self,
2764            decoder: &mut fidl::encoding::Decoder<
2765                '_,
2766                fidl::encoding::DefaultFuchsiaResourceDialect,
2767            >,
2768            offset: usize,
2769            _depth: fidl::encoding::Depth,
2770        ) -> fidl::Result<()> {
2771            decoder.debug_check_bounds::<Self>(offset);
2772            // Verify that padding bytes are zero.
2773            fidl::decode!(
2774                fidl::encoding::UnboundedString,
2775                fidl::encoding::DefaultFuchsiaResourceDialect,
2776                &mut self.name,
2777                decoder,
2778                offset + 0,
2779                _depth
2780            )?;
2781            fidl::decode!(
2782                u32,
2783                fidl::encoding::DefaultFuchsiaResourceDialect,
2784                &mut self.memory_size,
2785                decoder,
2786                offset + 16,
2787                _depth
2788            )?;
2789            fidl::decode!(
2790                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteDomainMarker>>,
2791                fidl::encoding::DefaultFuchsiaResourceDialect,
2792                &mut self.server,
2793                decoder,
2794                offset + 20,
2795                _depth
2796            )?;
2797            Ok(())
2798        }
2799    }
2800
2801    impl fidl::encoding::ResourceTypeMarker for SecureFastRpcAllocateResponse {
2802        type Borrowed<'a> = &'a mut Self;
2803        fn take_or_borrow<'a>(
2804            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2805        ) -> Self::Borrowed<'a> {
2806            value
2807        }
2808    }
2809
2810    unsafe impl fidl::encoding::TypeMarker for SecureFastRpcAllocateResponse {
2811        type Owned = Self;
2812
2813        #[inline(always)]
2814        fn inline_align(_context: fidl::encoding::Context) -> usize {
2815            4
2816        }
2817
2818        #[inline(always)]
2819        fn inline_size(_context: fidl::encoding::Context) -> usize {
2820            4
2821        }
2822    }
2823
2824    unsafe impl
2825        fidl::encoding::Encode<
2826            SecureFastRpcAllocateResponse,
2827            fidl::encoding::DefaultFuchsiaResourceDialect,
2828        > for &mut SecureFastRpcAllocateResponse
2829    {
2830        #[inline]
2831        unsafe fn encode(
2832            self,
2833            encoder: &mut fidl::encoding::Encoder<
2834                '_,
2835                fidl::encoding::DefaultFuchsiaResourceDialect,
2836            >,
2837            offset: usize,
2838            _depth: fidl::encoding::Depth,
2839        ) -> fidl::Result<()> {
2840            encoder.debug_check_bounds::<SecureFastRpcAllocateResponse>(offset);
2841            // Delegate to tuple encoding.
2842            fidl::encoding::Encode::<
2843                SecureFastRpcAllocateResponse,
2844                fidl::encoding::DefaultFuchsiaResourceDialect,
2845            >::encode(
2846                (<fidl::encoding::HandleType<
2847                    fidl::Vmo,
2848                    { fidl::ObjectType::VMO.into_raw() },
2849                    2147483648,
2850                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2851                    &mut self.vmo
2852                ),),
2853                encoder,
2854                offset,
2855                _depth,
2856            )
2857        }
2858    }
2859    unsafe impl<
2860        T0: fidl::encoding::Encode<
2861                fidl::encoding::HandleType<
2862                    fidl::Vmo,
2863                    { fidl::ObjectType::VMO.into_raw() },
2864                    2147483648,
2865                >,
2866                fidl::encoding::DefaultFuchsiaResourceDialect,
2867            >,
2868    >
2869        fidl::encoding::Encode<
2870            SecureFastRpcAllocateResponse,
2871            fidl::encoding::DefaultFuchsiaResourceDialect,
2872        > for (T0,)
2873    {
2874        #[inline]
2875        unsafe fn encode(
2876            self,
2877            encoder: &mut fidl::encoding::Encoder<
2878                '_,
2879                fidl::encoding::DefaultFuchsiaResourceDialect,
2880            >,
2881            offset: usize,
2882            depth: fidl::encoding::Depth,
2883        ) -> fidl::Result<()> {
2884            encoder.debug_check_bounds::<SecureFastRpcAllocateResponse>(offset);
2885            // Zero out padding regions. There's no need to apply masks
2886            // because the unmasked parts will be overwritten by fields.
2887            // Write the fields.
2888            self.0.encode(encoder, offset + 0, depth)?;
2889            Ok(())
2890        }
2891    }
2892
2893    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2894        for SecureFastRpcAllocateResponse
2895    {
2896        #[inline(always)]
2897        fn new_empty() -> Self {
2898            Self {
2899                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2900            }
2901        }
2902
2903        #[inline]
2904        unsafe fn decode(
2905            &mut self,
2906            decoder: &mut fidl::encoding::Decoder<
2907                '_,
2908                fidl::encoding::DefaultFuchsiaResourceDialect,
2909            >,
2910            offset: usize,
2911            _depth: fidl::encoding::Depth,
2912        ) -> fidl::Result<()> {
2913            decoder.debug_check_bounds::<Self>(offset);
2914            // Verify that padding bytes are zero.
2915            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
2916            Ok(())
2917        }
2918    }
2919
2920    impl fidl::encoding::ResourceTypeMarker for SharedPayloadBuffer {
2921        type Borrowed<'a> = &'a mut Self;
2922        fn take_or_borrow<'a>(
2923            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2924        ) -> Self::Borrowed<'a> {
2925            value
2926        }
2927    }
2928
2929    unsafe impl fidl::encoding::TypeMarker for SharedPayloadBuffer {
2930        type Owned = Self;
2931
2932        #[inline(always)]
2933        fn inline_align(_context: fidl::encoding::Context) -> usize {
2934            4
2935        }
2936
2937        #[inline(always)]
2938        fn inline_size(_context: fidl::encoding::Context) -> usize {
2939            8
2940        }
2941    }
2942
2943    unsafe impl
2944        fidl::encoding::Encode<SharedPayloadBuffer, fidl::encoding::DefaultFuchsiaResourceDialect>
2945        for &mut SharedPayloadBuffer
2946    {
2947        #[inline]
2948        unsafe fn encode(
2949            self,
2950            encoder: &mut fidl::encoding::Encoder<
2951                '_,
2952                fidl::encoding::DefaultFuchsiaResourceDialect,
2953            >,
2954            offset: usize,
2955            _depth: fidl::encoding::Depth,
2956        ) -> fidl::Result<()> {
2957            encoder.debug_check_bounds::<SharedPayloadBuffer>(offset);
2958            // Delegate to tuple encoding.
2959            fidl::encoding::Encode::<
2960                SharedPayloadBuffer,
2961                fidl::encoding::DefaultFuchsiaResourceDialect,
2962            >::encode(
2963                (
2964                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2965                    <fidl::encoding::HandleType<
2966                        fidl::Vmo,
2967                        { fidl::ObjectType::VMO.into_raw() },
2968                        2147483648,
2969                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2970                        &mut self.vmo
2971                    ),
2972                ),
2973                encoder,
2974                offset,
2975                _depth,
2976            )
2977        }
2978    }
2979    unsafe impl<
2980        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2981        T1: fidl::encoding::Encode<
2982                fidl::encoding::HandleType<
2983                    fidl::Vmo,
2984                    { fidl::ObjectType::VMO.into_raw() },
2985                    2147483648,
2986                >,
2987                fidl::encoding::DefaultFuchsiaResourceDialect,
2988            >,
2989    > fidl::encoding::Encode<SharedPayloadBuffer, fidl::encoding::DefaultFuchsiaResourceDialect>
2990        for (T0, T1)
2991    {
2992        #[inline]
2993        unsafe fn encode(
2994            self,
2995            encoder: &mut fidl::encoding::Encoder<
2996                '_,
2997                fidl::encoding::DefaultFuchsiaResourceDialect,
2998            >,
2999            offset: usize,
3000            depth: fidl::encoding::Depth,
3001        ) -> fidl::Result<()> {
3002            encoder.debug_check_bounds::<SharedPayloadBuffer>(offset);
3003            // Zero out padding regions. There's no need to apply masks
3004            // because the unmasked parts will be overwritten by fields.
3005            // Write the fields.
3006            self.0.encode(encoder, offset + 0, depth)?;
3007            self.1.encode(encoder, offset + 4, depth)?;
3008            Ok(())
3009        }
3010    }
3011
3012    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3013        for SharedPayloadBuffer
3014    {
3015        #[inline(always)]
3016        fn new_empty() -> Self {
3017            Self {
3018                id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
3019                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3020            }
3021        }
3022
3023        #[inline]
3024        unsafe fn decode(
3025            &mut self,
3026            decoder: &mut fidl::encoding::Decoder<
3027                '_,
3028                fidl::encoding::DefaultFuchsiaResourceDialect,
3029            >,
3030            offset: usize,
3031            _depth: fidl::encoding::Depth,
3032        ) -> fidl::Result<()> {
3033            decoder.debug_check_bounds::<Self>(offset);
3034            // Verify that padding bytes are zero.
3035            fidl::decode!(
3036                u32,
3037                fidl::encoding::DefaultFuchsiaResourceDialect,
3038                &mut self.id,
3039                decoder,
3040                offset + 0,
3041                _depth
3042            )?;
3043            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 4, _depth)?;
3044            Ok(())
3045        }
3046    }
3047
3048    impl fidl::encoding::ResourceTypeMarker for VmoArgument {
3049        type Borrowed<'a> = &'a mut Self;
3050        fn take_or_borrow<'a>(
3051            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3052        ) -> Self::Borrowed<'a> {
3053            value
3054        }
3055    }
3056
3057    unsafe impl fidl::encoding::TypeMarker for VmoArgument {
3058        type Owned = Self;
3059
3060        #[inline(always)]
3061        fn inline_align(_context: fidl::encoding::Context) -> usize {
3062            8
3063        }
3064
3065        #[inline(always)]
3066        fn inline_size(_context: fidl::encoding::Context) -> usize {
3067            24
3068        }
3069    }
3070
3071    unsafe impl fidl::encoding::Encode<VmoArgument, fidl::encoding::DefaultFuchsiaResourceDialect>
3072        for &mut VmoArgument
3073    {
3074        #[inline]
3075        unsafe fn encode(
3076            self,
3077            encoder: &mut fidl::encoding::Encoder<
3078                '_,
3079                fidl::encoding::DefaultFuchsiaResourceDialect,
3080            >,
3081            offset: usize,
3082            _depth: fidl::encoding::Depth,
3083        ) -> fidl::Result<()> {
3084            encoder.debug_check_bounds::<VmoArgument>(offset);
3085            // Delegate to tuple encoding.
3086            fidl::encoding::Encode::<VmoArgument, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3087                (
3088                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
3089                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.offset),
3090                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.length),
3091                ),
3092                encoder, offset, _depth
3093            )
3094        }
3095    }
3096    unsafe impl<
3097        T0: fidl::encoding::Encode<
3098                fidl::encoding::HandleType<
3099                    fidl::Vmo,
3100                    { fidl::ObjectType::VMO.into_raw() },
3101                    2147483648,
3102                >,
3103                fidl::encoding::DefaultFuchsiaResourceDialect,
3104            >,
3105        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3106        T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3107    > fidl::encoding::Encode<VmoArgument, fidl::encoding::DefaultFuchsiaResourceDialect>
3108        for (T0, T1, T2)
3109    {
3110        #[inline]
3111        unsafe fn encode(
3112            self,
3113            encoder: &mut fidl::encoding::Encoder<
3114                '_,
3115                fidl::encoding::DefaultFuchsiaResourceDialect,
3116            >,
3117            offset: usize,
3118            depth: fidl::encoding::Depth,
3119        ) -> fidl::Result<()> {
3120            encoder.debug_check_bounds::<VmoArgument>(offset);
3121            // Zero out padding regions. There's no need to apply masks
3122            // because the unmasked parts will be overwritten by fields.
3123            unsafe {
3124                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3125                (ptr as *mut u64).write_unaligned(0);
3126            }
3127            // Write the fields.
3128            self.0.encode(encoder, offset + 0, depth)?;
3129            self.1.encode(encoder, offset + 8, depth)?;
3130            self.2.encode(encoder, offset + 16, depth)?;
3131            Ok(())
3132        }
3133    }
3134
3135    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoArgument {
3136        #[inline(always)]
3137        fn new_empty() -> Self {
3138            Self {
3139                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3140                offset: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3141                length: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3142            }
3143        }
3144
3145        #[inline]
3146        unsafe fn decode(
3147            &mut self,
3148            decoder: &mut fidl::encoding::Decoder<
3149                '_,
3150                fidl::encoding::DefaultFuchsiaResourceDialect,
3151            >,
3152            offset: usize,
3153            _depth: fidl::encoding::Depth,
3154        ) -> fidl::Result<()> {
3155            decoder.debug_check_bounds::<Self>(offset);
3156            // Verify that padding bytes are zero.
3157            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3158            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3159            let mask = 0xffffffff00000000u64;
3160            let maskedval = padval & mask;
3161            if maskedval != 0 {
3162                return Err(fidl::Error::NonZeroPadding {
3163                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3164                });
3165            }
3166            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
3167            fidl::decode!(
3168                u64,
3169                fidl::encoding::DefaultFuchsiaResourceDialect,
3170                &mut self.offset,
3171                decoder,
3172                offset + 8,
3173                _depth
3174            )?;
3175            fidl::decode!(
3176                u64,
3177                fidl::encoding::DefaultFuchsiaResourceDialect,
3178                &mut self.length,
3179                decoder,
3180                offset + 16,
3181                _depth
3182            )?;
3183            Ok(())
3184        }
3185    }
3186
3187    impl fidl::encoding::ResourceTypeMarker for ArgumentEntry {
3188        type Borrowed<'a> = &'a mut Self;
3189        fn take_or_borrow<'a>(
3190            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3191        ) -> Self::Borrowed<'a> {
3192            value
3193        }
3194    }
3195
3196    unsafe impl fidl::encoding::TypeMarker for ArgumentEntry {
3197        type Owned = Self;
3198
3199        #[inline(always)]
3200        fn inline_align(_context: fidl::encoding::Context) -> usize {
3201            8
3202        }
3203
3204        #[inline(always)]
3205        fn inline_size(_context: fidl::encoding::Context) -> usize {
3206            16
3207        }
3208    }
3209
3210    unsafe impl fidl::encoding::Encode<ArgumentEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
3211        for &mut ArgumentEntry
3212    {
3213        #[inline]
3214        unsafe fn encode(
3215            self,
3216            encoder: &mut fidl::encoding::Encoder<
3217                '_,
3218                fidl::encoding::DefaultFuchsiaResourceDialect,
3219            >,
3220            offset: usize,
3221            _depth: fidl::encoding::Depth,
3222        ) -> fidl::Result<()> {
3223            encoder.debug_check_bounds::<ArgumentEntry>(offset);
3224            encoder.write_num::<u64>(self.ordinal(), offset);
3225            match self {
3226                ArgumentEntry::Argument(ref val) => fidl::encoding::encode_in_envelope::<
3227                    Argument,
3228                    fidl::encoding::DefaultFuchsiaResourceDialect,
3229                >(
3230                    <Argument as fidl::encoding::ValueTypeMarker>::borrow(val),
3231                    encoder,
3232                    offset + 8,
3233                    _depth,
3234                ),
3235                ArgumentEntry::VmoArgument(ref mut val) => fidl::encoding::encode_in_envelope::<
3236                    VmoArgument,
3237                    fidl::encoding::DefaultFuchsiaResourceDialect,
3238                >(
3239                    <VmoArgument as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3240                    encoder,
3241                    offset + 8,
3242                    _depth,
3243                ),
3244            }
3245        }
3246    }
3247
3248    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ArgumentEntry {
3249        #[inline(always)]
3250        fn new_empty() -> Self {
3251            Self::Argument(fidl::new_empty!(
3252                Argument,
3253                fidl::encoding::DefaultFuchsiaResourceDialect
3254            ))
3255        }
3256
3257        #[inline]
3258        unsafe fn decode(
3259            &mut self,
3260            decoder: &mut fidl::encoding::Decoder<
3261                '_,
3262                fidl::encoding::DefaultFuchsiaResourceDialect,
3263            >,
3264            offset: usize,
3265            mut depth: fidl::encoding::Depth,
3266        ) -> fidl::Result<()> {
3267            decoder.debug_check_bounds::<Self>(offset);
3268            #[allow(unused_variables)]
3269            let next_out_of_line = decoder.next_out_of_line();
3270            let handles_before = decoder.remaining_handles();
3271            let (ordinal, inlined, num_bytes, num_handles) =
3272                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3273
3274            let member_inline_size = match ordinal {
3275                1 => <Argument as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3276                2 => <VmoArgument as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3277                _ => return Err(fidl::Error::UnknownUnionTag),
3278            };
3279
3280            if inlined != (member_inline_size <= 4) {
3281                return Err(fidl::Error::InvalidInlineBitInEnvelope);
3282            }
3283            let _inner_offset;
3284            if inlined {
3285                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3286                _inner_offset = offset + 8;
3287            } else {
3288                depth.increment()?;
3289                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3290            }
3291            match ordinal {
3292                1 => {
3293                    #[allow(irrefutable_let_patterns)]
3294                    if let ArgumentEntry::Argument(_) = self {
3295                        // Do nothing, read the value into the object
3296                    } else {
3297                        // Initialize `self` to the right variant
3298                        *self = ArgumentEntry::Argument(fidl::new_empty!(
3299                            Argument,
3300                            fidl::encoding::DefaultFuchsiaResourceDialect
3301                        ));
3302                    }
3303                    #[allow(irrefutable_let_patterns)]
3304                    if let ArgumentEntry::Argument(ref mut val) = self {
3305                        fidl::decode!(
3306                            Argument,
3307                            fidl::encoding::DefaultFuchsiaResourceDialect,
3308                            val,
3309                            decoder,
3310                            _inner_offset,
3311                            depth
3312                        )?;
3313                    } else {
3314                        unreachable!()
3315                    }
3316                }
3317                2 => {
3318                    #[allow(irrefutable_let_patterns)]
3319                    if let ArgumentEntry::VmoArgument(_) = self {
3320                        // Do nothing, read the value into the object
3321                    } else {
3322                        // Initialize `self` to the right variant
3323                        *self = ArgumentEntry::VmoArgument(fidl::new_empty!(
3324                            VmoArgument,
3325                            fidl::encoding::DefaultFuchsiaResourceDialect
3326                        ));
3327                    }
3328                    #[allow(irrefutable_let_patterns)]
3329                    if let ArgumentEntry::VmoArgument(ref mut val) = self {
3330                        fidl::decode!(
3331                            VmoArgument,
3332                            fidl::encoding::DefaultFuchsiaResourceDialect,
3333                            val,
3334                            decoder,
3335                            _inner_offset,
3336                            depth
3337                        )?;
3338                    } else {
3339                        unreachable!()
3340                    }
3341                }
3342                ordinal => panic!("unexpected ordinal {:?}", ordinal),
3343            }
3344            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3345                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3346            }
3347            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3348                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3349            }
3350            Ok(())
3351        }
3352    }
3353}