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