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
227pub use self::natural::*;
228
229/// The type corresponding to the Cloneable protocol.
230#[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"]
231#[derive(PartialEq, Debug)]
232pub struct Cloneable;
233
234#[cfg(target_os = "fuchsia")]
235impl ::fidl_next::HasTransport for Cloneable {
236    type Transport = ::fdomain_client::Channel;
237}
238
239pub mod cloneable {
240    pub mod prelude {
241        pub use crate::{
242            Cloneable, CloneableClientHandler, CloneableLocalClientHandler,
243            CloneableLocalServerHandler, CloneableServerHandler, cloneable,
244        };
245
246        pub use crate::natural::CloneableCloneRequest;
247    }
248
249    pub struct Clone;
250
251    impl ::fidl_next::Method for Clone {
252        const ORDINAL: u64 = 2366825959783828089;
253        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
254            ::fidl_next::protocol::Flexibility::Strict;
255
256        type Protocol = crate::Cloneable;
257
258        type Request = crate::wire::CloneableCloneRequest;
259    }
260
261    mod ___detail {
262        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Cloneable
263        where
264            ___T: ::fidl_next::Transport,
265        {
266            type Client = CloneableClient<___T>;
267            type Server = CloneableServer<___T>;
268        }
269
270        /// The client for the `Cloneable` protocol.
271        #[repr(transparent)]
272        pub struct CloneableClient<___T: ::fidl_next::Transport> {
273            #[allow(dead_code)]
274            client: ::fidl_next::protocol::Client<___T>,
275        }
276
277        impl<___T> CloneableClient<___T>
278        where
279            ___T: ::fidl_next::Transport,
280        {
281            pub fn clone(
282                &self,
283
284                request: impl ::fidl_next::Encode<
285                    ::fidl_next::ServerEnd<
286                        crate::Cloneable,
287                        ::fdomain_client::fidl_next::wire::Handle,
288                    >,
289                    <___T as ::fidl_next::Transport>::SendBuffer,
290                >,
291            ) -> ::fidl_next::SendFuture<'_, ___T>
292            where
293                <___T as ::fidl_next::Transport>::SendBuffer:
294                    ::fidl_next::encoder::InternalHandleEncoder,
295                <___T as ::fidl_next::Transport>::SendBuffer:
296                    ::fdomain_client::fidl_next::HandleEncoder,
297            {
298                self.clone_with(crate::generic::CloneableCloneRequest { request })
299            }
300
301            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
302            where
303                ___R: ::fidl_next::Encode<
304                        crate::wire::CloneableCloneRequest,
305                        <___T as ::fidl_next::Transport>::SendBuffer,
306                    >,
307            {
308                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
309                    2366825959783828089,
310                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
311                    request,
312                ))
313            }
314        }
315
316        /// The server for the `Cloneable` protocol.
317        #[repr(transparent)]
318        pub struct CloneableServer<___T: ::fidl_next::Transport> {
319            server: ::fidl_next::protocol::Server<___T>,
320        }
321
322        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
323    }
324}
325
326#[diagnostic::on_unimplemented(
327    note = "If {Self} implements the non-local CloneableClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
328)]
329
330/// A client handler for the Cloneable protocol.
331///
332/// See [`Cloneable`] for more details.
333pub trait CloneableLocalClientHandler<
334    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
335    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
336>
337{
338}
339
340impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Cloneable
341where
342    ___H: CloneableLocalClientHandler<___T>,
343    ___T: ::fidl_next::Transport,
344{
345    async fn on_event(
346        handler: &mut ___H,
347        ordinal: u64,
348        flexibility: ::fidl_next::protocol::Flexibility,
349        body: ::fidl_next::Body<___T>,
350    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
351        match ordinal {
352            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
353        }
354    }
355}
356
357#[diagnostic::on_unimplemented(
358    note = "If {Self} implements the non-local CloneableServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
359)]
360
361/// A server handler for the Cloneable protocol.
362///
363/// See [`Cloneable`] for more details.
364pub trait CloneableLocalServerHandler<
365    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
366    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
367>
368{
369    fn clone(
370        &mut self,
371
372        request: ::fidl_next::Request<cloneable::Clone, ___T>,
373    ) -> impl ::core::future::Future<Output = ()>;
374}
375
376impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Cloneable
377where
378    ___H: CloneableLocalServerHandler<___T>,
379    ___T: ::fidl_next::Transport,
380    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
381            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
382            Constraint = (),
383        >,
384{
385    async fn on_one_way(
386        handler: &mut ___H,
387        ordinal: u64,
388        flexibility: ::fidl_next::protocol::Flexibility,
389        body: ::fidl_next::Body<___T>,
390    ) -> ::core::result::Result<
391        (),
392        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
393    > {
394        match ordinal {
395            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
396                Ok(decoded) => {
397                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
398                    Ok(())
399                }
400                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
401                    ordinal: 2366825959783828089,
402                    error,
403                }),
404            },
405
406            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
407        }
408    }
409
410    async fn on_two_way(
411        handler: &mut ___H,
412        ordinal: u64,
413        flexibility: ::fidl_next::protocol::Flexibility,
414        body: ::fidl_next::Body<___T>,
415        responder: ::fidl_next::protocol::Responder<___T>,
416    ) -> ::core::result::Result<
417        (),
418        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
419    > {
420        match ordinal {
421            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
422        }
423    }
424}
425
426/// A client handler for the Cloneable protocol.
427///
428/// See [`Cloneable`] for more details.
429pub trait CloneableClientHandler<
430    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
431    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
432>
433{
434}
435
436impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
437where
438    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
439    ___T: ::fidl_next::Transport,
440{
441    async fn on_event(
442        handler: &mut ___H,
443        ordinal: u64,
444        flexibility: ::fidl_next::protocol::Flexibility,
445        body: ::fidl_next::Body<___T>,
446    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
447        match ordinal {
448            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
449        }
450    }
451}
452
453/// A server handler for the Cloneable protocol.
454///
455/// See [`Cloneable`] for more details.
456pub trait CloneableServerHandler<
457    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
458    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
459>
460{
461    fn clone(
462        &mut self,
463
464        request: ::fidl_next::Request<cloneable::Clone, ___T>,
465    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
466}
467
468impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
469where
470    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
471    ___T: ::fidl_next::Transport,
472    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
473            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
474            Constraint = (),
475        >,
476{
477    async fn on_one_way(
478        handler: &mut ___H,
479        ordinal: u64,
480        flexibility: ::fidl_next::protocol::Flexibility,
481        body: ::fidl_next::Body<___T>,
482    ) -> ::core::result::Result<
483        (),
484        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
485    > {
486        match ordinal {
487            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
488                Ok(decoded) => {
489                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
490                    Ok(())
491                }
492                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
493                    ordinal: 2366825959783828089,
494                    error,
495                }),
496            },
497
498            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
499        }
500    }
501
502    async fn on_two_way(
503        handler: &mut ___H,
504        ordinal: u64,
505        flexibility: ::fidl_next::protocol::Flexibility,
506        body: ::fidl_next::Body<___T>,
507        responder: ::fidl_next::protocol::Responder<___T>,
508    ) -> ::core::result::Result<
509        (),
510        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
511    > {
512        match ordinal {
513            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
514        }
515    }
516}
517
518impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
519    ___T: ::fidl_next::Transport
520{
521}
522
523impl<___H, ___T> CloneableLocalClientHandler<___T> for ::fidl_next::Local<___H>
524where
525    ___H: CloneableClientHandler<___T>,
526    ___T: ::fidl_next::Transport,
527{
528}
529
530impl<___H, ___T> CloneableLocalServerHandler<___T> for ::fidl_next::Local<___H>
531where
532    ___H: CloneableServerHandler<___T>,
533    ___T: ::fidl_next::Transport,
534{
535    async fn clone(&mut self, request: ::fidl_next::Request<cloneable::Clone, ___T>) {
536        ___H::clone(&mut self.0, request).await
537    }
538}
539
540pub use fidl_next_common_fuchsia_unknown::*;