Skip to main content

fidl_next_fuchsia_examples/
fidl_next_fuchsia_examples.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_examples::natural::*;
8
9    #[derive(Debug, PartialEq)]
10    #[repr(C)]
11    pub struct EchoLauncherGetEchoResponse {
12        pub response: ::fidl_next::ClientEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
13    }
14
15    unsafe impl<___E> ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoResponse, ___E>
16        for EchoLauncherGetEchoResponse
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::EchoLauncherGetEchoResponse,
24        > = unsafe {
25            ::fidl_next::CopyOptimization::enable_if(
26            true
27
28                && <
29                    ::fidl_next::ClientEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::Encode<::fidl_next::ClientEnd<crate::Echo, ::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::EchoLauncherGetEchoResponse>,
40            _: (),
41        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42            ::fidl_next::munge! {
43                let crate::wire::EchoLauncherGetEchoResponse {
44                    response,
45
46                } = out_;
47            }
48
49            ::fidl_next::Encode::encode(self.response, encoder_, response, ())?;
50
51            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(response.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::EchoLauncherGetEchoResponse>,
60            ___E,
61        > for EchoLauncherGetEchoResponse
62    where
63        ___E: ::fidl_next::Encoder + ?Sized,
64        EchoLauncherGetEchoResponse:
65            ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoResponse, ___E>,
66    {
67        #[inline]
68        fn encode_option(
69            this: ::core::option::Option<Self>,
70            encoder: &mut ___E,
71            out: &mut ::core::mem::MaybeUninit<
72                ::fidl_next::wire::Box<'static, crate::wire::EchoLauncherGetEchoResponse>,
73            >,
74            _: (),
75        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
76            if let Some(inner) = this {
77                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
78                ::fidl_next::wire::Box::encode_present(out);
79            } else {
80                ::fidl_next::wire::Box::encode_absent(out);
81            }
82
83            Ok(())
84        }
85    }
86
87    impl ::fidl_next::FromWire<crate::wire::EchoLauncherGetEchoResponse>
88        for EchoLauncherGetEchoResponse
89    {
90        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
91            crate::wire::EchoLauncherGetEchoResponse,
92            Self,
93        > = unsafe {
94            ::fidl_next::CopyOptimization::enable_if(
95            true
96
97                && <
98                    ::fidl_next::ClientEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel> as ::fidl_next::FromWire<::fidl_next::ClientEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>>
99                >::COPY_OPTIMIZATION.is_enabled()
100
101        )
102        };
103
104        #[inline]
105        fn from_wire(wire: crate::wire::EchoLauncherGetEchoResponse) -> Self {
106            Self { response: ::fidl_next::FromWire::from_wire(wire.response) }
107        }
108    }
109
110    #[derive(Debug, PartialEq)]
111    pub struct EchoLauncherGetEchoPipelinedRequest {
112        pub echo_prefix: ::std::string::String,
113
114        pub request: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
115    }
116
117    unsafe impl<___E>
118        ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>, ___E>
119        for EchoLauncherGetEchoPipelinedRequest
120    where
121        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
122        ___E: ::fidl_next::Encoder,
123        ___E: ::fidl_next::fuchsia::HandleEncoder,
124    {
125        #[inline]
126        fn encode(
127            self,
128            encoder_: &mut ___E,
129            out_: &mut ::core::mem::MaybeUninit<
130                crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
131            >,
132            _: (),
133        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
134            ::fidl_next::munge! {
135                let crate::wire::EchoLauncherGetEchoPipelinedRequest {
136                    echo_prefix,
137                    request,
138
139                } = out_;
140            }
141
142            ::fidl_next::Encode::encode(self.echo_prefix, encoder_, echo_prefix, 32)?;
143
144            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(echo_prefix.as_mut_ptr()) };
145            ::fidl_next::Constrained::validate(_field, 32)?;
146
147            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
148
149            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(request.as_mut_ptr()) };
150
151            Ok(())
152        }
153    }
154
155    unsafe impl<___E>
156        ::fidl_next::EncodeOption<
157            ::fidl_next::wire::Box<
158                'static,
159                crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
160            >,
161            ___E,
162        > for EchoLauncherGetEchoPipelinedRequest
163    where
164        ___E: ::fidl_next::Encoder + ?Sized,
165        EchoLauncherGetEchoPipelinedRequest:
166            ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>, ___E>,
167    {
168        #[inline]
169        fn encode_option(
170            this: ::core::option::Option<Self>,
171            encoder: &mut ___E,
172            out: &mut ::core::mem::MaybeUninit<
173                ::fidl_next::wire::Box<
174                    'static,
175                    crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
176                >,
177            >,
178            _: (),
179        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
180            if let Some(inner) = this {
181                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
182                ::fidl_next::wire::Box::encode_present(out);
183            } else {
184                ::fidl_next::wire::Box::encode_absent(out);
185            }
186
187            Ok(())
188        }
189    }
190
191    impl<'de> ::fidl_next::FromWire<crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>>
192        for EchoLauncherGetEchoPipelinedRequest
193    {
194        #[inline]
195        fn from_wire(wire: crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>) -> Self {
196            Self {
197                echo_prefix: ::fidl_next::FromWire::from_wire(wire.echo_prefix),
198
199                request: ::fidl_next::FromWire::from_wire(wire.request),
200            }
201        }
202    }
203
204    #[derive(Debug, PartialEq)]
205    #[repr(C)]
206    pub struct EventStruct {
207        pub event: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
208    }
209
210    unsafe impl<___E> ::fidl_next::Encode<crate::wire::EventStruct, ___E> for EventStruct
211    where
212        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
213        ___E: ::fidl_next::fuchsia::HandleEncoder,
214    {
215        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::EventStruct> = unsafe {
216            ::fidl_next::CopyOptimization::enable_if(
217            true
218
219                && <
220                    ::core::option::Option<::fidl_next::fuchsia::zx::Event> as ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEvent, ___E>
221                >::COPY_OPTIMIZATION.is_enabled()
222
223        )
224        };
225
226        #[inline]
227        fn encode(
228            self,
229            encoder_: &mut ___E,
230            out_: &mut ::core::mem::MaybeUninit<crate::wire::EventStruct>,
231            _: (),
232        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
233            ::fidl_next::munge! {
234                let crate::wire::EventStruct {
235                    event,
236
237                } = out_;
238            }
239
240            ::fidl_next::Encode::encode(self.event, encoder_, event, ())?;
241
242            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(event.as_mut_ptr()) };
243
244            Ok(())
245        }
246    }
247
248    unsafe impl<___E>
249        ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::EventStruct>, ___E>
250        for EventStruct
251    where
252        ___E: ::fidl_next::Encoder + ?Sized,
253        EventStruct: ::fidl_next::Encode<crate::wire::EventStruct, ___E>,
254    {
255        #[inline]
256        fn encode_option(
257            this: ::core::option::Option<Self>,
258            encoder: &mut ___E,
259            out: &mut ::core::mem::MaybeUninit<
260                ::fidl_next::wire::Box<'static, crate::wire::EventStruct>,
261            >,
262            _: (),
263        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
264            if let Some(inner) = this {
265                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
266                ::fidl_next::wire::Box::encode_present(out);
267            } else {
268                ::fidl_next::wire::Box::encode_absent(out);
269            }
270
271            Ok(())
272        }
273    }
274
275    impl ::fidl_next::FromWire<crate::wire::EventStruct> for EventStruct {
276        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::EventStruct, Self> = unsafe {
277            ::fidl_next::CopyOptimization::enable_if(
278            true
279
280                && <
281                    ::core::option::Option<::fidl_next::fuchsia::zx::Event> as ::fidl_next::FromWire<::fidl_next::wire::fuchsia::OptionalEvent>
282                >::COPY_OPTIMIZATION.is_enabled()
283
284        )
285        };
286
287        #[inline]
288        fn from_wire(wire: crate::wire::EventStruct) -> Self {
289            Self { event: ::fidl_next::FromWire::from_wire(wire.event) }
290        }
291    }
292}
293
294pub mod wire {
295
296    pub use fidl_next_common_fuchsia_examples::wire::*;
297
298    /// The wire type corresponding to [`EchoLauncherGetEchoResponse`].
299    #[derive(Debug)]
300    #[repr(C)]
301    pub struct EchoLauncherGetEchoResponse {
302        pub response: ::fidl_next::ClientEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
303    }
304
305    static_assertions::const_assert_eq!(std::mem::size_of::<EchoLauncherGetEchoResponse>(), 4);
306    static_assertions::const_assert_eq!(std::mem::align_of::<EchoLauncherGetEchoResponse>(), 4);
307
308    static_assertions::const_assert_eq!(
309        std::mem::offset_of!(EchoLauncherGetEchoResponse, response),
310        0
311    );
312
313    impl ::fidl_next::Constrained for EchoLauncherGetEchoResponse {
314        type Constraint = ();
315
316        fn validate(
317            _: ::fidl_next::Slot<'_, Self>,
318            _: Self::Constraint,
319        ) -> Result<(), ::fidl_next::ValidationError> {
320            Ok(())
321        }
322    }
323
324    unsafe impl ::fidl_next::Wire for EchoLauncherGetEchoResponse {
325        type Narrowed<'de> = EchoLauncherGetEchoResponse;
326
327        #[inline]
328        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
329            ::fidl_next::munge! {
330                let Self {
331                    response,
332
333                } = &mut *out_;
334            }
335
336            ::fidl_next::Wire::zero_padding(response);
337        }
338    }
339
340    unsafe impl<___D> ::fidl_next::Decode<___D> for EchoLauncherGetEchoResponse
341    where
342        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
343        ___D: ::fidl_next::fuchsia::HandleDecoder,
344    {
345        fn decode(
346            slot_: ::fidl_next::Slot<'_, Self>,
347            decoder_: &mut ___D,
348            _: (),
349        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
350            ::fidl_next::munge! {
351                let Self {
352                    mut response,
353
354                } = slot_;
355            }
356
357            let _field = response.as_mut();
358
359            ::fidl_next::Decode::decode(response.as_mut(), decoder_, ())?;
360
361            Ok(())
362        }
363    }
364
365    impl ::fidl_next::IntoNatural for EchoLauncherGetEchoResponse {
366        type Natural = crate::natural::EchoLauncherGetEchoResponse;
367    }
368
369    /// The wire type corresponding to [`EchoLauncherGetEchoPipelinedRequest`].
370    #[derive(Debug)]
371    #[repr(C)]
372    pub struct EchoLauncherGetEchoPipelinedRequest<'de> {
373        pub echo_prefix: ::fidl_next::wire::String<'de>,
374
375        pub request: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
376    }
377
378    static_assertions::const_assert_eq!(
379        std::mem::size_of::<EchoLauncherGetEchoPipelinedRequest<'_>>(),
380        24
381    );
382    static_assertions::const_assert_eq!(
383        std::mem::align_of::<EchoLauncherGetEchoPipelinedRequest<'_>>(),
384        8
385    );
386
387    static_assertions::const_assert_eq!(
388        std::mem::offset_of!(EchoLauncherGetEchoPipelinedRequest<'_>, echo_prefix),
389        0
390    );
391
392    static_assertions::const_assert_eq!(
393        std::mem::offset_of!(EchoLauncherGetEchoPipelinedRequest<'_>, request),
394        16
395    );
396
397    impl ::fidl_next::Constrained for EchoLauncherGetEchoPipelinedRequest<'_> {
398        type Constraint = ();
399
400        fn validate(
401            _: ::fidl_next::Slot<'_, Self>,
402            _: Self::Constraint,
403        ) -> Result<(), ::fidl_next::ValidationError> {
404            Ok(())
405        }
406    }
407
408    unsafe impl ::fidl_next::Wire for EchoLauncherGetEchoPipelinedRequest<'static> {
409        type Narrowed<'de> = EchoLauncherGetEchoPipelinedRequest<'de>;
410
411        #[inline]
412        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
413            ::fidl_next::munge! {
414                let Self {
415                    echo_prefix,
416                    request,
417
418                } = &mut *out_;
419            }
420
421            ::fidl_next::Wire::zero_padding(echo_prefix);
422
423            ::fidl_next::Wire::zero_padding(request);
424
425            unsafe {
426                out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
427            }
428        }
429    }
430
431    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for EchoLauncherGetEchoPipelinedRequest<'de>
432    where
433        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
434        ___D: ::fidl_next::Decoder<'de>,
435        ___D: ::fidl_next::fuchsia::HandleDecoder,
436    {
437        fn decode(
438            slot_: ::fidl_next::Slot<'_, Self>,
439            decoder_: &mut ___D,
440            _: (),
441        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
442            if slot_.as_bytes()[20..24] != [0u8; 4] {
443                return Err(::fidl_next::DecodeError::InvalidPadding);
444            }
445
446            ::fidl_next::munge! {
447                let Self {
448                    mut echo_prefix,
449                    mut request,
450
451                } = slot_;
452            }
453
454            let _field = echo_prefix.as_mut();
455            ::fidl_next::Constrained::validate(_field, 32)?;
456            ::fidl_next::Decode::decode(echo_prefix.as_mut(), decoder_, 32)?;
457
458            let echo_prefix = unsafe { echo_prefix.deref_unchecked() };
459
460            if echo_prefix.len() > 32 {
461                return Err(::fidl_next::DecodeError::VectorTooLong {
462                    size: echo_prefix.len() as u64,
463                    limit: 32,
464                });
465            }
466
467            let _field = request.as_mut();
468
469            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
470
471            Ok(())
472        }
473    }
474
475    impl<'de> ::fidl_next::IntoNatural for EchoLauncherGetEchoPipelinedRequest<'de> {
476        type Natural = crate::natural::EchoLauncherGetEchoPipelinedRequest;
477    }
478
479    /// The wire type corresponding to [`EventStruct`].
480    #[derive(Debug)]
481    #[repr(C)]
482    pub struct EventStruct {
483        pub event: ::fidl_next::wire::fuchsia::OptionalEvent,
484    }
485
486    static_assertions::const_assert_eq!(std::mem::size_of::<EventStruct>(), 4);
487    static_assertions::const_assert_eq!(std::mem::align_of::<EventStruct>(), 4);
488
489    static_assertions::const_assert_eq!(std::mem::offset_of!(EventStruct, event), 0);
490
491    impl ::fidl_next::Constrained for EventStruct {
492        type Constraint = ();
493
494        fn validate(
495            _: ::fidl_next::Slot<'_, Self>,
496            _: Self::Constraint,
497        ) -> Result<(), ::fidl_next::ValidationError> {
498            Ok(())
499        }
500    }
501
502    unsafe impl ::fidl_next::Wire for EventStruct {
503        type Narrowed<'de> = EventStruct;
504
505        #[inline]
506        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
507            ::fidl_next::munge! {
508                let Self {
509                    event,
510
511                } = &mut *out_;
512            }
513
514            ::fidl_next::Wire::zero_padding(event);
515        }
516    }
517
518    unsafe impl<___D> ::fidl_next::Decode<___D> for EventStruct
519    where
520        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
521        ___D: ::fidl_next::fuchsia::HandleDecoder,
522    {
523        fn decode(
524            slot_: ::fidl_next::Slot<'_, Self>,
525            decoder_: &mut ___D,
526            _: (),
527        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
528            ::fidl_next::munge! {
529                let Self {
530                    mut event,
531
532                } = slot_;
533            }
534
535            let _field = event.as_mut();
536
537            ::fidl_next::Decode::decode(event.as_mut(), decoder_, ())?;
538
539            Ok(())
540        }
541    }
542
543    impl ::fidl_next::IntoNatural for EventStruct {
544        type Natural = crate::natural::EventStruct;
545    }
546}
547
548pub mod wire_optional {
549
550    pub use fidl_next_common_fuchsia_examples::wire_optional::*;
551}
552
553pub mod generic {
554
555    pub use fidl_next_common_fuchsia_examples::generic::*;
556
557    /// The generic type corresponding to [`EchoLauncherGetEchoResponse`].
558    pub struct EchoLauncherGetEchoResponse<T0> {
559        pub response: T0,
560    }
561
562    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoResponse, ___E>
563        for EchoLauncherGetEchoResponse<T0>
564    where
565        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
566        ___E: ::fidl_next::fuchsia::HandleEncoder,
567        T0: ::fidl_next::Encode<
568                ::fidl_next::ClientEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
569                ___E,
570            >,
571    {
572        #[inline]
573        fn encode(
574            self,
575            encoder_: &mut ___E,
576            out_: &mut ::core::mem::MaybeUninit<crate::wire::EchoLauncherGetEchoResponse>,
577            _: (),
578        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
579            ::fidl_next::munge! {
580                let crate::wire::EchoLauncherGetEchoResponse {
581                    response,
582
583                } = out_;
584            }
585
586            ::fidl_next::Encode::encode(self.response, encoder_, response, ())?;
587
588            Ok(())
589        }
590    }
591
592    /// The generic type corresponding to [`EchoLauncherGetEchoPipelinedRequest`].
593    pub struct EchoLauncherGetEchoPipelinedRequest<T0, T1> {
594        pub echo_prefix: T0,
595
596        pub request: T1,
597    }
598
599    unsafe impl<___E, T0, T1>
600        ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>, ___E>
601        for EchoLauncherGetEchoPipelinedRequest<T0, T1>
602    where
603        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
604        ___E: ::fidl_next::Encoder,
605        ___E: ::fidl_next::fuchsia::HandleEncoder,
606        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
607        T1: ::fidl_next::Encode<
608                ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
609                ___E,
610            >,
611    {
612        #[inline]
613        fn encode(
614            self,
615            encoder_: &mut ___E,
616            out_: &mut ::core::mem::MaybeUninit<
617                crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
618            >,
619            _: (),
620        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
621            ::fidl_next::munge! {
622                let crate::wire::EchoLauncherGetEchoPipelinedRequest {
623                    echo_prefix,
624                    request,
625
626                } = out_;
627            }
628
629            ::fidl_next::Encode::encode(self.echo_prefix, encoder_, echo_prefix, 32)?;
630
631            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
632
633            Ok(())
634        }
635    }
636
637    /// The generic type corresponding to [`EventStruct`].
638    pub struct EventStruct<T0> {
639        pub event: T0,
640    }
641
642    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::EventStruct, ___E> for EventStruct<T0>
643    where
644        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
645        ___E: ::fidl_next::fuchsia::HandleEncoder,
646        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEvent, ___E>,
647    {
648        #[inline]
649        fn encode(
650            self,
651            encoder_: &mut ___E,
652            out_: &mut ::core::mem::MaybeUninit<crate::wire::EventStruct>,
653            _: (),
654        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
655            ::fidl_next::munge! {
656                let crate::wire::EventStruct {
657                    event,
658
659                } = out_;
660            }
661
662            ::fidl_next::Encode::encode(self.event, encoder_, event, ())?;
663
664            Ok(())
665        }
666    }
667}
668
669pub use self::natural::*;
670
671/// The type corresponding to the EchoLauncher protocol.
672#[derive(PartialEq, Debug)]
673pub struct EchoLauncher;
674
675impl ::fidl_next::Discoverable for EchoLauncher {
676    const PROTOCOL_NAME: &'static str = "fuchsia.examples.EchoLauncher";
677}
678
679#[cfg(target_os = "fuchsia")]
680impl ::fidl_next::HasTransport for EchoLauncher {
681    type Transport = ::fidl_next::fuchsia::zx::Channel;
682}
683
684pub mod echo_launcher {
685    pub mod prelude {
686        pub use crate::{
687            EchoLauncher, EchoLauncherClientHandler, EchoLauncherLocalClientHandler,
688            EchoLauncherLocalServerHandler, EchoLauncherServerHandler, echo_launcher,
689        };
690
691        pub use crate::natural::EchoLauncherGetEchoPipelinedRequest;
692
693        pub use crate::natural::EchoLauncherGetEchoRequest;
694
695        pub use crate::natural::EchoLauncherGetEchoResponse;
696    }
697
698    pub struct GetEcho;
699
700    impl ::fidl_next::Method for GetEcho {
701        const ORDINAL: u64 = 1213319469445758440;
702        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
703            ::fidl_next::protocol::Flexibility::Strict;
704
705        type Protocol = crate::EchoLauncher;
706
707        type Request = crate::wire::EchoLauncherGetEchoRequest<'static>;
708    }
709
710    impl ::fidl_next::TwoWayMethod for GetEcho {
711        type Response = crate::wire::EchoLauncherGetEchoResponse;
712    }
713
714    impl<___R> ::fidl_next::Respond<___R> for GetEcho {
715        type Output = crate::generic::EchoLauncherGetEchoResponse<___R>;
716
717        fn respond(response: ___R) -> Self::Output {
718            crate::generic::EchoLauncherGetEchoResponse { response: response }
719        }
720    }
721
722    pub struct GetEchoPipelined;
723
724    impl ::fidl_next::Method for GetEchoPipelined {
725        const ORDINAL: u64 = 2118769043708531827;
726        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
727            ::fidl_next::protocol::Flexibility::Strict;
728
729        type Protocol = crate::EchoLauncher;
730
731        type Request = crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>;
732    }
733
734    mod ___detail {
735        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::EchoLauncher
736        where
737            ___T: ::fidl_next::Transport,
738        {
739            type Client = EchoLauncherClient<___T>;
740            type Server = EchoLauncherServer<___T>;
741        }
742
743        /// The client for the `EchoLauncher` protocol.
744        #[repr(transparent)]
745        pub struct EchoLauncherClient<___T: ::fidl_next::Transport> {
746            #[allow(dead_code)]
747            client: ::fidl_next::protocol::Client<___T>,
748        }
749
750        impl<___T> EchoLauncherClient<___T>
751        where
752            ___T: ::fidl_next::Transport,
753        {
754            pub fn get_echo(
755                &self,
756
757                echo_prefix: impl ::fidl_next::Encode<
758                    ::fidl_next::wire::String<'static>,
759                    <___T as ::fidl_next::Transport>::SendBuffer,
760                >,
761            ) -> ::fidl_next::TwoWayFuture<'_, super::GetEcho, ___T>
762            where
763                <___T as ::fidl_next::Transport>::SendBuffer:
764                    ::fidl_next::encoder::InternalHandleEncoder,
765                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
766            {
767                self.get_echo_with(crate::generic::EchoLauncherGetEchoRequest { echo_prefix })
768            }
769
770            pub fn get_echo_with<___R>(
771                &self,
772                request: ___R,
773            ) -> ::fidl_next::TwoWayFuture<'_, super::GetEcho, ___T>
774            where
775                ___R: ::fidl_next::Encode<
776                        crate::wire::EchoLauncherGetEchoRequest<'static>,
777                        <___T as ::fidl_next::Transport>::SendBuffer,
778                    >,
779            {
780                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
781                    1213319469445758440,
782                    <super::GetEcho as ::fidl_next::Method>::FLEXIBILITY,
783                    request,
784                ))
785            }
786
787            pub fn get_echo_pipelined(
788                &self,
789
790                echo_prefix: impl ::fidl_next::Encode<
791                    ::fidl_next::wire::String<'static>,
792                    <___T as ::fidl_next::Transport>::SendBuffer,
793                >,
794
795                request: impl ::fidl_next::Encode<
796                    ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
797                    <___T as ::fidl_next::Transport>::SendBuffer,
798                >,
799            ) -> ::fidl_next::SendFuture<'_, ___T>
800            where
801                <___T as ::fidl_next::Transport>::SendBuffer:
802                    ::fidl_next::encoder::InternalHandleEncoder,
803                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
804                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
805            {
806                self.get_echo_pipelined_with(crate::generic::EchoLauncherGetEchoPipelinedRequest {
807                    echo_prefix,
808
809                    request,
810                })
811            }
812
813            pub fn get_echo_pipelined_with<___R>(
814                &self,
815                request: ___R,
816            ) -> ::fidl_next::SendFuture<'_, ___T>
817            where
818                ___R: ::fidl_next::Encode<
819                        crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
820                        <___T as ::fidl_next::Transport>::SendBuffer,
821                    >,
822            {
823                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
824                    2118769043708531827,
825                    <super::GetEchoPipelined as ::fidl_next::Method>::FLEXIBILITY,
826                    request,
827                ))
828            }
829        }
830
831        /// The server for the `EchoLauncher` protocol.
832        #[repr(transparent)]
833        pub struct EchoLauncherServer<___T: ::fidl_next::Transport> {
834            server: ::fidl_next::protocol::Server<___T>,
835        }
836
837        impl<___T> EchoLauncherServer<___T> where ___T: ::fidl_next::Transport {}
838    }
839}
840
841#[diagnostic::on_unimplemented(
842    note = "If {Self} implements the non-local EchoLauncherClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
843)]
844
845/// A client handler for the EchoLauncher protocol.
846///
847/// See [`EchoLauncher`] for more details.
848pub trait EchoLauncherLocalClientHandler<
849    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
850    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
851>
852{
853}
854
855impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for EchoLauncher
856where
857    ___H: EchoLauncherLocalClientHandler<___T>,
858    ___T: ::fidl_next::Transport,
859{
860    async fn on_event(
861        handler: &mut ___H,
862        ordinal: u64,
863        flexibility: ::fidl_next::protocol::Flexibility,
864        body: ::fidl_next::Body<___T>,
865    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
866        match ordinal {
867            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
868        }
869    }
870}
871
872#[diagnostic::on_unimplemented(
873    note = "If {Self} implements the non-local EchoLauncherServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
874)]
875
876/// A server handler for the EchoLauncher protocol.
877///
878/// See [`EchoLauncher`] for more details.
879pub trait EchoLauncherLocalServerHandler<
880    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
881    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
882>
883{
884    fn get_echo(
885        &mut self,
886
887        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
888
889        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
890    ) -> impl ::core::future::Future<Output = ()>;
891
892    fn get_echo_pipelined(
893        &mut self,
894
895        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
896    ) -> impl ::core::future::Future<Output = ()>;
897}
898
899impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for EchoLauncher
900where
901    ___H: EchoLauncherLocalServerHandler<___T>,
902    ___T: ::fidl_next::Transport,
903    for<'de> crate::wire::EchoLauncherGetEchoRequest<'de>: ::fidl_next::Decode<
904            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
905            Constraint = (),
906        >,
907    for<'de> crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>: ::fidl_next::Decode<
908            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
909            Constraint = (),
910        >,
911{
912    async fn on_one_way(
913        handler: &mut ___H,
914        ordinal: u64,
915        flexibility: ::fidl_next::protocol::Flexibility,
916        body: ::fidl_next::Body<___T>,
917    ) -> ::core::result::Result<
918        (),
919        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
920    > {
921        match ordinal {
922            2118769043708531827 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
923                Ok(decoded) => {
924                    handler.get_echo_pipelined(::fidl_next::Request::from_decoded(decoded)).await;
925                    Ok(())
926                }
927                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
928                    ordinal: 2118769043708531827,
929                    error,
930                }),
931            },
932
933            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
934        }
935    }
936
937    async fn on_two_way(
938        handler: &mut ___H,
939        ordinal: u64,
940        flexibility: ::fidl_next::protocol::Flexibility,
941        body: ::fidl_next::Body<___T>,
942        responder: ::fidl_next::protocol::Responder<___T>,
943    ) -> ::core::result::Result<
944        (),
945        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
946    > {
947        match ordinal {
948            1213319469445758440 => {
949                let responder = ::fidl_next::Responder::from_untyped(responder);
950
951                match ::fidl_next::AsDecoderExt::into_decoded(body) {
952                    Ok(decoded) => {
953                        handler
954                            .get_echo(::fidl_next::Request::from_decoded(decoded), responder)
955                            .await;
956                        Ok(())
957                    }
958                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
959                        ordinal: 1213319469445758440,
960                        error,
961                    }),
962                }
963            }
964
965            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
966        }
967    }
968}
969
970/// A client handler for the EchoLauncher protocol.
971///
972/// See [`EchoLauncher`] for more details.
973pub trait EchoLauncherClientHandler<
974    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
975    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
976>
977{
978}
979
980impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for EchoLauncher
981where
982    ___H: EchoLauncherClientHandler<___T> + ::core::marker::Send,
983    ___T: ::fidl_next::Transport,
984{
985    async fn on_event(
986        handler: &mut ___H,
987        ordinal: u64,
988        flexibility: ::fidl_next::protocol::Flexibility,
989        body: ::fidl_next::Body<___T>,
990    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
991        match ordinal {
992            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
993        }
994    }
995}
996
997/// A server handler for the EchoLauncher protocol.
998///
999/// See [`EchoLauncher`] for more details.
1000pub trait EchoLauncherServerHandler<
1001    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1002    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1003>
1004{
1005    fn get_echo(
1006        &mut self,
1007
1008        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
1009
1010        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
1011    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1012
1013    fn get_echo_pipelined(
1014        &mut self,
1015
1016        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
1017    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1018}
1019
1020impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for EchoLauncher
1021where
1022    ___H: EchoLauncherServerHandler<___T> + ::core::marker::Send,
1023    ___T: ::fidl_next::Transport,
1024    for<'de> crate::wire::EchoLauncherGetEchoRequest<'de>: ::fidl_next::Decode<
1025            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1026            Constraint = (),
1027        >,
1028    for<'de> crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>: ::fidl_next::Decode<
1029            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1030            Constraint = (),
1031        >,
1032{
1033    async fn on_one_way(
1034        handler: &mut ___H,
1035        ordinal: u64,
1036        flexibility: ::fidl_next::protocol::Flexibility,
1037        body: ::fidl_next::Body<___T>,
1038    ) -> ::core::result::Result<
1039        (),
1040        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1041    > {
1042        match ordinal {
1043            2118769043708531827 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
1044                Ok(decoded) => {
1045                    handler.get_echo_pipelined(::fidl_next::Request::from_decoded(decoded)).await;
1046                    Ok(())
1047                }
1048                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1049                    ordinal: 2118769043708531827,
1050                    error,
1051                }),
1052            },
1053
1054            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1055        }
1056    }
1057
1058    async fn on_two_way(
1059        handler: &mut ___H,
1060        ordinal: u64,
1061        flexibility: ::fidl_next::protocol::Flexibility,
1062        body: ::fidl_next::Body<___T>,
1063        responder: ::fidl_next::protocol::Responder<___T>,
1064    ) -> ::core::result::Result<
1065        (),
1066        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1067    > {
1068        match ordinal {
1069            1213319469445758440 => {
1070                let responder = ::fidl_next::Responder::from_untyped(responder);
1071
1072                match ::fidl_next::AsDecoderExt::into_decoded(body) {
1073                    Ok(decoded) => {
1074                        handler
1075                            .get_echo(::fidl_next::Request::from_decoded(decoded), responder)
1076                            .await;
1077                        Ok(())
1078                    }
1079                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1080                        ordinal: 1213319469445758440,
1081                        error,
1082                    }),
1083                }
1084            }
1085
1086            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1087        }
1088    }
1089}
1090
1091impl<___T> EchoLauncherClientHandler<___T> for ::fidl_next::IgnoreEvents where
1092    ___T: ::fidl_next::Transport
1093{
1094}
1095
1096impl<___H, ___T> EchoLauncherLocalClientHandler<___T> for ::fidl_next::Local<___H>
1097where
1098    ___H: EchoLauncherClientHandler<___T>,
1099    ___T: ::fidl_next::Transport,
1100{
1101}
1102
1103impl<___H, ___T> EchoLauncherLocalServerHandler<___T> for ::fidl_next::Local<___H>
1104where
1105    ___H: EchoLauncherServerHandler<___T>,
1106    ___T: ::fidl_next::Transport,
1107{
1108    async fn get_echo(
1109        &mut self,
1110
1111        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
1112
1113        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
1114    ) {
1115        ___H::get_echo(&mut self.0, request, responder).await
1116    }
1117
1118    async fn get_echo_pipelined(
1119        &mut self,
1120
1121        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
1122    ) {
1123        ___H::get_echo_pipelined(&mut self.0, request).await
1124    }
1125}
1126
1127/// The type corresponding to the EchoService service.
1128#[derive(Debug)]
1129pub struct EchoService;
1130
1131impl ::fidl_next::DiscoverableService for EchoService {
1132    const SERVICE_NAME: &'static str = "fuchsia.examples.EchoService";
1133    const MEMBER_NAMES: &'static [&'static str] = &["regular_echo", "reversed_echo"];
1134}
1135
1136impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for EchoService {}
1137
1138impl<___C> ::fidl_next::Service<___C> for EchoService
1139where
1140    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1141    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1142{
1143    type Connector = EchoServiceConnector<___C>;
1144}
1145
1146/// A strongly-typed service connector for the `EchoService` service.
1147#[repr(transparent)]
1148pub struct EchoServiceConnector<___C> {
1149    #[allow(dead_code)]
1150    connector: ___C,
1151}
1152
1153impl<___C> EchoServiceConnector<___C>
1154where
1155    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1156    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1157{
1158    /// Attempts to connect to the `regular_echo` service member.
1159    pub fn regular_echo(
1160        &self,
1161        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1162    ) -> ::core::result::Result<
1163        (),
1164        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1165    > {
1166        ::fidl_next::protocol::ServiceConnector::<
1167                ::fidl_next::fuchsia::zx::Channel
1168            >::connect_to_member(
1169                &self.connector,
1170                "regular_echo",
1171                server_end.into_untyped(),
1172            )
1173    }
1174
1175    /// Attempts to connect to the `reversed_echo` service member.
1176    pub fn reversed_echo(
1177        &self,
1178        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1179    ) -> ::core::result::Result<
1180        (),
1181        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1182    > {
1183        ::fidl_next::protocol::ServiceConnector::<
1184                ::fidl_next::fuchsia::zx::Channel
1185            >::connect_to_member(
1186                &self.connector,
1187                "reversed_echo",
1188                server_end.into_untyped(),
1189            )
1190    }
1191}
1192
1193/// A service handler for the `EchoService` service.
1194pub trait EchoServiceHandler {
1195    /// Handles an attempt to connect to the `regular_echo` member.
1196    fn regular_echo(
1197        &self,
1198        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1199    );
1200
1201    /// Handles an attempt to connect to the `reversed_echo` member.
1202    fn reversed_echo(
1203        &self,
1204        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1205    );
1206}
1207
1208impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for EchoService
1209where
1210    ___H: EchoServiceHandler,
1211    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1212    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1213{
1214    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
1215        use ::fidl_next::InstanceFromServiceTransport;
1216        match member {
1217            "regular_echo" => handler.regular_echo(::fidl_next::ServerEnd::from_untyped(
1218                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1219            )),
1220
1221            "reversed_echo" => handler.reversed_echo(::fidl_next::ServerEnd::from_untyped(
1222                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1223            )),
1224
1225            _ => unreachable!(),
1226        }
1227    }
1228}
1229
1230pub use fidl_next_common_fuchsia_examples::*;