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
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: ::fidl_next::fuchsia::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
165                    mut request,
166
167                } = slot_;
168            }
169
170            let _field = request.as_mut();
171
172            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
173
174            Ok(())
175        }
176    }
177
178    impl ::fidl_next::IntoNatural for CloneableCloneRequest {
179        type Natural = crate::natural::CloneableCloneRequest;
180    }
181}
182
183pub mod wire_optional {
184
185    pub use fidl_next_common_fuchsia_unknown::wire_optional::*;
186}
187
188pub mod generic {
189
190    pub use fidl_next_common_fuchsia_unknown::generic::*;
191
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: ::fidl_next::fuchsia::HandleEncoder,
201        T0: ::fidl_next::Encode<
202                ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>,
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
216                    request,
217
218                } = out_;
219            }
220
221            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
222
223            Ok(())
224        }
225    }
226}
227
228pub use self::natural::*;
229
230/// The type corresponding to the Cloneable protocol.
231#[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"]
232#[derive(PartialEq, Debug)]
233pub struct Cloneable;
234
235#[cfg(target_os = "fuchsia")]
236impl ::fidl_next::HasTransport for Cloneable {
237    type Transport = ::fidl_next::fuchsia::zx::Channel;
238}
239
240pub mod cloneable {
241    pub mod prelude {
242        pub use crate::{Cloneable, CloneableClientHandler, CloneableServerHandler, cloneable};
243
244        pub use crate::natural::CloneableCloneRequest;
245    }
246
247    pub struct Clone;
248
249    impl ::fidl_next::Method for Clone {
250        const ORDINAL: u64 = 2366825959783828089;
251        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
252            ::fidl_next::protocol::Flexibility::Strict;
253
254        type Protocol = crate::Cloneable;
255
256        type Request = crate::wire::CloneableCloneRequest;
257    }
258
259    mod ___detail {
260        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Cloneable
261        where
262            ___T: ::fidl_next::Transport,
263        {
264            type Client = CloneableClient<___T>;
265            type Server = CloneableServer<___T>;
266        }
267
268        /// The client for the `Cloneable` protocol.
269        #[repr(transparent)]
270        pub struct CloneableClient<___T: ::fidl_next::Transport> {
271            #[allow(dead_code)]
272            client: ::fidl_next::protocol::Client<___T>,
273        }
274
275        impl<___T> CloneableClient<___T>
276        where
277            ___T: ::fidl_next::Transport,
278        {
279            pub fn clone(
280                &self,
281
282                request: impl ::fidl_next::Encode<
283                    ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>,
284                    <___T as ::fidl_next::Transport>::SendBuffer,
285                >,
286            ) -> ::fidl_next::SendFuture<'_, ___T>
287            where
288                <___T as ::fidl_next::Transport>::SendBuffer:
289                    ::fidl_next::encoder::InternalHandleEncoder,
290                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
291            {
292                self.clone_with(crate::generic::CloneableCloneRequest { request })
293            }
294
295            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
296            where
297                ___R: ::fidl_next::Encode<
298                        crate::wire::CloneableCloneRequest,
299                        <___T as ::fidl_next::Transport>::SendBuffer,
300                    >,
301            {
302                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
303                    2366825959783828089,
304                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
305                    request,
306                ))
307            }
308        }
309
310        /// The server for the `Cloneable` protocol.
311        #[repr(transparent)]
312        pub struct CloneableServer<___T: ::fidl_next::Transport> {
313            server: ::fidl_next::protocol::Server<___T>,
314        }
315
316        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
317    }
318}
319
320/// A client handler for the Cloneable protocol.
321///
322/// See [`Cloneable`] for more details.
323pub trait CloneableClientHandler<
324    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
325    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
326>
327{
328}
329
330impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
331    ___T: ::fidl_next::Transport
332{
333}
334
335impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
336where
337    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
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/// A server handler for the Cloneable protocol.
353///
354/// See [`Cloneable`] for more details.
355pub trait CloneableServerHandler<
356    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
357    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
358>
359{
360    fn clone(
361        &mut self,
362
363        request: ::fidl_next::Request<cloneable::Clone, ___T>,
364    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
365}
366
367impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
368where
369    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
370    ___T: ::fidl_next::Transport,
371    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
372            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
373            Constraint = (),
374        >,
375{
376    async fn on_one_way(
377        handler: &mut ___H,
378        ordinal: u64,
379        flexibility: ::fidl_next::protocol::Flexibility,
380        body: ::fidl_next::Body<___T>,
381    ) -> ::core::result::Result<
382        (),
383        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
384    > {
385        match ordinal {
386            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
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        ordinal: u64,
404        flexibility: ::fidl_next::protocol::Flexibility,
405        body: ::fidl_next::Body<___T>,
406        responder: ::fidl_next::protocol::Responder<___T>,
407    ) -> ::core::result::Result<
408        (),
409        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
410    > {
411        match ordinal {
412            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
413        }
414    }
415}
416
417pub use fidl_next_common_fuchsia_unknown::*;
418
419/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
420pub mod compat {
421
422    pub use fidl_next_common_fuchsia_unknown::compat::*;
423
424    impl ::fidl_next::CompatFrom<crate::CloneableCloneRequest>
425        for ::fidl_fuchsia_unknown::CloneableCloneRequest
426    {
427        #[inline]
428        fn compat_from(value: crate::CloneableCloneRequest) -> Self {
429            Self { request: ::fidl_next::CompatFrom::compat_from(value.request) }
430        }
431    }
432
433    impl ::fidl_next::CompatFrom<::fidl_fuchsia_unknown::CloneableCloneRequest>
434        for crate::CloneableCloneRequest
435    {
436        #[inline]
437        fn compat_from(value: ::fidl_fuchsia_unknown::CloneableCloneRequest) -> Self {
438            Self { request: ::fidl_next::CompatFrom::compat_from(value.request) }
439        }
440    }
441
442    #[cfg(target_os = "fuchsia")]
443    /// An alias for a client over `zx::Channel` for the `Cloneable`
444    /// protocol.
445    pub type CloneableProxy = ::fidl_next::Client<crate::Cloneable>;
446
447    impl ::fidl_next::CompatFrom<crate::Cloneable> for ::fidl_fuchsia_unknown::CloneableMarker {
448        fn compat_from(_: crate::Cloneable) -> Self {
449            Self
450        }
451    }
452
453    impl ::fidl_next::CompatFrom<::fidl_fuchsia_unknown::CloneableMarker> for crate::Cloneable {
454        fn compat_from(_: ::fidl_fuchsia_unknown::CloneableMarker) -> Self {
455            Self
456        }
457    }
458
459    #[cfg(target_os = "fuchsia")]
460
461    impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_unknown::CloneableProxy> for crate::Cloneable {
462        fn client_compat_from(
463            proxy: ::fidl_fuchsia_unknown::CloneableProxy,
464        ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
465            let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
466            let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
467            ::fidl_next::ClientDispatcher::new(client_end)
468        }
469    }
470}