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