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
332                    response,
333
334                } = &mut *out_;
335            }
336
337            ::fidl_next::Wire::zero_padding(response);
338        }
339    }
340
341    unsafe impl<___D> ::fidl_next::Decode<___D> for EchoLauncherGetEchoResponse
342    where
343        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
344        ___D: ::fidl_next::fuchsia::HandleDecoder,
345    {
346        fn decode(
347            slot_: ::fidl_next::Slot<'_, Self>,
348            decoder_: &mut ___D,
349            _: (),
350        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
351            ::fidl_next::munge! {
352                let Self {
353
354                    mut response,
355
356                } = slot_;
357            }
358
359            let _field = response.as_mut();
360
361            ::fidl_next::Decode::decode(response.as_mut(), decoder_, ())?;
362
363            Ok(())
364        }
365    }
366
367    impl ::fidl_next::IntoNatural for EchoLauncherGetEchoResponse {
368        type Natural = crate::natural::EchoLauncherGetEchoResponse;
369    }
370
371    /// The wire type corresponding to [`EchoLauncherGetEchoPipelinedRequest`].
372    #[derive(Debug)]
373    #[repr(C)]
374    pub struct EchoLauncherGetEchoPipelinedRequest<'de> {
375        pub echo_prefix: ::fidl_next::wire::String<'de>,
376
377        pub request: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
378    }
379
380    static_assertions::const_assert_eq!(
381        std::mem::size_of::<EchoLauncherGetEchoPipelinedRequest<'_>>(),
382        24
383    );
384    static_assertions::const_assert_eq!(
385        std::mem::align_of::<EchoLauncherGetEchoPipelinedRequest<'_>>(),
386        8
387    );
388
389    static_assertions::const_assert_eq!(
390        std::mem::offset_of!(EchoLauncherGetEchoPipelinedRequest<'_>, echo_prefix),
391        0
392    );
393
394    static_assertions::const_assert_eq!(
395        std::mem::offset_of!(EchoLauncherGetEchoPipelinedRequest<'_>, request),
396        16
397    );
398
399    impl ::fidl_next::Constrained for EchoLauncherGetEchoPipelinedRequest<'_> {
400        type Constraint = ();
401
402        fn validate(
403            _: ::fidl_next::Slot<'_, Self>,
404            _: Self::Constraint,
405        ) -> Result<(), ::fidl_next::ValidationError> {
406            Ok(())
407        }
408    }
409
410    unsafe impl ::fidl_next::Wire for EchoLauncherGetEchoPipelinedRequest<'static> {
411        type Narrowed<'de> = EchoLauncherGetEchoPipelinedRequest<'de>;
412
413        #[inline]
414        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
415            ::fidl_next::munge! {
416                let Self {
417
418                    echo_prefix,
419                    request,
420
421                } = &mut *out_;
422            }
423
424            ::fidl_next::Wire::zero_padding(echo_prefix);
425
426            ::fidl_next::Wire::zero_padding(request);
427
428            unsafe {
429                out_.as_mut_ptr().cast::<u8>().add(20).write_bytes(0, 4);
430            }
431        }
432    }
433
434    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for EchoLauncherGetEchoPipelinedRequest<'de>
435    where
436        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
437        ___D: ::fidl_next::Decoder<'de>,
438        ___D: ::fidl_next::fuchsia::HandleDecoder,
439    {
440        fn decode(
441            slot_: ::fidl_next::Slot<'_, Self>,
442            decoder_: &mut ___D,
443            _: (),
444        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
445            if slot_.as_bytes()[20..24] != [0u8; 4] {
446                return Err(::fidl_next::DecodeError::InvalidPadding);
447            }
448
449            ::fidl_next::munge! {
450                let Self {
451
452                    mut echo_prefix,
453                    mut request,
454
455                } = slot_;
456            }
457
458            let _field = echo_prefix.as_mut();
459            ::fidl_next::Constrained::validate(_field, 32)?;
460            ::fidl_next::Decode::decode(echo_prefix.as_mut(), decoder_, 32)?;
461
462            let echo_prefix = unsafe { echo_prefix.deref_unchecked() };
463
464            if echo_prefix.len() > 32 {
465                return Err(::fidl_next::DecodeError::VectorTooLong {
466                    size: echo_prefix.len() as u64,
467                    limit: 32,
468                });
469            }
470
471            let _field = request.as_mut();
472
473            ::fidl_next::Decode::decode(request.as_mut(), decoder_, ())?;
474
475            Ok(())
476        }
477    }
478
479    impl<'de> ::fidl_next::IntoNatural for EchoLauncherGetEchoPipelinedRequest<'de> {
480        type Natural = crate::natural::EchoLauncherGetEchoPipelinedRequest;
481    }
482
483    /// The wire type corresponding to [`EventStruct`].
484    #[derive(Debug)]
485    #[repr(C)]
486    pub struct EventStruct {
487        pub event: ::fidl_next::wire::fuchsia::OptionalEvent,
488    }
489
490    static_assertions::const_assert_eq!(std::mem::size_of::<EventStruct>(), 4);
491    static_assertions::const_assert_eq!(std::mem::align_of::<EventStruct>(), 4);
492
493    static_assertions::const_assert_eq!(std::mem::offset_of!(EventStruct, event), 0);
494
495    impl ::fidl_next::Constrained for EventStruct {
496        type Constraint = ();
497
498        fn validate(
499            _: ::fidl_next::Slot<'_, Self>,
500            _: Self::Constraint,
501        ) -> Result<(), ::fidl_next::ValidationError> {
502            Ok(())
503        }
504    }
505
506    unsafe impl ::fidl_next::Wire for EventStruct {
507        type Narrowed<'de> = EventStruct;
508
509        #[inline]
510        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
511            ::fidl_next::munge! {
512                let Self {
513
514                    event,
515
516                } = &mut *out_;
517            }
518
519            ::fidl_next::Wire::zero_padding(event);
520        }
521    }
522
523    unsafe impl<___D> ::fidl_next::Decode<___D> for EventStruct
524    where
525        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
526        ___D: ::fidl_next::fuchsia::HandleDecoder,
527    {
528        fn decode(
529            slot_: ::fidl_next::Slot<'_, Self>,
530            decoder_: &mut ___D,
531            _: (),
532        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
533            ::fidl_next::munge! {
534                let Self {
535
536                    mut event,
537
538                } = slot_;
539            }
540
541            let _field = event.as_mut();
542
543            ::fidl_next::Decode::decode(event.as_mut(), decoder_, ())?;
544
545            Ok(())
546        }
547    }
548
549    impl ::fidl_next::IntoNatural for EventStruct {
550        type Natural = crate::natural::EventStruct;
551    }
552}
553
554pub mod wire_optional {
555
556    pub use fidl_next_common_fuchsia_examples::wire_optional::*;
557}
558
559pub mod generic {
560
561    pub use fidl_next_common_fuchsia_examples::generic::*;
562
563    pub struct EchoLauncherGetEchoResponse<T0> {
564        pub response: T0,
565    }
566
567    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoResponse, ___E>
568        for EchoLauncherGetEchoResponse<T0>
569    where
570        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
571        ___E: ::fidl_next::fuchsia::HandleEncoder,
572        T0: ::fidl_next::Encode<
573                ::fidl_next::ClientEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
574                ___E,
575            >,
576    {
577        #[inline]
578        fn encode(
579            self,
580            encoder_: &mut ___E,
581            out_: &mut ::core::mem::MaybeUninit<crate::wire::EchoLauncherGetEchoResponse>,
582            _: (),
583        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
584            ::fidl_next::munge! {
585                let crate::wire::EchoLauncherGetEchoResponse {
586
587                    response,
588
589                } = out_;
590            }
591
592            ::fidl_next::Encode::encode(self.response, encoder_, response, ())?;
593
594            Ok(())
595        }
596    }
597
598    pub struct EchoLauncherGetEchoPipelinedRequest<T0, T1> {
599        pub echo_prefix: T0,
600
601        pub request: T1,
602    }
603
604    unsafe impl<___E, T0, T1>
605        ::fidl_next::Encode<crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>, ___E>
606        for EchoLauncherGetEchoPipelinedRequest<T0, T1>
607    where
608        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
609        ___E: ::fidl_next::Encoder,
610        ___E: ::fidl_next::fuchsia::HandleEncoder,
611        T0: ::fidl_next::Encode<::fidl_next::wire::String<'static>, ___E>,
612        T1: ::fidl_next::Encode<
613                ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
614                ___E,
615            >,
616    {
617        #[inline]
618        fn encode(
619            self,
620            encoder_: &mut ___E,
621            out_: &mut ::core::mem::MaybeUninit<
622                crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
623            >,
624            _: (),
625        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
626            ::fidl_next::munge! {
627                let crate::wire::EchoLauncherGetEchoPipelinedRequest {
628
629                    echo_prefix,
630                    request,
631
632                } = out_;
633            }
634
635            ::fidl_next::Encode::encode(self.echo_prefix, encoder_, echo_prefix, 32)?;
636
637            ::fidl_next::Encode::encode(self.request, encoder_, request, ())?;
638
639            Ok(())
640        }
641    }
642
643    pub struct EventStruct<T0> {
644        pub event: T0,
645    }
646
647    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::EventStruct, ___E> for EventStruct<T0>
648    where
649        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
650        ___E: ::fidl_next::fuchsia::HandleEncoder,
651        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalEvent, ___E>,
652    {
653        #[inline]
654        fn encode(
655            self,
656            encoder_: &mut ___E,
657            out_: &mut ::core::mem::MaybeUninit<crate::wire::EventStruct>,
658            _: (),
659        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
660            ::fidl_next::munge! {
661                let crate::wire::EventStruct {
662
663                    event,
664
665                } = out_;
666            }
667
668            ::fidl_next::Encode::encode(self.event, encoder_, event, ())?;
669
670            Ok(())
671        }
672    }
673}
674
675pub use self::natural::*;
676
677/// The type corresponding to the EchoLauncher protocol.
678#[derive(PartialEq, Debug)]
679pub struct EchoLauncher;
680
681impl ::fidl_next::Discoverable for EchoLauncher {
682    const PROTOCOL_NAME: &'static str = "fuchsia.examples.EchoLauncher";
683}
684
685#[cfg(target_os = "fuchsia")]
686impl ::fidl_next::HasTransport for EchoLauncher {
687    type Transport = ::fidl_next::fuchsia::zx::Channel;
688}
689
690pub mod echo_launcher {
691    pub mod prelude {
692        pub use crate::{
693            EchoLauncher, EchoLauncherClientHandler, EchoLauncherServerHandler, echo_launcher,
694        };
695
696        pub use crate::natural::EchoLauncherGetEchoPipelinedRequest;
697
698        pub use crate::natural::EchoLauncherGetEchoRequest;
699
700        pub use crate::natural::EchoLauncherGetEchoResponse;
701    }
702
703    pub struct GetEcho;
704
705    impl ::fidl_next::Method for GetEcho {
706        const ORDINAL: u64 = 1213319469445758440;
707        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
708            ::fidl_next::protocol::Flexibility::Strict;
709
710        type Protocol = crate::EchoLauncher;
711
712        type Request = crate::wire::EchoLauncherGetEchoRequest<'static>;
713    }
714
715    impl ::fidl_next::TwoWayMethod for GetEcho {
716        type Response = crate::wire::EchoLauncherGetEchoResponse;
717    }
718
719    impl<___R> ::fidl_next::Respond<___R> for GetEcho {
720        type Output = crate::generic::EchoLauncherGetEchoResponse<___R>;
721
722        fn respond(response: ___R) -> Self::Output {
723            crate::generic::EchoLauncherGetEchoResponse { response: response }
724        }
725    }
726
727    pub struct GetEchoPipelined;
728
729    impl ::fidl_next::Method for GetEchoPipelined {
730        const ORDINAL: u64 = 2118769043708531827;
731        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
732            ::fidl_next::protocol::Flexibility::Strict;
733
734        type Protocol = crate::EchoLauncher;
735
736        type Request = crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>;
737    }
738
739    mod ___detail {
740        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::EchoLauncher
741        where
742            ___T: ::fidl_next::Transport,
743        {
744            type Client = EchoLauncherClient<___T>;
745            type Server = EchoLauncherServer<___T>;
746        }
747
748        /// The client for the `EchoLauncher` protocol.
749        #[repr(transparent)]
750        pub struct EchoLauncherClient<___T: ::fidl_next::Transport> {
751            #[allow(dead_code)]
752            client: ::fidl_next::protocol::Client<___T>,
753        }
754
755        impl<___T> EchoLauncherClient<___T>
756        where
757            ___T: ::fidl_next::Transport,
758        {
759            pub fn get_echo(
760                &self,
761
762                echo_prefix: impl ::fidl_next::Encode<
763                    ::fidl_next::wire::String<'static>,
764                    <___T as ::fidl_next::Transport>::SendBuffer,
765                >,
766            ) -> ::fidl_next::TwoWayFuture<'_, super::GetEcho, ___T>
767            where
768                <___T as ::fidl_next::Transport>::SendBuffer:
769                    ::fidl_next::encoder::InternalHandleEncoder,
770                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
771            {
772                self.get_echo_with(crate::generic::EchoLauncherGetEchoRequest { echo_prefix })
773            }
774
775            pub fn get_echo_with<___R>(
776                &self,
777                request: ___R,
778            ) -> ::fidl_next::TwoWayFuture<'_, super::GetEcho, ___T>
779            where
780                ___R: ::fidl_next::Encode<
781                        crate::wire::EchoLauncherGetEchoRequest<'static>,
782                        <___T as ::fidl_next::Transport>::SendBuffer,
783                    >,
784            {
785                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
786                    1213319469445758440,
787                    <super::GetEcho as ::fidl_next::Method>::FLEXIBILITY,
788                    request,
789                ))
790            }
791
792            pub fn get_echo_pipelined(
793                &self,
794
795                echo_prefix: impl ::fidl_next::Encode<
796                    ::fidl_next::wire::String<'static>,
797                    <___T as ::fidl_next::Transport>::SendBuffer,
798                >,
799
800                request: impl ::fidl_next::Encode<
801                    ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::wire::fuchsia::Channel>,
802                    <___T as ::fidl_next::Transport>::SendBuffer,
803                >,
804            ) -> ::fidl_next::SendFuture<'_, ___T>
805            where
806                <___T as ::fidl_next::Transport>::SendBuffer:
807                    ::fidl_next::encoder::InternalHandleEncoder,
808                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
809                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
810            {
811                self.get_echo_pipelined_with(crate::generic::EchoLauncherGetEchoPipelinedRequest {
812                    echo_prefix,
813
814                    request,
815                })
816            }
817
818            pub fn get_echo_pipelined_with<___R>(
819                &self,
820                request: ___R,
821            ) -> ::fidl_next::SendFuture<'_, ___T>
822            where
823                ___R: ::fidl_next::Encode<
824                        crate::wire::EchoLauncherGetEchoPipelinedRequest<'static>,
825                        <___T as ::fidl_next::Transport>::SendBuffer,
826                    >,
827            {
828                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
829                    2118769043708531827,
830                    <super::GetEchoPipelined as ::fidl_next::Method>::FLEXIBILITY,
831                    request,
832                ))
833            }
834        }
835
836        /// The server for the `EchoLauncher` protocol.
837        #[repr(transparent)]
838        pub struct EchoLauncherServer<___T: ::fidl_next::Transport> {
839            server: ::fidl_next::protocol::Server<___T>,
840        }
841
842        impl<___T> EchoLauncherServer<___T> where ___T: ::fidl_next::Transport {}
843    }
844}
845
846/// A client handler for the EchoLauncher protocol.
847///
848/// See [`EchoLauncher`] for more details.
849pub trait EchoLauncherClientHandler<
850    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
851    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
852>
853{
854}
855
856impl<___T> EchoLauncherClientHandler<___T> for ::fidl_next::IgnoreEvents where
857    ___T: ::fidl_next::Transport
858{
859}
860
861impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for EchoLauncher
862where
863    ___H: EchoLauncherClientHandler<___T> + ::core::marker::Send,
864    ___T: ::fidl_next::Transport,
865{
866    async fn on_event(
867        handler: &mut ___H,
868        ordinal: u64,
869        flexibility: ::fidl_next::protocol::Flexibility,
870        body: ::fidl_next::Body<___T>,
871    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
872        match ordinal {
873            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
874        }
875    }
876}
877
878/// A server handler for the EchoLauncher protocol.
879///
880/// See [`EchoLauncher`] for more details.
881pub trait EchoLauncherServerHandler<
882    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
883    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
884>
885{
886    fn get_echo(
887        &mut self,
888
889        request: ::fidl_next::Request<echo_launcher::GetEcho, ___T>,
890
891        responder: ::fidl_next::Responder<echo_launcher::GetEcho, ___T>,
892    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
893
894    fn get_echo_pipelined(
895        &mut self,
896
897        request: ::fidl_next::Request<echo_launcher::GetEchoPipelined, ___T>,
898    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
899}
900
901impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for EchoLauncher
902where
903    ___H: EchoLauncherServerHandler<___T> + ::core::marker::Send,
904    ___T: ::fidl_next::Transport,
905    for<'de> crate::wire::EchoLauncherGetEchoRequest<'de>: ::fidl_next::Decode<
906            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
907            Constraint = (),
908        >,
909    for<'de> crate::wire::EchoLauncherGetEchoPipelinedRequest<'de>: ::fidl_next::Decode<
910            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
911            Constraint = (),
912        >,
913{
914    async fn on_one_way(
915        handler: &mut ___H,
916        ordinal: u64,
917        flexibility: ::fidl_next::protocol::Flexibility,
918        body: ::fidl_next::Body<___T>,
919    ) -> ::core::result::Result<
920        (),
921        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
922    > {
923        match ordinal {
924            2118769043708531827 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
925                Ok(decoded) => {
926                    handler.get_echo_pipelined(::fidl_next::Request::from_decoded(decoded)).await;
927                    Ok(())
928                }
929                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
930                    ordinal: 2118769043708531827,
931                    error,
932                }),
933            },
934
935            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
936        }
937    }
938
939    async fn on_two_way(
940        handler: &mut ___H,
941        ordinal: u64,
942        flexibility: ::fidl_next::protocol::Flexibility,
943        body: ::fidl_next::Body<___T>,
944        responder: ::fidl_next::protocol::Responder<___T>,
945    ) -> ::core::result::Result<
946        (),
947        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
948    > {
949        match ordinal {
950            1213319469445758440 => {
951                let responder = ::fidl_next::Responder::from_untyped(responder);
952
953                match ::fidl_next::AsDecoderExt::into_decoded(body) {
954                    Ok(decoded) => {
955                        handler
956                            .get_echo(::fidl_next::Request::from_decoded(decoded), responder)
957                            .await;
958                        Ok(())
959                    }
960                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
961                        ordinal: 1213319469445758440,
962                        error,
963                    }),
964                }
965            }
966
967            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
968        }
969    }
970}
971
972/// The type corresponding to the EchoService service.
973#[derive(Debug)]
974pub struct EchoService;
975
976impl ::fidl_next::DiscoverableService for EchoService {
977    const SERVICE_NAME: &'static str = "fuchsia.examples.EchoService";
978    const MEMBER_NAMES: &'static [&'static str] = &["regular_echo", "reversed_echo"];
979}
980
981impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for EchoService {}
982
983impl<___C> ::fidl_next::Service<___C> for EchoService
984where
985    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
986    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
987{
988    type Connector = EchoServiceConnector<___C>;
989}
990
991/// A strongly-typed service connector for the `EchoService` service.
992#[repr(transparent)]
993pub struct EchoServiceConnector<___C> {
994    #[allow(dead_code)]
995    connector: ___C,
996}
997
998impl<___C> EchoServiceConnector<___C>
999where
1000    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1001    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
1002{
1003    /// Attempts to connect to the `regular_echo` service member.
1004    pub fn regular_echo(
1005        &self,
1006        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1007    ) -> ::core::result::Result<
1008        (),
1009        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1010    > {
1011        ::fidl_next::protocol::ServiceConnector::<
1012                ::fidl_next::fuchsia::zx::Channel
1013            >::connect_to_member(
1014                &self.connector,
1015                "regular_echo",
1016                server_end.into_untyped(),
1017            )
1018    }
1019
1020    /// Attempts to connect to the `reversed_echo` service member.
1021    pub fn reversed_echo(
1022        &self,
1023        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1024    ) -> ::core::result::Result<
1025        (),
1026        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
1027    > {
1028        ::fidl_next::protocol::ServiceConnector::<
1029                ::fidl_next::fuchsia::zx::Channel
1030            >::connect_to_member(
1031                &self.connector,
1032                "reversed_echo",
1033                server_end.into_untyped(),
1034            )
1035    }
1036}
1037
1038/// A service handler for the `EchoService` service.
1039pub trait EchoServiceHandler {
1040    /// Handles an attempt to connect to the `regular_echo` member.
1041    fn regular_echo(
1042        &self,
1043        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1044    );
1045
1046    /// Handles an attempt to connect to the `reversed_echo` member.
1047    fn reversed_echo(
1048        &self,
1049        server_end: ::fidl_next::ServerEnd<crate::Echo, ::fidl_next::fuchsia::zx::Channel>,
1050    );
1051}
1052
1053impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for EchoService
1054where
1055    ___H: EchoServiceHandler,
1056    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1057    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
1058{
1059    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
1060        use ::fidl_next::InstanceFromServiceTransport;
1061        match member {
1062            "regular_echo" => handler.regular_echo(::fidl_next::ServerEnd::from_untyped(
1063                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1064            )),
1065
1066            "reversed_echo" => handler.reversed_echo(::fidl_next::ServerEnd::from_untyped(
1067                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
1068            )),
1069
1070            _ => unreachable!(),
1071        }
1072    }
1073}
1074
1075pub use fidl_next_common_fuchsia_examples::*;
1076
1077/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
1078pub mod compat {
1079
1080    pub use fidl_next_common_fuchsia_examples::compat::*;
1081
1082    impl ::fidl_next::CompatFrom<crate::EchoLauncherGetEchoResponse>
1083        for ::fidl_fuchsia_examples::EchoLauncherGetEchoResponse
1084    {
1085        #[inline]
1086        fn compat_from(value: crate::EchoLauncherGetEchoResponse) -> Self {
1087            Self { response: ::fidl_next::CompatFrom::compat_from(value.response) }
1088        }
1089    }
1090
1091    impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples::EchoLauncherGetEchoResponse>
1092        for crate::EchoLauncherGetEchoResponse
1093    {
1094        #[inline]
1095        fn compat_from(value: ::fidl_fuchsia_examples::EchoLauncherGetEchoResponse) -> Self {
1096            Self { response: ::fidl_next::CompatFrom::compat_from(value.response) }
1097        }
1098    }
1099
1100    impl ::fidl_next::CompatFrom<crate::EchoLauncherGetEchoPipelinedRequest>
1101        for ::fidl_fuchsia_examples::EchoLauncherGetEchoPipelinedRequest
1102    {
1103        #[inline]
1104        fn compat_from(value: crate::EchoLauncherGetEchoPipelinedRequest) -> Self {
1105            Self {
1106                echo_prefix: ::fidl_next::CompatFrom::compat_from(value.echo_prefix),
1107
1108                request: ::fidl_next::CompatFrom::compat_from(value.request),
1109            }
1110        }
1111    }
1112
1113    impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples::EchoLauncherGetEchoPipelinedRequest>
1114        for crate::EchoLauncherGetEchoPipelinedRequest
1115    {
1116        #[inline]
1117        fn compat_from(
1118            value: ::fidl_fuchsia_examples::EchoLauncherGetEchoPipelinedRequest,
1119        ) -> Self {
1120            Self {
1121                echo_prefix: ::fidl_next::CompatFrom::compat_from(value.echo_prefix),
1122
1123                request: ::fidl_next::CompatFrom::compat_from(value.request),
1124            }
1125        }
1126    }
1127
1128    #[cfg(target_os = "fuchsia")]
1129    /// An alias for a client over `zx::Channel` for the `EchoLauncher`
1130    /// protocol.
1131    pub type EchoLauncherProxy = ::fidl_next::Client<crate::EchoLauncher>;
1132
1133    impl ::fidl_next::CompatFrom<crate::EchoLauncher> for ::fidl_fuchsia_examples::EchoLauncherMarker {
1134        fn compat_from(_: crate::EchoLauncher) -> Self {
1135            Self
1136        }
1137    }
1138
1139    impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples::EchoLauncherMarker> for crate::EchoLauncher {
1140        fn compat_from(_: ::fidl_fuchsia_examples::EchoLauncherMarker) -> Self {
1141            Self
1142        }
1143    }
1144
1145    #[cfg(target_os = "fuchsia")]
1146
1147    impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_examples::EchoLauncherProxy>
1148        for crate::EchoLauncher
1149    {
1150        fn client_compat_from(
1151            proxy: ::fidl_fuchsia_examples::EchoLauncherProxy,
1152        ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
1153            let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
1154            let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
1155            ::fidl_next::ClientDispatcher::new(client_end)
1156        }
1157    }
1158
1159    impl ::fidl_next::CompatFrom<crate::EventStruct> for ::fidl_fuchsia_examples::EventStruct {
1160        #[inline]
1161        fn compat_from(value: crate::EventStruct) -> Self {
1162            Self { event: ::fidl_next::CompatFrom::compat_from(value.event) }
1163        }
1164    }
1165
1166    impl ::fidl_next::CompatFrom<::fidl_fuchsia_examples::EventStruct> for crate::EventStruct {
1167        #[inline]
1168        fn compat_from(value: ::fidl_fuchsia_examples::EventStruct) -> Self {
1169            Self { event: ::fidl_next::CompatFrom::compat_from(value.event) }
1170        }
1171    }
1172}