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 = ::fidl_next::wire::Strict<crate::wire::EchoLauncherGetEchoResponse>;
712    }
713
714    impl<___R> ::fidl_next::Respond<___R> for GetEcho {
715        type Output = ::fidl_next::Strict<crate::generic::EchoLauncherGetEchoResponse<___R>>;
716
717        fn respond(response: ___R) -> Self::Output {
718            ::fidl_next::Strict(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        mut message: ::fidl_next::Message<___T>,
863    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
864        match *message.header().ordinal {
865            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
866        }
867    }
868}
869
870#[diagnostic::on_unimplemented(
871    note = "If {Self} implements the non-local EchoLauncherServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
872)]
873
874/// A server handler for the EchoLauncher protocol.
875///
876/// See [`EchoLauncher`] for more details.
877pub trait EchoLauncherLocalServerHandler<
878    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
879    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
880>
881{
882    fn get_echo(
883        &mut self,
884
885        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
886
887        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
888    ) -> impl ::core::future::Future<Output = ()>;
889
890    fn get_echo_pipelined(
891        &mut self,
892
893        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
894    ) -> impl ::core::future::Future<Output = ()>;
895}
896
897impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for EchoLauncher
898where
899    ___H: EchoLauncherLocalServerHandler<___T>,
900    ___T: ::fidl_next::Transport,
901    for<'de> crate::wire::EchoLauncherGetEchoRequest<'de>: ::fidl_next::Decode<
902            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
903            Constraint = (),
904        >,
905    for<'de> crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>: ::fidl_next::Decode<
906            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
907            Constraint = (),
908        >,
909{
910    async fn on_one_way(
911        handler: &mut ___H,
912        mut message: ::fidl_next::Message<___T>,
913    ) -> ::core::result::Result<
914        (),
915        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
916    > {
917        match *message.header().ordinal {
918            2118769043708531827 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
919                Ok(decoded) => {
920                    handler.get_echo_pipelined(::fidl_next::Request::from_decoded(decoded)).await;
921                    Ok(())
922                }
923                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
924                    ordinal: 2118769043708531827,
925                    error,
926                }),
927            },
928
929            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
930        }
931    }
932
933    async fn on_two_way(
934        handler: &mut ___H,
935        mut message: ::fidl_next::Message<___T>,
936        responder: ::fidl_next::protocol::Responder<___T>,
937    ) -> ::core::result::Result<
938        (),
939        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
940    > {
941        match *message.header().ordinal {
942            1213319469445758440 => {
943                let responder = ::fidl_next::Responder::from_untyped(responder);
944
945                match ::fidl_next::AsDecoderExt::into_decoded(message) {
946                    Ok(decoded) => {
947                        handler
948                            .get_echo(::fidl_next::Request::from_decoded(decoded), responder)
949                            .await;
950                        Ok(())
951                    }
952                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
953                        ordinal: 1213319469445758440,
954                        error,
955                    }),
956                }
957            }
958
959            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
960        }
961    }
962}
963
964/// A client handler for the EchoLauncher protocol.
965///
966/// See [`EchoLauncher`] for more details.
967pub trait EchoLauncherClientHandler<
968    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
969    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
970>
971{
972}
973
974impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for EchoLauncher
975where
976    ___H: EchoLauncherClientHandler<___T> + ::core::marker::Send,
977    ___T: ::fidl_next::Transport,
978{
979    async fn on_event(
980        handler: &mut ___H,
981        mut message: ::fidl_next::Message<___T>,
982    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
983        match *message.header().ordinal {
984            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
985        }
986    }
987}
988
989/// A server handler for the EchoLauncher protocol.
990///
991/// See [`EchoLauncher`] for more details.
992pub trait EchoLauncherServerHandler<
993    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
994    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
995>
996{
997    fn get_echo(
998        &mut self,
999
1000        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
1001
1002        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
1003    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1004
1005    fn get_echo_pipelined(
1006        &mut self,
1007
1008        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
1009    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1010}
1011
1012impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for EchoLauncher
1013where
1014    ___H: EchoLauncherServerHandler<___T> + ::core::marker::Send,
1015    ___T: ::fidl_next::Transport,
1016    for<'de> crate::wire::EchoLauncherGetEchoRequest<'de>: ::fidl_next::Decode<
1017            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1018            Constraint = (),
1019        >,
1020    for<'de> crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>: ::fidl_next::Decode<
1021            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1022            Constraint = (),
1023        >,
1024{
1025    async fn on_one_way(
1026        handler: &mut ___H,
1027        mut message: ::fidl_next::Message<___T>,
1028    ) -> ::core::result::Result<
1029        (),
1030        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1031    > {
1032        match *message.header().ordinal {
1033            2118769043708531827 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1034                Ok(decoded) => {
1035                    handler.get_echo_pipelined(::fidl_next::Request::from_decoded(decoded)).await;
1036                    Ok(())
1037                }
1038                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1039                    ordinal: 2118769043708531827,
1040                    error,
1041                }),
1042            },
1043
1044            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1045        }
1046    }
1047
1048    async fn on_two_way(
1049        handler: &mut ___H,
1050        mut message: ::fidl_next::Message<___T>,
1051        responder: ::fidl_next::protocol::Responder<___T>,
1052    ) -> ::core::result::Result<
1053        (),
1054        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1055    > {
1056        match *message.header().ordinal {
1057            1213319469445758440 => {
1058                let responder = ::fidl_next::Responder::from_untyped(responder);
1059
1060                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1061                    Ok(decoded) => {
1062                        handler
1063                            .get_echo(::fidl_next::Request::from_decoded(decoded), responder)
1064                            .await;
1065                        Ok(())
1066                    }
1067                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1068                        ordinal: 1213319469445758440,
1069                        error,
1070                    }),
1071                }
1072            }
1073
1074            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1075        }
1076    }
1077}
1078
1079impl<___T> EchoLauncherClientHandler<___T> for ::fidl_next::IgnoreEvents where
1080    ___T: ::fidl_next::Transport
1081{
1082}
1083
1084impl<___H, ___T> EchoLauncherLocalClientHandler<___T> for ::fidl_next::Local<___H>
1085where
1086    ___H: EchoLauncherClientHandler<___T>,
1087    ___T: ::fidl_next::Transport,
1088{
1089}
1090
1091impl<___H, ___T> EchoLauncherLocalServerHandler<___T> for ::fidl_next::Local<___H>
1092where
1093    ___H: EchoLauncherServerHandler<___T>,
1094    ___T: ::fidl_next::Transport,
1095{
1096    async fn get_echo(
1097        &mut self,
1098
1099        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
1100
1101        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
1102    ) {
1103        ___H::get_echo(&mut self.0, request, responder).await
1104    }
1105
1106    async fn get_echo_pipelined(
1107        &mut self,
1108
1109        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
1110    ) {
1111        ___H::get_echo_pipelined(&mut self.0, request).await
1112    }
1113}
1114
1115/// The type corresponding to the EchoService service.
1116#[derive(Debug)]
1117pub struct EchoService;
1118
1119impl ::fidl_next::DiscoverableService for EchoService {
1120    const SERVICE_NAME: &'static str = "fuchsia.examples.EchoService";
1121    const MEMBER_NAMES: &'static [&'static str] = &["regular_echo", "reversed_echo"];
1122}
1123
1124impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for EchoService {}
1125
1126impl<___C> ::fidl_next::Service<___C> for EchoService
1127where
1128    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1129    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1130{
1131    type Connector = EchoServiceConnector<___C>;
1132}
1133
1134/// A strongly-typed service connector for the `EchoService` service.
1135#[repr(transparent)]
1136pub struct EchoServiceConnector<___C> {
1137    #[allow(dead_code)]
1138    connector: ___C,
1139}
1140
1141impl<___C> EchoServiceConnector<___C>
1142where
1143    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1144    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1145{
1146    /// Attempts to connect to the `regular_echo` service member.
1147    pub fn regular_echo(
1148        &self,
1149        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1150    ) -> ::core::result::Result<
1151        (),
1152        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1153    > {
1154        ::fidl_next::protocol::ServiceConnector::<
1155                ::fidl_next::fuchsia::zx::Channel
1156            >::connect_to_member(
1157                &self.connector,
1158                "regular_echo",
1159                server_end.into_untyped(),
1160            )
1161    }
1162
1163    /// Attempts to connect to the `reversed_echo` service member.
1164    pub fn reversed_echo(
1165        &self,
1166        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1167    ) -> ::core::result::Result<
1168        (),
1169        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1170    > {
1171        ::fidl_next::protocol::ServiceConnector::<
1172                ::fidl_next::fuchsia::zx::Channel
1173            >::connect_to_member(
1174                &self.connector,
1175                "reversed_echo",
1176                server_end.into_untyped(),
1177            )
1178    }
1179}
1180
1181/// A service handler for the `EchoService` service.
1182pub trait EchoServiceHandler {
1183    /// Handles an attempt to connect to the `regular_echo` member.
1184    fn regular_echo(
1185        &self,
1186        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1187    );
1188
1189    /// Handles an attempt to connect to the `reversed_echo` member.
1190    fn reversed_echo(
1191        &self,
1192        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1193    );
1194}
1195
1196impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for EchoService
1197where
1198    ___H: EchoServiceHandler,
1199    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1200    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1201{
1202    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
1203        use ::fidl_next::InstanceFromServiceTransport;
1204        match member {
1205            "regular_echo" => handler.regular_echo(::fidl_next::ServerEnd::from_untyped(
1206                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1207            )),
1208
1209            "reversed_echo" => handler.reversed_echo(::fidl_next::ServerEnd::from_untyped(
1210                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1211            )),
1212
1213            _ => unreachable!(),
1214        }
1215    }
1216}
1217
1218pub use fidl_next_common_fuchsia_examples::*;