Skip to main content

fidl_next_fuchsia_hardware_power/
fidl_next_fuchsia_hardware_power.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_hardware_power::natural::*;
8
9    #[derive(Debug, PartialEq)]
10    #[repr(C)]
11    pub struct PowerTokenProviderGetTokenResponse {
12        pub handle: ::fidl_next::fuchsia::zx::Event,
13    }
14
15    unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerTokenProviderGetTokenResponse, ___E>
16        for PowerTokenProviderGetTokenResponse
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::PowerTokenProviderGetTokenResponse,
24        > = unsafe {
25            ::fidl_next::CopyOptimization::enable_if(
26                true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::Encode<
27                    ::fidl_next::wire::fuchsia::Event,
28                    ___E,
29                >>::COPY_OPTIMIZATION
30                    .is_enabled(),
31            )
32        };
33
34        #[inline]
35        fn encode(
36            self,
37            encoder_: &mut ___E,
38            out_: &mut ::core::mem::MaybeUninit<crate::wire::PowerTokenProviderGetTokenResponse>,
39            _: (),
40        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
41            ::fidl_next::munge! {
42                let crate::wire::PowerTokenProviderGetTokenResponse {
43                    handle,
44
45                } = out_;
46            }
47
48            ::fidl_next::Encode::encode(self.handle, encoder_, handle, ())?;
49
50            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(handle.as_mut_ptr()) };
51
52            Ok(())
53        }
54    }
55
56    unsafe impl<___E>
57        ::fidl_next::EncodeOption<
58            ::fidl_next::wire::Box<'static, crate::wire::PowerTokenProviderGetTokenResponse>,
59            ___E,
60        > for PowerTokenProviderGetTokenResponse
61    where
62        ___E: ::fidl_next::Encoder + ?Sized,
63        PowerTokenProviderGetTokenResponse:
64            ::fidl_next::Encode<crate::wire::PowerTokenProviderGetTokenResponse, ___E>,
65    {
66        #[inline]
67        fn encode_option(
68            this: ::core::option::Option<Self>,
69            encoder: &mut ___E,
70            out: &mut ::core::mem::MaybeUninit<
71                ::fidl_next::wire::Box<'static, crate::wire::PowerTokenProviderGetTokenResponse>,
72            >,
73            _: (),
74        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
75            if let Some(inner) = this {
76                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
77                ::fidl_next::wire::Box::encode_present(out);
78            } else {
79                ::fidl_next::wire::Box::encode_absent(out);
80            }
81
82            Ok(())
83        }
84    }
85
86    impl ::fidl_next::FromWire<crate::wire::PowerTokenProviderGetTokenResponse>
87        for PowerTokenProviderGetTokenResponse
88    {
89        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
90            crate::wire::PowerTokenProviderGetTokenResponse,
91            Self,
92        > = unsafe {
93            ::fidl_next::CopyOptimization::enable_if(
94                true && <::fidl_next::fuchsia::zx::Event as ::fidl_next::FromWire<
95                    ::fidl_next::wire::fuchsia::Event,
96                >>::COPY_OPTIMIZATION
97                    .is_enabled(),
98            )
99        };
100
101        #[inline]
102        fn from_wire(wire: crate::wire::PowerTokenProviderGetTokenResponse) -> Self {
103            Self { handle: ::fidl_next::FromWire::from_wire(wire.handle) }
104        }
105    }
106}
107
108pub mod wire {
109
110    pub use fidl_next_common_fuchsia_hardware_power::wire::*;
111
112    /// The wire type corresponding to [`PowerTokenProviderGetTokenResponse`].
113    #[derive(Debug)]
114    #[repr(C)]
115    pub struct PowerTokenProviderGetTokenResponse {
116        pub handle: ::fidl_next::wire::fuchsia::Event,
117    }
118
119    static_assertions::const_assert_eq!(
120        std::mem::size_of::<PowerTokenProviderGetTokenResponse>(),
121        4
122    );
123    static_assertions::const_assert_eq!(
124        std::mem::align_of::<PowerTokenProviderGetTokenResponse>(),
125        4
126    );
127
128    static_assertions::const_assert_eq!(
129        std::mem::offset_of!(PowerTokenProviderGetTokenResponse, handle),
130        0
131    );
132
133    impl ::fidl_next::Constrained for PowerTokenProviderGetTokenResponse {
134        type Constraint = ();
135
136        fn validate(
137            _: ::fidl_next::Slot<'_, Self>,
138            _: Self::Constraint,
139        ) -> Result<(), ::fidl_next::ValidationError> {
140            Ok(())
141        }
142    }
143
144    unsafe impl ::fidl_next::Wire for PowerTokenProviderGetTokenResponse {
145        type Narrowed<'de> = PowerTokenProviderGetTokenResponse;
146
147        #[inline]
148        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
149            ::fidl_next::munge! {
150                let Self {
151                    handle,
152
153                } = &mut *out_;
154            }
155
156            ::fidl_next::Wire::zero_padding(handle);
157        }
158    }
159
160    unsafe impl<___D> ::fidl_next::Decode<___D> for PowerTokenProviderGetTokenResponse
161    where
162        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
163        ___D: ::fidl_next::fuchsia::HandleDecoder,
164    {
165        fn decode(
166            slot_: ::fidl_next::Slot<'_, Self>,
167            decoder_: &mut ___D,
168            _: (),
169        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
170            ::fidl_next::munge! {
171                let Self {
172                    mut handle,
173
174                } = slot_;
175            }
176
177            let _field = handle.as_mut();
178
179            ::fidl_next::Decode::decode(handle.as_mut(), decoder_, ())?;
180
181            Ok(())
182        }
183    }
184
185    impl ::fidl_next::IntoNatural for PowerTokenProviderGetTokenResponse {
186        type Natural = crate::natural::PowerTokenProviderGetTokenResponse;
187    }
188}
189
190pub mod wire_optional {
191
192    pub use fidl_next_common_fuchsia_hardware_power::wire_optional::*;
193}
194
195pub mod generic {
196
197    pub use fidl_next_common_fuchsia_hardware_power::generic::*;
198
199    /// The generic type corresponding to [`PowerTokenProviderGetTokenResponse`].
200    pub struct PowerTokenProviderGetTokenResponse<T0> {
201        pub handle: T0,
202    }
203
204    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::PowerTokenProviderGetTokenResponse, ___E>
205        for PowerTokenProviderGetTokenResponse<T0>
206    where
207        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
208        ___E: ::fidl_next::fuchsia::HandleEncoder,
209        T0: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Event, ___E>,
210    {
211        #[inline]
212        fn encode(
213            self,
214            encoder_: &mut ___E,
215            out_: &mut ::core::mem::MaybeUninit<crate::wire::PowerTokenProviderGetTokenResponse>,
216            _: (),
217        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
218            ::fidl_next::munge! {
219                let crate::wire::PowerTokenProviderGetTokenResponse {
220                    handle,
221
222                } = out_;
223            }
224
225            ::fidl_next::Encode::encode(self.handle, encoder_, handle, ())?;
226
227            Ok(())
228        }
229    }
230}
231
232pub use self::natural::*;
233
234/// The type corresponding to the PowerTokenProvider protocol.
235#[derive(PartialEq, Debug)]
236pub struct PowerTokenProvider;
237
238impl ::fidl_next::Discoverable for PowerTokenProvider {
239    const PROTOCOL_NAME: &'static str = "fuchsia.hardware.power.PowerTokenProvider";
240}
241
242#[cfg(target_os = "fuchsia")]
243impl ::fidl_next::HasTransport for PowerTokenProvider {
244    type Transport = ::fidl_next::fuchsia::zx::Channel;
245}
246
247pub mod power_token_provider {
248    pub mod prelude {
249        pub use crate::{
250            PowerTokenProvider, PowerTokenProviderClientHandler,
251            PowerTokenProviderLocalClientHandler, PowerTokenProviderLocalServerHandler,
252            PowerTokenProviderServerHandler, power_token_provider,
253        };
254
255        pub use crate::natural::PowerTokenProviderGetTokenResponse;
256    }
257
258    pub struct GetToken;
259
260    impl ::fidl_next::Method for GetToken {
261        const ORDINAL: u64 = 2926448721688236234;
262        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
263            ::fidl_next::protocol::Flexibility::Flexible;
264
265        type Protocol = crate::PowerTokenProvider;
266
267        type Request = ::fidl_next::wire::EmptyMessageBody;
268    }
269
270    impl ::fidl_next::TwoWayMethod for GetToken {
271        type Response = ::fidl_next::wire::FlexibleResult<
272            'static,
273            crate::wire::PowerTokenProviderGetTokenResponse,
274            ::fidl_next::wire::Int32,
275        >;
276    }
277
278    impl<___R> ::fidl_next::Respond<___R> for GetToken {
279        type Output = ::fidl_next::FlexibleResult<
280            crate::generic::PowerTokenProviderGetTokenResponse<___R>,
281            ::fidl_next::util::Never,
282        >;
283
284        fn respond(response: ___R) -> Self::Output {
285            ::fidl_next::FlexibleResult::Ok(crate::generic::PowerTokenProviderGetTokenResponse {
286                handle: response,
287            })
288        }
289    }
290
291    impl<___R> ::fidl_next::RespondErr<___R> for GetToken {
292        type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
293
294        fn respond_err(response: ___R) -> Self::Output {
295            ::fidl_next::FlexibleResult::Err(response)
296        }
297    }
298
299    mod ___detail {
300        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::PowerTokenProvider
301        where
302            ___T: ::fidl_next::Transport,
303        {
304            type Client = PowerTokenProviderClient<___T>;
305            type Server = PowerTokenProviderServer<___T>;
306        }
307
308        /// The client for the `PowerTokenProvider` protocol.
309        #[repr(transparent)]
310        pub struct PowerTokenProviderClient<___T: ::fidl_next::Transport> {
311            #[allow(dead_code)]
312            client: ::fidl_next::protocol::Client<___T>,
313        }
314
315        impl<___T> PowerTokenProviderClient<___T>
316        where
317            ___T: ::fidl_next::Transport,
318        {
319            #[doc = " Returns a token which can be used with `fuchsia.power.broker` APIs to\n create a relationship between this driver\'s power element(s) and the\n power element this token is associated with.\n"]
320            pub fn get_token(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetToken, ___T> {
321                ::fidl_next::TwoWayFuture::from_untyped(
322                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
323                        2926448721688236234,
324                        <super::GetToken as ::fidl_next::Method>::FLEXIBILITY,
325                        (),
326                    ),
327                )
328            }
329        }
330
331        /// The server for the `PowerTokenProvider` protocol.
332        #[repr(transparent)]
333        pub struct PowerTokenProviderServer<___T: ::fidl_next::Transport> {
334            server: ::fidl_next::protocol::Server<___T>,
335        }
336
337        impl<___T> PowerTokenProviderServer<___T> where ___T: ::fidl_next::Transport {}
338    }
339}
340
341#[diagnostic::on_unimplemented(
342    note = "If {Self} implements the non-local PowerTokenProviderClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
343)]
344
345/// A client handler for the PowerTokenProvider protocol.
346///
347/// See [`PowerTokenProvider`] for more details.
348pub trait PowerTokenProviderLocalClientHandler<
349    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
350    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
351>
352{
353    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
354        ::core::future::ready(())
355    }
356}
357
358impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for PowerTokenProvider
359where
360    ___H: PowerTokenProviderLocalClientHandler<___T>,
361    ___T: ::fidl_next::Transport,
362{
363    async fn on_event(
364        handler: &mut ___H,
365        ordinal: u64,
366        flexibility: ::fidl_next::protocol::Flexibility,
367        body: ::fidl_next::Body<___T>,
368    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
369        match ordinal {
370            ordinal => {
371                handler.on_unknown_interaction(ordinal).await;
372                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
373                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
374                } else {
375                    Ok(())
376                }
377            }
378        }
379    }
380}
381
382#[diagnostic::on_unimplemented(
383    note = "If {Self} implements the non-local PowerTokenProviderServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
384)]
385
386/// A server handler for the PowerTokenProvider protocol.
387///
388/// See [`PowerTokenProvider`] for more details.
389pub trait PowerTokenProviderLocalServerHandler<
390    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
391    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
392>
393{
394    #[doc = " Returns a token which can be used with `fuchsia.power.broker` APIs to\n create a relationship between this driver\'s power element(s) and the\n power element this token is associated with.\n"]
395    fn get_token(
396        &mut self,
397
398        responder: ::fidl_next::Responder<power_token_provider::GetToken, ___T>,
399    ) -> impl ::core::future::Future<Output = ()>;
400
401    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
402        ::core::future::ready(())
403    }
404}
405
406impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for PowerTokenProvider
407where
408    ___H: PowerTokenProviderLocalServerHandler<___T>,
409    ___T: ::fidl_next::Transport,
410{
411    async fn on_one_way(
412        handler: &mut ___H,
413        ordinal: u64,
414        flexibility: ::fidl_next::protocol::Flexibility,
415        body: ::fidl_next::Body<___T>,
416    ) -> ::core::result::Result<
417        (),
418        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
419    > {
420        match ordinal {
421            ordinal => {
422                handler.on_unknown_interaction(ordinal).await;
423                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
424                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
425                } else {
426                    Ok(())
427                }
428            }
429        }
430    }
431
432    async fn on_two_way(
433        handler: &mut ___H,
434        ordinal: u64,
435        flexibility: ::fidl_next::protocol::Flexibility,
436        body: ::fidl_next::Body<___T>,
437        responder: ::fidl_next::protocol::Responder<___T>,
438    ) -> ::core::result::Result<
439        (),
440        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
441    > {
442        match ordinal {
443            2926448721688236234 => {
444                let responder = ::fidl_next::Responder::from_untyped(responder);
445
446                handler.get_token(responder).await;
447                Ok(())
448            }
449
450            ordinal => {
451                handler.on_unknown_interaction(ordinal).await;
452                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
453                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
454                } else {
455                    responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
456                                ordinal,
457                                flexibility,
458                                ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
459                            )
460                            .expect("encoding a framework error should never fail")
461                            .await?;
462                    Ok(())
463                }
464            }
465        }
466    }
467}
468
469/// A client handler for the PowerTokenProvider protocol.
470///
471/// See [`PowerTokenProvider`] for more details.
472pub trait PowerTokenProviderClientHandler<
473    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
474    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
475>
476{
477    fn on_unknown_interaction(
478        &mut self,
479        ordinal: u64,
480    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
481        ::core::future::ready(())
482    }
483}
484
485impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for PowerTokenProvider
486where
487    ___H: PowerTokenProviderClientHandler<___T> + ::core::marker::Send,
488    ___T: ::fidl_next::Transport,
489{
490    async fn on_event(
491        handler: &mut ___H,
492        ordinal: u64,
493        flexibility: ::fidl_next::protocol::Flexibility,
494        body: ::fidl_next::Body<___T>,
495    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
496        match ordinal {
497            ordinal => {
498                handler.on_unknown_interaction(ordinal).await;
499                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
500                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
501                } else {
502                    Ok(())
503                }
504            }
505        }
506    }
507}
508
509/// A server handler for the PowerTokenProvider protocol.
510///
511/// See [`PowerTokenProvider`] for more details.
512pub trait PowerTokenProviderServerHandler<
513    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
514    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
515>
516{
517    #[doc = " Returns a token which can be used with `fuchsia.power.broker` APIs to\n create a relationship between this driver\'s power element(s) and the\n power element this token is associated with.\n"]
518    fn get_token(
519        &mut self,
520
521        responder: ::fidl_next::Responder<power_token_provider::GetToken, ___T>,
522    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
523
524    fn on_unknown_interaction(
525        &mut self,
526        ordinal: u64,
527    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
528        ::core::future::ready(())
529    }
530}
531
532impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for PowerTokenProvider
533where
534    ___H: PowerTokenProviderServerHandler<___T> + ::core::marker::Send,
535    ___T: ::fidl_next::Transport,
536{
537    async fn on_one_way(
538        handler: &mut ___H,
539        ordinal: u64,
540        flexibility: ::fidl_next::protocol::Flexibility,
541        body: ::fidl_next::Body<___T>,
542    ) -> ::core::result::Result<
543        (),
544        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
545    > {
546        match ordinal {
547            ordinal => {
548                handler.on_unknown_interaction(ordinal).await;
549                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
550                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
551                } else {
552                    Ok(())
553                }
554            }
555        }
556    }
557
558    async fn on_two_way(
559        handler: &mut ___H,
560        ordinal: u64,
561        flexibility: ::fidl_next::protocol::Flexibility,
562        body: ::fidl_next::Body<___T>,
563        responder: ::fidl_next::protocol::Responder<___T>,
564    ) -> ::core::result::Result<
565        (),
566        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
567    > {
568        match ordinal {
569            2926448721688236234 => {
570                let responder = ::fidl_next::Responder::from_untyped(responder);
571
572                handler.get_token(responder).await;
573                Ok(())
574            }
575
576            ordinal => {
577                handler.on_unknown_interaction(ordinal).await;
578                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
579                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
580                } else {
581                    responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
582                                ordinal,
583                                flexibility,
584                                ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
585                            )
586                            .expect("encoding a framework error should never fail")
587                            .await?;
588                    Ok(())
589                }
590            }
591        }
592    }
593}
594
595impl<___T> PowerTokenProviderClientHandler<___T> for ::fidl_next::IgnoreEvents
596where
597    ___T: ::fidl_next::Transport,
598{
599    async fn on_unknown_interaction(&mut self, _: u64) {}
600}
601
602impl<___H, ___T> PowerTokenProviderLocalClientHandler<___T> for ::fidl_next::Local<___H>
603where
604    ___H: PowerTokenProviderClientHandler<___T>,
605    ___T: ::fidl_next::Transport,
606{
607    async fn on_unknown_interaction(&mut self, ordinal: u64) {
608        ___H::on_unknown_interaction(&mut self.0, ordinal).await
609    }
610}
611
612impl<___H, ___T> PowerTokenProviderLocalServerHandler<___T> for ::fidl_next::Local<___H>
613where
614    ___H: PowerTokenProviderServerHandler<___T>,
615    ___T: ::fidl_next::Transport,
616{
617    async fn get_token(
618        &mut self,
619
620        responder: ::fidl_next::Responder<power_token_provider::GetToken, ___T>,
621    ) {
622        ___H::get_token(&mut self.0, responder).await
623    }
624
625    async fn on_unknown_interaction(&mut self, ordinal: u64) {
626        ___H::on_unknown_interaction(&mut self.0, ordinal).await
627    }
628}
629
630/// The type corresponding to the PowerTokenService service.
631#[derive(Debug)]
632pub struct PowerTokenService;
633
634impl ::fidl_next::DiscoverableService for PowerTokenService {
635    const SERVICE_NAME: &'static str = "fuchsia.hardware.power.PowerTokenService";
636    const MEMBER_NAMES: &'static [&'static str] = &["token_provider"];
637}
638
639impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for PowerTokenService {}
640
641impl<___C> ::fidl_next::Service<___C> for PowerTokenService
642where
643    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
644{
645    type Connector = PowerTokenServiceConnector<___C>;
646}
647
648/// A strongly-typed service connector for the `PowerTokenService` service.
649#[repr(transparent)]
650pub struct PowerTokenServiceConnector<___C> {
651    #[allow(dead_code)]
652    connector: ___C,
653}
654
655impl<___C> PowerTokenServiceConnector<___C>
656where
657    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
658{
659    /// Attempts to connect to the `token_provider` service member.
660    pub fn token_provider(
661        &self,
662        server_end: ::fidl_next::ServerEnd<
663            crate::PowerTokenProvider,
664            ::fidl_next::fuchsia::zx::Channel,
665        >,
666    ) -> ::core::result::Result<
667        (),
668        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
669    > {
670        ::fidl_next::protocol::ServiceConnector::<
671                ::fidl_next::fuchsia::zx::Channel
672            >::connect_to_member(
673                &self.connector,
674                "token_provider",
675                server_end.into_untyped(),
676            )
677    }
678}
679
680/// A service handler for the `PowerTokenService` service.
681pub trait PowerTokenServiceHandler {
682    /// Handles an attempt to connect to the `token_provider` member.
683    fn token_provider(
684        &self,
685        server_end: ::fidl_next::ServerEnd<
686            crate::PowerTokenProvider,
687            ::fidl_next::fuchsia::zx::Channel,
688        >,
689    );
690}
691
692impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for PowerTokenService
693where
694    ___H: PowerTokenServiceHandler,
695    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
696{
697    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
698        use ::fidl_next::InstanceFromServiceTransport;
699        match member {
700            "token_provider" => handler.token_provider(::fidl_next::ServerEnd::from_untyped(
701                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
702            )),
703
704            _ => unreachable!(),
705        }
706    }
707}
708
709/// The type corresponding to the Service service.
710#[derive(Debug)]
711pub struct Service;
712
713impl ::fidl_next::DiscoverableService for Service {
714    const SERVICE_NAME: &'static str = "fuchsia.hardware.power.Service";
715    const MEMBER_NAMES: &'static [&'static str] = &["device"];
716}
717
718impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
719
720impl<___C> ::fidl_next::Service<___C> for Service
721where
722    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
723{
724    type Connector = ServiceConnector<___C>;
725}
726
727/// A strongly-typed service connector for the `Service` service.
728#[repr(transparent)]
729pub struct ServiceConnector<___C> {
730    #[allow(dead_code)]
731    connector: ___C,
732}
733
734impl<___C> ServiceConnector<___C>
735where
736    ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
737{
738    /// Attempts to connect to the `device` service member.
739    pub fn device(
740        &self,
741        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
742    ) -> ::core::result::Result<
743        (),
744        <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
745    > {
746        ::fidl_next::protocol::ServiceConnector::<
747                ::fidl_next::fuchsia::zx::Channel
748            >::connect_to_member(
749                &self.connector,
750                "device",
751                server_end.into_untyped(),
752            )
753    }
754}
755
756/// A service handler for the `Service` service.
757pub trait ServiceHandler {
758    /// Handles an attempt to connect to the `device` member.
759    fn device(
760        &self,
761        server_end: ::fidl_next::ServerEnd<crate::Device, ::fidl_next::fuchsia::zx::Channel>,
762    );
763}
764
765impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
766where
767    ___H: ServiceHandler,
768    ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
769{
770    fn on_connection(handler: &___H, member: &str, server_end: ___T) {
771        use ::fidl_next::InstanceFromServiceTransport;
772        match member {
773            "device" => handler.device(::fidl_next::ServerEnd::from_untyped(
774                ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
775            )),
776
777            _ => unreachable!(),
778        }
779    }
780}
781
782pub use fidl_next_common_fuchsia_hardware_power::*;