Skip to main content

fdomain_next_fuchsia_unknown/
fdomain_next_fuchsia_unknown.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7    pub use fidl_next_common_fuchsia_unknown::natural::*;
8
9    #[derive(Debug, PartialEq)]
10    #[repr(C)]
11    pub struct CloneableCloneRequest {
12        pub request: ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::Channel>,
13    }
14
15    unsafe impl<___E> ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>
16        for CloneableCloneRequest
17    where
18        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
19        ___E: ::fdomain_client::fidl_next::HandleEncoder,
20    {
21        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
22            Self,
23            crate::wire::CloneableCloneRequest,
24        > = unsafe {
25            ::fidl_next::CopyOptimization::enable_if(
26            true
27
28                && <
29                    ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>, ___E>
30                >::COPY_OPTIMIZATION.is_enabled()
31
32        )
33        };
34
35        #[inline]
36        fn encode(
37            self,
38            encoder_: &mut ___E,
39            out_: &mut ::core::mem::MaybeUninit<crate::wire::CloneableCloneRequest>,
40            _: (),
41        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42            ::fidl_next::munge! {
43                let crate::wire::CloneableCloneRequest {
44                    request,
45
46                } = out_;
47            }
48
49            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
50
51            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(request.as_mut_ptr()) };
52
53            Ok(())
54        }
55    }
56
57    unsafe impl<___E>
58        ::fidl_next::EncodeOption<
59            ::fidl_next::wire::Box<'static, crate::wire::CloneableCloneRequest>,
60            ___E,
61        > for CloneableCloneRequest
62    where
63        ___E: ::fidl_next::Encoder + ?Sized,
64        CloneableCloneRequest: ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>,
65    {
66        #[inline]
67        fn encode_option(
68            this: ::core::option::Option<Self>,
69            encoder: &mut ___E,
70            out: &mut ::core::mem::MaybeUninit<
71                ::fidl_next::wire::Box<'static, crate::wire::CloneableCloneRequest>,
72            >,
73            _: (),
74        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
75            if let Some(inner) = this {
76                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
77                ::fidl_next::wire::Box::encode_present(out);
78            } else {
79                ::fidl_next::wire::Box::encode_absent(out);
80            }
81
82            Ok(())
83        }
84    }
85
86    impl ::fidl_next::FromWire<crate::wire::CloneableCloneRequest> for CloneableCloneRequest {
87        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
88            crate::wire::CloneableCloneRequest,
89            Self,
90        > = unsafe {
91            ::fidl_next::CopyOptimization::enable_if(
92            true
93
94                && <
95                    ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>>
96                >::COPY_OPTIMIZATION.is_enabled()
97
98        )
99        };
100
101        #[inline]
102        fn from_wire(wire: crate::wire::CloneableCloneRequest) -> Self {
103            Self { request: ::fidl_next::FromWire::from_wire(wire.request) }
104        }
105    }
106}
107
108pub mod wire {
109
110    pub use fidl_next_common_fuchsia_unknown::wire::*;
111
112    /// The wire type corresponding to [`CloneableCloneRequest`].
113    #[derive(Debug)]
114    #[repr(C)]
115    pub struct CloneableCloneRequest {
116        pub request:
117            ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>,
118    }
119
120    static_assertions::const_assert_eq!(std::mem::size_of::<CloneableCloneRequest>(), 4);
121    static_assertions::const_assert_eq!(std::mem::align_of::<CloneableCloneRequest>(), 4);
122
123    static_assertions::const_assert_eq!(std::mem::offset_of!(CloneableCloneRequest, request), 0);
124
125    impl ::fidl_next::Constrained for CloneableCloneRequest {
126        type Constraint = ();
127
128        fn validate(
129            _: ::fidl_next::Slot<'_, Self>,
130            _: Self::Constraint,
131        ) -> Result<(), ::fidl_next::ValidationError> {
132            Ok(())
133        }
134    }
135
136    unsafe impl ::fidl_next::Wire for CloneableCloneRequest {
137        type Narrowed<'de> = CloneableCloneRequest;
138
139        #[inline]
140        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
141            ::fidl_next::munge! {
142                let Self {
143                    request,
144
145                } = &mut *out_;
146            }
147
148            ::fidl_next::Wire::zero_padding(request);
149        }
150    }
151
152    unsafe impl<___D> ::fidl_next::Decode<___D> for CloneableCloneRequest
153    where
154        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
155        ___D: ::fdomain_client::fidl_next::HandleDecoder,
156    {
157        fn decode(
158            slot_: ::fidl_next::Slot<'_, Self>,
159            decoder_: &mut ___D,
160            _: (),
161        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
162            ::fidl_next::munge! {
163                let Self {
164                    mut request,
165
166                } = slot_;
167            }
168
169            let _field = request.as_mut();
170
171            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
172
173            Ok(())
174        }
175    }
176
177    impl ::fidl_next::IntoNatural for CloneableCloneRequest {
178        type Natural = crate::natural::CloneableCloneRequest;
179    }
180}
181
182pub mod wire_optional {
183
184    pub use fidl_next_common_fuchsia_unknown::wire_optional::*;
185}
186
187pub mod generic {
188
189    pub use fidl_next_common_fuchsia_unknown::generic::*;
190
191    /// The generic type corresponding to [`CloneableCloneRequest`].
192    pub struct CloneableCloneRequest<T0> {
193        pub request: T0,
194    }
195
196    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>
197        for CloneableCloneRequest<T0>
198    where
199        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
200        ___E: ::fdomain_client::fidl_next::HandleEncoder,
201        T0: ::fidl_next::Encode<
202                ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>,
203                ___E,
204            >,
205    {
206        #[inline]
207        fn encode(
208            self,
209            encoder_: &mut ___E,
210            out_: &mut ::core::mem::MaybeUninit<crate::wire::CloneableCloneRequest>,
211            _: (),
212        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
213            ::fidl_next::munge! {
214                let crate::wire::CloneableCloneRequest {
215                    request,
216
217                } = out_;
218            }
219
220            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
221
222            Ok(())
223        }
224    }
225
226    unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>
227        for &'a CloneableCloneRequest<T0>
228    where
229        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
230        ___E: ::fdomain_client::fidl_next::HandleEncoder,
231        &'a T0: ::fidl_next::Encode<
232                ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>,
233                ___E,
234            >,
235    {
236        #[inline]
237        fn encode(
238            self,
239            encoder_: &mut ___E,
240            out_: &mut ::core::mem::MaybeUninit<crate::wire::CloneableCloneRequest>,
241            _: (),
242        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
243            ::fidl_next::munge! {
244                let crate::wire::CloneableCloneRequest {
245                    request,
246
247                } = out_;
248            }
249
250            ::fidl_next::Encode::encode(&self.request, encoder_, request, ())?;
251
252            Ok(())
253        }
254    }
255}
256
257pub use self::natural::*;
258
259/// The type corresponding to the Cloneable protocol.
260#[doc = " Provides a means of duplicating a connection.\n\n See the composing protocol\'s documentation for a description of\n connection-scoped state, if any.\n"]
261#[derive(PartialEq, Debug)]
262pub struct Cloneable;
263
264#[cfg(target_os = "fuchsia")]
265impl ::fidl_next::HasTransport for Cloneable {
266    type Transport = ::fdomain_client::Channel;
267}
268
269pub mod cloneable {
270    pub mod prelude {
271        pub use crate::{
272            Cloneable, CloneableClientHandler, CloneableLocalClientHandler,
273            CloneableLocalServerHandler, CloneableServerHandler, cloneable,
274        };
275
276        pub use crate::natural::CloneableCloneRequest;
277    }
278
279    pub struct Clone;
280
281    impl ::fidl_next::Method for Clone {
282        const ORDINAL: u64 = 2366825959783828089;
283        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
284            ::fidl_next::protocol::Flexibility::Strict;
285
286        type Protocol = crate::Cloneable;
287
288        type Request = crate::wire::CloneableCloneRequest;
289    }
290
291    mod ___detail {
292        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Cloneable
293        where
294            ___T: ::fidl_next::Transport,
295        {
296            type Client = CloneableClient<___T>;
297            type Server = CloneableServer<___T>;
298        }
299
300        /// The client for the `Cloneable` protocol.
301        #[repr(transparent)]
302        pub struct CloneableClient<___T: ::fidl_next::Transport> {
303            #[allow(dead_code)]
304            client: ::fidl_next::protocol::Client<___T>,
305        }
306
307        impl<___T> CloneableClient<___T>
308        where
309            ___T: ::fidl_next::Transport,
310        {
311            pub fn clone(
312                &self,
313
314                request: impl ::fidl_next::Encode<
315                    ::fidl_next::ServerEnd<
316                        crate::Cloneable,
317                        ::fdomain_client::fidl_next::wire::Handle,
318                    >,
319                    <___T as ::fidl_next::Transport>::SendBuffer,
320                >,
321            ) -> ::fidl_next::SendFuture<'_, ___T>
322            where
323                <___T as ::fidl_next::Transport>::SendBuffer:
324                    ::fidl_next::encoder::InternalHandleEncoder,
325                <___T as ::fidl_next::Transport>::SendBuffer:
326                    ::fdomain_client::fidl_next::HandleEncoder,
327            {
328                self.clone_with(crate::generic::CloneableCloneRequest { request })
329            }
330
331            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
332            where
333                ___R: ::fidl_next::Encode<
334                        crate::wire::CloneableCloneRequest,
335                        <___T as ::fidl_next::Transport>::SendBuffer,
336                    >,
337            {
338                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
339                    2366825959783828089,
340                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
341                    request,
342                ))
343            }
344        }
345
346        /// The server for the `Cloneable` protocol.
347        #[repr(transparent)]
348        pub struct CloneableServer<___T: ::fidl_next::Transport> {
349            server: ::fidl_next::protocol::Server<___T>,
350        }
351
352        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
353    }
354}
355
356#[diagnostic::on_unimplemented(
357    note = "If {Self} implements the non-local CloneableClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
358)]
359
360/// A client handler for the Cloneable protocol.
361///
362/// See [`Cloneable`] for more details.
363pub trait CloneableLocalClientHandler<
364    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
365    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
366>
367{
368}
369
370impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Cloneable
371where
372    ___H: CloneableLocalClientHandler<___T>,
373    ___T: ::fidl_next::Transport,
374{
375    async fn on_event(
376        handler: &mut ___H,
377        mut message: ::fidl_next::Message<___T>,
378    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
379        match *message.header().ordinal {
380            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
381        }
382    }
383}
384
385#[diagnostic::on_unimplemented(
386    note = "If {Self} implements the non-local CloneableServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
387)]
388
389/// A server handler for the Cloneable protocol.
390///
391/// See [`Cloneable`] for more details.
392pub trait CloneableLocalServerHandler<
393    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
394    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
395>
396{
397    fn clone(
398        &mut self,
399
400        request: ::fidl_next::Request<cloneable::Clone, ___T>,
401    ) -> impl ::core::future::Future<Output = ()>;
402}
403
404impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Cloneable
405where
406    ___H: CloneableLocalServerHandler<___T>,
407    ___T: ::fidl_next::Transport,
408    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
409            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
410            Constraint = (),
411        >,
412{
413    async fn on_one_way(
414        handler: &mut ___H,
415        mut message: ::fidl_next::Message<___T>,
416    ) -> ::core::result::Result<
417        (),
418        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
419    > {
420        match *message.header().ordinal {
421            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
422                Ok(decoded) => {
423                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
424                    Ok(())
425                }
426                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
427                    ordinal: 2366825959783828089,
428                    error,
429                }),
430            },
431
432            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
433        }
434    }
435
436    async fn on_two_way(
437        handler: &mut ___H,
438        mut message: ::fidl_next::Message<___T>,
439        responder: ::fidl_next::protocol::Responder<___T>,
440    ) -> ::core::result::Result<
441        (),
442        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
443    > {
444        match *message.header().ordinal {
445            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
446        }
447    }
448}
449
450/// A client handler for the Cloneable protocol.
451///
452/// See [`Cloneable`] for more details.
453pub trait CloneableClientHandler<
454    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
455    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
456>
457{
458}
459
460impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
461where
462    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
463    ___T: ::fidl_next::Transport,
464{
465    async fn on_event(
466        handler: &mut ___H,
467        mut message: ::fidl_next::Message<___T>,
468    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
469        match *message.header().ordinal {
470            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
471        }
472    }
473}
474
475/// A server handler for the Cloneable protocol.
476///
477/// See [`Cloneable`] for more details.
478pub trait CloneableServerHandler<
479    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
480    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
481>
482{
483    fn clone(
484        &mut self,
485
486        request: ::fidl_next::Request<cloneable::Clone, ___T>,
487    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
488}
489
490impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
491where
492    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
493    ___T: ::fidl_next::Transport,
494    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
495            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
496            Constraint = (),
497        >,
498{
499    async fn on_one_way(
500        handler: &mut ___H,
501        mut message: ::fidl_next::Message<___T>,
502    ) -> ::core::result::Result<
503        (),
504        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
505    > {
506        match *message.header().ordinal {
507            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
508                Ok(decoded) => {
509                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
510                    Ok(())
511                }
512                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
513                    ordinal: 2366825959783828089,
514                    error,
515                }),
516            },
517
518            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
519        }
520    }
521
522    async fn on_two_way(
523        handler: &mut ___H,
524        mut message: ::fidl_next::Message<___T>,
525        responder: ::fidl_next::protocol::Responder<___T>,
526    ) -> ::core::result::Result<
527        (),
528        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
529    > {
530        match *message.header().ordinal {
531            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
532        }
533    }
534}
535
536impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
537    ___T: ::fidl_next::Transport
538{
539}
540
541impl<___H, ___T> CloneableLocalClientHandler<___T> for ::fidl_next::Local<___H>
542where
543    ___H: CloneableClientHandler<___T>,
544    ___T: ::fidl_next::Transport,
545{
546}
547
548impl<___H, ___T> CloneableLocalServerHandler<___T> for ::fidl_next::Local<___H>
549where
550    ___H: CloneableServerHandler<___T>,
551    ___T: ::fidl_next::Transport,
552{
553    async fn clone(&mut self, request: ::fidl_next::Request<cloneable::Clone, ___T>) {
554        ___H::clone(&mut self.0, request).await
555    }
556}
557
558pub use fidl_next_common_fuchsia_unknown::*;