fidl_fuchsia_driver_index/
fidl_fuchsia_driver_index.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_driver_index__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DevelopmentManagerGetCompositeNodeSpecsRequest {
16    pub name_filter: Option<String>,
17    pub iterator: fidl::endpoints::ServerEnd<
18        fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
19    >,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23    for DevelopmentManagerGetCompositeNodeSpecsRequest
24{
25}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct DevelopmentManagerGetDriverInfoRequest {
29    pub driver_filter: Vec<String>,
30    pub iterator:
31        fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
35    for DevelopmentManagerGetDriverInfoRequest
36{
37}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct DriverIndexSetNotifierRequest {
41    pub notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for DriverIndexSetNotifierRequest
46{
47}
48
49#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
50pub struct DevelopmentManagerMarker;
51
52impl fidl::endpoints::ProtocolMarker for DevelopmentManagerMarker {
53    type Proxy = DevelopmentManagerProxy;
54    type RequestStream = DevelopmentManagerRequestStream;
55    #[cfg(target_os = "fuchsia")]
56    type SynchronousProxy = DevelopmentManagerSynchronousProxy;
57
58    const DEBUG_NAME: &'static str = "fuchsia.driver.index.DevelopmentManager";
59}
60impl fidl::endpoints::DiscoverableProtocolMarker for DevelopmentManagerMarker {}
61pub type DevelopmentManagerDisableDriverResult = Result<(), i32>;
62pub type DevelopmentManagerEnableDriverResult = Result<(), i32>;
63pub type DevelopmentManagerRebindCompositesWithDriverResult = Result<(), i32>;
64
65pub trait DevelopmentManagerProxyInterface: Send + Sync {
66    fn r#get_driver_info(
67        &self,
68        driver_filter: &[String],
69        iterator: fidl::endpoints::ServerEnd<
70            fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
71        >,
72    ) -> Result<(), fidl::Error>;
73    fn r#get_composite_node_specs(
74        &self,
75        name_filter: Option<&str>,
76        iterator: fidl::endpoints::ServerEnd<
77            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
78        >,
79    ) -> Result<(), fidl::Error>;
80    type DisableDriverResponseFut: std::future::Future<Output = Result<DevelopmentManagerDisableDriverResult, fidl::Error>>
81        + Send;
82    fn r#disable_driver(
83        &self,
84        driver_url: &str,
85        package_hash: Option<&str>,
86    ) -> Self::DisableDriverResponseFut;
87    type EnableDriverResponseFut: std::future::Future<Output = Result<DevelopmentManagerEnableDriverResult, fidl::Error>>
88        + Send;
89    fn r#enable_driver(
90        &self,
91        driver_url: &str,
92        package_hash: Option<&str>,
93    ) -> Self::EnableDriverResponseFut;
94    type RebindCompositesWithDriverResponseFut: std::future::Future<
95            Output = Result<DevelopmentManagerRebindCompositesWithDriverResult, fidl::Error>,
96        > + Send;
97    fn r#rebind_composites_with_driver(
98        &self,
99        driver_url: &str,
100    ) -> Self::RebindCompositesWithDriverResponseFut;
101}
102#[derive(Debug)]
103#[cfg(target_os = "fuchsia")]
104pub struct DevelopmentManagerSynchronousProxy {
105    client: fidl::client::sync::Client,
106}
107
108#[cfg(target_os = "fuchsia")]
109impl fidl::endpoints::SynchronousProxy for DevelopmentManagerSynchronousProxy {
110    type Proxy = DevelopmentManagerProxy;
111    type Protocol = DevelopmentManagerMarker;
112
113    fn from_channel(inner: fidl::Channel) -> Self {
114        Self::new(inner)
115    }
116
117    fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    fn as_channel(&self) -> &fidl::Channel {
122        self.client.as_channel()
123    }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl DevelopmentManagerSynchronousProxy {
128    pub fn new(channel: fidl::Channel) -> Self {
129        let protocol_name =
130            <DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
131        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
132    }
133
134    pub fn into_channel(self) -> fidl::Channel {
135        self.client.into_channel()
136    }
137
138    /// Waits until an event arrives and returns it. It is safe for other
139    /// threads to make concurrent requests while waiting for an event.
140    pub fn wait_for_event(
141        &self,
142        deadline: zx::MonotonicInstant,
143    ) -> Result<DevelopmentManagerEvent, fidl::Error> {
144        DevelopmentManagerEvent::decode(self.client.wait_for_event(deadline)?)
145    }
146
147    /// Returns a list of all drivers that are known to the system.
148    /// If a |driver_filter| is provided, the returned list will be filtered to
149    /// only include drivers specified in the filter.
150    ///
151    /// |iterator| is closed with following epitaphs on error:
152    /// ZX_ERR_NOT_FOUND indicates that there is no driver matching the given path for at least
153    /// one driver in |driver_filter|.
154    /// ZX_ERR_BUFFER_TOO_SMALL indicates that the driver's bind program is longer than the
155    /// maximum number of instructions (BIND_PROGRAM_INSTRUCTIONS_MAX).
156    pub fn r#get_driver_info(
157        &self,
158        mut driver_filter: &[String],
159        mut iterator: fidl::endpoints::ServerEnd<
160            fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
161        >,
162    ) -> Result<(), fidl::Error> {
163        self.client.send::<DevelopmentManagerGetDriverInfoRequest>(
164            (driver_filter, iterator),
165            0x80387b9999b4de2,
166            fidl::encoding::DynamicFlags::empty(),
167        )
168    }
169
170    /// Returns a list of all composite node specs that are known to the system.
171    /// If a |name_filter| is provided, the returned list will only include 1 spec,
172    /// the one with that exact name.
173    ///
174    /// |iterator| is closed with following epitaphs on error:
175    /// ZX_ERR_NOT_FOUND indicates that there are no specs or if a |name_filter| is provided,
176    /// that there are no specs with that name.
177    pub fn r#get_composite_node_specs(
178        &self,
179        mut name_filter: Option<&str>,
180        mut iterator: fidl::endpoints::ServerEnd<
181            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
182        >,
183    ) -> Result<(), fidl::Error> {
184        self.client.send::<DevelopmentManagerGetCompositeNodeSpecsRequest>(
185            (name_filter, iterator),
186            0x6fd4c2f5e0478970,
187            fidl::encoding::DynamicFlags::empty(),
188        )
189    }
190
191    /// Disables the driver with the given driver component url.
192    /// Disabled drivers will not be considered for matching to nodes.
193    /// If a |package_hash| is provided, only that specific version of the driver
194    /// package will be disabled. Otherwise this applies to all existing versions
195    /// of a driver with the given url.
196    /// Returns an error ZX_ERR_NOT_FOUND if no drivers were affected.
197    pub fn r#disable_driver(
198        &self,
199        mut driver_url: &str,
200        mut package_hash: Option<&str>,
201        ___deadline: zx::MonotonicInstant,
202    ) -> Result<DevelopmentManagerDisableDriverResult, fidl::Error> {
203        let _response = self.client.send_query::<
204            DevelopmentManagerDisableDriverRequest,
205            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
206        >(
207            (driver_url, package_hash,),
208            0x7a9043fc2acabf77,
209            fidl::encoding::DynamicFlags::empty(),
210            ___deadline,
211        )?;
212        Ok(_response.map(|x| x))
213    }
214
215    /// Enables the driver with the given driver component url.
216    /// This is only meant to revert a |DisableDriver| action.
217    /// Returns an error ZX_ERR_NOT_FOUND if no drivers were affected.
218    pub fn r#enable_driver(
219        &self,
220        mut driver_url: &str,
221        mut package_hash: Option<&str>,
222        ___deadline: zx::MonotonicInstant,
223    ) -> Result<DevelopmentManagerEnableDriverResult, fidl::Error> {
224        let _response = self.client.send_query::<
225            DevelopmentManagerEnableDriverRequest,
226            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
227        >(
228            (driver_url, package_hash,),
229            0x4abba8d322e671d9,
230            fidl::encoding::DynamicFlags::empty(),
231            ___deadline,
232        )?;
233        Ok(_response.map(|x| x))
234    }
235
236    /// Rebinds any composite specs that have the given driver_url. This means the
237    /// spec is rematched with possibly another driver, or none if the only matching driver is
238    /// disabled.
239    pub fn r#rebind_composites_with_driver(
240        &self,
241        mut driver_url: &str,
242        ___deadline: zx::MonotonicInstant,
243    ) -> Result<DevelopmentManagerRebindCompositesWithDriverResult, fidl::Error> {
244        let _response = self.client.send_query::<
245            DevelopmentManagerRebindCompositesWithDriverRequest,
246            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
247        >(
248            (driver_url,),
249            0x1da137c4f10d053c,
250            fidl::encoding::DynamicFlags::empty(),
251            ___deadline,
252        )?;
253        Ok(_response.map(|x| x))
254    }
255}
256
257#[cfg(target_os = "fuchsia")]
258impl From<DevelopmentManagerSynchronousProxy> for zx::Handle {
259    fn from(value: DevelopmentManagerSynchronousProxy) -> Self {
260        value.into_channel().into()
261    }
262}
263
264#[cfg(target_os = "fuchsia")]
265impl From<fidl::Channel> for DevelopmentManagerSynchronousProxy {
266    fn from(value: fidl::Channel) -> Self {
267        Self::new(value)
268    }
269}
270
271#[cfg(target_os = "fuchsia")]
272impl fidl::endpoints::FromClient for DevelopmentManagerSynchronousProxy {
273    type Protocol = DevelopmentManagerMarker;
274
275    fn from_client(value: fidl::endpoints::ClientEnd<DevelopmentManagerMarker>) -> Self {
276        Self::new(value.into_channel())
277    }
278}
279
280#[derive(Debug, Clone)]
281pub struct DevelopmentManagerProxy {
282    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
283}
284
285impl fidl::endpoints::Proxy for DevelopmentManagerProxy {
286    type Protocol = DevelopmentManagerMarker;
287
288    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
289        Self::new(inner)
290    }
291
292    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
293        self.client.into_channel().map_err(|client| Self { client })
294    }
295
296    fn as_channel(&self) -> &::fidl::AsyncChannel {
297        self.client.as_channel()
298    }
299}
300
301impl DevelopmentManagerProxy {
302    /// Create a new Proxy for fuchsia.driver.index/DevelopmentManager.
303    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
304        let protocol_name =
305            <DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
306        Self { client: fidl::client::Client::new(channel, protocol_name) }
307    }
308
309    /// Get a Stream of events from the remote end of the protocol.
310    ///
311    /// # Panics
312    ///
313    /// Panics if the event stream was already taken.
314    pub fn take_event_stream(&self) -> DevelopmentManagerEventStream {
315        DevelopmentManagerEventStream { event_receiver: self.client.take_event_receiver() }
316    }
317
318    /// Returns a list of all drivers that are known to the system.
319    /// If a |driver_filter| is provided, the returned list will be filtered to
320    /// only include drivers specified in the filter.
321    ///
322    /// |iterator| is closed with following epitaphs on error:
323    /// ZX_ERR_NOT_FOUND indicates that there is no driver matching the given path for at least
324    /// one driver in |driver_filter|.
325    /// ZX_ERR_BUFFER_TOO_SMALL indicates that the driver's bind program is longer than the
326    /// maximum number of instructions (BIND_PROGRAM_INSTRUCTIONS_MAX).
327    pub fn r#get_driver_info(
328        &self,
329        mut driver_filter: &[String],
330        mut iterator: fidl::endpoints::ServerEnd<
331            fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
332        >,
333    ) -> Result<(), fidl::Error> {
334        DevelopmentManagerProxyInterface::r#get_driver_info(self, driver_filter, iterator)
335    }
336
337    /// Returns a list of all composite node specs that are known to the system.
338    /// If a |name_filter| is provided, the returned list will only include 1 spec,
339    /// the one with that exact name.
340    ///
341    /// |iterator| is closed with following epitaphs on error:
342    /// ZX_ERR_NOT_FOUND indicates that there are no specs or if a |name_filter| is provided,
343    /// that there are no specs with that name.
344    pub fn r#get_composite_node_specs(
345        &self,
346        mut name_filter: Option<&str>,
347        mut iterator: fidl::endpoints::ServerEnd<
348            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
349        >,
350    ) -> Result<(), fidl::Error> {
351        DevelopmentManagerProxyInterface::r#get_composite_node_specs(self, name_filter, iterator)
352    }
353
354    /// Disables the driver with the given driver component url.
355    /// Disabled drivers will not be considered for matching to nodes.
356    /// If a |package_hash| is provided, only that specific version of the driver
357    /// package will be disabled. Otherwise this applies to all existing versions
358    /// of a driver with the given url.
359    /// Returns an error ZX_ERR_NOT_FOUND if no drivers were affected.
360    pub fn r#disable_driver(
361        &self,
362        mut driver_url: &str,
363        mut package_hash: Option<&str>,
364    ) -> fidl::client::QueryResponseFut<
365        DevelopmentManagerDisableDriverResult,
366        fidl::encoding::DefaultFuchsiaResourceDialect,
367    > {
368        DevelopmentManagerProxyInterface::r#disable_driver(self, driver_url, package_hash)
369    }
370
371    /// Enables the driver with the given driver component url.
372    /// This is only meant to revert a |DisableDriver| action.
373    /// Returns an error ZX_ERR_NOT_FOUND if no drivers were affected.
374    pub fn r#enable_driver(
375        &self,
376        mut driver_url: &str,
377        mut package_hash: Option<&str>,
378    ) -> fidl::client::QueryResponseFut<
379        DevelopmentManagerEnableDriverResult,
380        fidl::encoding::DefaultFuchsiaResourceDialect,
381    > {
382        DevelopmentManagerProxyInterface::r#enable_driver(self, driver_url, package_hash)
383    }
384
385    /// Rebinds any composite specs that have the given driver_url. This means the
386    /// spec is rematched with possibly another driver, or none if the only matching driver is
387    /// disabled.
388    pub fn r#rebind_composites_with_driver(
389        &self,
390        mut driver_url: &str,
391    ) -> fidl::client::QueryResponseFut<
392        DevelopmentManagerRebindCompositesWithDriverResult,
393        fidl::encoding::DefaultFuchsiaResourceDialect,
394    > {
395        DevelopmentManagerProxyInterface::r#rebind_composites_with_driver(self, driver_url)
396    }
397}
398
399impl DevelopmentManagerProxyInterface for DevelopmentManagerProxy {
400    fn r#get_driver_info(
401        &self,
402        mut driver_filter: &[String],
403        mut iterator: fidl::endpoints::ServerEnd<
404            fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
405        >,
406    ) -> Result<(), fidl::Error> {
407        self.client.send::<DevelopmentManagerGetDriverInfoRequest>(
408            (driver_filter, iterator),
409            0x80387b9999b4de2,
410            fidl::encoding::DynamicFlags::empty(),
411        )
412    }
413
414    fn r#get_composite_node_specs(
415        &self,
416        mut name_filter: Option<&str>,
417        mut iterator: fidl::endpoints::ServerEnd<
418            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
419        >,
420    ) -> Result<(), fidl::Error> {
421        self.client.send::<DevelopmentManagerGetCompositeNodeSpecsRequest>(
422            (name_filter, iterator),
423            0x6fd4c2f5e0478970,
424            fidl::encoding::DynamicFlags::empty(),
425        )
426    }
427
428    type DisableDriverResponseFut = fidl::client::QueryResponseFut<
429        DevelopmentManagerDisableDriverResult,
430        fidl::encoding::DefaultFuchsiaResourceDialect,
431    >;
432    fn r#disable_driver(
433        &self,
434        mut driver_url: &str,
435        mut package_hash: Option<&str>,
436    ) -> Self::DisableDriverResponseFut {
437        fn _decode(
438            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
439        ) -> Result<DevelopmentManagerDisableDriverResult, fidl::Error> {
440            let _response = fidl::client::decode_transaction_body::<
441                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
442                fidl::encoding::DefaultFuchsiaResourceDialect,
443                0x7a9043fc2acabf77,
444            >(_buf?)?;
445            Ok(_response.map(|x| x))
446        }
447        self.client.send_query_and_decode::<
448            DevelopmentManagerDisableDriverRequest,
449            DevelopmentManagerDisableDriverResult,
450        >(
451            (driver_url, package_hash,),
452            0x7a9043fc2acabf77,
453            fidl::encoding::DynamicFlags::empty(),
454            _decode,
455        )
456    }
457
458    type EnableDriverResponseFut = fidl::client::QueryResponseFut<
459        DevelopmentManagerEnableDriverResult,
460        fidl::encoding::DefaultFuchsiaResourceDialect,
461    >;
462    fn r#enable_driver(
463        &self,
464        mut driver_url: &str,
465        mut package_hash: Option<&str>,
466    ) -> Self::EnableDriverResponseFut {
467        fn _decode(
468            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
469        ) -> Result<DevelopmentManagerEnableDriverResult, fidl::Error> {
470            let _response = fidl::client::decode_transaction_body::<
471                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
472                fidl::encoding::DefaultFuchsiaResourceDialect,
473                0x4abba8d322e671d9,
474            >(_buf?)?;
475            Ok(_response.map(|x| x))
476        }
477        self.client.send_query_and_decode::<
478            DevelopmentManagerEnableDriverRequest,
479            DevelopmentManagerEnableDriverResult,
480        >(
481            (driver_url, package_hash,),
482            0x4abba8d322e671d9,
483            fidl::encoding::DynamicFlags::empty(),
484            _decode,
485        )
486    }
487
488    type RebindCompositesWithDriverResponseFut = fidl::client::QueryResponseFut<
489        DevelopmentManagerRebindCompositesWithDriverResult,
490        fidl::encoding::DefaultFuchsiaResourceDialect,
491    >;
492    fn r#rebind_composites_with_driver(
493        &self,
494        mut driver_url: &str,
495    ) -> Self::RebindCompositesWithDriverResponseFut {
496        fn _decode(
497            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
498        ) -> Result<DevelopmentManagerRebindCompositesWithDriverResult, fidl::Error> {
499            let _response = fidl::client::decode_transaction_body::<
500                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
501                fidl::encoding::DefaultFuchsiaResourceDialect,
502                0x1da137c4f10d053c,
503            >(_buf?)?;
504            Ok(_response.map(|x| x))
505        }
506        self.client.send_query_and_decode::<
507            DevelopmentManagerRebindCompositesWithDriverRequest,
508            DevelopmentManagerRebindCompositesWithDriverResult,
509        >(
510            (driver_url,),
511            0x1da137c4f10d053c,
512            fidl::encoding::DynamicFlags::empty(),
513            _decode,
514        )
515    }
516}
517
518pub struct DevelopmentManagerEventStream {
519    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
520}
521
522impl std::marker::Unpin for DevelopmentManagerEventStream {}
523
524impl futures::stream::FusedStream for DevelopmentManagerEventStream {
525    fn is_terminated(&self) -> bool {
526        self.event_receiver.is_terminated()
527    }
528}
529
530impl futures::Stream for DevelopmentManagerEventStream {
531    type Item = Result<DevelopmentManagerEvent, fidl::Error>;
532
533    fn poll_next(
534        mut self: std::pin::Pin<&mut Self>,
535        cx: &mut std::task::Context<'_>,
536    ) -> std::task::Poll<Option<Self::Item>> {
537        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
538            &mut self.event_receiver,
539            cx
540        )?) {
541            Some(buf) => std::task::Poll::Ready(Some(DevelopmentManagerEvent::decode(buf))),
542            None => std::task::Poll::Ready(None),
543        }
544    }
545}
546
547#[derive(Debug)]
548pub enum DevelopmentManagerEvent {}
549
550impl DevelopmentManagerEvent {
551    /// Decodes a message buffer as a [`DevelopmentManagerEvent`].
552    fn decode(
553        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
554    ) -> Result<DevelopmentManagerEvent, fidl::Error> {
555        let (bytes, _handles) = buf.split_mut();
556        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
557        debug_assert_eq!(tx_header.tx_id, 0);
558        match tx_header.ordinal {
559            _ => Err(fidl::Error::UnknownOrdinal {
560                ordinal: tx_header.ordinal,
561                protocol_name:
562                    <DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
563            }),
564        }
565    }
566}
567
568/// A Stream of incoming requests for fuchsia.driver.index/DevelopmentManager.
569pub struct DevelopmentManagerRequestStream {
570    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
571    is_terminated: bool,
572}
573
574impl std::marker::Unpin for DevelopmentManagerRequestStream {}
575
576impl futures::stream::FusedStream for DevelopmentManagerRequestStream {
577    fn is_terminated(&self) -> bool {
578        self.is_terminated
579    }
580}
581
582impl fidl::endpoints::RequestStream for DevelopmentManagerRequestStream {
583    type Protocol = DevelopmentManagerMarker;
584    type ControlHandle = DevelopmentManagerControlHandle;
585
586    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
587        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
588    }
589
590    fn control_handle(&self) -> Self::ControlHandle {
591        DevelopmentManagerControlHandle { inner: self.inner.clone() }
592    }
593
594    fn into_inner(
595        self,
596    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
597    {
598        (self.inner, self.is_terminated)
599    }
600
601    fn from_inner(
602        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
603        is_terminated: bool,
604    ) -> Self {
605        Self { inner, is_terminated }
606    }
607}
608
609impl futures::Stream for DevelopmentManagerRequestStream {
610    type Item = Result<DevelopmentManagerRequest, fidl::Error>;
611
612    fn poll_next(
613        mut self: std::pin::Pin<&mut Self>,
614        cx: &mut std::task::Context<'_>,
615    ) -> std::task::Poll<Option<Self::Item>> {
616        let this = &mut *self;
617        if this.inner.check_shutdown(cx) {
618            this.is_terminated = true;
619            return std::task::Poll::Ready(None);
620        }
621        if this.is_terminated {
622            panic!("polled DevelopmentManagerRequestStream after completion");
623        }
624        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
625            |bytes, handles| {
626                match this.inner.channel().read_etc(cx, bytes, handles) {
627                    std::task::Poll::Ready(Ok(())) => {}
628                    std::task::Poll::Pending => return std::task::Poll::Pending,
629                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
630                        this.is_terminated = true;
631                        return std::task::Poll::Ready(None);
632                    }
633                    std::task::Poll::Ready(Err(e)) => {
634                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
635                            e.into(),
636                        ))))
637                    }
638                }
639
640                // A message has been received from the channel
641                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
642
643                std::task::Poll::Ready(Some(match header.ordinal {
644                0x80387b9999b4de2 => {
645                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
646                    let mut req = fidl::new_empty!(DevelopmentManagerGetDriverInfoRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
647                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerGetDriverInfoRequest>(&header, _body_bytes, handles, &mut req)?;
648                    let control_handle = DevelopmentManagerControlHandle {
649                        inner: this.inner.clone(),
650                    };
651                    Ok(DevelopmentManagerRequest::GetDriverInfo {driver_filter: req.driver_filter,
652iterator: req.iterator,
653
654                        control_handle,
655                    })
656                }
657                0x6fd4c2f5e0478970 => {
658                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
659                    let mut req = fidl::new_empty!(DevelopmentManagerGetCompositeNodeSpecsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
660                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerGetCompositeNodeSpecsRequest>(&header, _body_bytes, handles, &mut req)?;
661                    let control_handle = DevelopmentManagerControlHandle {
662                        inner: this.inner.clone(),
663                    };
664                    Ok(DevelopmentManagerRequest::GetCompositeNodeSpecs {name_filter: req.name_filter,
665iterator: req.iterator,
666
667                        control_handle,
668                    })
669                }
670                0x7a9043fc2acabf77 => {
671                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
672                    let mut req = fidl::new_empty!(DevelopmentManagerDisableDriverRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
673                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerDisableDriverRequest>(&header, _body_bytes, handles, &mut req)?;
674                    let control_handle = DevelopmentManagerControlHandle {
675                        inner: this.inner.clone(),
676                    };
677                    Ok(DevelopmentManagerRequest::DisableDriver {driver_url: req.driver_url,
678package_hash: req.package_hash,
679
680                        responder: DevelopmentManagerDisableDriverResponder {
681                            control_handle: std::mem::ManuallyDrop::new(control_handle),
682                            tx_id: header.tx_id,
683                        },
684                    })
685                }
686                0x4abba8d322e671d9 => {
687                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
688                    let mut req = fidl::new_empty!(DevelopmentManagerEnableDriverRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
689                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerEnableDriverRequest>(&header, _body_bytes, handles, &mut req)?;
690                    let control_handle = DevelopmentManagerControlHandle {
691                        inner: this.inner.clone(),
692                    };
693                    Ok(DevelopmentManagerRequest::EnableDriver {driver_url: req.driver_url,
694package_hash: req.package_hash,
695
696                        responder: DevelopmentManagerEnableDriverResponder {
697                            control_handle: std::mem::ManuallyDrop::new(control_handle),
698                            tx_id: header.tx_id,
699                        },
700                    })
701                }
702                0x1da137c4f10d053c => {
703                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
704                    let mut req = fidl::new_empty!(DevelopmentManagerRebindCompositesWithDriverRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
705                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevelopmentManagerRebindCompositesWithDriverRequest>(&header, _body_bytes, handles, &mut req)?;
706                    let control_handle = DevelopmentManagerControlHandle {
707                        inner: this.inner.clone(),
708                    };
709                    Ok(DevelopmentManagerRequest::RebindCompositesWithDriver {driver_url: req.driver_url,
710
711                        responder: DevelopmentManagerRebindCompositesWithDriverResponder {
712                            control_handle: std::mem::ManuallyDrop::new(control_handle),
713                            tx_id: header.tx_id,
714                        },
715                    })
716                }
717                _ => Err(fidl::Error::UnknownOrdinal {
718                    ordinal: header.ordinal,
719                    protocol_name: <DevelopmentManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
720                }),
721            }))
722            },
723        )
724    }
725}
726
727/// Protocol for driver development APIs for the driver index.
728/// This interface should only be used for development and disabled in release builds.
729/// This protocol is internal to the driver framework and should not be used directly by users.
730/// Users should go through the `fuchsia.driver.development/Manager` protocol instead.
731#[derive(Debug)]
732pub enum DevelopmentManagerRequest {
733    /// Returns a list of all drivers that are known to the system.
734    /// If a |driver_filter| is provided, the returned list will be filtered to
735    /// only include drivers specified in the filter.
736    ///
737    /// |iterator| is closed with following epitaphs on error:
738    /// ZX_ERR_NOT_FOUND indicates that there is no driver matching the given path for at least
739    /// one driver in |driver_filter|.
740    /// ZX_ERR_BUFFER_TOO_SMALL indicates that the driver's bind program is longer than the
741    /// maximum number of instructions (BIND_PROGRAM_INSTRUCTIONS_MAX).
742    GetDriverInfo {
743        driver_filter: Vec<String>,
744        iterator:
745            fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>,
746        control_handle: DevelopmentManagerControlHandle,
747    },
748    /// Returns a list of all composite node specs that are known to the system.
749    /// If a |name_filter| is provided, the returned list will only include 1 spec,
750    /// the one with that exact name.
751    ///
752    /// |iterator| is closed with following epitaphs on error:
753    /// ZX_ERR_NOT_FOUND indicates that there are no specs or if a |name_filter| is provided,
754    /// that there are no specs with that name.
755    GetCompositeNodeSpecs {
756        name_filter: Option<String>,
757        iterator: fidl::endpoints::ServerEnd<
758            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
759        >,
760        control_handle: DevelopmentManagerControlHandle,
761    },
762    /// Disables the driver with the given driver component url.
763    /// Disabled drivers will not be considered for matching to nodes.
764    /// If a |package_hash| is provided, only that specific version of the driver
765    /// package will be disabled. Otherwise this applies to all existing versions
766    /// of a driver with the given url.
767    /// Returns an error ZX_ERR_NOT_FOUND if no drivers were affected.
768    DisableDriver {
769        driver_url: String,
770        package_hash: Option<String>,
771        responder: DevelopmentManagerDisableDriverResponder,
772    },
773    /// Enables the driver with the given driver component url.
774    /// This is only meant to revert a |DisableDriver| action.
775    /// Returns an error ZX_ERR_NOT_FOUND if no drivers were affected.
776    EnableDriver {
777        driver_url: String,
778        package_hash: Option<String>,
779        responder: DevelopmentManagerEnableDriverResponder,
780    },
781    /// Rebinds any composite specs that have the given driver_url. This means the
782    /// spec is rematched with possibly another driver, or none if the only matching driver is
783    /// disabled.
784    RebindCompositesWithDriver {
785        driver_url: String,
786        responder: DevelopmentManagerRebindCompositesWithDriverResponder,
787    },
788}
789
790impl DevelopmentManagerRequest {
791    #[allow(irrefutable_let_patterns)]
792    pub fn into_get_driver_info(
793        self,
794    ) -> Option<(
795        Vec<String>,
796        fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>,
797        DevelopmentManagerControlHandle,
798    )> {
799        if let DevelopmentManagerRequest::GetDriverInfo {
800            driver_filter,
801            iterator,
802            control_handle,
803        } = self
804        {
805            Some((driver_filter, iterator, control_handle))
806        } else {
807            None
808        }
809    }
810
811    #[allow(irrefutable_let_patterns)]
812    pub fn into_get_composite_node_specs(
813        self,
814    ) -> Option<(
815        Option<String>,
816        fidl::endpoints::ServerEnd<
817            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
818        >,
819        DevelopmentManagerControlHandle,
820    )> {
821        if let DevelopmentManagerRequest::GetCompositeNodeSpecs {
822            name_filter,
823            iterator,
824            control_handle,
825        } = self
826        {
827            Some((name_filter, iterator, control_handle))
828        } else {
829            None
830        }
831    }
832
833    #[allow(irrefutable_let_patterns)]
834    pub fn into_disable_driver(
835        self,
836    ) -> Option<(String, Option<String>, DevelopmentManagerDisableDriverResponder)> {
837        if let DevelopmentManagerRequest::DisableDriver { driver_url, package_hash, responder } =
838            self
839        {
840            Some((driver_url, package_hash, responder))
841        } else {
842            None
843        }
844    }
845
846    #[allow(irrefutable_let_patterns)]
847    pub fn into_enable_driver(
848        self,
849    ) -> Option<(String, Option<String>, DevelopmentManagerEnableDriverResponder)> {
850        if let DevelopmentManagerRequest::EnableDriver { driver_url, package_hash, responder } =
851            self
852        {
853            Some((driver_url, package_hash, responder))
854        } else {
855            None
856        }
857    }
858
859    #[allow(irrefutable_let_patterns)]
860    pub fn into_rebind_composites_with_driver(
861        self,
862    ) -> Option<(String, DevelopmentManagerRebindCompositesWithDriverResponder)> {
863        if let DevelopmentManagerRequest::RebindCompositesWithDriver { driver_url, responder } =
864            self
865        {
866            Some((driver_url, responder))
867        } else {
868            None
869        }
870    }
871
872    /// Name of the method defined in FIDL
873    pub fn method_name(&self) -> &'static str {
874        match *self {
875            DevelopmentManagerRequest::GetDriverInfo { .. } => "get_driver_info",
876            DevelopmentManagerRequest::GetCompositeNodeSpecs { .. } => "get_composite_node_specs",
877            DevelopmentManagerRequest::DisableDriver { .. } => "disable_driver",
878            DevelopmentManagerRequest::EnableDriver { .. } => "enable_driver",
879            DevelopmentManagerRequest::RebindCompositesWithDriver { .. } => {
880                "rebind_composites_with_driver"
881            }
882        }
883    }
884}
885
886#[derive(Debug, Clone)]
887pub struct DevelopmentManagerControlHandle {
888    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
889}
890
891impl fidl::endpoints::ControlHandle for DevelopmentManagerControlHandle {
892    fn shutdown(&self) {
893        self.inner.shutdown()
894    }
895    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
896        self.inner.shutdown_with_epitaph(status)
897    }
898
899    fn is_closed(&self) -> bool {
900        self.inner.channel().is_closed()
901    }
902    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
903        self.inner.channel().on_closed()
904    }
905
906    #[cfg(target_os = "fuchsia")]
907    fn signal_peer(
908        &self,
909        clear_mask: zx::Signals,
910        set_mask: zx::Signals,
911    ) -> Result<(), zx_status::Status> {
912        use fidl::Peered;
913        self.inner.channel().signal_peer(clear_mask, set_mask)
914    }
915}
916
917impl DevelopmentManagerControlHandle {}
918
919#[must_use = "FIDL methods require a response to be sent"]
920#[derive(Debug)]
921pub struct DevelopmentManagerDisableDriverResponder {
922    control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
923    tx_id: u32,
924}
925
926/// Set the the channel to be shutdown (see [`DevelopmentManagerControlHandle::shutdown`])
927/// if the responder is dropped without sending a response, so that the client
928/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
929impl std::ops::Drop for DevelopmentManagerDisableDriverResponder {
930    fn drop(&mut self) {
931        self.control_handle.shutdown();
932        // Safety: drops once, never accessed again
933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
934    }
935}
936
937impl fidl::endpoints::Responder for DevelopmentManagerDisableDriverResponder {
938    type ControlHandle = DevelopmentManagerControlHandle;
939
940    fn control_handle(&self) -> &DevelopmentManagerControlHandle {
941        &self.control_handle
942    }
943
944    fn drop_without_shutdown(mut self) {
945        // Safety: drops once, never accessed again due to mem::forget
946        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
947        // Prevent Drop from running (which would shut down the channel)
948        std::mem::forget(self);
949    }
950}
951
952impl DevelopmentManagerDisableDriverResponder {
953    /// Sends a response to the FIDL transaction.
954    ///
955    /// Sets the channel to shutdown if an error occurs.
956    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
957        let _result = self.send_raw(result);
958        if _result.is_err() {
959            self.control_handle.shutdown();
960        }
961        self.drop_without_shutdown();
962        _result
963    }
964
965    /// Similar to "send" but does not shutdown the channel if an error occurs.
966    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
967        let _result = self.send_raw(result);
968        self.drop_without_shutdown();
969        _result
970    }
971
972    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
973        self.control_handle
974            .inner
975            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
976                result,
977                self.tx_id,
978                0x7a9043fc2acabf77,
979                fidl::encoding::DynamicFlags::empty(),
980            )
981    }
982}
983
984#[must_use = "FIDL methods require a response to be sent"]
985#[derive(Debug)]
986pub struct DevelopmentManagerEnableDriverResponder {
987    control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
988    tx_id: u32,
989}
990
991/// Set the the channel to be shutdown (see [`DevelopmentManagerControlHandle::shutdown`])
992/// if the responder is dropped without sending a response, so that the client
993/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
994impl std::ops::Drop for DevelopmentManagerEnableDriverResponder {
995    fn drop(&mut self) {
996        self.control_handle.shutdown();
997        // Safety: drops once, never accessed again
998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999    }
1000}
1001
1002impl fidl::endpoints::Responder for DevelopmentManagerEnableDriverResponder {
1003    type ControlHandle = DevelopmentManagerControlHandle;
1004
1005    fn control_handle(&self) -> &DevelopmentManagerControlHandle {
1006        &self.control_handle
1007    }
1008
1009    fn drop_without_shutdown(mut self) {
1010        // Safety: drops once, never accessed again due to mem::forget
1011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012        // Prevent Drop from running (which would shut down the channel)
1013        std::mem::forget(self);
1014    }
1015}
1016
1017impl DevelopmentManagerEnableDriverResponder {
1018    /// Sends a response to the FIDL transaction.
1019    ///
1020    /// Sets the channel to shutdown if an error occurs.
1021    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1022        let _result = self.send_raw(result);
1023        if _result.is_err() {
1024            self.control_handle.shutdown();
1025        }
1026        self.drop_without_shutdown();
1027        _result
1028    }
1029
1030    /// Similar to "send" but does not shutdown the channel if an error occurs.
1031    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1032        let _result = self.send_raw(result);
1033        self.drop_without_shutdown();
1034        _result
1035    }
1036
1037    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1038        self.control_handle
1039            .inner
1040            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1041                result,
1042                self.tx_id,
1043                0x4abba8d322e671d9,
1044                fidl::encoding::DynamicFlags::empty(),
1045            )
1046    }
1047}
1048
1049#[must_use = "FIDL methods require a response to be sent"]
1050#[derive(Debug)]
1051pub struct DevelopmentManagerRebindCompositesWithDriverResponder {
1052    control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
1053    tx_id: u32,
1054}
1055
1056/// Set the the channel to be shutdown (see [`DevelopmentManagerControlHandle::shutdown`])
1057/// if the responder is dropped without sending a response, so that the client
1058/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1059impl std::ops::Drop for DevelopmentManagerRebindCompositesWithDriverResponder {
1060    fn drop(&mut self) {
1061        self.control_handle.shutdown();
1062        // Safety: drops once, never accessed again
1063        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1064    }
1065}
1066
1067impl fidl::endpoints::Responder for DevelopmentManagerRebindCompositesWithDriverResponder {
1068    type ControlHandle = DevelopmentManagerControlHandle;
1069
1070    fn control_handle(&self) -> &DevelopmentManagerControlHandle {
1071        &self.control_handle
1072    }
1073
1074    fn drop_without_shutdown(mut self) {
1075        // Safety: drops once, never accessed again due to mem::forget
1076        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1077        // Prevent Drop from running (which would shut down the channel)
1078        std::mem::forget(self);
1079    }
1080}
1081
1082impl DevelopmentManagerRebindCompositesWithDriverResponder {
1083    /// Sends a response to the FIDL transaction.
1084    ///
1085    /// Sets the channel to shutdown if an error occurs.
1086    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1087        let _result = self.send_raw(result);
1088        if _result.is_err() {
1089            self.control_handle.shutdown();
1090        }
1091        self.drop_without_shutdown();
1092        _result
1093    }
1094
1095    /// Similar to "send" but does not shutdown the channel if an error occurs.
1096    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1097        let _result = self.send_raw(result);
1098        self.drop_without_shutdown();
1099        _result
1100    }
1101
1102    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1103        self.control_handle
1104            .inner
1105            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1106                result,
1107                self.tx_id,
1108                0x1da137c4f10d053c,
1109                fidl::encoding::DynamicFlags::empty(),
1110            )
1111    }
1112}
1113
1114#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1115pub struct DriverIndexMarker;
1116
1117impl fidl::endpoints::ProtocolMarker for DriverIndexMarker {
1118    type Proxy = DriverIndexProxy;
1119    type RequestStream = DriverIndexRequestStream;
1120    #[cfg(target_os = "fuchsia")]
1121    type SynchronousProxy = DriverIndexSynchronousProxy;
1122
1123    const DEBUG_NAME: &'static str = "fuchsia.driver.index.DriverIndex";
1124}
1125impl fidl::endpoints::DiscoverableProtocolMarker for DriverIndexMarker {}
1126pub type DriverIndexMatchDriverResult = Result<MatchDriverResult, i32>;
1127pub type DriverIndexAddCompositeNodeSpecResult = Result<(), i32>;
1128pub type DriverIndexRebindCompositeNodeSpecResult = Result<(), i32>;
1129
1130pub trait DriverIndexProxyInterface: Send + Sync {
1131    type MatchDriverResponseFut: std::future::Future<Output = Result<DriverIndexMatchDriverResult, fidl::Error>>
1132        + Send;
1133    fn r#match_driver(&self, args: &MatchDriverArgs) -> Self::MatchDriverResponseFut;
1134    type AddCompositeNodeSpecResponseFut: std::future::Future<Output = Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error>>
1135        + Send;
1136    fn r#add_composite_node_spec(
1137        &self,
1138        payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1139    ) -> Self::AddCompositeNodeSpecResponseFut;
1140    type RebindCompositeNodeSpecResponseFut: std::future::Future<Output = Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error>>
1141        + Send;
1142    fn r#rebind_composite_node_spec(
1143        &self,
1144        spec: &str,
1145        driver_url_suffix: Option<&str>,
1146    ) -> Self::RebindCompositeNodeSpecResponseFut;
1147    fn r#set_notifier(
1148        &self,
1149        notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1150    ) -> Result<(), fidl::Error>;
1151}
1152#[derive(Debug)]
1153#[cfg(target_os = "fuchsia")]
1154pub struct DriverIndexSynchronousProxy {
1155    client: fidl::client::sync::Client,
1156}
1157
1158#[cfg(target_os = "fuchsia")]
1159impl fidl::endpoints::SynchronousProxy for DriverIndexSynchronousProxy {
1160    type Proxy = DriverIndexProxy;
1161    type Protocol = DriverIndexMarker;
1162
1163    fn from_channel(inner: fidl::Channel) -> Self {
1164        Self::new(inner)
1165    }
1166
1167    fn into_channel(self) -> fidl::Channel {
1168        self.client.into_channel()
1169    }
1170
1171    fn as_channel(&self) -> &fidl::Channel {
1172        self.client.as_channel()
1173    }
1174}
1175
1176#[cfg(target_os = "fuchsia")]
1177impl DriverIndexSynchronousProxy {
1178    pub fn new(channel: fidl::Channel) -> Self {
1179        let protocol_name = <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1180        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1181    }
1182
1183    pub fn into_channel(self) -> fidl::Channel {
1184        self.client.into_channel()
1185    }
1186
1187    /// Waits until an event arrives and returns it. It is safe for other
1188    /// threads to make concurrent requests while waiting for an event.
1189    pub fn wait_for_event(
1190        &self,
1191        deadline: zx::MonotonicInstant,
1192    ) -> Result<DriverIndexEvent, fidl::Error> {
1193        DriverIndexEvent::decode(self.client.wait_for_event(deadline)?)
1194    }
1195
1196    /// Match a set of device arguments to a driver package URL.
1197    pub fn r#match_driver(
1198        &self,
1199        mut args: &MatchDriverArgs,
1200        ___deadline: zx::MonotonicInstant,
1201    ) -> Result<DriverIndexMatchDriverResult, fidl::Error> {
1202        let _response = self.client.send_query::<
1203            DriverIndexMatchDriverRequest,
1204            fidl::encoding::ResultType<MatchDriverResult, i32>,
1205        >(
1206            (args,),
1207            0x38317894f6269541,
1208            fidl::encoding::DynamicFlags::empty(),
1209            ___deadline,
1210        )?;
1211        Ok(_response.map(|x| x))
1212    }
1213
1214    /// Adds a composite node spec to the driver index. The driver index stores the
1215    /// composite node spec and maps it by the name. The stored composite node specs are
1216    /// included in the driver matching process.
1217    pub fn r#add_composite_node_spec(
1218        &self,
1219        mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1220        ___deadline: zx::MonotonicInstant,
1221    ) -> Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error> {
1222        let _response = self.client.send_query::<
1223            fidl_fuchsia_driver_framework::CompositeNodeSpec,
1224            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1225        >(
1226            payload,
1227            0x66d25a18fa46a2a2,
1228            fidl::encoding::DynamicFlags::empty(),
1229            ___deadline,
1230        )?;
1231        Ok(_response.map(|x| x))
1232    }
1233
1234    /// Rematch the composite node spec to a composite driver. If a driver url suffix is
1235    /// provided, the composite node spec will only be matched against drivers with URLS that
1236    /// end with the suffix.
1237    pub fn r#rebind_composite_node_spec(
1238        &self,
1239        mut spec: &str,
1240        mut driver_url_suffix: Option<&str>,
1241        ___deadline: zx::MonotonicInstant,
1242    ) -> Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error> {
1243        let _response = self.client.send_query::<
1244            DriverIndexRebindCompositeNodeSpecRequest,
1245            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1246        >(
1247            (spec, driver_url_suffix,),
1248            0x6667ac8de58b202a,
1249            fidl::encoding::DynamicFlags::empty(),
1250            ___deadline,
1251        )?;
1252        Ok(_response.map(|x| x))
1253    }
1254
1255    /// Sets the DriverNotifier which is used for reverse communication.
1256    pub fn r#set_notifier(
1257        &self,
1258        mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1259    ) -> Result<(), fidl::Error> {
1260        self.client.send::<DriverIndexSetNotifierRequest>(
1261            (notifier,),
1262            0x1dfdede9fcdab511,
1263            fidl::encoding::DynamicFlags::empty(),
1264        )
1265    }
1266}
1267
1268#[cfg(target_os = "fuchsia")]
1269impl From<DriverIndexSynchronousProxy> for zx::Handle {
1270    fn from(value: DriverIndexSynchronousProxy) -> Self {
1271        value.into_channel().into()
1272    }
1273}
1274
1275#[cfg(target_os = "fuchsia")]
1276impl From<fidl::Channel> for DriverIndexSynchronousProxy {
1277    fn from(value: fidl::Channel) -> Self {
1278        Self::new(value)
1279    }
1280}
1281
1282#[cfg(target_os = "fuchsia")]
1283impl fidl::endpoints::FromClient for DriverIndexSynchronousProxy {
1284    type Protocol = DriverIndexMarker;
1285
1286    fn from_client(value: fidl::endpoints::ClientEnd<DriverIndexMarker>) -> Self {
1287        Self::new(value.into_channel())
1288    }
1289}
1290
1291#[derive(Debug, Clone)]
1292pub struct DriverIndexProxy {
1293    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1294}
1295
1296impl fidl::endpoints::Proxy for DriverIndexProxy {
1297    type Protocol = DriverIndexMarker;
1298
1299    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1300        Self::new(inner)
1301    }
1302
1303    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1304        self.client.into_channel().map_err(|client| Self { client })
1305    }
1306
1307    fn as_channel(&self) -> &::fidl::AsyncChannel {
1308        self.client.as_channel()
1309    }
1310}
1311
1312impl DriverIndexProxy {
1313    /// Create a new Proxy for fuchsia.driver.index/DriverIndex.
1314    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1315        let protocol_name = <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1316        Self { client: fidl::client::Client::new(channel, protocol_name) }
1317    }
1318
1319    /// Get a Stream of events from the remote end of the protocol.
1320    ///
1321    /// # Panics
1322    ///
1323    /// Panics if the event stream was already taken.
1324    pub fn take_event_stream(&self) -> DriverIndexEventStream {
1325        DriverIndexEventStream { event_receiver: self.client.take_event_receiver() }
1326    }
1327
1328    /// Match a set of device arguments to a driver package URL.
1329    pub fn r#match_driver(
1330        &self,
1331        mut args: &MatchDriverArgs,
1332    ) -> fidl::client::QueryResponseFut<
1333        DriverIndexMatchDriverResult,
1334        fidl::encoding::DefaultFuchsiaResourceDialect,
1335    > {
1336        DriverIndexProxyInterface::r#match_driver(self, args)
1337    }
1338
1339    /// Adds a composite node spec to the driver index. The driver index stores the
1340    /// composite node spec and maps it by the name. The stored composite node specs are
1341    /// included in the driver matching process.
1342    pub fn r#add_composite_node_spec(
1343        &self,
1344        mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1345    ) -> fidl::client::QueryResponseFut<
1346        DriverIndexAddCompositeNodeSpecResult,
1347        fidl::encoding::DefaultFuchsiaResourceDialect,
1348    > {
1349        DriverIndexProxyInterface::r#add_composite_node_spec(self, payload)
1350    }
1351
1352    /// Rematch the composite node spec to a composite driver. If a driver url suffix is
1353    /// provided, the composite node spec will only be matched against drivers with URLS that
1354    /// end with the suffix.
1355    pub fn r#rebind_composite_node_spec(
1356        &self,
1357        mut spec: &str,
1358        mut driver_url_suffix: Option<&str>,
1359    ) -> fidl::client::QueryResponseFut<
1360        DriverIndexRebindCompositeNodeSpecResult,
1361        fidl::encoding::DefaultFuchsiaResourceDialect,
1362    > {
1363        DriverIndexProxyInterface::r#rebind_composite_node_spec(self, spec, driver_url_suffix)
1364    }
1365
1366    /// Sets the DriverNotifier which is used for reverse communication.
1367    pub fn r#set_notifier(
1368        &self,
1369        mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1370    ) -> Result<(), fidl::Error> {
1371        DriverIndexProxyInterface::r#set_notifier(self, notifier)
1372    }
1373}
1374
1375impl DriverIndexProxyInterface for DriverIndexProxy {
1376    type MatchDriverResponseFut = fidl::client::QueryResponseFut<
1377        DriverIndexMatchDriverResult,
1378        fidl::encoding::DefaultFuchsiaResourceDialect,
1379    >;
1380    fn r#match_driver(&self, mut args: &MatchDriverArgs) -> Self::MatchDriverResponseFut {
1381        fn _decode(
1382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1383        ) -> Result<DriverIndexMatchDriverResult, fidl::Error> {
1384            let _response = fidl::client::decode_transaction_body::<
1385                fidl::encoding::ResultType<MatchDriverResult, i32>,
1386                fidl::encoding::DefaultFuchsiaResourceDialect,
1387                0x38317894f6269541,
1388            >(_buf?)?;
1389            Ok(_response.map(|x| x))
1390        }
1391        self.client
1392            .send_query_and_decode::<DriverIndexMatchDriverRequest, DriverIndexMatchDriverResult>(
1393                (args,),
1394                0x38317894f6269541,
1395                fidl::encoding::DynamicFlags::empty(),
1396                _decode,
1397            )
1398    }
1399
1400    type AddCompositeNodeSpecResponseFut = fidl::client::QueryResponseFut<
1401        DriverIndexAddCompositeNodeSpecResult,
1402        fidl::encoding::DefaultFuchsiaResourceDialect,
1403    >;
1404    fn r#add_composite_node_spec(
1405        &self,
1406        mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1407    ) -> Self::AddCompositeNodeSpecResponseFut {
1408        fn _decode(
1409            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1410        ) -> Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error> {
1411            let _response = fidl::client::decode_transaction_body::<
1412                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1413                fidl::encoding::DefaultFuchsiaResourceDialect,
1414                0x66d25a18fa46a2a2,
1415            >(_buf?)?;
1416            Ok(_response.map(|x| x))
1417        }
1418        self.client.send_query_and_decode::<
1419            fidl_fuchsia_driver_framework::CompositeNodeSpec,
1420            DriverIndexAddCompositeNodeSpecResult,
1421        >(
1422            payload,
1423            0x66d25a18fa46a2a2,
1424            fidl::encoding::DynamicFlags::empty(),
1425            _decode,
1426        )
1427    }
1428
1429    type RebindCompositeNodeSpecResponseFut = fidl::client::QueryResponseFut<
1430        DriverIndexRebindCompositeNodeSpecResult,
1431        fidl::encoding::DefaultFuchsiaResourceDialect,
1432    >;
1433    fn r#rebind_composite_node_spec(
1434        &self,
1435        mut spec: &str,
1436        mut driver_url_suffix: Option<&str>,
1437    ) -> Self::RebindCompositeNodeSpecResponseFut {
1438        fn _decode(
1439            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1440        ) -> Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error> {
1441            let _response = fidl::client::decode_transaction_body::<
1442                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1443                fidl::encoding::DefaultFuchsiaResourceDialect,
1444                0x6667ac8de58b202a,
1445            >(_buf?)?;
1446            Ok(_response.map(|x| x))
1447        }
1448        self.client.send_query_and_decode::<
1449            DriverIndexRebindCompositeNodeSpecRequest,
1450            DriverIndexRebindCompositeNodeSpecResult,
1451        >(
1452            (spec, driver_url_suffix,),
1453            0x6667ac8de58b202a,
1454            fidl::encoding::DynamicFlags::empty(),
1455            _decode,
1456        )
1457    }
1458
1459    fn r#set_notifier(
1460        &self,
1461        mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1462    ) -> Result<(), fidl::Error> {
1463        self.client.send::<DriverIndexSetNotifierRequest>(
1464            (notifier,),
1465            0x1dfdede9fcdab511,
1466            fidl::encoding::DynamicFlags::empty(),
1467        )
1468    }
1469}
1470
1471pub struct DriverIndexEventStream {
1472    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1473}
1474
1475impl std::marker::Unpin for DriverIndexEventStream {}
1476
1477impl futures::stream::FusedStream for DriverIndexEventStream {
1478    fn is_terminated(&self) -> bool {
1479        self.event_receiver.is_terminated()
1480    }
1481}
1482
1483impl futures::Stream for DriverIndexEventStream {
1484    type Item = Result<DriverIndexEvent, fidl::Error>;
1485
1486    fn poll_next(
1487        mut self: std::pin::Pin<&mut Self>,
1488        cx: &mut std::task::Context<'_>,
1489    ) -> std::task::Poll<Option<Self::Item>> {
1490        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1491            &mut self.event_receiver,
1492            cx
1493        )?) {
1494            Some(buf) => std::task::Poll::Ready(Some(DriverIndexEvent::decode(buf))),
1495            None => std::task::Poll::Ready(None),
1496        }
1497    }
1498}
1499
1500#[derive(Debug)]
1501pub enum DriverIndexEvent {}
1502
1503impl DriverIndexEvent {
1504    /// Decodes a message buffer as a [`DriverIndexEvent`].
1505    fn decode(
1506        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1507    ) -> Result<DriverIndexEvent, fidl::Error> {
1508        let (bytes, _handles) = buf.split_mut();
1509        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1510        debug_assert_eq!(tx_header.tx_id, 0);
1511        match tx_header.ordinal {
1512            _ => Err(fidl::Error::UnknownOrdinal {
1513                ordinal: tx_header.ordinal,
1514                protocol_name: <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1515            }),
1516        }
1517    }
1518}
1519
1520/// A Stream of incoming requests for fuchsia.driver.index/DriverIndex.
1521pub struct DriverIndexRequestStream {
1522    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1523    is_terminated: bool,
1524}
1525
1526impl std::marker::Unpin for DriverIndexRequestStream {}
1527
1528impl futures::stream::FusedStream for DriverIndexRequestStream {
1529    fn is_terminated(&self) -> bool {
1530        self.is_terminated
1531    }
1532}
1533
1534impl fidl::endpoints::RequestStream for DriverIndexRequestStream {
1535    type Protocol = DriverIndexMarker;
1536    type ControlHandle = DriverIndexControlHandle;
1537
1538    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1539        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1540    }
1541
1542    fn control_handle(&self) -> Self::ControlHandle {
1543        DriverIndexControlHandle { inner: self.inner.clone() }
1544    }
1545
1546    fn into_inner(
1547        self,
1548    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1549    {
1550        (self.inner, self.is_terminated)
1551    }
1552
1553    fn from_inner(
1554        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1555        is_terminated: bool,
1556    ) -> Self {
1557        Self { inner, is_terminated }
1558    }
1559}
1560
1561impl futures::Stream for DriverIndexRequestStream {
1562    type Item = Result<DriverIndexRequest, fidl::Error>;
1563
1564    fn poll_next(
1565        mut self: std::pin::Pin<&mut Self>,
1566        cx: &mut std::task::Context<'_>,
1567    ) -> std::task::Poll<Option<Self::Item>> {
1568        let this = &mut *self;
1569        if this.inner.check_shutdown(cx) {
1570            this.is_terminated = true;
1571            return std::task::Poll::Ready(None);
1572        }
1573        if this.is_terminated {
1574            panic!("polled DriverIndexRequestStream after completion");
1575        }
1576        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1577            |bytes, handles| {
1578                match this.inner.channel().read_etc(cx, bytes, handles) {
1579                    std::task::Poll::Ready(Ok(())) => {}
1580                    std::task::Poll::Pending => return std::task::Poll::Pending,
1581                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1582                        this.is_terminated = true;
1583                        return std::task::Poll::Ready(None);
1584                    }
1585                    std::task::Poll::Ready(Err(e)) => {
1586                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1587                            e.into(),
1588                        ))))
1589                    }
1590                }
1591
1592                // A message has been received from the channel
1593                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1594
1595                std::task::Poll::Ready(Some(match header.ordinal {
1596                    0x38317894f6269541 => {
1597                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1598                        let mut req = fidl::new_empty!(
1599                            DriverIndexMatchDriverRequest,
1600                            fidl::encoding::DefaultFuchsiaResourceDialect
1601                        );
1602                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexMatchDriverRequest>(&header, _body_bytes, handles, &mut req)?;
1603                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1604                        Ok(DriverIndexRequest::MatchDriver {
1605                            args: req.args,
1606
1607                            responder: DriverIndexMatchDriverResponder {
1608                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1609                                tx_id: header.tx_id,
1610                            },
1611                        })
1612                    }
1613                    0x66d25a18fa46a2a2 => {
1614                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1615                        let mut req = fidl::new_empty!(
1616                            fidl_fuchsia_driver_framework::CompositeNodeSpec,
1617                            fidl::encoding::DefaultFuchsiaResourceDialect
1618                        );
1619                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_driver_framework::CompositeNodeSpec>(&header, _body_bytes, handles, &mut req)?;
1620                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1621                        Ok(DriverIndexRequest::AddCompositeNodeSpec {
1622                            payload: req,
1623                            responder: DriverIndexAddCompositeNodeSpecResponder {
1624                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1625                                tx_id: header.tx_id,
1626                            },
1627                        })
1628                    }
1629                    0x6667ac8de58b202a => {
1630                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1631                        let mut req = fidl::new_empty!(
1632                            DriverIndexRebindCompositeNodeSpecRequest,
1633                            fidl::encoding::DefaultFuchsiaResourceDialect
1634                        );
1635                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexRebindCompositeNodeSpecRequest>(&header, _body_bytes, handles, &mut req)?;
1636                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1637                        Ok(DriverIndexRequest::RebindCompositeNodeSpec {
1638                            spec: req.spec,
1639                            driver_url_suffix: req.driver_url_suffix,
1640
1641                            responder: DriverIndexRebindCompositeNodeSpecResponder {
1642                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1643                                tx_id: header.tx_id,
1644                            },
1645                        })
1646                    }
1647                    0x1dfdede9fcdab511 => {
1648                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1649                        let mut req = fidl::new_empty!(
1650                            DriverIndexSetNotifierRequest,
1651                            fidl::encoding::DefaultFuchsiaResourceDialect
1652                        );
1653                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexSetNotifierRequest>(&header, _body_bytes, handles, &mut req)?;
1654                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1655                        Ok(DriverIndexRequest::SetNotifier {
1656                            notifier: req.notifier,
1657
1658                            control_handle,
1659                        })
1660                    }
1661                    _ => Err(fidl::Error::UnknownOrdinal {
1662                        ordinal: header.ordinal,
1663                        protocol_name:
1664                            <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1665                    }),
1666                }))
1667            },
1668        )
1669    }
1670}
1671
1672/// Protocol through which the driver index can be queried.
1673#[derive(Debug)]
1674pub enum DriverIndexRequest {
1675    /// Match a set of device arguments to a driver package URL.
1676    MatchDriver { args: MatchDriverArgs, responder: DriverIndexMatchDriverResponder },
1677    /// Adds a composite node spec to the driver index. The driver index stores the
1678    /// composite node spec and maps it by the name. The stored composite node specs are
1679    /// included in the driver matching process.
1680    AddCompositeNodeSpec {
1681        payload: fidl_fuchsia_driver_framework::CompositeNodeSpec,
1682        responder: DriverIndexAddCompositeNodeSpecResponder,
1683    },
1684    /// Rematch the composite node spec to a composite driver. If a driver url suffix is
1685    /// provided, the composite node spec will only be matched against drivers with URLS that
1686    /// end with the suffix.
1687    RebindCompositeNodeSpec {
1688        spec: String,
1689        driver_url_suffix: Option<String>,
1690        responder: DriverIndexRebindCompositeNodeSpecResponder,
1691    },
1692    /// Sets the DriverNotifier which is used for reverse communication.
1693    SetNotifier {
1694        notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1695        control_handle: DriverIndexControlHandle,
1696    },
1697}
1698
1699impl DriverIndexRequest {
1700    #[allow(irrefutable_let_patterns)]
1701    pub fn into_match_driver(self) -> Option<(MatchDriverArgs, DriverIndexMatchDriverResponder)> {
1702        if let DriverIndexRequest::MatchDriver { args, responder } = self {
1703            Some((args, responder))
1704        } else {
1705            None
1706        }
1707    }
1708
1709    #[allow(irrefutable_let_patterns)]
1710    pub fn into_add_composite_node_spec(
1711        self,
1712    ) -> Option<(
1713        fidl_fuchsia_driver_framework::CompositeNodeSpec,
1714        DriverIndexAddCompositeNodeSpecResponder,
1715    )> {
1716        if let DriverIndexRequest::AddCompositeNodeSpec { payload, responder } = self {
1717            Some((payload, responder))
1718        } else {
1719            None
1720        }
1721    }
1722
1723    #[allow(irrefutable_let_patterns)]
1724    pub fn into_rebind_composite_node_spec(
1725        self,
1726    ) -> Option<(String, Option<String>, DriverIndexRebindCompositeNodeSpecResponder)> {
1727        if let DriverIndexRequest::RebindCompositeNodeSpec { spec, driver_url_suffix, responder } =
1728            self
1729        {
1730            Some((spec, driver_url_suffix, responder))
1731        } else {
1732            None
1733        }
1734    }
1735
1736    #[allow(irrefutable_let_patterns)]
1737    pub fn into_set_notifier(
1738        self,
1739    ) -> Option<(fidl::endpoints::ClientEnd<DriverNotifierMarker>, DriverIndexControlHandle)> {
1740        if let DriverIndexRequest::SetNotifier { notifier, control_handle } = self {
1741            Some((notifier, control_handle))
1742        } else {
1743            None
1744        }
1745    }
1746
1747    /// Name of the method defined in FIDL
1748    pub fn method_name(&self) -> &'static str {
1749        match *self {
1750            DriverIndexRequest::MatchDriver { .. } => "match_driver",
1751            DriverIndexRequest::AddCompositeNodeSpec { .. } => "add_composite_node_spec",
1752            DriverIndexRequest::RebindCompositeNodeSpec { .. } => "rebind_composite_node_spec",
1753            DriverIndexRequest::SetNotifier { .. } => "set_notifier",
1754        }
1755    }
1756}
1757
1758#[derive(Debug, Clone)]
1759pub struct DriverIndexControlHandle {
1760    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1761}
1762
1763impl fidl::endpoints::ControlHandle for DriverIndexControlHandle {
1764    fn shutdown(&self) {
1765        self.inner.shutdown()
1766    }
1767    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1768        self.inner.shutdown_with_epitaph(status)
1769    }
1770
1771    fn is_closed(&self) -> bool {
1772        self.inner.channel().is_closed()
1773    }
1774    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1775        self.inner.channel().on_closed()
1776    }
1777
1778    #[cfg(target_os = "fuchsia")]
1779    fn signal_peer(
1780        &self,
1781        clear_mask: zx::Signals,
1782        set_mask: zx::Signals,
1783    ) -> Result<(), zx_status::Status> {
1784        use fidl::Peered;
1785        self.inner.channel().signal_peer(clear_mask, set_mask)
1786    }
1787}
1788
1789impl DriverIndexControlHandle {}
1790
1791#[must_use = "FIDL methods require a response to be sent"]
1792#[derive(Debug)]
1793pub struct DriverIndexMatchDriverResponder {
1794    control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
1795    tx_id: u32,
1796}
1797
1798/// Set the the channel to be shutdown (see [`DriverIndexControlHandle::shutdown`])
1799/// if the responder is dropped without sending a response, so that the client
1800/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1801impl std::ops::Drop for DriverIndexMatchDriverResponder {
1802    fn drop(&mut self) {
1803        self.control_handle.shutdown();
1804        // Safety: drops once, never accessed again
1805        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1806    }
1807}
1808
1809impl fidl::endpoints::Responder for DriverIndexMatchDriverResponder {
1810    type ControlHandle = DriverIndexControlHandle;
1811
1812    fn control_handle(&self) -> &DriverIndexControlHandle {
1813        &self.control_handle
1814    }
1815
1816    fn drop_without_shutdown(mut self) {
1817        // Safety: drops once, never accessed again due to mem::forget
1818        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1819        // Prevent Drop from running (which would shut down the channel)
1820        std::mem::forget(self);
1821    }
1822}
1823
1824impl DriverIndexMatchDriverResponder {
1825    /// Sends a response to the FIDL transaction.
1826    ///
1827    /// Sets the channel to shutdown if an error occurs.
1828    pub fn send(self, mut result: Result<&MatchDriverResult, i32>) -> Result<(), fidl::Error> {
1829        let _result = self.send_raw(result);
1830        if _result.is_err() {
1831            self.control_handle.shutdown();
1832        }
1833        self.drop_without_shutdown();
1834        _result
1835    }
1836
1837    /// Similar to "send" but does not shutdown the channel if an error occurs.
1838    pub fn send_no_shutdown_on_err(
1839        self,
1840        mut result: Result<&MatchDriverResult, i32>,
1841    ) -> Result<(), fidl::Error> {
1842        let _result = self.send_raw(result);
1843        self.drop_without_shutdown();
1844        _result
1845    }
1846
1847    fn send_raw(&self, mut result: Result<&MatchDriverResult, i32>) -> Result<(), fidl::Error> {
1848        self.control_handle.inner.send::<fidl::encoding::ResultType<MatchDriverResult, i32>>(
1849            result,
1850            self.tx_id,
1851            0x38317894f6269541,
1852            fidl::encoding::DynamicFlags::empty(),
1853        )
1854    }
1855}
1856
1857#[must_use = "FIDL methods require a response to be sent"]
1858#[derive(Debug)]
1859pub struct DriverIndexAddCompositeNodeSpecResponder {
1860    control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
1861    tx_id: u32,
1862}
1863
1864/// Set the the channel to be shutdown (see [`DriverIndexControlHandle::shutdown`])
1865/// if the responder is dropped without sending a response, so that the client
1866/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1867impl std::ops::Drop for DriverIndexAddCompositeNodeSpecResponder {
1868    fn drop(&mut self) {
1869        self.control_handle.shutdown();
1870        // Safety: drops once, never accessed again
1871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1872    }
1873}
1874
1875impl fidl::endpoints::Responder for DriverIndexAddCompositeNodeSpecResponder {
1876    type ControlHandle = DriverIndexControlHandle;
1877
1878    fn control_handle(&self) -> &DriverIndexControlHandle {
1879        &self.control_handle
1880    }
1881
1882    fn drop_without_shutdown(mut self) {
1883        // Safety: drops once, never accessed again due to mem::forget
1884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1885        // Prevent Drop from running (which would shut down the channel)
1886        std::mem::forget(self);
1887    }
1888}
1889
1890impl DriverIndexAddCompositeNodeSpecResponder {
1891    /// Sends a response to the FIDL transaction.
1892    ///
1893    /// Sets the channel to shutdown if an error occurs.
1894    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1895        let _result = self.send_raw(result);
1896        if _result.is_err() {
1897            self.control_handle.shutdown();
1898        }
1899        self.drop_without_shutdown();
1900        _result
1901    }
1902
1903    /// Similar to "send" but does not shutdown the channel if an error occurs.
1904    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1905        let _result = self.send_raw(result);
1906        self.drop_without_shutdown();
1907        _result
1908    }
1909
1910    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1911        self.control_handle
1912            .inner
1913            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1914                result,
1915                self.tx_id,
1916                0x66d25a18fa46a2a2,
1917                fidl::encoding::DynamicFlags::empty(),
1918            )
1919    }
1920}
1921
1922#[must_use = "FIDL methods require a response to be sent"]
1923#[derive(Debug)]
1924pub struct DriverIndexRebindCompositeNodeSpecResponder {
1925    control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
1926    tx_id: u32,
1927}
1928
1929/// Set the the channel to be shutdown (see [`DriverIndexControlHandle::shutdown`])
1930/// if the responder is dropped without sending a response, so that the client
1931/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1932impl std::ops::Drop for DriverIndexRebindCompositeNodeSpecResponder {
1933    fn drop(&mut self) {
1934        self.control_handle.shutdown();
1935        // Safety: drops once, never accessed again
1936        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1937    }
1938}
1939
1940impl fidl::endpoints::Responder for DriverIndexRebindCompositeNodeSpecResponder {
1941    type ControlHandle = DriverIndexControlHandle;
1942
1943    fn control_handle(&self) -> &DriverIndexControlHandle {
1944        &self.control_handle
1945    }
1946
1947    fn drop_without_shutdown(mut self) {
1948        // Safety: drops once, never accessed again due to mem::forget
1949        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1950        // Prevent Drop from running (which would shut down the channel)
1951        std::mem::forget(self);
1952    }
1953}
1954
1955impl DriverIndexRebindCompositeNodeSpecResponder {
1956    /// Sends a response to the FIDL transaction.
1957    ///
1958    /// Sets the channel to shutdown if an error occurs.
1959    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1960        let _result = self.send_raw(result);
1961        if _result.is_err() {
1962            self.control_handle.shutdown();
1963        }
1964        self.drop_without_shutdown();
1965        _result
1966    }
1967
1968    /// Similar to "send" but does not shutdown the channel if an error occurs.
1969    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1970        let _result = self.send_raw(result);
1971        self.drop_without_shutdown();
1972        _result
1973    }
1974
1975    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1976        self.control_handle
1977            .inner
1978            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1979                result,
1980                self.tx_id,
1981                0x6667ac8de58b202a,
1982                fidl::encoding::DynamicFlags::empty(),
1983            )
1984    }
1985}
1986
1987#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1988pub struct DriverNotifierMarker;
1989
1990impl fidl::endpoints::ProtocolMarker for DriverNotifierMarker {
1991    type Proxy = DriverNotifierProxy;
1992    type RequestStream = DriverNotifierRequestStream;
1993    #[cfg(target_os = "fuchsia")]
1994    type SynchronousProxy = DriverNotifierSynchronousProxy;
1995
1996    const DEBUG_NAME: &'static str = "(anonymous) DriverNotifier";
1997}
1998
1999pub trait DriverNotifierProxyInterface: Send + Sync {
2000    fn r#new_driver_available(&self) -> Result<(), fidl::Error>;
2001}
2002#[derive(Debug)]
2003#[cfg(target_os = "fuchsia")]
2004pub struct DriverNotifierSynchronousProxy {
2005    client: fidl::client::sync::Client,
2006}
2007
2008#[cfg(target_os = "fuchsia")]
2009impl fidl::endpoints::SynchronousProxy for DriverNotifierSynchronousProxy {
2010    type Proxy = DriverNotifierProxy;
2011    type Protocol = DriverNotifierMarker;
2012
2013    fn from_channel(inner: fidl::Channel) -> Self {
2014        Self::new(inner)
2015    }
2016
2017    fn into_channel(self) -> fidl::Channel {
2018        self.client.into_channel()
2019    }
2020
2021    fn as_channel(&self) -> &fidl::Channel {
2022        self.client.as_channel()
2023    }
2024}
2025
2026#[cfg(target_os = "fuchsia")]
2027impl DriverNotifierSynchronousProxy {
2028    pub fn new(channel: fidl::Channel) -> Self {
2029        let protocol_name = <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2030        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2031    }
2032
2033    pub fn into_channel(self) -> fidl::Channel {
2034        self.client.into_channel()
2035    }
2036
2037    /// Waits until an event arrives and returns it. It is safe for other
2038    /// threads to make concurrent requests while waiting for an event.
2039    pub fn wait_for_event(
2040        &self,
2041        deadline: zx::MonotonicInstant,
2042    ) -> Result<DriverNotifierEvent, fidl::Error> {
2043        DriverNotifierEvent::decode(self.client.wait_for_event(deadline)?)
2044    }
2045
2046    /// One-way method called from the driver index to the driver manager to notify it of
2047    /// new drivers.
2048    pub fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
2049        self.client.send::<fidl::encoding::EmptyPayload>(
2050            (),
2051            0x1642ffd065b6b48e,
2052            fidl::encoding::DynamicFlags::empty(),
2053        )
2054    }
2055}
2056
2057#[cfg(target_os = "fuchsia")]
2058impl From<DriverNotifierSynchronousProxy> for zx::Handle {
2059    fn from(value: DriverNotifierSynchronousProxy) -> Self {
2060        value.into_channel().into()
2061    }
2062}
2063
2064#[cfg(target_os = "fuchsia")]
2065impl From<fidl::Channel> for DriverNotifierSynchronousProxy {
2066    fn from(value: fidl::Channel) -> Self {
2067        Self::new(value)
2068    }
2069}
2070
2071#[cfg(target_os = "fuchsia")]
2072impl fidl::endpoints::FromClient for DriverNotifierSynchronousProxy {
2073    type Protocol = DriverNotifierMarker;
2074
2075    fn from_client(value: fidl::endpoints::ClientEnd<DriverNotifierMarker>) -> Self {
2076        Self::new(value.into_channel())
2077    }
2078}
2079
2080#[derive(Debug, Clone)]
2081pub struct DriverNotifierProxy {
2082    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2083}
2084
2085impl fidl::endpoints::Proxy for DriverNotifierProxy {
2086    type Protocol = DriverNotifierMarker;
2087
2088    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2089        Self::new(inner)
2090    }
2091
2092    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2093        self.client.into_channel().map_err(|client| Self { client })
2094    }
2095
2096    fn as_channel(&self) -> &::fidl::AsyncChannel {
2097        self.client.as_channel()
2098    }
2099}
2100
2101impl DriverNotifierProxy {
2102    /// Create a new Proxy for fuchsia.driver.index/DriverNotifier.
2103    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2104        let protocol_name = <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2105        Self { client: fidl::client::Client::new(channel, protocol_name) }
2106    }
2107
2108    /// Get a Stream of events from the remote end of the protocol.
2109    ///
2110    /// # Panics
2111    ///
2112    /// Panics if the event stream was already taken.
2113    pub fn take_event_stream(&self) -> DriverNotifierEventStream {
2114        DriverNotifierEventStream { event_receiver: self.client.take_event_receiver() }
2115    }
2116
2117    /// One-way method called from the driver index to the driver manager to notify it of
2118    /// new drivers.
2119    pub fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
2120        DriverNotifierProxyInterface::r#new_driver_available(self)
2121    }
2122}
2123
2124impl DriverNotifierProxyInterface for DriverNotifierProxy {
2125    fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
2126        self.client.send::<fidl::encoding::EmptyPayload>(
2127            (),
2128            0x1642ffd065b6b48e,
2129            fidl::encoding::DynamicFlags::empty(),
2130        )
2131    }
2132}
2133
2134pub struct DriverNotifierEventStream {
2135    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2136}
2137
2138impl std::marker::Unpin for DriverNotifierEventStream {}
2139
2140impl futures::stream::FusedStream for DriverNotifierEventStream {
2141    fn is_terminated(&self) -> bool {
2142        self.event_receiver.is_terminated()
2143    }
2144}
2145
2146impl futures::Stream for DriverNotifierEventStream {
2147    type Item = Result<DriverNotifierEvent, fidl::Error>;
2148
2149    fn poll_next(
2150        mut self: std::pin::Pin<&mut Self>,
2151        cx: &mut std::task::Context<'_>,
2152    ) -> std::task::Poll<Option<Self::Item>> {
2153        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2154            &mut self.event_receiver,
2155            cx
2156        )?) {
2157            Some(buf) => std::task::Poll::Ready(Some(DriverNotifierEvent::decode(buf))),
2158            None => std::task::Poll::Ready(None),
2159        }
2160    }
2161}
2162
2163#[derive(Debug)]
2164pub enum DriverNotifierEvent {}
2165
2166impl DriverNotifierEvent {
2167    /// Decodes a message buffer as a [`DriverNotifierEvent`].
2168    fn decode(
2169        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2170    ) -> Result<DriverNotifierEvent, fidl::Error> {
2171        let (bytes, _handles) = buf.split_mut();
2172        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2173        debug_assert_eq!(tx_header.tx_id, 0);
2174        match tx_header.ordinal {
2175            _ => Err(fidl::Error::UnknownOrdinal {
2176                ordinal: tx_header.ordinal,
2177                protocol_name:
2178                    <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2179            }),
2180        }
2181    }
2182}
2183
2184/// A Stream of incoming requests for fuchsia.driver.index/DriverNotifier.
2185pub struct DriverNotifierRequestStream {
2186    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2187    is_terminated: bool,
2188}
2189
2190impl std::marker::Unpin for DriverNotifierRequestStream {}
2191
2192impl futures::stream::FusedStream for DriverNotifierRequestStream {
2193    fn is_terminated(&self) -> bool {
2194        self.is_terminated
2195    }
2196}
2197
2198impl fidl::endpoints::RequestStream for DriverNotifierRequestStream {
2199    type Protocol = DriverNotifierMarker;
2200    type ControlHandle = DriverNotifierControlHandle;
2201
2202    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2203        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2204    }
2205
2206    fn control_handle(&self) -> Self::ControlHandle {
2207        DriverNotifierControlHandle { inner: self.inner.clone() }
2208    }
2209
2210    fn into_inner(
2211        self,
2212    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2213    {
2214        (self.inner, self.is_terminated)
2215    }
2216
2217    fn from_inner(
2218        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2219        is_terminated: bool,
2220    ) -> Self {
2221        Self { inner, is_terminated }
2222    }
2223}
2224
2225impl futures::Stream for DriverNotifierRequestStream {
2226    type Item = Result<DriverNotifierRequest, fidl::Error>;
2227
2228    fn poll_next(
2229        mut self: std::pin::Pin<&mut Self>,
2230        cx: &mut std::task::Context<'_>,
2231    ) -> std::task::Poll<Option<Self::Item>> {
2232        let this = &mut *self;
2233        if this.inner.check_shutdown(cx) {
2234            this.is_terminated = true;
2235            return std::task::Poll::Ready(None);
2236        }
2237        if this.is_terminated {
2238            panic!("polled DriverNotifierRequestStream after completion");
2239        }
2240        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2241            |bytes, handles| {
2242                match this.inner.channel().read_etc(cx, bytes, handles) {
2243                    std::task::Poll::Ready(Ok(())) => {}
2244                    std::task::Poll::Pending => return std::task::Poll::Pending,
2245                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2246                        this.is_terminated = true;
2247                        return std::task::Poll::Ready(None);
2248                    }
2249                    std::task::Poll::Ready(Err(e)) => {
2250                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2251                            e.into(),
2252                        ))))
2253                    }
2254                }
2255
2256                // A message has been received from the channel
2257                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2258
2259                std::task::Poll::Ready(Some(match header.ordinal {
2260                    0x1642ffd065b6b48e => {
2261                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2262                        let mut req = fidl::new_empty!(
2263                            fidl::encoding::EmptyPayload,
2264                            fidl::encoding::DefaultFuchsiaResourceDialect
2265                        );
2266                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2267                        let control_handle =
2268                            DriverNotifierControlHandle { inner: this.inner.clone() };
2269                        Ok(DriverNotifierRequest::NewDriverAvailable { control_handle })
2270                    }
2271                    _ => Err(fidl::Error::UnknownOrdinal {
2272                        ordinal: header.ordinal,
2273                        protocol_name:
2274                            <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2275                    }),
2276                }))
2277            },
2278        )
2279    }
2280}
2281
2282/// This is served by the driver manager for the driver index to use to notify it of new
2283/// drivers that are available on the driver index.
2284///
2285/// We are making this a separate protocol so that the DriverIndex protocol can be marked as
2286/// delivery: on_readable. This way no matter what protocol caused the index to wake up, we can
2287/// send notifications to the driver manager.
2288#[derive(Debug)]
2289pub enum DriverNotifierRequest {
2290    /// One-way method called from the driver index to the driver manager to notify it of
2291    /// new drivers.
2292    NewDriverAvailable { control_handle: DriverNotifierControlHandle },
2293}
2294
2295impl DriverNotifierRequest {
2296    #[allow(irrefutable_let_patterns)]
2297    pub fn into_new_driver_available(self) -> Option<(DriverNotifierControlHandle)> {
2298        if let DriverNotifierRequest::NewDriverAvailable { control_handle } = self {
2299            Some((control_handle))
2300        } else {
2301            None
2302        }
2303    }
2304
2305    /// Name of the method defined in FIDL
2306    pub fn method_name(&self) -> &'static str {
2307        match *self {
2308            DriverNotifierRequest::NewDriverAvailable { .. } => "new_driver_available",
2309        }
2310    }
2311}
2312
2313#[derive(Debug, Clone)]
2314pub struct DriverNotifierControlHandle {
2315    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2316}
2317
2318impl fidl::endpoints::ControlHandle for DriverNotifierControlHandle {
2319    fn shutdown(&self) {
2320        self.inner.shutdown()
2321    }
2322    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2323        self.inner.shutdown_with_epitaph(status)
2324    }
2325
2326    fn is_closed(&self) -> bool {
2327        self.inner.channel().is_closed()
2328    }
2329    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2330        self.inner.channel().on_closed()
2331    }
2332
2333    #[cfg(target_os = "fuchsia")]
2334    fn signal_peer(
2335        &self,
2336        clear_mask: zx::Signals,
2337        set_mask: zx::Signals,
2338    ) -> Result<(), zx_status::Status> {
2339        use fidl::Peered;
2340        self.inner.channel().signal_peer(clear_mask, set_mask)
2341    }
2342}
2343
2344impl DriverNotifierControlHandle {}
2345
2346mod internal {
2347    use super::*;
2348
2349    impl fidl::encoding::ResourceTypeMarker for DevelopmentManagerGetCompositeNodeSpecsRequest {
2350        type Borrowed<'a> = &'a mut Self;
2351        fn take_or_borrow<'a>(
2352            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2353        ) -> Self::Borrowed<'a> {
2354            value
2355        }
2356    }
2357
2358    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerGetCompositeNodeSpecsRequest {
2359        type Owned = Self;
2360
2361        #[inline(always)]
2362        fn inline_align(_context: fidl::encoding::Context) -> usize {
2363            8
2364        }
2365
2366        #[inline(always)]
2367        fn inline_size(_context: fidl::encoding::Context) -> usize {
2368            24
2369        }
2370    }
2371
2372    unsafe impl
2373        fidl::encoding::Encode<
2374            DevelopmentManagerGetCompositeNodeSpecsRequest,
2375            fidl::encoding::DefaultFuchsiaResourceDialect,
2376        > for &mut DevelopmentManagerGetCompositeNodeSpecsRequest
2377    {
2378        #[inline]
2379        unsafe fn encode(
2380            self,
2381            encoder: &mut fidl::encoding::Encoder<
2382                '_,
2383                fidl::encoding::DefaultFuchsiaResourceDialect,
2384            >,
2385            offset: usize,
2386            _depth: fidl::encoding::Depth,
2387        ) -> fidl::Result<()> {
2388            encoder.debug_check_bounds::<DevelopmentManagerGetCompositeNodeSpecsRequest>(offset);
2389            // Delegate to tuple encoding.
2390            fidl::encoding::Encode::<DevelopmentManagerGetCompositeNodeSpecsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2391                (
2392                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name_filter),
2393                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2394                ),
2395                encoder, offset, _depth
2396            )
2397        }
2398    }
2399    unsafe impl<
2400            T0: fidl::encoding::Encode<
2401                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2402                fidl::encoding::DefaultFuchsiaResourceDialect,
2403            >,
2404            T1: fidl::encoding::Encode<
2405                fidl::encoding::Endpoint<
2406                    fidl::endpoints::ServerEnd<
2407                        fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
2408                    >,
2409                >,
2410                fidl::encoding::DefaultFuchsiaResourceDialect,
2411            >,
2412        >
2413        fidl::encoding::Encode<
2414            DevelopmentManagerGetCompositeNodeSpecsRequest,
2415            fidl::encoding::DefaultFuchsiaResourceDialect,
2416        > for (T0, T1)
2417    {
2418        #[inline]
2419        unsafe fn encode(
2420            self,
2421            encoder: &mut fidl::encoding::Encoder<
2422                '_,
2423                fidl::encoding::DefaultFuchsiaResourceDialect,
2424            >,
2425            offset: usize,
2426            depth: fidl::encoding::Depth,
2427        ) -> fidl::Result<()> {
2428            encoder.debug_check_bounds::<DevelopmentManagerGetCompositeNodeSpecsRequest>(offset);
2429            // Zero out padding regions. There's no need to apply masks
2430            // because the unmasked parts will be overwritten by fields.
2431            unsafe {
2432                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2433                (ptr as *mut u64).write_unaligned(0);
2434            }
2435            // Write the fields.
2436            self.0.encode(encoder, offset + 0, depth)?;
2437            self.1.encode(encoder, offset + 16, depth)?;
2438            Ok(())
2439        }
2440    }
2441
2442    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2443        for DevelopmentManagerGetCompositeNodeSpecsRequest
2444    {
2445        #[inline(always)]
2446        fn new_empty() -> Self {
2447            Self {
2448                name_filter: fidl::new_empty!(
2449                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2450                    fidl::encoding::DefaultFuchsiaResourceDialect
2451                ),
2452                iterator: fidl::new_empty!(
2453                    fidl::encoding::Endpoint<
2454                        fidl::endpoints::ServerEnd<
2455                            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
2456                        >,
2457                    >,
2458                    fidl::encoding::DefaultFuchsiaResourceDialect
2459                ),
2460            }
2461        }
2462
2463        #[inline]
2464        unsafe fn decode(
2465            &mut self,
2466            decoder: &mut fidl::encoding::Decoder<
2467                '_,
2468                fidl::encoding::DefaultFuchsiaResourceDialect,
2469            >,
2470            offset: usize,
2471            _depth: fidl::encoding::Depth,
2472        ) -> fidl::Result<()> {
2473            decoder.debug_check_bounds::<Self>(offset);
2474            // Verify that padding bytes are zero.
2475            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2476            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2477            let mask = 0xffffffff00000000u64;
2478            let maskedval = padval & mask;
2479            if maskedval != 0 {
2480                return Err(fidl::Error::NonZeroPadding {
2481                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2482                });
2483            }
2484            fidl::decode!(
2485                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2486                fidl::encoding::DefaultFuchsiaResourceDialect,
2487                &mut self.name_filter,
2488                decoder,
2489                offset + 0,
2490                _depth
2491            )?;
2492            fidl::decode!(
2493                fidl::encoding::Endpoint<
2494                    fidl::endpoints::ServerEnd<
2495                        fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
2496                    >,
2497                >,
2498                fidl::encoding::DefaultFuchsiaResourceDialect,
2499                &mut self.iterator,
2500                decoder,
2501                offset + 16,
2502                _depth
2503            )?;
2504            Ok(())
2505        }
2506    }
2507
2508    impl fidl::encoding::ResourceTypeMarker for DevelopmentManagerGetDriverInfoRequest {
2509        type Borrowed<'a> = &'a mut Self;
2510        fn take_or_borrow<'a>(
2511            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2512        ) -> Self::Borrowed<'a> {
2513            value
2514        }
2515    }
2516
2517    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerGetDriverInfoRequest {
2518        type Owned = Self;
2519
2520        #[inline(always)]
2521        fn inline_align(_context: fidl::encoding::Context) -> usize {
2522            8
2523        }
2524
2525        #[inline(always)]
2526        fn inline_size(_context: fidl::encoding::Context) -> usize {
2527            24
2528        }
2529    }
2530
2531    unsafe impl
2532        fidl::encoding::Encode<
2533            DevelopmentManagerGetDriverInfoRequest,
2534            fidl::encoding::DefaultFuchsiaResourceDialect,
2535        > for &mut DevelopmentManagerGetDriverInfoRequest
2536    {
2537        #[inline]
2538        unsafe fn encode(
2539            self,
2540            encoder: &mut fidl::encoding::Encoder<
2541                '_,
2542                fidl::encoding::DefaultFuchsiaResourceDialect,
2543            >,
2544            offset: usize,
2545            _depth: fidl::encoding::Depth,
2546        ) -> fidl::Result<()> {
2547            encoder.debug_check_bounds::<DevelopmentManagerGetDriverInfoRequest>(offset);
2548            // Delegate to tuple encoding.
2549            fidl::encoding::Encode::<DevelopmentManagerGetDriverInfoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2550                (
2551                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_filter),
2552                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2553                ),
2554                encoder, offset, _depth
2555            )
2556        }
2557    }
2558    unsafe impl<
2559            T0: fidl::encoding::Encode<
2560                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2561                fidl::encoding::DefaultFuchsiaResourceDialect,
2562            >,
2563            T1: fidl::encoding::Encode<
2564                fidl::encoding::Endpoint<
2565                    fidl::endpoints::ServerEnd<
2566                        fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
2567                    >,
2568                >,
2569                fidl::encoding::DefaultFuchsiaResourceDialect,
2570            >,
2571        >
2572        fidl::encoding::Encode<
2573            DevelopmentManagerGetDriverInfoRequest,
2574            fidl::encoding::DefaultFuchsiaResourceDialect,
2575        > for (T0, T1)
2576    {
2577        #[inline]
2578        unsafe fn encode(
2579            self,
2580            encoder: &mut fidl::encoding::Encoder<
2581                '_,
2582                fidl::encoding::DefaultFuchsiaResourceDialect,
2583            >,
2584            offset: usize,
2585            depth: fidl::encoding::Depth,
2586        ) -> fidl::Result<()> {
2587            encoder.debug_check_bounds::<DevelopmentManagerGetDriverInfoRequest>(offset);
2588            // Zero out padding regions. There's no need to apply masks
2589            // because the unmasked parts will be overwritten by fields.
2590            unsafe {
2591                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2592                (ptr as *mut u64).write_unaligned(0);
2593            }
2594            // Write the fields.
2595            self.0.encode(encoder, offset + 0, depth)?;
2596            self.1.encode(encoder, offset + 16, depth)?;
2597            Ok(())
2598        }
2599    }
2600
2601    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2602        for DevelopmentManagerGetDriverInfoRequest
2603    {
2604        #[inline(always)]
2605        fn new_empty() -> Self {
2606            Self {
2607                driver_filter: fidl::new_empty!(
2608                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2609                    fidl::encoding::DefaultFuchsiaResourceDialect
2610                ),
2611                iterator: fidl::new_empty!(
2612                    fidl::encoding::Endpoint<
2613                        fidl::endpoints::ServerEnd<
2614                            fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
2615                        >,
2616                    >,
2617                    fidl::encoding::DefaultFuchsiaResourceDialect
2618                ),
2619            }
2620        }
2621
2622        #[inline]
2623        unsafe fn decode(
2624            &mut self,
2625            decoder: &mut fidl::encoding::Decoder<
2626                '_,
2627                fidl::encoding::DefaultFuchsiaResourceDialect,
2628            >,
2629            offset: usize,
2630            _depth: fidl::encoding::Depth,
2631        ) -> fidl::Result<()> {
2632            decoder.debug_check_bounds::<Self>(offset);
2633            // Verify that padding bytes are zero.
2634            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2635            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2636            let mask = 0xffffffff00000000u64;
2637            let maskedval = padval & mask;
2638            if maskedval != 0 {
2639                return Err(fidl::Error::NonZeroPadding {
2640                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2641                });
2642            }
2643            fidl::decode!(
2644                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2645                fidl::encoding::DefaultFuchsiaResourceDialect,
2646                &mut self.driver_filter,
2647                decoder,
2648                offset + 0,
2649                _depth
2650            )?;
2651            fidl::decode!(
2652                fidl::encoding::Endpoint<
2653                    fidl::endpoints::ServerEnd<
2654                        fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
2655                    >,
2656                >,
2657                fidl::encoding::DefaultFuchsiaResourceDialect,
2658                &mut self.iterator,
2659                decoder,
2660                offset + 16,
2661                _depth
2662            )?;
2663            Ok(())
2664        }
2665    }
2666
2667    impl fidl::encoding::ResourceTypeMarker for DriverIndexSetNotifierRequest {
2668        type Borrowed<'a> = &'a mut Self;
2669        fn take_or_borrow<'a>(
2670            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2671        ) -> Self::Borrowed<'a> {
2672            value
2673        }
2674    }
2675
2676    unsafe impl fidl::encoding::TypeMarker for DriverIndexSetNotifierRequest {
2677        type Owned = Self;
2678
2679        #[inline(always)]
2680        fn inline_align(_context: fidl::encoding::Context) -> usize {
2681            4
2682        }
2683
2684        #[inline(always)]
2685        fn inline_size(_context: fidl::encoding::Context) -> usize {
2686            4
2687        }
2688    }
2689
2690    unsafe impl
2691        fidl::encoding::Encode<
2692            DriverIndexSetNotifierRequest,
2693            fidl::encoding::DefaultFuchsiaResourceDialect,
2694        > for &mut DriverIndexSetNotifierRequest
2695    {
2696        #[inline]
2697        unsafe fn encode(
2698            self,
2699            encoder: &mut fidl::encoding::Encoder<
2700                '_,
2701                fidl::encoding::DefaultFuchsiaResourceDialect,
2702            >,
2703            offset: usize,
2704            _depth: fidl::encoding::Depth,
2705        ) -> fidl::Result<()> {
2706            encoder.debug_check_bounds::<DriverIndexSetNotifierRequest>(offset);
2707            // Delegate to tuple encoding.
2708            fidl::encoding::Encode::<DriverIndexSetNotifierRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2709                (
2710                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.notifier),
2711                ),
2712                encoder, offset, _depth
2713            )
2714        }
2715    }
2716    unsafe impl<
2717            T0: fidl::encoding::Encode<
2718                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
2719                fidl::encoding::DefaultFuchsiaResourceDialect,
2720            >,
2721        >
2722        fidl::encoding::Encode<
2723            DriverIndexSetNotifierRequest,
2724            fidl::encoding::DefaultFuchsiaResourceDialect,
2725        > for (T0,)
2726    {
2727        #[inline]
2728        unsafe fn encode(
2729            self,
2730            encoder: &mut fidl::encoding::Encoder<
2731                '_,
2732                fidl::encoding::DefaultFuchsiaResourceDialect,
2733            >,
2734            offset: usize,
2735            depth: fidl::encoding::Depth,
2736        ) -> fidl::Result<()> {
2737            encoder.debug_check_bounds::<DriverIndexSetNotifierRequest>(offset);
2738            // Zero out padding regions. There's no need to apply masks
2739            // because the unmasked parts will be overwritten by fields.
2740            // Write the fields.
2741            self.0.encode(encoder, offset + 0, depth)?;
2742            Ok(())
2743        }
2744    }
2745
2746    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2747        for DriverIndexSetNotifierRequest
2748    {
2749        #[inline(always)]
2750        fn new_empty() -> Self {
2751            Self {
2752                notifier: fidl::new_empty!(
2753                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
2754                    fidl::encoding::DefaultFuchsiaResourceDialect
2755                ),
2756            }
2757        }
2758
2759        #[inline]
2760        unsafe fn decode(
2761            &mut self,
2762            decoder: &mut fidl::encoding::Decoder<
2763                '_,
2764                fidl::encoding::DefaultFuchsiaResourceDialect,
2765            >,
2766            offset: usize,
2767            _depth: fidl::encoding::Depth,
2768        ) -> fidl::Result<()> {
2769            decoder.debug_check_bounds::<Self>(offset);
2770            // Verify that padding bytes are zero.
2771            fidl::decode!(
2772                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
2773                fidl::encoding::DefaultFuchsiaResourceDialect,
2774                &mut self.notifier,
2775                decoder,
2776                offset + 0,
2777                _depth
2778            )?;
2779            Ok(())
2780        }
2781    }
2782}