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        mut message: ::fidl_next::Message<___T>,
348    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
349        match *message.header().ordinal {
350            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
351        }
352    }
353}
354
355#[diagnostic::on_unimplemented(
356    note = "If {Self} implements the non-local CloneableServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
357)]
358
359/// A server handler for the Cloneable protocol.
360///
361/// See [`Cloneable`] for more details.
362pub trait CloneableLocalServerHandler<
363    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
364    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
365>
366{
367    fn clone(
368        &mut self,
369
370        request: ::fidl_next::Request<cloneable::Clone, ___T>,
371    ) -> impl ::core::future::Future<Output = ()>;
372}
373
374impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Cloneable
375where
376    ___H: CloneableLocalServerHandler<___T>,
377    ___T: ::fidl_next::Transport,
378    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
379            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
380            Constraint = (),
381        >,
382{
383    async fn on_one_way(
384        handler: &mut ___H,
385        mut message: ::fidl_next::Message<___T>,
386    ) -> ::core::result::Result<
387        (),
388        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
389    > {
390        match *message.header().ordinal {
391            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
392                Ok(decoded) => {
393                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
394                    Ok(())
395                }
396                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
397                    ordinal: 2366825959783828089,
398                    error,
399                }),
400            },
401
402            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
403        }
404    }
405
406    async fn on_two_way(
407        handler: &mut ___H,
408        mut message: ::fidl_next::Message<___T>,
409        responder: ::fidl_next::protocol::Responder<___T>,
410    ) -> ::core::result::Result<
411        (),
412        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
413    > {
414        match *message.header().ordinal {
415            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
416        }
417    }
418}
419
420/// A client handler for the Cloneable protocol.
421///
422/// See [`Cloneable`] for more details.
423pub trait CloneableClientHandler<
424    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
425    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
426>
427{
428}
429
430impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
431where
432    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
433    ___T: ::fidl_next::Transport,
434{
435    async fn on_event(
436        handler: &mut ___H,
437        mut message: ::fidl_next::Message<___T>,
438    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
439        match *message.header().ordinal {
440            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
441        }
442    }
443}
444
445/// A server handler for the Cloneable protocol.
446///
447/// See [`Cloneable`] for more details.
448pub trait CloneableServerHandler<
449    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
450    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
451>
452{
453    fn clone(
454        &mut self,
455
456        request: ::fidl_next::Request<cloneable::Clone, ___T>,
457    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
458}
459
460impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
461where
462    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
463    ___T: ::fidl_next::Transport,
464    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
465            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
466            Constraint = (),
467        >,
468{
469    async fn on_one_way(
470        handler: &mut ___H,
471        mut message: ::fidl_next::Message<___T>,
472    ) -> ::core::result::Result<
473        (),
474        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
475    > {
476        match *message.header().ordinal {
477            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
478                Ok(decoded) => {
479                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
480                    Ok(())
481                }
482                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
483                    ordinal: 2366825959783828089,
484                    error,
485                }),
486            },
487
488            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
489        }
490    }
491
492    async fn on_two_way(
493        handler: &mut ___H,
494        mut message: ::fidl_next::Message<___T>,
495        responder: ::fidl_next::protocol::Responder<___T>,
496    ) -> ::core::result::Result<
497        (),
498        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
499    > {
500        match *message.header().ordinal {
501            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
502        }
503    }
504}
505
506impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
507    ___T: ::fidl_next::Transport
508{
509}
510
511impl<___H, ___T> CloneableLocalClientHandler<___T> for ::fidl_next::Local<___H>
512where
513    ___H: CloneableClientHandler<___T>,
514    ___T: ::fidl_next::Transport,
515{
516}
517
518impl<___H, ___T> CloneableLocalServerHandler<___T> for ::fidl_next::Local<___H>
519where
520    ___H: CloneableServerHandler<___T>,
521    ___T: ::fidl_next::Transport,
522{
523    async fn clone(&mut self, request: ::fidl_next::Request<cloneable::Clone, ___T>) {
524        ___H::clone(&mut self.0, request).await
525    }
526}
527
528pub use fidl_next_common_fuchsia_unknown::*;