Skip to main content

fidl_fuchsia_hardware_qualcomm_fastrpc/
fidl_fuchsia_hardware_qualcomm_fastrpc.rs

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