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(PartialEq, Debug)]
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::fuchsia::WireChannel>, ___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::WireBox<'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::WireBox<'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::WireBox::encode_present(out);
78            } else {
79                ::fidl_next::WireBox::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::fuchsia::WireChannel>>
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::fuchsia::WireChannel>,
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    unsafe impl ::fidl_next::Wire for CloneableCloneRequest {
125        type Owned<'de> = CloneableCloneRequest;
126
127        #[inline]
128        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
129            ::fidl_next::munge! {
130                let Self {
131
132                    request,
133
134                } = &mut *out_;
135            }
136
137            ::fidl_next::Wire::zero_padding(request);
138        }
139    }
140
141    unsafe impl<___D> ::fidl_next::Decode<___D> for CloneableCloneRequest
142    where
143        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
144        ___D: ::fidl_next::fuchsia::HandleDecoder,
145    {
146        fn decode(
147            slot_: ::fidl_next::Slot<'_, Self>,
148            decoder_: &mut ___D,
149            _: (),
150        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
151            ::fidl_next::munge! {
152                let Self {
153
154                    mut request,
155
156                } = slot_;
157            }
158
159            let _field = request.as_mut();
160
161            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
162
163            Ok(())
164        }
165    }
166
167    impl ::fidl_next::IntoNatural for CloneableCloneRequest {
168        type Natural = crate::natural::CloneableCloneRequest;
169    }
170
171    impl ::fidl_next::Unconstrained for CloneableCloneRequest {}
172}
173
174pub mod wire_optional {
175
176    pub use fidl_next_common_fuchsia_unknown::wire_optional::*;
177}
178
179pub mod generic {
180
181    pub use fidl_next_common_fuchsia_unknown::generic::*;
182
183    pub struct CloneableCloneRequest<T0> {
184        pub request: T0,
185    }
186
187    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>
188        for CloneableCloneRequest<T0>
189    where
190        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
191        ___E: ::fidl_next::fuchsia::HandleEncoder,
192        T0: ::fidl_next::Encode<
193                ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::fuchsia::WireChannel>,
194                ___E,
195            >,
196    {
197        #[inline]
198        fn encode(
199            self,
200            encoder_: &mut ___E,
201            out_: &mut ::core::mem::MaybeUninit<crate::wire::CloneableCloneRequest>,
202            _: (),
203        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
204            ::fidl_next::munge! {
205                let crate::wire::CloneableCloneRequest {
206
207                    request,
208
209                } = out_;
210            }
211
212            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
213
214            Ok(())
215        }
216    }
217}
218
219pub use self::natural::*;
220
221/// The type corresponding to the Cloneable protocol.
222#[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"]
223#[derive(PartialEq, Debug)]
224pub struct Cloneable;
225
226#[cfg(target_os = "fuchsia")]
227impl ::fidl_next::HasTransport for Cloneable {
228    type Transport = ::fidl_next::fuchsia::zx::Channel;
229}
230
231pub mod cloneable {
232    pub mod prelude {
233        pub use crate::{Cloneable, CloneableClientHandler, CloneableServerHandler, cloneable};
234
235        pub use crate::natural::CloneableCloneRequest;
236    }
237
238    pub struct Clone;
239
240    impl ::fidl_next::Method for Clone {
241        const ORDINAL: u64 = 2366825959783828089;
242        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
243            ::fidl_next::protocol::Flexibility::Strict;
244
245        type Protocol = crate::Cloneable;
246
247        type Request = crate::wire::CloneableCloneRequest;
248    }
249
250    mod ___detail {
251        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Cloneable
252        where
253            ___T: ::fidl_next::Transport,
254        {
255            type Client = CloneableClient<___T>;
256            type Server = CloneableServer<___T>;
257        }
258
259        /// The client for the `Cloneable` protocol.
260        #[repr(transparent)]
261        pub struct CloneableClient<___T: ::fidl_next::Transport> {
262            #[allow(dead_code)]
263            client: ::fidl_next::protocol::Client<___T>,
264        }
265
266        impl<___T> CloneableClient<___T>
267        where
268            ___T: ::fidl_next::Transport,
269        {
270            pub fn clone(
271                &self,
272
273                request: impl ::fidl_next::Encode<
274                    ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::fuchsia::WireChannel>,
275                    <___T as ::fidl_next::Transport>::SendBuffer,
276                >,
277            ) -> ::fidl_next::SendFuture<'_, ___T>
278            where
279                <___T as ::fidl_next::Transport>::SendBuffer:
280                    ::fidl_next::encoder::InternalHandleEncoder,
281                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
282            {
283                self.clone_with(crate::generic::CloneableCloneRequest { request })
284            }
285
286            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
287            where
288                ___R: ::fidl_next::Encode<
289                        crate::wire::CloneableCloneRequest,
290                        <___T as ::fidl_next::Transport>::SendBuffer,
291                    >,
292            {
293                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
294                    2366825959783828089,
295                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
296                    request,
297                ))
298            }
299        }
300
301        /// The server for the `Cloneable` protocol.
302        #[repr(transparent)]
303        pub struct CloneableServer<___T: ::fidl_next::Transport> {
304            server: ::fidl_next::protocol::Server<___T>,
305        }
306
307        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
308    }
309}
310
311/// A client handler for the Cloneable protocol.
312///
313/// See [`Cloneable`] for more details.
314pub trait CloneableClientHandler<
315    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
316    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
317>
318{
319}
320
321impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
322    ___T: ::fidl_next::Transport
323{
324}
325
326impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
327where
328    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
329    ___T: ::fidl_next::Transport,
330{
331    async fn on_event(
332        handler: &mut ___H,
333        ordinal: u64,
334        flexibility: ::fidl_next::protocol::Flexibility,
335        buffer: ___T::RecvBuffer,
336    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
337        match ordinal {
338            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
339        }
340    }
341}
342
343/// A server handler for the Cloneable protocol.
344///
345/// See [`Cloneable`] for more details.
346pub trait CloneableServerHandler<
347    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
348    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
349>
350{
351    fn clone(
352        &mut self,
353
354        request: ::fidl_next::Request<cloneable::Clone, ___T>,
355    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
356}
357
358impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
359where
360    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
361    ___T: ::fidl_next::Transport,
362    <cloneable::Clone as ::fidl_next::Method>::Request:
363        ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
364{
365    async fn on_one_way(
366        handler: &mut ___H,
367        ordinal: u64,
368        flexibility: ::fidl_next::protocol::Flexibility,
369        buffer: ___T::RecvBuffer,
370    ) -> ::core::result::Result<
371        (),
372        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
373    > {
374        match ordinal {
375            2366825959783828089 => match ::fidl_next::DecoderExt::decode(buffer) {
376                Ok(decoded) => {
377                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
378                    Ok(())
379                }
380                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
381                    ordinal: 2366825959783828089,
382                    error,
383                }),
384            },
385
386            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
387        }
388    }
389
390    async fn on_two_way(
391        handler: &mut ___H,
392        ordinal: u64,
393        flexibility: ::fidl_next::protocol::Flexibility,
394        buffer: ___T::RecvBuffer,
395        responder: ::fidl_next::protocol::Responder<___T>,
396    ) -> ::core::result::Result<
397        (),
398        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
399    > {
400        match ordinal {
401            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
402        }
403    }
404}
405
406pub use fidl_next_common_fuchsia_unknown::*;
407
408/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
409pub mod compat {
410
411    pub use fidl_next_common_fuchsia_unknown::compat::*;
412
413    impl ::fidl_next::CompatFrom<crate::CloneableCloneRequest>
414        for ::fidl_fuchsia_unknown::CloneableCloneRequest
415    {
416        #[inline]
417        fn compat_from(value: crate::CloneableCloneRequest) -> Self {
418            Self { request: ::fidl_next::CompatFrom::compat_from(value.request) }
419        }
420    }
421
422    impl ::fidl_next::CompatFrom<::fidl_fuchsia_unknown::CloneableCloneRequest>
423        for crate::CloneableCloneRequest
424    {
425        #[inline]
426        fn compat_from(value: ::fidl_fuchsia_unknown::CloneableCloneRequest) -> Self {
427            Self { request: ::fidl_next::CompatFrom::compat_from(value.request) }
428        }
429    }
430
431    #[cfg(target_os = "fuchsia")]
432    /// An alias for a client over `zx::Channel` for the `Cloneable`
433    /// protocol.
434    pub type CloneableProxy = ::fidl_next::Client<crate::Cloneable>;
435
436    impl ::fidl_next::CompatFrom<crate::Cloneable> for ::fidl_fuchsia_unknown::CloneableMarker {
437        fn compat_from(_: crate::Cloneable) -> Self {
438            Self
439        }
440    }
441
442    impl ::fidl_next::CompatFrom<::fidl_fuchsia_unknown::CloneableMarker> for crate::Cloneable {
443        fn compat_from(_: ::fidl_fuchsia_unknown::CloneableMarker) -> Self {
444            Self
445        }
446    }
447
448    #[cfg(target_os = "fuchsia")]
449
450    impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_unknown::CloneableProxy> for crate::Cloneable {
451        fn client_compat_from(
452            proxy: ::fidl_fuchsia_unknown::CloneableProxy,
453        ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
454            let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
455            let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
456            ::fidl_next::ClientDispatcher::new(client_end)
457        }
458    }
459}