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::{Cloneable, CloneableClientHandler, CloneableServerHandler, cloneable};
241
242        pub use crate::natural::CloneableCloneRequest;
243    }
244
245    pub struct Clone;
246
247    impl ::fidl_next::Method for Clone {
248        const ORDINAL: u64 = 2366825959783828089;
249        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
250            ::fidl_next::protocol::Flexibility::Strict;
251
252        type Protocol = crate::Cloneable;
253
254        type Request = crate::wire::CloneableCloneRequest;
255    }
256
257    mod ___detail {
258        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Cloneable
259        where
260            ___T: ::fidl_next::Transport,
261        {
262            type Client = CloneableClient<___T>;
263            type Server = CloneableServer<___T>;
264        }
265
266        /// The client for the `Cloneable` protocol.
267        #[repr(transparent)]
268        pub struct CloneableClient<___T: ::fidl_next::Transport> {
269            #[allow(dead_code)]
270            client: ::fidl_next::protocol::Client<___T>,
271        }
272
273        impl<___T> CloneableClient<___T>
274        where
275            ___T: ::fidl_next::Transport,
276        {
277            pub fn clone(
278                &self,
279
280                request: impl ::fidl_next::Encode<
281                    ::fidl_next::ServerEnd<crate::Cloneable, ::fidl_next::wire::fuchsia::Channel>,
282                    <___T as ::fidl_next::Transport>::SendBuffer,
283                >,
284            ) -> ::fidl_next::SendFuture<'_, ___T>
285            where
286                <___T as ::fidl_next::Transport>::SendBuffer:
287                    ::fidl_next::encoder::InternalHandleEncoder,
288                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
289            {
290                self.clone_with(crate::generic::CloneableCloneRequest { request })
291            }
292
293            pub fn clone_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
294            where
295                ___R: ::fidl_next::Encode<
296                        crate::wire::CloneableCloneRequest,
297                        <___T as ::fidl_next::Transport>::SendBuffer,
298                    >,
299            {
300                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
301                    2366825959783828089,
302                    <super::Clone as ::fidl_next::Method>::FLEXIBILITY,
303                    request,
304                ))
305            }
306        }
307
308        /// The server for the `Cloneable` protocol.
309        #[repr(transparent)]
310        pub struct CloneableServer<___T: ::fidl_next::Transport> {
311            server: ::fidl_next::protocol::Server<___T>,
312        }
313
314        impl<___T> CloneableServer<___T> where ___T: ::fidl_next::Transport {}
315    }
316}
317
318/// A client handler for the Cloneable protocol.
319///
320/// See [`Cloneable`] for more details.
321pub trait CloneableClientHandler<
322    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
323    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
324>
325{
326}
327
328impl<___T> CloneableClientHandler<___T> for ::fidl_next::IgnoreEvents where
329    ___T: ::fidl_next::Transport
330{
331}
332
333impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Cloneable
334where
335    ___H: CloneableClientHandler<___T> + ::core::marker::Send,
336    ___T: ::fidl_next::Transport,
337{
338    async fn on_event(
339        handler: &mut ___H,
340        ordinal: u64,
341        flexibility: ::fidl_next::protocol::Flexibility,
342        body: ::fidl_next::Body<___T>,
343    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
344        match ordinal {
345            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
346        }
347    }
348}
349
350/// A server handler for the Cloneable protocol.
351///
352/// See [`Cloneable`] for more details.
353pub trait CloneableServerHandler<
354    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
355    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
356>
357{
358    fn clone(
359        &mut self,
360
361        request: ::fidl_next::Request<cloneable::Clone, ___T>,
362    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
363}
364
365impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Cloneable
366where
367    ___H: CloneableServerHandler<___T> + ::core::marker::Send,
368    ___T: ::fidl_next::Transport,
369    for<'de> crate::wire::CloneableCloneRequest: ::fidl_next::Decode<
370            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
371            Constraint = (),
372        >,
373{
374    async fn on_one_way(
375        handler: &mut ___H,
376        ordinal: u64,
377        flexibility: ::fidl_next::protocol::Flexibility,
378        body: ::fidl_next::Body<___T>,
379    ) -> ::core::result::Result<
380        (),
381        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
382    > {
383        match ordinal {
384            2366825959783828089 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
385                Ok(decoded) => {
386                    handler.clone(::fidl_next::Request::from_decoded(decoded)).await;
387                    Ok(())
388                }
389                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
390                    ordinal: 2366825959783828089,
391                    error,
392                }),
393            },
394
395            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
396        }
397    }
398
399    async fn on_two_way(
400        handler: &mut ___H,
401        ordinal: u64,
402        flexibility: ::fidl_next::protocol::Flexibility,
403        body: ::fidl_next::Body<___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 ordinal {
410            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
411        }
412    }
413}
414
415pub use fidl_next_common_fuchsia_unknown::*;