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