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