Skip to main content

fidl_next_fuchsia_unknown/
fidl_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, ::fidl_next::fuchsia::zx::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: ::fidl_next::fuchsia::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, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>, ___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, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>>
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: ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>,
117    }
118
119    static_assertions::const_assert_eq!(std::mem::size_of::<CloneableCloneRequest>(), 4);
120    static_assertions::const_assert_eq!(std::mem::align_of::<CloneableCloneRequest>(), 4);
121
122    static_assertions::const_assert_eq!(std::mem::offset_of!(CloneableCloneRequest, request), 0);
123
124    impl ::fidl_next::Constrained for CloneableCloneRequest {
125        type Constraint = ();
126
127        fn validate(
128            _: ::fidl_next::Slot<'_, Self>,
129            _: Self::Constraint,
130        ) -> Result<(), ::fidl_next::ValidationError> {
131            Ok(())
132        }
133    }
134
135    unsafe impl ::fidl_next::Wire for CloneableCloneRequest {
136        type Narrowed<'de> = CloneableCloneRequest;
137
138        #[inline]
139        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
140            ::fidl_next::munge! {
141                let Self {
142                    request,
143
144                } = &mut *out_;
145            }
146
147            ::fidl_next::Wire::zero_padding(request);
148        }
149    }
150
151    unsafe impl<___D> ::fidl_next::Decode<___D> for CloneableCloneRequest
152    where
153        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
154        ___D: ::fidl_next::fuchsia::HandleDecoder,
155    {
156        fn decode(
157            slot_: ::fidl_next::Slot<'_, Self>,
158            decoder_: &mut ___D,
159            _: (),
160        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
161            ::fidl_next::munge! {
162                let Self {
163                    mut request,
164
165                } = slot_;
166            }
167
168            let _field = request.as_mut();
169
170            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
171
172            Ok(())
173        }
174    }
175
176    impl ::fidl_next::IntoNatural for CloneableCloneRequest {
177        type Natural = crate::natural::CloneableCloneRequest;
178    }
179}
180
181pub mod wire_optional {
182
183    pub use fidl_next_common_fuchsia_unknown::wire_optional::*;
184}
185
186pub mod generic {
187
188    pub use fidl_next_common_fuchsia_unknown::generic::*;
189
190    /// The generic type corresponding to [`CloneableCloneRequest`].
191    pub struct CloneableCloneRequest<T0> {
192        pub request: T0,
193    }
194
195    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>
196        for CloneableCloneRequest<T0>
197    where
198        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
199        ___E: ::fidl_next::fuchsia::HandleEncoder,
200        T0: ::fidl_next::Encode<
201                ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>,
202                ___E,
203            >,
204    {
205        #[inline]
206        fn encode(
207            self,
208            encoder_: &mut ___E,
209            out_: &mut ::core::mem::MaybeUninit<crate::wire::CloneableCloneRequest>,
210            _: (),
211        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
212            ::fidl_next::munge! {
213                let crate::wire::CloneableCloneRequest {
214                    request,
215
216                } = out_;
217            }
218
219            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
220
221            Ok(())
222        }
223    }
224}
225
226pub use self::natural::*;
227
228/// The type corresponding to the Cloneable protocol.
229#[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"]
230#[derive(PartialEq, Debug)]
231pub struct Cloneable;
232
233#[cfg(target_os = "fuchsia")]
234impl ::fidl_next::HasTransport for Cloneable {
235    type Transport = ::fidl_next::fuchsia::zx::Channel;
236}
237
238pub mod cloneable {
239    pub mod prelude {
240        pub use crate::{
241            Cloneable, CloneableClientHandler, CloneableLocalClientHandler,
242            CloneableLocalServerHandler, CloneableServerHandler, cloneable,
243        };
244
245        pub use crate::natural::CloneableCloneRequest;
246    }
247
248    pub struct Clone;
249
250    impl ::fidl_next::Method for Clone {
251        const ORDINAL: u64 = 2366825959783828089;
252        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
253            ::fidl_next::protocol::Flexibility::Strict;
254
255        type Protocol = crate::Cloneable;
256
257        type Request = crate::wire::CloneableCloneRequest;
258    }
259
260    mod ___detail {
261        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Cloneable
262        where
263            ___T: ::fidl_next::Transport,
264        {
265            type Client = CloneableClient<___T>;
266            type Server = CloneableServer<___T>;
267        }
268
269        /// The client for the `Cloneable` protocol.
270        #[repr(transparent)]
271        pub struct CloneableClient<___T: ::fidl_next::Transport> {
272            #[allow(dead_code)]
273            client: ::fidl_next::protocol::Client<___T>,
274        }
275
276        impl<___T> CloneableClient<___T>
277        where
278            ___T: ::fidl_next::Transport,
279        {
280            pub fn clone(
281                &self,
282
283                request: impl ::fidl_next::Encode<
284                    ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>,
285                    <___T as ::fidl_next::Transport>::SendBuffer,
286                >,
287            ) -> ::fidl_next::SendFuture<'_, ___T>
288            where
289                <___T as ::fidl_next::Transport>::SendBuffer:
290                    ::fidl_next::encoder::InternalHandleEncoder,
291                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
292            {
293                self.clone_with(crate::generic::CloneableCloneRequest { request })
294            }
295
296            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
297            where
298                ___R: ::fidl_next::Encode<
299                        crate::wire::CloneableCloneRequest,
300                        <___T as ::fidl_next::Transport>::SendBuffer,
301                    >,
302            {
303                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
304                    2366825959783828089,
305                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
306                    request,
307                ))
308            }
309        }
310
311        /// The server for the `Cloneable` protocol.
312        #[repr(transparent)]
313        pub struct CloneableServer<___T: ::fidl_next::Transport> {
314            server: ::fidl_next::protocol::Server<___T>,
315        }
316
317        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
318    }
319}
320
321#[diagnostic::on_unimplemented(
322    note = "If {Self} implements the non-local CloneableClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
323)]
324
325/// A client handler for the Cloneable protocol.
326///
327/// See [`Cloneable`] for more details.
328pub trait CloneableLocalClientHandler<
329    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
330    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
331>
332{
333}
334
335impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Cloneable
336where
337    ___H: CloneableLocalClientHandler<___T>,
338    ___T: ::fidl_next::Transport,
339{
340    async fn on_event(
341        handler: &mut ___H,
342        ordinal: u64,
343        flexibility: ::fidl_next::protocol::Flexibility,
344        body: ::fidl_next::Body<___T>,
345    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
346        match ordinal {
347            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
348        }
349    }
350}
351
352#[diagnostic::on_unimplemented(
353    note = "If {Self} implements the non-local CloneableServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
354)]
355
356/// A server handler for the Cloneable protocol.
357///
358/// See [`Cloneable`] for more details.
359pub trait CloneableLocalServerHandler<
360    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
361    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
362>
363{
364    fn clone(
365        &mut self,
366
367        request: ::fidl_next::Request<cloneable::Clone, ___T>,
368    ) -> impl ::core::future::Future<Output = ()>;
369}
370
371impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Cloneable
372where
373    ___H: CloneableLocalServerHandler<___T>,
374    ___T: ::fidl_next::Transport,
375    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
376            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
377            Constraint = (),
378        >,
379{
380    async fn on_one_way(
381        handler: &mut ___H,
382        ordinal: u64,
383        flexibility: ::fidl_next::protocol::Flexibility,
384        body: ::fidl_next::Body<___T>,
385    ) -> ::core::result::Result<
386        (),
387        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
388    > {
389        match ordinal {
390            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
391                Ok(decoded) => {
392                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
393                    Ok(())
394                }
395                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
396                    ordinal: 2366825959783828089,
397                    error,
398                }),
399            },
400
401            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
402        }
403    }
404
405    async fn on_two_way(
406        handler: &mut ___H,
407        ordinal: u64,
408        flexibility: ::fidl_next::protocol::Flexibility,
409        body: ::fidl_next::Body<___T>,
410        responder: ::fidl_next::protocol::Responder<___T>,
411    ) -> ::core::result::Result<
412        (),
413        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
414    > {
415        match ordinal {
416            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
417        }
418    }
419}
420
421/// A client handler for the Cloneable protocol.
422///
423/// See [`Cloneable`] for more details.
424pub trait CloneableClientHandler<
425    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
426    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
427>
428{
429}
430
431impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
432where
433    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
434    ___T: ::fidl_next::Transport,
435{
436    async fn on_event(
437        handler: &mut ___H,
438        ordinal: u64,
439        flexibility: ::fidl_next::protocol::Flexibility,
440        body: ::fidl_next::Body<___T>,
441    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
442        match ordinal {
443            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
444        }
445    }
446}
447
448/// A server handler for the Cloneable protocol.
449///
450/// See [`Cloneable`] for more details.
451pub trait CloneableServerHandler<
452    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
453    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
454>
455{
456    fn clone(
457        &mut self,
458
459        request: ::fidl_next::Request<cloneable::Clone, ___T>,
460    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
461}
462
463impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
464where
465    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
466    ___T: ::fidl_next::Transport,
467    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
468            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
469            Constraint = (),
470        >,
471{
472    async fn on_one_way(
473        handler: &mut ___H,
474        ordinal: u64,
475        flexibility: ::fidl_next::protocol::Flexibility,
476        body: ::fidl_next::Body<___T>,
477    ) -> ::core::result::Result<
478        (),
479        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
480    > {
481        match ordinal {
482            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
483                Ok(decoded) => {
484                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
485                    Ok(())
486                }
487                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
488                    ordinal: 2366825959783828089,
489                    error,
490                }),
491            },
492
493            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
494        }
495    }
496
497    async fn on_two_way(
498        handler: &mut ___H,
499        ordinal: u64,
500        flexibility: ::fidl_next::protocol::Flexibility,
501        body: ::fidl_next::Body<___T>,
502        responder: ::fidl_next::protocol::Responder<___T>,
503    ) -> ::core::result::Result<
504        (),
505        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
506    > {
507        match ordinal {
508            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
509        }
510    }
511}
512
513impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
514    ___T: ::fidl_next::Transport
515{
516}
517
518impl<___H, ___T> CloneableLocalClientHandler<___T> for ::fidl_next::Local<___H>
519where
520    ___H: CloneableClientHandler<___T>,
521    ___T: ::fidl_next::Transport,
522{
523}
524
525impl<___H, ___T> CloneableLocalServerHandler<___T> for ::fidl_next::Local<___H>
526where
527    ___H: CloneableServerHandler<___T>,
528    ___T: ::fidl_next::Transport,
529{
530    async fn clone(&mut self, request: ::fidl_next::Request<cloneable::Clone, ___T>) {
531        ___H::clone(&mut self.0, request).await
532    }
533}
534
535pub use fidl_next_common_fuchsia_unknown::*;