fidl_fuchsia_power_systemmode/
fidl_fuchsia_power_systemmode.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_power_systemmode_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ClientConfiguratorMarker;
16
17impl fidl::endpoints::ProtocolMarker for ClientConfiguratorMarker {
18    type Proxy = ClientConfiguratorProxy;
19    type RequestStream = ClientConfiguratorRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = ClientConfiguratorSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.power.systemmode.ClientConfigurator";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for ClientConfiguratorMarker {}
26
27pub trait ClientConfiguratorProxyInterface: Send + Sync {
28    type GetResponseFut: std::future::Future<Output = Result<Option<Box<ClientConfig>>, fidl::Error>>
29        + Send;
30    fn r#get(
31        &self,
32        client_type: fidl_fuchsia_power_clientlevel::ClientType,
33    ) -> Self::GetResponseFut;
34    type SetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
35    fn r#set(
36        &self,
37        client_type: fidl_fuchsia_power_clientlevel::ClientType,
38        config: &ClientConfig,
39    ) -> Self::SetResponseFut;
40}
41#[derive(Debug)]
42#[cfg(target_os = "fuchsia")]
43pub struct ClientConfiguratorSynchronousProxy {
44    client: fidl::client::sync::Client,
45}
46
47#[cfg(target_os = "fuchsia")]
48impl fidl::endpoints::SynchronousProxy for ClientConfiguratorSynchronousProxy {
49    type Proxy = ClientConfiguratorProxy;
50    type Protocol = ClientConfiguratorMarker;
51
52    fn from_channel(inner: fidl::Channel) -> Self {
53        Self::new(inner)
54    }
55
56    fn into_channel(self) -> fidl::Channel {
57        self.client.into_channel()
58    }
59
60    fn as_channel(&self) -> &fidl::Channel {
61        self.client.as_channel()
62    }
63}
64
65#[cfg(target_os = "fuchsia")]
66impl ClientConfiguratorSynchronousProxy {
67    pub fn new(channel: fidl::Channel) -> Self {
68        let protocol_name =
69            <ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
70        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
71    }
72
73    pub fn into_channel(self) -> fidl::Channel {
74        self.client.into_channel()
75    }
76
77    /// Waits until an event arrives and returns it. It is safe for other
78    /// threads to make concurrent requests while waiting for an event.
79    pub fn wait_for_event(
80        &self,
81        deadline: zx::MonotonicInstant,
82    ) -> Result<ClientConfiguratorEvent, fidl::Error> {
83        ClientConfiguratorEvent::decode(self.client.wait_for_event(deadline)?)
84    }
85
86    /// Gets the power configuration for the given [`ClientType`].
87    ///
88    /// If there is no power configuration for `client_type` then the returned
89    /// value will be absent.
90    ///
91    /// + `client_type` specifies which [`ClientType`] [`ClientConfig`] to get
92    /// - `config` is the returned client-specific configuration, or an absent
93    /// value if `client_type` does not have an existing configuration
94    pub fn r#get(
95        &self,
96        mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
97        ___deadline: zx::MonotonicInstant,
98    ) -> Result<Option<Box<ClientConfig>>, fidl::Error> {
99        let _response =
100            self.client.send_query::<ClientConfiguratorGetRequest, ClientConfiguratorGetResponse>(
101                (client_type,),
102                0x1e37597b4d247d7b,
103                fidl::encoding::DynamicFlags::empty(),
104                ___deadline,
105            )?;
106        Ok(_response.config)
107    }
108
109    /// Sets the power configuration for the given [`ClientType`].
110    ///
111    /// This method should be used in tandem with [`GetConfig`] in order to
112    /// update the existing power configuration for a given [`ClientType`]
113    /// without fully overwriting it.
114    ///
115    /// When the power configuration for a given [`ClientType`] is changed, the
116    /// Power Manager will reevaluate current power level of that [`ClientType`]
117    /// according to the new configuration. This reevaluation may result in a
118    /// new power level being sent to the connected client.
119    ///
120    /// The call returns immediately after the new config has been received and
121    /// validated. Actual system changes to be applied as a result of changing a
122    /// client's configuration will occur after the call has returned.
123    /// Therefore, any errors that occur while updating clients according to the
124    /// new system power mode are not propagated back to the caller. Instead,
125    /// client updates are applied on a "best effort" basis.
126    ///
127    /// If the provided `config` is not valid, then no changes will be applied
128    /// and the channel will be closed. Validation will fail if a given
129    /// `SystemMode` is repeated across multiple `mode_match` entries contained
130    /// by the `ClientConfig`.
131    ///
132    /// + `client_type` specifies which [`ClientType`]'s [`ClientConfig`] to set
133    /// + `config` is the [`ClientConfig`] that will be set for [`client_type`]
134    pub fn r#set(
135        &self,
136        mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
137        mut config: &ClientConfig,
138        ___deadline: zx::MonotonicInstant,
139    ) -> Result<(), fidl::Error> {
140        let _response =
141            self.client.send_query::<ClientConfiguratorSetRequest, fidl::encoding::EmptyPayload>(
142                (client_type, config),
143                0x2204fb91b32f6435,
144                fidl::encoding::DynamicFlags::empty(),
145                ___deadline,
146            )?;
147        Ok(_response)
148    }
149}
150
151#[cfg(target_os = "fuchsia")]
152impl From<ClientConfiguratorSynchronousProxy> for zx::Handle {
153    fn from(value: ClientConfiguratorSynchronousProxy) -> Self {
154        value.into_channel().into()
155    }
156}
157
158#[cfg(target_os = "fuchsia")]
159impl From<fidl::Channel> for ClientConfiguratorSynchronousProxy {
160    fn from(value: fidl::Channel) -> Self {
161        Self::new(value)
162    }
163}
164
165#[derive(Debug, Clone)]
166pub struct ClientConfiguratorProxy {
167    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
168}
169
170impl fidl::endpoints::Proxy for ClientConfiguratorProxy {
171    type Protocol = ClientConfiguratorMarker;
172
173    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
174        Self::new(inner)
175    }
176
177    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
178        self.client.into_channel().map_err(|client| Self { client })
179    }
180
181    fn as_channel(&self) -> &::fidl::AsyncChannel {
182        self.client.as_channel()
183    }
184}
185
186impl ClientConfiguratorProxy {
187    /// Create a new Proxy for fuchsia.power.systemmode/ClientConfigurator.
188    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
189        let protocol_name =
190            <ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
191        Self { client: fidl::client::Client::new(channel, protocol_name) }
192    }
193
194    /// Get a Stream of events from the remote end of the protocol.
195    ///
196    /// # Panics
197    ///
198    /// Panics if the event stream was already taken.
199    pub fn take_event_stream(&self) -> ClientConfiguratorEventStream {
200        ClientConfiguratorEventStream { event_receiver: self.client.take_event_receiver() }
201    }
202
203    /// Gets the power configuration for the given [`ClientType`].
204    ///
205    /// If there is no power configuration for `client_type` then the returned
206    /// value will be absent.
207    ///
208    /// + `client_type` specifies which [`ClientType`] [`ClientConfig`] to get
209    /// - `config` is the returned client-specific configuration, or an absent
210    /// value if `client_type` does not have an existing configuration
211    pub fn r#get(
212        &self,
213        mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
214    ) -> fidl::client::QueryResponseFut<
215        Option<Box<ClientConfig>>,
216        fidl::encoding::DefaultFuchsiaResourceDialect,
217    > {
218        ClientConfiguratorProxyInterface::r#get(self, client_type)
219    }
220
221    /// Sets the power configuration for the given [`ClientType`].
222    ///
223    /// This method should be used in tandem with [`GetConfig`] in order to
224    /// update the existing power configuration for a given [`ClientType`]
225    /// without fully overwriting it.
226    ///
227    /// When the power configuration for a given [`ClientType`] is changed, the
228    /// Power Manager will reevaluate current power level of that [`ClientType`]
229    /// according to the new configuration. This reevaluation may result in a
230    /// new power level being sent to the connected client.
231    ///
232    /// The call returns immediately after the new config has been received and
233    /// validated. Actual system changes to be applied as a result of changing a
234    /// client's configuration will occur after the call has returned.
235    /// Therefore, any errors that occur while updating clients according to the
236    /// new system power mode are not propagated back to the caller. Instead,
237    /// client updates are applied on a "best effort" basis.
238    ///
239    /// If the provided `config` is not valid, then no changes will be applied
240    /// and the channel will be closed. Validation will fail if a given
241    /// `SystemMode` is repeated across multiple `mode_match` entries contained
242    /// by the `ClientConfig`.
243    ///
244    /// + `client_type` specifies which [`ClientType`]'s [`ClientConfig`] to set
245    /// + `config` is the [`ClientConfig`] that will be set for [`client_type`]
246    pub fn r#set(
247        &self,
248        mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
249        mut config: &ClientConfig,
250    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
251        ClientConfiguratorProxyInterface::r#set(self, client_type, config)
252    }
253}
254
255impl ClientConfiguratorProxyInterface for ClientConfiguratorProxy {
256    type GetResponseFut = fidl::client::QueryResponseFut<
257        Option<Box<ClientConfig>>,
258        fidl::encoding::DefaultFuchsiaResourceDialect,
259    >;
260    fn r#get(
261        &self,
262        mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
263    ) -> Self::GetResponseFut {
264        fn _decode(
265            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
266        ) -> Result<Option<Box<ClientConfig>>, fidl::Error> {
267            let _response = fidl::client::decode_transaction_body::<
268                ClientConfiguratorGetResponse,
269                fidl::encoding::DefaultFuchsiaResourceDialect,
270                0x1e37597b4d247d7b,
271            >(_buf?)?;
272            Ok(_response.config)
273        }
274        self.client
275            .send_query_and_decode::<ClientConfiguratorGetRequest, Option<Box<ClientConfig>>>(
276                (client_type,),
277                0x1e37597b4d247d7b,
278                fidl::encoding::DynamicFlags::empty(),
279                _decode,
280            )
281    }
282
283    type SetResponseFut =
284        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
285    fn r#set(
286        &self,
287        mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
288        mut config: &ClientConfig,
289    ) -> Self::SetResponseFut {
290        fn _decode(
291            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
292        ) -> Result<(), fidl::Error> {
293            let _response = fidl::client::decode_transaction_body::<
294                fidl::encoding::EmptyPayload,
295                fidl::encoding::DefaultFuchsiaResourceDialect,
296                0x2204fb91b32f6435,
297            >(_buf?)?;
298            Ok(_response)
299        }
300        self.client.send_query_and_decode::<ClientConfiguratorSetRequest, ()>(
301            (client_type, config),
302            0x2204fb91b32f6435,
303            fidl::encoding::DynamicFlags::empty(),
304            _decode,
305        )
306    }
307}
308
309pub struct ClientConfiguratorEventStream {
310    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
311}
312
313impl std::marker::Unpin for ClientConfiguratorEventStream {}
314
315impl futures::stream::FusedStream for ClientConfiguratorEventStream {
316    fn is_terminated(&self) -> bool {
317        self.event_receiver.is_terminated()
318    }
319}
320
321impl futures::Stream for ClientConfiguratorEventStream {
322    type Item = Result<ClientConfiguratorEvent, fidl::Error>;
323
324    fn poll_next(
325        mut self: std::pin::Pin<&mut Self>,
326        cx: &mut std::task::Context<'_>,
327    ) -> std::task::Poll<Option<Self::Item>> {
328        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
329            &mut self.event_receiver,
330            cx
331        )?) {
332            Some(buf) => std::task::Poll::Ready(Some(ClientConfiguratorEvent::decode(buf))),
333            None => std::task::Poll::Ready(None),
334        }
335    }
336}
337
338#[derive(Debug)]
339pub enum ClientConfiguratorEvent {}
340
341impl ClientConfiguratorEvent {
342    /// Decodes a message buffer as a [`ClientConfiguratorEvent`].
343    fn decode(
344        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
345    ) -> Result<ClientConfiguratorEvent, fidl::Error> {
346        let (bytes, _handles) = buf.split_mut();
347        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
348        debug_assert_eq!(tx_header.tx_id, 0);
349        match tx_header.ordinal {
350            _ => Err(fidl::Error::UnknownOrdinal {
351                ordinal: tx_header.ordinal,
352                protocol_name:
353                    <ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
354            }),
355        }
356    }
357}
358
359/// A Stream of incoming requests for fuchsia.power.systemmode/ClientConfigurator.
360pub struct ClientConfiguratorRequestStream {
361    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
362    is_terminated: bool,
363}
364
365impl std::marker::Unpin for ClientConfiguratorRequestStream {}
366
367impl futures::stream::FusedStream for ClientConfiguratorRequestStream {
368    fn is_terminated(&self) -> bool {
369        self.is_terminated
370    }
371}
372
373impl fidl::endpoints::RequestStream for ClientConfiguratorRequestStream {
374    type Protocol = ClientConfiguratorMarker;
375    type ControlHandle = ClientConfiguratorControlHandle;
376
377    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
378        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
379    }
380
381    fn control_handle(&self) -> Self::ControlHandle {
382        ClientConfiguratorControlHandle { inner: self.inner.clone() }
383    }
384
385    fn into_inner(
386        self,
387    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
388    {
389        (self.inner, self.is_terminated)
390    }
391
392    fn from_inner(
393        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
394        is_terminated: bool,
395    ) -> Self {
396        Self { inner, is_terminated }
397    }
398}
399
400impl futures::Stream for ClientConfiguratorRequestStream {
401    type Item = Result<ClientConfiguratorRequest, fidl::Error>;
402
403    fn poll_next(
404        mut self: std::pin::Pin<&mut Self>,
405        cx: &mut std::task::Context<'_>,
406    ) -> std::task::Poll<Option<Self::Item>> {
407        let this = &mut *self;
408        if this.inner.check_shutdown(cx) {
409            this.is_terminated = true;
410            return std::task::Poll::Ready(None);
411        }
412        if this.is_terminated {
413            panic!("polled ClientConfiguratorRequestStream after completion");
414        }
415        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
416            |bytes, handles| {
417                match this.inner.channel().read_etc(cx, bytes, handles) {
418                    std::task::Poll::Ready(Ok(())) => {}
419                    std::task::Poll::Pending => return std::task::Poll::Pending,
420                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
421                        this.is_terminated = true;
422                        return std::task::Poll::Ready(None);
423                    }
424                    std::task::Poll::Ready(Err(e)) => {
425                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
426                            e.into(),
427                        ))))
428                    }
429                }
430
431                // A message has been received from the channel
432                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
433
434                std::task::Poll::Ready(Some(match header.ordinal {
435                0x1e37597b4d247d7b => {
436                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
437                    let mut req = fidl::new_empty!(ClientConfiguratorGetRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
438                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConfiguratorGetRequest>(&header, _body_bytes, handles, &mut req)?;
439                    let control_handle = ClientConfiguratorControlHandle {
440                        inner: this.inner.clone(),
441                    };
442                    Ok(ClientConfiguratorRequest::Get {client_type: req.client_type,
443
444                        responder: ClientConfiguratorGetResponder {
445                            control_handle: std::mem::ManuallyDrop::new(control_handle),
446                            tx_id: header.tx_id,
447                        },
448                    })
449                }
450                0x2204fb91b32f6435 => {
451                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
452                    let mut req = fidl::new_empty!(ClientConfiguratorSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
453                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConfiguratorSetRequest>(&header, _body_bytes, handles, &mut req)?;
454                    let control_handle = ClientConfiguratorControlHandle {
455                        inner: this.inner.clone(),
456                    };
457                    Ok(ClientConfiguratorRequest::Set {client_type: req.client_type,
458config: req.config,
459
460                        responder: ClientConfiguratorSetResponder {
461                            control_handle: std::mem::ManuallyDrop::new(control_handle),
462                            tx_id: header.tx_id,
463                        },
464                    })
465                }
466                _ => Err(fidl::Error::UnknownOrdinal {
467                    ordinal: header.ordinal,
468                    protocol_name: <ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
469                }),
470            }))
471            },
472        )
473    }
474}
475
476/// A protocol that can be used to update the power configuration for a given
477/// [`ClientType`].
478#[derive(Debug)]
479pub enum ClientConfiguratorRequest {
480    /// Gets the power configuration for the given [`ClientType`].
481    ///
482    /// If there is no power configuration for `client_type` then the returned
483    /// value will be absent.
484    ///
485    /// + `client_type` specifies which [`ClientType`] [`ClientConfig`] to get
486    /// - `config` is the returned client-specific configuration, or an absent
487    /// value if `client_type` does not have an existing configuration
488    Get {
489        client_type: fidl_fuchsia_power_clientlevel::ClientType,
490        responder: ClientConfiguratorGetResponder,
491    },
492    /// Sets the power configuration for the given [`ClientType`].
493    ///
494    /// This method should be used in tandem with [`GetConfig`] in order to
495    /// update the existing power configuration for a given [`ClientType`]
496    /// without fully overwriting it.
497    ///
498    /// When the power configuration for a given [`ClientType`] is changed, the
499    /// Power Manager will reevaluate current power level of that [`ClientType`]
500    /// according to the new configuration. This reevaluation may result in a
501    /// new power level being sent to the connected client.
502    ///
503    /// The call returns immediately after the new config has been received and
504    /// validated. Actual system changes to be applied as a result of changing a
505    /// client's configuration will occur after the call has returned.
506    /// Therefore, any errors that occur while updating clients according to the
507    /// new system power mode are not propagated back to the caller. Instead,
508    /// client updates are applied on a "best effort" basis.
509    ///
510    /// If the provided `config` is not valid, then no changes will be applied
511    /// and the channel will be closed. Validation will fail if a given
512    /// `SystemMode` is repeated across multiple `mode_match` entries contained
513    /// by the `ClientConfig`.
514    ///
515    /// + `client_type` specifies which [`ClientType`]'s [`ClientConfig`] to set
516    /// + `config` is the [`ClientConfig`] that will be set for [`client_type`]
517    Set {
518        client_type: fidl_fuchsia_power_clientlevel::ClientType,
519        config: ClientConfig,
520        responder: ClientConfiguratorSetResponder,
521    },
522}
523
524impl ClientConfiguratorRequest {
525    #[allow(irrefutable_let_patterns)]
526    pub fn into_get(
527        self,
528    ) -> Option<(fidl_fuchsia_power_clientlevel::ClientType, ClientConfiguratorGetResponder)> {
529        if let ClientConfiguratorRequest::Get { client_type, responder } = self {
530            Some((client_type, responder))
531        } else {
532            None
533        }
534    }
535
536    #[allow(irrefutable_let_patterns)]
537    pub fn into_set(
538        self,
539    ) -> Option<(
540        fidl_fuchsia_power_clientlevel::ClientType,
541        ClientConfig,
542        ClientConfiguratorSetResponder,
543    )> {
544        if let ClientConfiguratorRequest::Set { client_type, config, responder } = self {
545            Some((client_type, config, responder))
546        } else {
547            None
548        }
549    }
550
551    /// Name of the method defined in FIDL
552    pub fn method_name(&self) -> &'static str {
553        match *self {
554            ClientConfiguratorRequest::Get { .. } => "get",
555            ClientConfiguratorRequest::Set { .. } => "set",
556        }
557    }
558}
559
560#[derive(Debug, Clone)]
561pub struct ClientConfiguratorControlHandle {
562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
563}
564
565impl fidl::endpoints::ControlHandle for ClientConfiguratorControlHandle {
566    fn shutdown(&self) {
567        self.inner.shutdown()
568    }
569    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
570        self.inner.shutdown_with_epitaph(status)
571    }
572
573    fn is_closed(&self) -> bool {
574        self.inner.channel().is_closed()
575    }
576    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
577        self.inner.channel().on_closed()
578    }
579
580    #[cfg(target_os = "fuchsia")]
581    fn signal_peer(
582        &self,
583        clear_mask: zx::Signals,
584        set_mask: zx::Signals,
585    ) -> Result<(), zx_status::Status> {
586        use fidl::Peered;
587        self.inner.channel().signal_peer(clear_mask, set_mask)
588    }
589}
590
591impl ClientConfiguratorControlHandle {}
592
593#[must_use = "FIDL methods require a response to be sent"]
594#[derive(Debug)]
595pub struct ClientConfiguratorGetResponder {
596    control_handle: std::mem::ManuallyDrop<ClientConfiguratorControlHandle>,
597    tx_id: u32,
598}
599
600/// Set the the channel to be shutdown (see [`ClientConfiguratorControlHandle::shutdown`])
601/// if the responder is dropped without sending a response, so that the client
602/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
603impl std::ops::Drop for ClientConfiguratorGetResponder {
604    fn drop(&mut self) {
605        self.control_handle.shutdown();
606        // Safety: drops once, never accessed again
607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
608    }
609}
610
611impl fidl::endpoints::Responder for ClientConfiguratorGetResponder {
612    type ControlHandle = ClientConfiguratorControlHandle;
613
614    fn control_handle(&self) -> &ClientConfiguratorControlHandle {
615        &self.control_handle
616    }
617
618    fn drop_without_shutdown(mut self) {
619        // Safety: drops once, never accessed again due to mem::forget
620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
621        // Prevent Drop from running (which would shut down the channel)
622        std::mem::forget(self);
623    }
624}
625
626impl ClientConfiguratorGetResponder {
627    /// Sends a response to the FIDL transaction.
628    ///
629    /// Sets the channel to shutdown if an error occurs.
630    pub fn send(self, mut config: Option<&ClientConfig>) -> Result<(), fidl::Error> {
631        let _result = self.send_raw(config);
632        if _result.is_err() {
633            self.control_handle.shutdown();
634        }
635        self.drop_without_shutdown();
636        _result
637    }
638
639    /// Similar to "send" but does not shutdown the channel if an error occurs.
640    pub fn send_no_shutdown_on_err(
641        self,
642        mut config: Option<&ClientConfig>,
643    ) -> Result<(), fidl::Error> {
644        let _result = self.send_raw(config);
645        self.drop_without_shutdown();
646        _result
647    }
648
649    fn send_raw(&self, mut config: Option<&ClientConfig>) -> Result<(), fidl::Error> {
650        self.control_handle.inner.send::<ClientConfiguratorGetResponse>(
651            (config,),
652            self.tx_id,
653            0x1e37597b4d247d7b,
654            fidl::encoding::DynamicFlags::empty(),
655        )
656    }
657}
658
659#[must_use = "FIDL methods require a response to be sent"]
660#[derive(Debug)]
661pub struct ClientConfiguratorSetResponder {
662    control_handle: std::mem::ManuallyDrop<ClientConfiguratorControlHandle>,
663    tx_id: u32,
664}
665
666/// Set the the channel to be shutdown (see [`ClientConfiguratorControlHandle::shutdown`])
667/// if the responder is dropped without sending a response, so that the client
668/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
669impl std::ops::Drop for ClientConfiguratorSetResponder {
670    fn drop(&mut self) {
671        self.control_handle.shutdown();
672        // Safety: drops once, never accessed again
673        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
674    }
675}
676
677impl fidl::endpoints::Responder for ClientConfiguratorSetResponder {
678    type ControlHandle = ClientConfiguratorControlHandle;
679
680    fn control_handle(&self) -> &ClientConfiguratorControlHandle {
681        &self.control_handle
682    }
683
684    fn drop_without_shutdown(mut self) {
685        // Safety: drops once, never accessed again due to mem::forget
686        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
687        // Prevent Drop from running (which would shut down the channel)
688        std::mem::forget(self);
689    }
690}
691
692impl ClientConfiguratorSetResponder {
693    /// Sends a response to the FIDL transaction.
694    ///
695    /// Sets the channel to shutdown if an error occurs.
696    pub fn send(self) -> Result<(), fidl::Error> {
697        let _result = self.send_raw();
698        if _result.is_err() {
699            self.control_handle.shutdown();
700        }
701        self.drop_without_shutdown();
702        _result
703    }
704
705    /// Similar to "send" but does not shutdown the channel if an error occurs.
706    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
707        let _result = self.send_raw();
708        self.drop_without_shutdown();
709        _result
710    }
711
712    fn send_raw(&self) -> Result<(), fidl::Error> {
713        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
714            (),
715            self.tx_id,
716            0x2204fb91b32f6435,
717            fidl::encoding::DynamicFlags::empty(),
718        )
719    }
720}
721
722#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
723pub struct RequesterMarker;
724
725impl fidl::endpoints::ProtocolMarker for RequesterMarker {
726    type Proxy = RequesterProxy;
727    type RequestStream = RequesterRequestStream;
728    #[cfg(target_os = "fuchsia")]
729    type SynchronousProxy = RequesterSynchronousProxy;
730
731    const DEBUG_NAME: &'static str = "fuchsia.power.systemmode.Requester";
732}
733impl fidl::endpoints::DiscoverableProtocolMarker for RequesterMarker {}
734pub type RequesterRequestResult = Result<(), ModeRequestError>;
735
736pub trait RequesterProxyInterface: Send + Sync {
737    type RequestResponseFut: std::future::Future<Output = Result<RequesterRequestResult, fidl::Error>>
738        + Send;
739    fn r#request(&self, mode: SystemMode, set: bool) -> Self::RequestResponseFut;
740}
741#[derive(Debug)]
742#[cfg(target_os = "fuchsia")]
743pub struct RequesterSynchronousProxy {
744    client: fidl::client::sync::Client,
745}
746
747#[cfg(target_os = "fuchsia")]
748impl fidl::endpoints::SynchronousProxy for RequesterSynchronousProxy {
749    type Proxy = RequesterProxy;
750    type Protocol = RequesterMarker;
751
752    fn from_channel(inner: fidl::Channel) -> Self {
753        Self::new(inner)
754    }
755
756    fn into_channel(self) -> fidl::Channel {
757        self.client.into_channel()
758    }
759
760    fn as_channel(&self) -> &fidl::Channel {
761        self.client.as_channel()
762    }
763}
764
765#[cfg(target_os = "fuchsia")]
766impl RequesterSynchronousProxy {
767    pub fn new(channel: fidl::Channel) -> Self {
768        let protocol_name = <RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
769        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
770    }
771
772    pub fn into_channel(self) -> fidl::Channel {
773        self.client.into_channel()
774    }
775
776    /// Waits until an event arrives and returns it. It is safe for other
777    /// threads to make concurrent requests while waiting for an event.
778    pub fn wait_for_event(
779        &self,
780        deadline: zx::MonotonicInstant,
781    ) -> Result<RequesterEvent, fidl::Error> {
782        RequesterEvent::decode(self.client.wait_for_event(deadline)?)
783    }
784
785    /// Requests to set or clear a system power mode.
786    ///
787    /// The call returns immediately after the request has been received,
788    /// validated, and accepted. Actual system changes to be applied as a result
789    /// of this request will occur after the call has returned. Therefore, any
790    /// errors that occur while updating clients according to the new system
791    /// power mode are not propagated back to the caller. Instead, client
792    /// updates are applied on a "best effort" basis.
793    ///
794    /// An error returned by this method means the request itself is not valid
795    /// and was rejected. Details of the specific rejection reason are reflected
796    /// by the error value. In the event of an error, the channel will remain
797    /// open.
798    ///
799    /// A client can use this method to set or clear system power mode variants
800    /// independently. For example:
801    ///
802    ///   // battery is below the "low" threshold
803    ///   Request(LOW_BATTERY, true);
804    ///
805    ///   // device is now plugged into the wall
806    ///   Request(ON_AC_POWER, true);
807    ///
808    ///   // battery is now above the "low" threshold
809    ///   Request(LOW_BATTERY, false);
810    ///
811    /// + `mode` is the `SystemMode` to request to be set or cleared
812    /// + `set` should be true to request to set `mode`, or false to clear it
813    /// * error a [`ModeRequestError`] value indicating why the request was
814    /// rejected.
815    pub fn r#request(
816        &self,
817        mut mode: SystemMode,
818        mut set: bool,
819        ___deadline: zx::MonotonicInstant,
820    ) -> Result<RequesterRequestResult, fidl::Error> {
821        let _response = self.client.send_query::<
822            RequesterRequestRequest,
823            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ModeRequestError>,
824        >(
825            (mode, set,),
826            0x5603afcd4421f425,
827            fidl::encoding::DynamicFlags::empty(),
828            ___deadline,
829        )?;
830        Ok(_response.map(|x| x))
831    }
832}
833
834#[cfg(target_os = "fuchsia")]
835impl From<RequesterSynchronousProxy> for zx::Handle {
836    fn from(value: RequesterSynchronousProxy) -> Self {
837        value.into_channel().into()
838    }
839}
840
841#[cfg(target_os = "fuchsia")]
842impl From<fidl::Channel> for RequesterSynchronousProxy {
843    fn from(value: fidl::Channel) -> Self {
844        Self::new(value)
845    }
846}
847
848#[derive(Debug, Clone)]
849pub struct RequesterProxy {
850    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
851}
852
853impl fidl::endpoints::Proxy for RequesterProxy {
854    type Protocol = RequesterMarker;
855
856    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
857        Self::new(inner)
858    }
859
860    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
861        self.client.into_channel().map_err(|client| Self { client })
862    }
863
864    fn as_channel(&self) -> &::fidl::AsyncChannel {
865        self.client.as_channel()
866    }
867}
868
869impl RequesterProxy {
870    /// Create a new Proxy for fuchsia.power.systemmode/Requester.
871    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
872        let protocol_name = <RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
873        Self { client: fidl::client::Client::new(channel, protocol_name) }
874    }
875
876    /// Get a Stream of events from the remote end of the protocol.
877    ///
878    /// # Panics
879    ///
880    /// Panics if the event stream was already taken.
881    pub fn take_event_stream(&self) -> RequesterEventStream {
882        RequesterEventStream { event_receiver: self.client.take_event_receiver() }
883    }
884
885    /// Requests to set or clear a system power mode.
886    ///
887    /// The call returns immediately after the request has been received,
888    /// validated, and accepted. Actual system changes to be applied as a result
889    /// of this request will occur after the call has returned. Therefore, any
890    /// errors that occur while updating clients according to the new system
891    /// power mode are not propagated back to the caller. Instead, client
892    /// updates are applied on a "best effort" basis.
893    ///
894    /// An error returned by this method means the request itself is not valid
895    /// and was rejected. Details of the specific rejection reason are reflected
896    /// by the error value. In the event of an error, the channel will remain
897    /// open.
898    ///
899    /// A client can use this method to set or clear system power mode variants
900    /// independently. For example:
901    ///
902    ///   // battery is below the "low" threshold
903    ///   Request(LOW_BATTERY, true);
904    ///
905    ///   // device is now plugged into the wall
906    ///   Request(ON_AC_POWER, true);
907    ///
908    ///   // battery is now above the "low" threshold
909    ///   Request(LOW_BATTERY, false);
910    ///
911    /// + `mode` is the `SystemMode` to request to be set or cleared
912    /// + `set` should be true to request to set `mode`, or false to clear it
913    /// * error a [`ModeRequestError`] value indicating why the request was
914    /// rejected.
915    pub fn r#request(
916        &self,
917        mut mode: SystemMode,
918        mut set: bool,
919    ) -> fidl::client::QueryResponseFut<
920        RequesterRequestResult,
921        fidl::encoding::DefaultFuchsiaResourceDialect,
922    > {
923        RequesterProxyInterface::r#request(self, mode, set)
924    }
925}
926
927impl RequesterProxyInterface for RequesterProxy {
928    type RequestResponseFut = fidl::client::QueryResponseFut<
929        RequesterRequestResult,
930        fidl::encoding::DefaultFuchsiaResourceDialect,
931    >;
932    fn r#request(&self, mut mode: SystemMode, mut set: bool) -> Self::RequestResponseFut {
933        fn _decode(
934            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
935        ) -> Result<RequesterRequestResult, fidl::Error> {
936            let _response = fidl::client::decode_transaction_body::<
937                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ModeRequestError>,
938                fidl::encoding::DefaultFuchsiaResourceDialect,
939                0x5603afcd4421f425,
940            >(_buf?)?;
941            Ok(_response.map(|x| x))
942        }
943        self.client.send_query_and_decode::<RequesterRequestRequest, RequesterRequestResult>(
944            (mode, set),
945            0x5603afcd4421f425,
946            fidl::encoding::DynamicFlags::empty(),
947            _decode,
948        )
949    }
950}
951
952pub struct RequesterEventStream {
953    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
954}
955
956impl std::marker::Unpin for RequesterEventStream {}
957
958impl futures::stream::FusedStream for RequesterEventStream {
959    fn is_terminated(&self) -> bool {
960        self.event_receiver.is_terminated()
961    }
962}
963
964impl futures::Stream for RequesterEventStream {
965    type Item = Result<RequesterEvent, fidl::Error>;
966
967    fn poll_next(
968        mut self: std::pin::Pin<&mut Self>,
969        cx: &mut std::task::Context<'_>,
970    ) -> std::task::Poll<Option<Self::Item>> {
971        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
972            &mut self.event_receiver,
973            cx
974        )?) {
975            Some(buf) => std::task::Poll::Ready(Some(RequesterEvent::decode(buf))),
976            None => std::task::Poll::Ready(None),
977        }
978    }
979}
980
981#[derive(Debug)]
982pub enum RequesterEvent {}
983
984impl RequesterEvent {
985    /// Decodes a message buffer as a [`RequesterEvent`].
986    fn decode(
987        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
988    ) -> Result<RequesterEvent, fidl::Error> {
989        let (bytes, _handles) = buf.split_mut();
990        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
991        debug_assert_eq!(tx_header.tx_id, 0);
992        match tx_header.ordinal {
993            _ => Err(fidl::Error::UnknownOrdinal {
994                ordinal: tx_header.ordinal,
995                protocol_name: <RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
996            }),
997        }
998    }
999}
1000
1001/// A Stream of incoming requests for fuchsia.power.systemmode/Requester.
1002pub struct RequesterRequestStream {
1003    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1004    is_terminated: bool,
1005}
1006
1007impl std::marker::Unpin for RequesterRequestStream {}
1008
1009impl futures::stream::FusedStream for RequesterRequestStream {
1010    fn is_terminated(&self) -> bool {
1011        self.is_terminated
1012    }
1013}
1014
1015impl fidl::endpoints::RequestStream for RequesterRequestStream {
1016    type Protocol = RequesterMarker;
1017    type ControlHandle = RequesterControlHandle;
1018
1019    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1020        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1021    }
1022
1023    fn control_handle(&self) -> Self::ControlHandle {
1024        RequesterControlHandle { inner: self.inner.clone() }
1025    }
1026
1027    fn into_inner(
1028        self,
1029    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1030    {
1031        (self.inner, self.is_terminated)
1032    }
1033
1034    fn from_inner(
1035        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1036        is_terminated: bool,
1037    ) -> Self {
1038        Self { inner, is_terminated }
1039    }
1040}
1041
1042impl futures::Stream for RequesterRequestStream {
1043    type Item = Result<RequesterRequest, fidl::Error>;
1044
1045    fn poll_next(
1046        mut self: std::pin::Pin<&mut Self>,
1047        cx: &mut std::task::Context<'_>,
1048    ) -> std::task::Poll<Option<Self::Item>> {
1049        let this = &mut *self;
1050        if this.inner.check_shutdown(cx) {
1051            this.is_terminated = true;
1052            return std::task::Poll::Ready(None);
1053        }
1054        if this.is_terminated {
1055            panic!("polled RequesterRequestStream after completion");
1056        }
1057        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1058            |bytes, handles| {
1059                match this.inner.channel().read_etc(cx, bytes, handles) {
1060                    std::task::Poll::Ready(Ok(())) => {}
1061                    std::task::Poll::Pending => return std::task::Poll::Pending,
1062                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1063                        this.is_terminated = true;
1064                        return std::task::Poll::Ready(None);
1065                    }
1066                    std::task::Poll::Ready(Err(e)) => {
1067                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1068                            e.into(),
1069                        ))))
1070                    }
1071                }
1072
1073                // A message has been received from the channel
1074                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1075
1076                std::task::Poll::Ready(Some(match header.ordinal {
1077                    0x5603afcd4421f425 => {
1078                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1079                        let mut req = fidl::new_empty!(
1080                            RequesterRequestRequest,
1081                            fidl::encoding::DefaultFuchsiaResourceDialect
1082                        );
1083                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RequesterRequestRequest>(&header, _body_bytes, handles, &mut req)?;
1084                        let control_handle = RequesterControlHandle { inner: this.inner.clone() };
1085                        Ok(RequesterRequest::Request {
1086                            mode: req.mode,
1087                            set: req.set,
1088
1089                            responder: RequesterRequestResponder {
1090                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1091                                tx_id: header.tx_id,
1092                            },
1093                        })
1094                    }
1095                    _ => Err(fidl::Error::UnknownOrdinal {
1096                        ordinal: header.ordinal,
1097                        protocol_name:
1098                            <RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1099                    }),
1100                }))
1101            },
1102        )
1103    }
1104}
1105
1106/// A protocol that can be used to request a change to the currently active
1107/// system power modes.
1108#[derive(Debug)]
1109pub enum RequesterRequest {
1110    /// Requests to set or clear a system power mode.
1111    ///
1112    /// The call returns immediately after the request has been received,
1113    /// validated, and accepted. Actual system changes to be applied as a result
1114    /// of this request will occur after the call has returned. Therefore, any
1115    /// errors that occur while updating clients according to the new system
1116    /// power mode are not propagated back to the caller. Instead, client
1117    /// updates are applied on a "best effort" basis.
1118    ///
1119    /// An error returned by this method means the request itself is not valid
1120    /// and was rejected. Details of the specific rejection reason are reflected
1121    /// by the error value. In the event of an error, the channel will remain
1122    /// open.
1123    ///
1124    /// A client can use this method to set or clear system power mode variants
1125    /// independently. For example:
1126    ///
1127    ///   // battery is below the "low" threshold
1128    ///   Request(LOW_BATTERY, true);
1129    ///
1130    ///   // device is now plugged into the wall
1131    ///   Request(ON_AC_POWER, true);
1132    ///
1133    ///   // battery is now above the "low" threshold
1134    ///   Request(LOW_BATTERY, false);
1135    ///
1136    /// + `mode` is the `SystemMode` to request to be set or cleared
1137    /// + `set` should be true to request to set `mode`, or false to clear it
1138    /// * error a [`ModeRequestError`] value indicating why the request was
1139    /// rejected.
1140    Request { mode: SystemMode, set: bool, responder: RequesterRequestResponder },
1141}
1142
1143impl RequesterRequest {
1144    #[allow(irrefutable_let_patterns)]
1145    pub fn into_request(self) -> Option<(SystemMode, bool, RequesterRequestResponder)> {
1146        if let RequesterRequest::Request { mode, set, responder } = self {
1147            Some((mode, set, responder))
1148        } else {
1149            None
1150        }
1151    }
1152
1153    /// Name of the method defined in FIDL
1154    pub fn method_name(&self) -> &'static str {
1155        match *self {
1156            RequesterRequest::Request { .. } => "request",
1157        }
1158    }
1159}
1160
1161#[derive(Debug, Clone)]
1162pub struct RequesterControlHandle {
1163    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1164}
1165
1166impl fidl::endpoints::ControlHandle for RequesterControlHandle {
1167    fn shutdown(&self) {
1168        self.inner.shutdown()
1169    }
1170    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1171        self.inner.shutdown_with_epitaph(status)
1172    }
1173
1174    fn is_closed(&self) -> bool {
1175        self.inner.channel().is_closed()
1176    }
1177    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1178        self.inner.channel().on_closed()
1179    }
1180
1181    #[cfg(target_os = "fuchsia")]
1182    fn signal_peer(
1183        &self,
1184        clear_mask: zx::Signals,
1185        set_mask: zx::Signals,
1186    ) -> Result<(), zx_status::Status> {
1187        use fidl::Peered;
1188        self.inner.channel().signal_peer(clear_mask, set_mask)
1189    }
1190}
1191
1192impl RequesterControlHandle {}
1193
1194#[must_use = "FIDL methods require a response to be sent"]
1195#[derive(Debug)]
1196pub struct RequesterRequestResponder {
1197    control_handle: std::mem::ManuallyDrop<RequesterControlHandle>,
1198    tx_id: u32,
1199}
1200
1201/// Set the the channel to be shutdown (see [`RequesterControlHandle::shutdown`])
1202/// if the responder is dropped without sending a response, so that the client
1203/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1204impl std::ops::Drop for RequesterRequestResponder {
1205    fn drop(&mut self) {
1206        self.control_handle.shutdown();
1207        // Safety: drops once, never accessed again
1208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1209    }
1210}
1211
1212impl fidl::endpoints::Responder for RequesterRequestResponder {
1213    type ControlHandle = RequesterControlHandle;
1214
1215    fn control_handle(&self) -> &RequesterControlHandle {
1216        &self.control_handle
1217    }
1218
1219    fn drop_without_shutdown(mut self) {
1220        // Safety: drops once, never accessed again due to mem::forget
1221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1222        // Prevent Drop from running (which would shut down the channel)
1223        std::mem::forget(self);
1224    }
1225}
1226
1227impl RequesterRequestResponder {
1228    /// Sends a response to the FIDL transaction.
1229    ///
1230    /// Sets the channel to shutdown if an error occurs.
1231    pub fn send(self, mut result: Result<(), ModeRequestError>) -> Result<(), fidl::Error> {
1232        let _result = self.send_raw(result);
1233        if _result.is_err() {
1234            self.control_handle.shutdown();
1235        }
1236        self.drop_without_shutdown();
1237        _result
1238    }
1239
1240    /// Similar to "send" but does not shutdown the channel if an error occurs.
1241    pub fn send_no_shutdown_on_err(
1242        self,
1243        mut result: Result<(), ModeRequestError>,
1244    ) -> Result<(), fidl::Error> {
1245        let _result = self.send_raw(result);
1246        self.drop_without_shutdown();
1247        _result
1248    }
1249
1250    fn send_raw(&self, mut result: Result<(), ModeRequestError>) -> Result<(), fidl::Error> {
1251        self.control_handle.inner.send::<fidl::encoding::ResultType<
1252            fidl::encoding::EmptyStruct,
1253            ModeRequestError,
1254        >>(
1255            result,
1256            self.tx_id,
1257            0x5603afcd4421f425,
1258            fidl::encoding::DynamicFlags::empty(),
1259        )
1260    }
1261}
1262
1263mod internal {
1264    use super::*;
1265}