Skip to main content

fdomain_next_fuchsia_unknown/
fdomain_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, ::fdomain_client::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: ::fdomain_client::fidl_next::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, ::fdomain_client::Channel> as ::fidl_next::Encode<::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>, ___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, ::fdomain_client::Channel> as ::fidl_next::FromWire<::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>>
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:
117            ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>,
118    }
119
120    static_assertions::const_assert_eq!(std::mem::size_of::<CloneableCloneRequest>(), 4);
121    static_assertions::const_assert_eq!(std::mem::align_of::<CloneableCloneRequest>(), 4);
122
123    static_assertions::const_assert_eq!(std::mem::offset_of!(CloneableCloneRequest, request), 0);
124
125    impl ::fidl_next::Constrained for CloneableCloneRequest {
126        type Constraint = ();
127
128        fn validate(
129            _: ::fidl_next::Slot<'_, Self>,
130            _: Self::Constraint,
131        ) -> Result<(), ::fidl_next::ValidationError> {
132            Ok(())
133        }
134    }
135
136    unsafe impl ::fidl_next::Wire for CloneableCloneRequest {
137        type Narrowed<'de> = CloneableCloneRequest;
138
139        #[inline]
140        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
141            ::fidl_next::munge! {
142                let Self {
143
144                    request,
145
146                } = &mut *out_;
147            }
148
149            ::fidl_next::Wire::zero_padding(request);
150        }
151    }
152
153    unsafe impl<___D> ::fidl_next::Decode<___D> for CloneableCloneRequest
154    where
155        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
156        ___D: ::fdomain_client::fidl_next::HandleDecoder,
157    {
158        fn decode(
159            slot_: ::fidl_next::Slot<'_, Self>,
160            decoder_: &mut ___D,
161            _: (),
162        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
163            ::fidl_next::munge! {
164                let Self {
165
166                    mut request,
167
168                } = slot_;
169            }
170
171            let _field = request.as_mut();
172
173            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
174
175            Ok(())
176        }
177    }
178
179    impl ::fidl_next::IntoNatural for CloneableCloneRequest {
180        type Natural = crate::natural::CloneableCloneRequest;
181    }
182}
183
184pub mod wire_optional {
185
186    pub use fidl_next_common_fuchsia_unknown::wire_optional::*;
187}
188
189pub mod generic {
190
191    pub use fidl_next_common_fuchsia_unknown::generic::*;
192
193    pub struct CloneableCloneRequest<T0> {
194        pub request: T0,
195    }
196
197    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CloneableCloneRequest, ___E>
198        for CloneableCloneRequest<T0>
199    where
200        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
201        ___E: ::fdomain_client::fidl_next::HandleEncoder,
202        T0: ::fidl_next::Encode<
203                ::fidl_next::ServerEnd<crate::Cloneable, ::fdomain_client::fidl_next::wire::Handle>,
204                ___E,
205            >,
206    {
207        #[inline]
208        fn encode(
209            self,
210            encoder_: &mut ___E,
211            out_: &mut ::core::mem::MaybeUninit<crate::wire::CloneableCloneRequest>,
212            _: (),
213        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
214            ::fidl_next::munge! {
215                let crate::wire::CloneableCloneRequest {
216
217                    request,
218
219                } = out_;
220            }
221
222            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
223
224            Ok(())
225        }
226    }
227}
228
229pub use self::natural::*;
230
231/// The type corresponding to the Cloneable protocol.
232#[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"]
233#[derive(PartialEq, Debug)]
234pub struct Cloneable;
235
236#[cfg(target_os = "fuchsia")]
237impl ::fidl_next::HasTransport for Cloneable {
238    type Transport = ::fdomain_client::Channel;
239}
240
241pub mod cloneable {
242    pub mod prelude {
243        pub use crate::{Cloneable, CloneableClientHandler, CloneableServerHandler, cloneable};
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<
285                        crate::Cloneable,
286                        ::fdomain_client::fidl_next::wire::Handle,
287                    >,
288                    <___T as ::fidl_next::Transport>::SendBuffer,
289                >,
290            ) -> ::fidl_next::SendFuture<'_, ___T>
291            where
292                <___T as ::fidl_next::Transport>::SendBuffer:
293                    ::fidl_next::encoder::InternalHandleEncoder,
294                <___T as ::fidl_next::Transport>::SendBuffer:
295                    ::fdomain_client::fidl_next::HandleEncoder,
296            {
297                self.clone_with(crate::generic::CloneableCloneRequest { request })
298            }
299
300            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
301            where
302                ___R: ::fidl_next::Encode<
303                        crate::wire::CloneableCloneRequest,
304                        <___T as ::fidl_next::Transport>::SendBuffer,
305                    >,
306            {
307                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
308                    2366825959783828089,
309                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
310                    request,
311                ))
312            }
313        }
314
315        /// The server for the `Cloneable` protocol.
316        #[repr(transparent)]
317        pub struct CloneableServer<___T: ::fidl_next::Transport> {
318            server: ::fidl_next::protocol::Server<___T>,
319        }
320
321        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
322    }
323}
324
325/// A client handler for the Cloneable protocol.
326///
327/// See [`Cloneable`] for more details.
328pub trait CloneableClientHandler<
329    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
330    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
331>
332{
333}
334
335impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
336    ___T: ::fidl_next::Transport
337{
338}
339
340impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
341where
342    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
343    ___T: ::fidl_next::Transport,
344{
345    async fn on_event(
346        handler: &mut ___H,
347        ordinal: u64,
348        flexibility: ::fidl_next::protocol::Flexibility,
349        body: ::fidl_next::Body<___T>,
350    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
351        match ordinal {
352            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
353        }
354    }
355}
356
357/// A server handler for the Cloneable protocol.
358///
359/// See [`Cloneable`] for more details.
360pub trait CloneableServerHandler<
361    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fdomain_client::Channel,
362    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
363>
364{
365    fn clone(
366        &mut self,
367
368        request: ::fidl_next::Request<cloneable::Clone, ___T>,
369    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
370}
371
372impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
373where
374    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
375    ___T: ::fidl_next::Transport,
376    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
377            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
378            Constraint = (),
379        >,
380{
381    async fn on_one_way(
382        handler: &mut ___H,
383        ordinal: u64,
384        flexibility: ::fidl_next::protocol::Flexibility,
385        body: ::fidl_next::Body<___T>,
386    ) -> ::core::result::Result<
387        (),
388        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
389    > {
390        match ordinal {
391            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
392                Ok(decoded) => {
393                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
394                    Ok(())
395                }
396                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
397                    ordinal: 2366825959783828089,
398                    error,
399                }),
400            },
401
402            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
403        }
404    }
405
406    async fn on_two_way(
407        handler: &mut ___H,
408        ordinal: u64,
409        flexibility: ::fidl_next::protocol::Flexibility,
410        body: ::fidl_next::Body<___T>,
411        responder: ::fidl_next::protocol::Responder<___T>,
412    ) -> ::core::result::Result<
413        (),
414        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
415    > {
416        match ordinal {
417            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
418        }
419    }
420}
421
422pub use fidl_next_common_fuchsia_unknown::*;