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::NullableHandle {
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
896    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
897        self.inner.shutdown_with_epitaph(status)
898    }
899
900    fn is_closed(&self) -> bool {
901        self.inner.channel().is_closed()
902    }
903    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
904        self.inner.channel().on_closed()
905    }
906
907    #[cfg(target_os = "fuchsia")]
908    fn signal_peer(
909        &self,
910        clear_mask: zx::Signals,
911        set_mask: zx::Signals,
912    ) -> Result<(), zx_status::Status> {
913        use fidl::Peered;
914        self.inner.channel().signal_peer(clear_mask, set_mask)
915    }
916}
917
918impl DevelopmentManagerControlHandle {}
919
920#[must_use = "FIDL methods require a response to be sent"]
921#[derive(Debug)]
922pub struct DevelopmentManagerDisableDriverResponder {
923    control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
924    tx_id: u32,
925}
926
927/// Set the the channel to be shutdown (see [`DevelopmentManagerControlHandle::shutdown`])
928/// if the responder is dropped without sending a response, so that the client
929/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
930impl std::ops::Drop for DevelopmentManagerDisableDriverResponder {
931    fn drop(&mut self) {
932        self.control_handle.shutdown();
933        // Safety: drops once, never accessed again
934        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
935    }
936}
937
938impl fidl::endpoints::Responder for DevelopmentManagerDisableDriverResponder {
939    type ControlHandle = DevelopmentManagerControlHandle;
940
941    fn control_handle(&self) -> &DevelopmentManagerControlHandle {
942        &self.control_handle
943    }
944
945    fn drop_without_shutdown(mut self) {
946        // Safety: drops once, never accessed again due to mem::forget
947        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
948        // Prevent Drop from running (which would shut down the channel)
949        std::mem::forget(self);
950    }
951}
952
953impl DevelopmentManagerDisableDriverResponder {
954    /// Sends a response to the FIDL transaction.
955    ///
956    /// Sets the channel to shutdown if an error occurs.
957    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
958        let _result = self.send_raw(result);
959        if _result.is_err() {
960            self.control_handle.shutdown();
961        }
962        self.drop_without_shutdown();
963        _result
964    }
965
966    /// Similar to "send" but does not shutdown the channel if an error occurs.
967    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
968        let _result = self.send_raw(result);
969        self.drop_without_shutdown();
970        _result
971    }
972
973    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
974        self.control_handle
975            .inner
976            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
977                result,
978                self.tx_id,
979                0x7a9043fc2acabf77,
980                fidl::encoding::DynamicFlags::empty(),
981            )
982    }
983}
984
985#[must_use = "FIDL methods require a response to be sent"]
986#[derive(Debug)]
987pub struct DevelopmentManagerEnableDriverResponder {
988    control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
989    tx_id: u32,
990}
991
992/// Set the the channel to be shutdown (see [`DevelopmentManagerControlHandle::shutdown`])
993/// if the responder is dropped without sending a response, so that the client
994/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
995impl std::ops::Drop for DevelopmentManagerEnableDriverResponder {
996    fn drop(&mut self) {
997        self.control_handle.shutdown();
998        // Safety: drops once, never accessed again
999        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1000    }
1001}
1002
1003impl fidl::endpoints::Responder for DevelopmentManagerEnableDriverResponder {
1004    type ControlHandle = DevelopmentManagerControlHandle;
1005
1006    fn control_handle(&self) -> &DevelopmentManagerControlHandle {
1007        &self.control_handle
1008    }
1009
1010    fn drop_without_shutdown(mut self) {
1011        // Safety: drops once, never accessed again due to mem::forget
1012        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1013        // Prevent Drop from running (which would shut down the channel)
1014        std::mem::forget(self);
1015    }
1016}
1017
1018impl DevelopmentManagerEnableDriverResponder {
1019    /// Sends a response to the FIDL transaction.
1020    ///
1021    /// Sets the channel to shutdown if an error occurs.
1022    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1023        let _result = self.send_raw(result);
1024        if _result.is_err() {
1025            self.control_handle.shutdown();
1026        }
1027        self.drop_without_shutdown();
1028        _result
1029    }
1030
1031    /// Similar to "send" but does not shutdown the channel if an error occurs.
1032    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1033        let _result = self.send_raw(result);
1034        self.drop_without_shutdown();
1035        _result
1036    }
1037
1038    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1039        self.control_handle
1040            .inner
1041            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1042                result,
1043                self.tx_id,
1044                0x4abba8d322e671d9,
1045                fidl::encoding::DynamicFlags::empty(),
1046            )
1047    }
1048}
1049
1050#[must_use = "FIDL methods require a response to be sent"]
1051#[derive(Debug)]
1052pub struct DevelopmentManagerRebindCompositesWithDriverResponder {
1053    control_handle: std::mem::ManuallyDrop<DevelopmentManagerControlHandle>,
1054    tx_id: u32,
1055}
1056
1057/// Set the the channel to be shutdown (see [`DevelopmentManagerControlHandle::shutdown`])
1058/// if the responder is dropped without sending a response, so that the client
1059/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1060impl std::ops::Drop for DevelopmentManagerRebindCompositesWithDriverResponder {
1061    fn drop(&mut self) {
1062        self.control_handle.shutdown();
1063        // Safety: drops once, never accessed again
1064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1065    }
1066}
1067
1068impl fidl::endpoints::Responder for DevelopmentManagerRebindCompositesWithDriverResponder {
1069    type ControlHandle = DevelopmentManagerControlHandle;
1070
1071    fn control_handle(&self) -> &DevelopmentManagerControlHandle {
1072        &self.control_handle
1073    }
1074
1075    fn drop_without_shutdown(mut self) {
1076        // Safety: drops once, never accessed again due to mem::forget
1077        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1078        // Prevent Drop from running (which would shut down the channel)
1079        std::mem::forget(self);
1080    }
1081}
1082
1083impl DevelopmentManagerRebindCompositesWithDriverResponder {
1084    /// Sends a response to the FIDL transaction.
1085    ///
1086    /// Sets the channel to shutdown if an error occurs.
1087    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1088        let _result = self.send_raw(result);
1089        if _result.is_err() {
1090            self.control_handle.shutdown();
1091        }
1092        self.drop_without_shutdown();
1093        _result
1094    }
1095
1096    /// Similar to "send" but does not shutdown the channel if an error occurs.
1097    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1098        let _result = self.send_raw(result);
1099        self.drop_without_shutdown();
1100        _result
1101    }
1102
1103    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1104        self.control_handle
1105            .inner
1106            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1107                result,
1108                self.tx_id,
1109                0x1da137c4f10d053c,
1110                fidl::encoding::DynamicFlags::empty(),
1111            )
1112    }
1113}
1114
1115#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1116pub struct DriverIndexMarker;
1117
1118impl fidl::endpoints::ProtocolMarker for DriverIndexMarker {
1119    type Proxy = DriverIndexProxy;
1120    type RequestStream = DriverIndexRequestStream;
1121    #[cfg(target_os = "fuchsia")]
1122    type SynchronousProxy = DriverIndexSynchronousProxy;
1123
1124    const DEBUG_NAME: &'static str = "fuchsia.driver.index.DriverIndex";
1125}
1126impl fidl::endpoints::DiscoverableProtocolMarker for DriverIndexMarker {}
1127pub type DriverIndexMatchDriverResult = Result<MatchDriverResult, i32>;
1128pub type DriverIndexAddCompositeNodeSpecResult = Result<(), i32>;
1129pub type DriverIndexRebindCompositeNodeSpecResult = Result<(), i32>;
1130
1131pub trait DriverIndexProxyInterface: Send + Sync {
1132    type MatchDriverResponseFut: std::future::Future<Output = Result<DriverIndexMatchDriverResult, fidl::Error>>
1133        + Send;
1134    fn r#match_driver(&self, args: &MatchDriverArgs) -> Self::MatchDriverResponseFut;
1135    type AddCompositeNodeSpecResponseFut: std::future::Future<Output = Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error>>
1136        + Send;
1137    fn r#add_composite_node_spec(
1138        &self,
1139        payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1140    ) -> Self::AddCompositeNodeSpecResponseFut;
1141    type RebindCompositeNodeSpecResponseFut: std::future::Future<Output = Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error>>
1142        + Send;
1143    fn r#rebind_composite_node_spec(
1144        &self,
1145        spec: &str,
1146        driver_url_suffix: Option<&str>,
1147    ) -> Self::RebindCompositeNodeSpecResponseFut;
1148    fn r#set_notifier(
1149        &self,
1150        notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1151    ) -> Result<(), fidl::Error>;
1152}
1153#[derive(Debug)]
1154#[cfg(target_os = "fuchsia")]
1155pub struct DriverIndexSynchronousProxy {
1156    client: fidl::client::sync::Client,
1157}
1158
1159#[cfg(target_os = "fuchsia")]
1160impl fidl::endpoints::SynchronousProxy for DriverIndexSynchronousProxy {
1161    type Proxy = DriverIndexProxy;
1162    type Protocol = DriverIndexMarker;
1163
1164    fn from_channel(inner: fidl::Channel) -> Self {
1165        Self::new(inner)
1166    }
1167
1168    fn into_channel(self) -> fidl::Channel {
1169        self.client.into_channel()
1170    }
1171
1172    fn as_channel(&self) -> &fidl::Channel {
1173        self.client.as_channel()
1174    }
1175}
1176
1177#[cfg(target_os = "fuchsia")]
1178impl DriverIndexSynchronousProxy {
1179    pub fn new(channel: fidl::Channel) -> Self {
1180        let protocol_name = <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1181        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1182    }
1183
1184    pub fn into_channel(self) -> fidl::Channel {
1185        self.client.into_channel()
1186    }
1187
1188    /// Waits until an event arrives and returns it. It is safe for other
1189    /// threads to make concurrent requests while waiting for an event.
1190    pub fn wait_for_event(
1191        &self,
1192        deadline: zx::MonotonicInstant,
1193    ) -> Result<DriverIndexEvent, fidl::Error> {
1194        DriverIndexEvent::decode(self.client.wait_for_event(deadline)?)
1195    }
1196
1197    /// Match a set of device arguments to a driver package URL.
1198    pub fn r#match_driver(
1199        &self,
1200        mut args: &MatchDriverArgs,
1201        ___deadline: zx::MonotonicInstant,
1202    ) -> Result<DriverIndexMatchDriverResult, fidl::Error> {
1203        let _response = self.client.send_query::<
1204            DriverIndexMatchDriverRequest,
1205            fidl::encoding::ResultType<MatchDriverResult, i32>,
1206        >(
1207            (args,),
1208            0x38317894f6269541,
1209            fidl::encoding::DynamicFlags::empty(),
1210            ___deadline,
1211        )?;
1212        Ok(_response.map(|x| x))
1213    }
1214
1215    /// Adds a composite node spec to the driver index. The driver index stores the
1216    /// composite node spec and maps it by the name. The stored composite node specs are
1217    /// included in the driver matching process.
1218    pub fn r#add_composite_node_spec(
1219        &self,
1220        mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1221        ___deadline: zx::MonotonicInstant,
1222    ) -> Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error> {
1223        let _response = self.client.send_query::<
1224            fidl_fuchsia_driver_framework::CompositeNodeSpec,
1225            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1226        >(
1227            payload,
1228            0x66d25a18fa46a2a2,
1229            fidl::encoding::DynamicFlags::empty(),
1230            ___deadline,
1231        )?;
1232        Ok(_response.map(|x| x))
1233    }
1234
1235    /// Rematch the composite node spec to a composite driver. If a driver url suffix is
1236    /// provided, the composite node spec will only be matched against drivers with URLS that
1237    /// end with the suffix.
1238    pub fn r#rebind_composite_node_spec(
1239        &self,
1240        mut spec: &str,
1241        mut driver_url_suffix: Option<&str>,
1242        ___deadline: zx::MonotonicInstant,
1243    ) -> Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error> {
1244        let _response = self.client.send_query::<
1245            DriverIndexRebindCompositeNodeSpecRequest,
1246            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1247        >(
1248            (spec, driver_url_suffix,),
1249            0x6667ac8de58b202a,
1250            fidl::encoding::DynamicFlags::empty(),
1251            ___deadline,
1252        )?;
1253        Ok(_response.map(|x| x))
1254    }
1255
1256    /// Sets the DriverNotifier which is used for reverse communication.
1257    pub fn r#set_notifier(
1258        &self,
1259        mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1260    ) -> Result<(), fidl::Error> {
1261        self.client.send::<DriverIndexSetNotifierRequest>(
1262            (notifier,),
1263            0x1dfdede9fcdab511,
1264            fidl::encoding::DynamicFlags::empty(),
1265        )
1266    }
1267}
1268
1269#[cfg(target_os = "fuchsia")]
1270impl From<DriverIndexSynchronousProxy> for zx::NullableHandle {
1271    fn from(value: DriverIndexSynchronousProxy) -> Self {
1272        value.into_channel().into()
1273    }
1274}
1275
1276#[cfg(target_os = "fuchsia")]
1277impl From<fidl::Channel> for DriverIndexSynchronousProxy {
1278    fn from(value: fidl::Channel) -> Self {
1279        Self::new(value)
1280    }
1281}
1282
1283#[cfg(target_os = "fuchsia")]
1284impl fidl::endpoints::FromClient for DriverIndexSynchronousProxy {
1285    type Protocol = DriverIndexMarker;
1286
1287    fn from_client(value: fidl::endpoints::ClientEnd<DriverIndexMarker>) -> Self {
1288        Self::new(value.into_channel())
1289    }
1290}
1291
1292#[derive(Debug, Clone)]
1293pub struct DriverIndexProxy {
1294    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1295}
1296
1297impl fidl::endpoints::Proxy for DriverIndexProxy {
1298    type Protocol = DriverIndexMarker;
1299
1300    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1301        Self::new(inner)
1302    }
1303
1304    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1305        self.client.into_channel().map_err(|client| Self { client })
1306    }
1307
1308    fn as_channel(&self) -> &::fidl::AsyncChannel {
1309        self.client.as_channel()
1310    }
1311}
1312
1313impl DriverIndexProxy {
1314    /// Create a new Proxy for fuchsia.driver.index/DriverIndex.
1315    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1316        let protocol_name = <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1317        Self { client: fidl::client::Client::new(channel, protocol_name) }
1318    }
1319
1320    /// Get a Stream of events from the remote end of the protocol.
1321    ///
1322    /// # Panics
1323    ///
1324    /// Panics if the event stream was already taken.
1325    pub fn take_event_stream(&self) -> DriverIndexEventStream {
1326        DriverIndexEventStream { event_receiver: self.client.take_event_receiver() }
1327    }
1328
1329    /// Match a set of device arguments to a driver package URL.
1330    pub fn r#match_driver(
1331        &self,
1332        mut args: &MatchDriverArgs,
1333    ) -> fidl::client::QueryResponseFut<
1334        DriverIndexMatchDriverResult,
1335        fidl::encoding::DefaultFuchsiaResourceDialect,
1336    > {
1337        DriverIndexProxyInterface::r#match_driver(self, args)
1338    }
1339
1340    /// Adds a composite node spec to the driver index. The driver index stores the
1341    /// composite node spec and maps it by the name. The stored composite node specs are
1342    /// included in the driver matching process.
1343    pub fn r#add_composite_node_spec(
1344        &self,
1345        mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1346    ) -> fidl::client::QueryResponseFut<
1347        DriverIndexAddCompositeNodeSpecResult,
1348        fidl::encoding::DefaultFuchsiaResourceDialect,
1349    > {
1350        DriverIndexProxyInterface::r#add_composite_node_spec(self, payload)
1351    }
1352
1353    /// Rematch the composite node spec to a composite driver. If a driver url suffix is
1354    /// provided, the composite node spec will only be matched against drivers with URLS that
1355    /// end with the suffix.
1356    pub fn r#rebind_composite_node_spec(
1357        &self,
1358        mut spec: &str,
1359        mut driver_url_suffix: Option<&str>,
1360    ) -> fidl::client::QueryResponseFut<
1361        DriverIndexRebindCompositeNodeSpecResult,
1362        fidl::encoding::DefaultFuchsiaResourceDialect,
1363    > {
1364        DriverIndexProxyInterface::r#rebind_composite_node_spec(self, spec, driver_url_suffix)
1365    }
1366
1367    /// Sets the DriverNotifier which is used for reverse communication.
1368    pub fn r#set_notifier(
1369        &self,
1370        mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1371    ) -> Result<(), fidl::Error> {
1372        DriverIndexProxyInterface::r#set_notifier(self, notifier)
1373    }
1374}
1375
1376impl DriverIndexProxyInterface for DriverIndexProxy {
1377    type MatchDriverResponseFut = fidl::client::QueryResponseFut<
1378        DriverIndexMatchDriverResult,
1379        fidl::encoding::DefaultFuchsiaResourceDialect,
1380    >;
1381    fn r#match_driver(&self, mut args: &MatchDriverArgs) -> Self::MatchDriverResponseFut {
1382        fn _decode(
1383            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1384        ) -> Result<DriverIndexMatchDriverResult, fidl::Error> {
1385            let _response = fidl::client::decode_transaction_body::<
1386                fidl::encoding::ResultType<MatchDriverResult, i32>,
1387                fidl::encoding::DefaultFuchsiaResourceDialect,
1388                0x38317894f6269541,
1389            >(_buf?)?;
1390            Ok(_response.map(|x| x))
1391        }
1392        self.client
1393            .send_query_and_decode::<DriverIndexMatchDriverRequest, DriverIndexMatchDriverResult>(
1394                (args,),
1395                0x38317894f6269541,
1396                fidl::encoding::DynamicFlags::empty(),
1397                _decode,
1398            )
1399    }
1400
1401    type AddCompositeNodeSpecResponseFut = fidl::client::QueryResponseFut<
1402        DriverIndexAddCompositeNodeSpecResult,
1403        fidl::encoding::DefaultFuchsiaResourceDialect,
1404    >;
1405    fn r#add_composite_node_spec(
1406        &self,
1407        mut payload: &fidl_fuchsia_driver_framework::CompositeNodeSpec,
1408    ) -> Self::AddCompositeNodeSpecResponseFut {
1409        fn _decode(
1410            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1411        ) -> Result<DriverIndexAddCompositeNodeSpecResult, fidl::Error> {
1412            let _response = fidl::client::decode_transaction_body::<
1413                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1414                fidl::encoding::DefaultFuchsiaResourceDialect,
1415                0x66d25a18fa46a2a2,
1416            >(_buf?)?;
1417            Ok(_response.map(|x| x))
1418        }
1419        self.client.send_query_and_decode::<
1420            fidl_fuchsia_driver_framework::CompositeNodeSpec,
1421            DriverIndexAddCompositeNodeSpecResult,
1422        >(
1423            payload,
1424            0x66d25a18fa46a2a2,
1425            fidl::encoding::DynamicFlags::empty(),
1426            _decode,
1427        )
1428    }
1429
1430    type RebindCompositeNodeSpecResponseFut = fidl::client::QueryResponseFut<
1431        DriverIndexRebindCompositeNodeSpecResult,
1432        fidl::encoding::DefaultFuchsiaResourceDialect,
1433    >;
1434    fn r#rebind_composite_node_spec(
1435        &self,
1436        mut spec: &str,
1437        mut driver_url_suffix: Option<&str>,
1438    ) -> Self::RebindCompositeNodeSpecResponseFut {
1439        fn _decode(
1440            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1441        ) -> Result<DriverIndexRebindCompositeNodeSpecResult, fidl::Error> {
1442            let _response = fidl::client::decode_transaction_body::<
1443                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1444                fidl::encoding::DefaultFuchsiaResourceDialect,
1445                0x6667ac8de58b202a,
1446            >(_buf?)?;
1447            Ok(_response.map(|x| x))
1448        }
1449        self.client.send_query_and_decode::<
1450            DriverIndexRebindCompositeNodeSpecRequest,
1451            DriverIndexRebindCompositeNodeSpecResult,
1452        >(
1453            (spec, driver_url_suffix,),
1454            0x6667ac8de58b202a,
1455            fidl::encoding::DynamicFlags::empty(),
1456            _decode,
1457        )
1458    }
1459
1460    fn r#set_notifier(
1461        &self,
1462        mut notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1463    ) -> Result<(), fidl::Error> {
1464        self.client.send::<DriverIndexSetNotifierRequest>(
1465            (notifier,),
1466            0x1dfdede9fcdab511,
1467            fidl::encoding::DynamicFlags::empty(),
1468        )
1469    }
1470}
1471
1472pub struct DriverIndexEventStream {
1473    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1474}
1475
1476impl std::marker::Unpin for DriverIndexEventStream {}
1477
1478impl futures::stream::FusedStream for DriverIndexEventStream {
1479    fn is_terminated(&self) -> bool {
1480        self.event_receiver.is_terminated()
1481    }
1482}
1483
1484impl futures::Stream for DriverIndexEventStream {
1485    type Item = Result<DriverIndexEvent, fidl::Error>;
1486
1487    fn poll_next(
1488        mut self: std::pin::Pin<&mut Self>,
1489        cx: &mut std::task::Context<'_>,
1490    ) -> std::task::Poll<Option<Self::Item>> {
1491        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1492            &mut self.event_receiver,
1493            cx
1494        )?) {
1495            Some(buf) => std::task::Poll::Ready(Some(DriverIndexEvent::decode(buf))),
1496            None => std::task::Poll::Ready(None),
1497        }
1498    }
1499}
1500
1501#[derive(Debug)]
1502pub enum DriverIndexEvent {}
1503
1504impl DriverIndexEvent {
1505    /// Decodes a message buffer as a [`DriverIndexEvent`].
1506    fn decode(
1507        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1508    ) -> Result<DriverIndexEvent, fidl::Error> {
1509        let (bytes, _handles) = buf.split_mut();
1510        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1511        debug_assert_eq!(tx_header.tx_id, 0);
1512        match tx_header.ordinal {
1513            _ => Err(fidl::Error::UnknownOrdinal {
1514                ordinal: tx_header.ordinal,
1515                protocol_name: <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1516            }),
1517        }
1518    }
1519}
1520
1521/// A Stream of incoming requests for fuchsia.driver.index/DriverIndex.
1522pub struct DriverIndexRequestStream {
1523    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1524    is_terminated: bool,
1525}
1526
1527impl std::marker::Unpin for DriverIndexRequestStream {}
1528
1529impl futures::stream::FusedStream for DriverIndexRequestStream {
1530    fn is_terminated(&self) -> bool {
1531        self.is_terminated
1532    }
1533}
1534
1535impl fidl::endpoints::RequestStream for DriverIndexRequestStream {
1536    type Protocol = DriverIndexMarker;
1537    type ControlHandle = DriverIndexControlHandle;
1538
1539    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1540        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1541    }
1542
1543    fn control_handle(&self) -> Self::ControlHandle {
1544        DriverIndexControlHandle { inner: self.inner.clone() }
1545    }
1546
1547    fn into_inner(
1548        self,
1549    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1550    {
1551        (self.inner, self.is_terminated)
1552    }
1553
1554    fn from_inner(
1555        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1556        is_terminated: bool,
1557    ) -> Self {
1558        Self { inner, is_terminated }
1559    }
1560}
1561
1562impl futures::Stream for DriverIndexRequestStream {
1563    type Item = Result<DriverIndexRequest, fidl::Error>;
1564
1565    fn poll_next(
1566        mut self: std::pin::Pin<&mut Self>,
1567        cx: &mut std::task::Context<'_>,
1568    ) -> std::task::Poll<Option<Self::Item>> {
1569        let this = &mut *self;
1570        if this.inner.check_shutdown(cx) {
1571            this.is_terminated = true;
1572            return std::task::Poll::Ready(None);
1573        }
1574        if this.is_terminated {
1575            panic!("polled DriverIndexRequestStream after completion");
1576        }
1577        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1578            |bytes, handles| {
1579                match this.inner.channel().read_etc(cx, bytes, handles) {
1580                    std::task::Poll::Ready(Ok(())) => {}
1581                    std::task::Poll::Pending => return std::task::Poll::Pending,
1582                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1583                        this.is_terminated = true;
1584                        return std::task::Poll::Ready(None);
1585                    }
1586                    std::task::Poll::Ready(Err(e)) => {
1587                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1588                            e.into(),
1589                        ))));
1590                    }
1591                }
1592
1593                // A message has been received from the channel
1594                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1595
1596                std::task::Poll::Ready(Some(match header.ordinal {
1597                    0x38317894f6269541 => {
1598                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1599                        let mut req = fidl::new_empty!(
1600                            DriverIndexMatchDriverRequest,
1601                            fidl::encoding::DefaultFuchsiaResourceDialect
1602                        );
1603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexMatchDriverRequest>(&header, _body_bytes, handles, &mut req)?;
1604                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1605                        Ok(DriverIndexRequest::MatchDriver {
1606                            args: req.args,
1607
1608                            responder: DriverIndexMatchDriverResponder {
1609                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1610                                tx_id: header.tx_id,
1611                            },
1612                        })
1613                    }
1614                    0x66d25a18fa46a2a2 => {
1615                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1616                        let mut req = fidl::new_empty!(
1617                            fidl_fuchsia_driver_framework::CompositeNodeSpec,
1618                            fidl::encoding::DefaultFuchsiaResourceDialect
1619                        );
1620                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_driver_framework::CompositeNodeSpec>(&header, _body_bytes, handles, &mut req)?;
1621                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1622                        Ok(DriverIndexRequest::AddCompositeNodeSpec {
1623                            payload: req,
1624                            responder: DriverIndexAddCompositeNodeSpecResponder {
1625                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1626                                tx_id: header.tx_id,
1627                            },
1628                        })
1629                    }
1630                    0x6667ac8de58b202a => {
1631                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1632                        let mut req = fidl::new_empty!(
1633                            DriverIndexRebindCompositeNodeSpecRequest,
1634                            fidl::encoding::DefaultFuchsiaResourceDialect
1635                        );
1636                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexRebindCompositeNodeSpecRequest>(&header, _body_bytes, handles, &mut req)?;
1637                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1638                        Ok(DriverIndexRequest::RebindCompositeNodeSpec {
1639                            spec: req.spec,
1640                            driver_url_suffix: req.driver_url_suffix,
1641
1642                            responder: DriverIndexRebindCompositeNodeSpecResponder {
1643                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1644                                tx_id: header.tx_id,
1645                            },
1646                        })
1647                    }
1648                    0x1dfdede9fcdab511 => {
1649                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1650                        let mut req = fidl::new_empty!(
1651                            DriverIndexSetNotifierRequest,
1652                            fidl::encoding::DefaultFuchsiaResourceDialect
1653                        );
1654                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverIndexSetNotifierRequest>(&header, _body_bytes, handles, &mut req)?;
1655                        let control_handle = DriverIndexControlHandle { inner: this.inner.clone() };
1656                        Ok(DriverIndexRequest::SetNotifier {
1657                            notifier: req.notifier,
1658
1659                            control_handle,
1660                        })
1661                    }
1662                    _ => Err(fidl::Error::UnknownOrdinal {
1663                        ordinal: header.ordinal,
1664                        protocol_name:
1665                            <DriverIndexMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1666                    }),
1667                }))
1668            },
1669        )
1670    }
1671}
1672
1673/// Protocol through which the driver index can be queried.
1674#[derive(Debug)]
1675pub enum DriverIndexRequest {
1676    /// Match a set of device arguments to a driver package URL.
1677    MatchDriver { args: MatchDriverArgs, responder: DriverIndexMatchDriverResponder },
1678    /// Adds a composite node spec to the driver index. The driver index stores the
1679    /// composite node spec and maps it by the name. The stored composite node specs are
1680    /// included in the driver matching process.
1681    AddCompositeNodeSpec {
1682        payload: fidl_fuchsia_driver_framework::CompositeNodeSpec,
1683        responder: DriverIndexAddCompositeNodeSpecResponder,
1684    },
1685    /// Rematch the composite node spec to a composite driver. If a driver url suffix is
1686    /// provided, the composite node spec will only be matched against drivers with URLS that
1687    /// end with the suffix.
1688    RebindCompositeNodeSpec {
1689        spec: String,
1690        driver_url_suffix: Option<String>,
1691        responder: DriverIndexRebindCompositeNodeSpecResponder,
1692    },
1693    /// Sets the DriverNotifier which is used for reverse communication.
1694    SetNotifier {
1695        notifier: fidl::endpoints::ClientEnd<DriverNotifierMarker>,
1696        control_handle: DriverIndexControlHandle,
1697    },
1698}
1699
1700impl DriverIndexRequest {
1701    #[allow(irrefutable_let_patterns)]
1702    pub fn into_match_driver(self) -> Option<(MatchDriverArgs, DriverIndexMatchDriverResponder)> {
1703        if let DriverIndexRequest::MatchDriver { args, responder } = self {
1704            Some((args, responder))
1705        } else {
1706            None
1707        }
1708    }
1709
1710    #[allow(irrefutable_let_patterns)]
1711    pub fn into_add_composite_node_spec(
1712        self,
1713    ) -> Option<(
1714        fidl_fuchsia_driver_framework::CompositeNodeSpec,
1715        DriverIndexAddCompositeNodeSpecResponder,
1716    )> {
1717        if let DriverIndexRequest::AddCompositeNodeSpec { payload, responder } = self {
1718            Some((payload, responder))
1719        } else {
1720            None
1721        }
1722    }
1723
1724    #[allow(irrefutable_let_patterns)]
1725    pub fn into_rebind_composite_node_spec(
1726        self,
1727    ) -> Option<(String, Option<String>, DriverIndexRebindCompositeNodeSpecResponder)> {
1728        if let DriverIndexRequest::RebindCompositeNodeSpec { spec, driver_url_suffix, responder } =
1729            self
1730        {
1731            Some((spec, driver_url_suffix, responder))
1732        } else {
1733            None
1734        }
1735    }
1736
1737    #[allow(irrefutable_let_patterns)]
1738    pub fn into_set_notifier(
1739        self,
1740    ) -> Option<(fidl::endpoints::ClientEnd<DriverNotifierMarker>, DriverIndexControlHandle)> {
1741        if let DriverIndexRequest::SetNotifier { notifier, control_handle } = self {
1742            Some((notifier, control_handle))
1743        } else {
1744            None
1745        }
1746    }
1747
1748    /// Name of the method defined in FIDL
1749    pub fn method_name(&self) -> &'static str {
1750        match *self {
1751            DriverIndexRequest::MatchDriver { .. } => "match_driver",
1752            DriverIndexRequest::AddCompositeNodeSpec { .. } => "add_composite_node_spec",
1753            DriverIndexRequest::RebindCompositeNodeSpec { .. } => "rebind_composite_node_spec",
1754            DriverIndexRequest::SetNotifier { .. } => "set_notifier",
1755        }
1756    }
1757}
1758
1759#[derive(Debug, Clone)]
1760pub struct DriverIndexControlHandle {
1761    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1762}
1763
1764impl fidl::endpoints::ControlHandle for DriverIndexControlHandle {
1765    fn shutdown(&self) {
1766        self.inner.shutdown()
1767    }
1768
1769    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1770        self.inner.shutdown_with_epitaph(status)
1771    }
1772
1773    fn is_closed(&self) -> bool {
1774        self.inner.channel().is_closed()
1775    }
1776    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1777        self.inner.channel().on_closed()
1778    }
1779
1780    #[cfg(target_os = "fuchsia")]
1781    fn signal_peer(
1782        &self,
1783        clear_mask: zx::Signals,
1784        set_mask: zx::Signals,
1785    ) -> Result<(), zx_status::Status> {
1786        use fidl::Peered;
1787        self.inner.channel().signal_peer(clear_mask, set_mask)
1788    }
1789}
1790
1791impl DriverIndexControlHandle {}
1792
1793#[must_use = "FIDL methods require a response to be sent"]
1794#[derive(Debug)]
1795pub struct DriverIndexMatchDriverResponder {
1796    control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
1797    tx_id: u32,
1798}
1799
1800/// Set the the channel to be shutdown (see [`DriverIndexControlHandle::shutdown`])
1801/// if the responder is dropped without sending a response, so that the client
1802/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1803impl std::ops::Drop for DriverIndexMatchDriverResponder {
1804    fn drop(&mut self) {
1805        self.control_handle.shutdown();
1806        // Safety: drops once, never accessed again
1807        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1808    }
1809}
1810
1811impl fidl::endpoints::Responder for DriverIndexMatchDriverResponder {
1812    type ControlHandle = DriverIndexControlHandle;
1813
1814    fn control_handle(&self) -> &DriverIndexControlHandle {
1815        &self.control_handle
1816    }
1817
1818    fn drop_without_shutdown(mut self) {
1819        // Safety: drops once, never accessed again due to mem::forget
1820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1821        // Prevent Drop from running (which would shut down the channel)
1822        std::mem::forget(self);
1823    }
1824}
1825
1826impl DriverIndexMatchDriverResponder {
1827    /// Sends a response to the FIDL transaction.
1828    ///
1829    /// Sets the channel to shutdown if an error occurs.
1830    pub fn send(self, mut result: Result<&MatchDriverResult, i32>) -> Result<(), fidl::Error> {
1831        let _result = self.send_raw(result);
1832        if _result.is_err() {
1833            self.control_handle.shutdown();
1834        }
1835        self.drop_without_shutdown();
1836        _result
1837    }
1838
1839    /// Similar to "send" but does not shutdown the channel if an error occurs.
1840    pub fn send_no_shutdown_on_err(
1841        self,
1842        mut result: Result<&MatchDriverResult, i32>,
1843    ) -> Result<(), fidl::Error> {
1844        let _result = self.send_raw(result);
1845        self.drop_without_shutdown();
1846        _result
1847    }
1848
1849    fn send_raw(&self, mut result: Result<&MatchDriverResult, i32>) -> Result<(), fidl::Error> {
1850        self.control_handle.inner.send::<fidl::encoding::ResultType<MatchDriverResult, i32>>(
1851            result,
1852            self.tx_id,
1853            0x38317894f6269541,
1854            fidl::encoding::DynamicFlags::empty(),
1855        )
1856    }
1857}
1858
1859#[must_use = "FIDL methods require a response to be sent"]
1860#[derive(Debug)]
1861pub struct DriverIndexAddCompositeNodeSpecResponder {
1862    control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
1863    tx_id: u32,
1864}
1865
1866/// Set the the channel to be shutdown (see [`DriverIndexControlHandle::shutdown`])
1867/// if the responder is dropped without sending a response, so that the client
1868/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1869impl std::ops::Drop for DriverIndexAddCompositeNodeSpecResponder {
1870    fn drop(&mut self) {
1871        self.control_handle.shutdown();
1872        // Safety: drops once, never accessed again
1873        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1874    }
1875}
1876
1877impl fidl::endpoints::Responder for DriverIndexAddCompositeNodeSpecResponder {
1878    type ControlHandle = DriverIndexControlHandle;
1879
1880    fn control_handle(&self) -> &DriverIndexControlHandle {
1881        &self.control_handle
1882    }
1883
1884    fn drop_without_shutdown(mut self) {
1885        // Safety: drops once, never accessed again due to mem::forget
1886        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1887        // Prevent Drop from running (which would shut down the channel)
1888        std::mem::forget(self);
1889    }
1890}
1891
1892impl DriverIndexAddCompositeNodeSpecResponder {
1893    /// Sends a response to the FIDL transaction.
1894    ///
1895    /// Sets the channel to shutdown if an error occurs.
1896    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1897        let _result = self.send_raw(result);
1898        if _result.is_err() {
1899            self.control_handle.shutdown();
1900        }
1901        self.drop_without_shutdown();
1902        _result
1903    }
1904
1905    /// Similar to "send" but does not shutdown the channel if an error occurs.
1906    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1907        let _result = self.send_raw(result);
1908        self.drop_without_shutdown();
1909        _result
1910    }
1911
1912    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1913        self.control_handle
1914            .inner
1915            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1916                result,
1917                self.tx_id,
1918                0x66d25a18fa46a2a2,
1919                fidl::encoding::DynamicFlags::empty(),
1920            )
1921    }
1922}
1923
1924#[must_use = "FIDL methods require a response to be sent"]
1925#[derive(Debug)]
1926pub struct DriverIndexRebindCompositeNodeSpecResponder {
1927    control_handle: std::mem::ManuallyDrop<DriverIndexControlHandle>,
1928    tx_id: u32,
1929}
1930
1931/// Set the the channel to be shutdown (see [`DriverIndexControlHandle::shutdown`])
1932/// if the responder is dropped without sending a response, so that the client
1933/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1934impl std::ops::Drop for DriverIndexRebindCompositeNodeSpecResponder {
1935    fn drop(&mut self) {
1936        self.control_handle.shutdown();
1937        // Safety: drops once, never accessed again
1938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1939    }
1940}
1941
1942impl fidl::endpoints::Responder for DriverIndexRebindCompositeNodeSpecResponder {
1943    type ControlHandle = DriverIndexControlHandle;
1944
1945    fn control_handle(&self) -> &DriverIndexControlHandle {
1946        &self.control_handle
1947    }
1948
1949    fn drop_without_shutdown(mut self) {
1950        // Safety: drops once, never accessed again due to mem::forget
1951        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1952        // Prevent Drop from running (which would shut down the channel)
1953        std::mem::forget(self);
1954    }
1955}
1956
1957impl DriverIndexRebindCompositeNodeSpecResponder {
1958    /// Sends a response to the FIDL transaction.
1959    ///
1960    /// Sets the channel to shutdown if an error occurs.
1961    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1962        let _result = self.send_raw(result);
1963        if _result.is_err() {
1964            self.control_handle.shutdown();
1965        }
1966        self.drop_without_shutdown();
1967        _result
1968    }
1969
1970    /// Similar to "send" but does not shutdown the channel if an error occurs.
1971    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1972        let _result = self.send_raw(result);
1973        self.drop_without_shutdown();
1974        _result
1975    }
1976
1977    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1978        self.control_handle
1979            .inner
1980            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1981                result,
1982                self.tx_id,
1983                0x6667ac8de58b202a,
1984                fidl::encoding::DynamicFlags::empty(),
1985            )
1986    }
1987}
1988
1989#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1990pub struct DriverNotifierMarker;
1991
1992impl fidl::endpoints::ProtocolMarker for DriverNotifierMarker {
1993    type Proxy = DriverNotifierProxy;
1994    type RequestStream = DriverNotifierRequestStream;
1995    #[cfg(target_os = "fuchsia")]
1996    type SynchronousProxy = DriverNotifierSynchronousProxy;
1997
1998    const DEBUG_NAME: &'static str = "(anonymous) DriverNotifier";
1999}
2000
2001pub trait DriverNotifierProxyInterface: Send + Sync {
2002    fn r#new_driver_available(&self) -> Result<(), fidl::Error>;
2003}
2004#[derive(Debug)]
2005#[cfg(target_os = "fuchsia")]
2006pub struct DriverNotifierSynchronousProxy {
2007    client: fidl::client::sync::Client,
2008}
2009
2010#[cfg(target_os = "fuchsia")]
2011impl fidl::endpoints::SynchronousProxy for DriverNotifierSynchronousProxy {
2012    type Proxy = DriverNotifierProxy;
2013    type Protocol = DriverNotifierMarker;
2014
2015    fn from_channel(inner: fidl::Channel) -> Self {
2016        Self::new(inner)
2017    }
2018
2019    fn into_channel(self) -> fidl::Channel {
2020        self.client.into_channel()
2021    }
2022
2023    fn as_channel(&self) -> &fidl::Channel {
2024        self.client.as_channel()
2025    }
2026}
2027
2028#[cfg(target_os = "fuchsia")]
2029impl DriverNotifierSynchronousProxy {
2030    pub fn new(channel: fidl::Channel) -> Self {
2031        let protocol_name = <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2032        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2033    }
2034
2035    pub fn into_channel(self) -> fidl::Channel {
2036        self.client.into_channel()
2037    }
2038
2039    /// Waits until an event arrives and returns it. It is safe for other
2040    /// threads to make concurrent requests while waiting for an event.
2041    pub fn wait_for_event(
2042        &self,
2043        deadline: zx::MonotonicInstant,
2044    ) -> Result<DriverNotifierEvent, fidl::Error> {
2045        DriverNotifierEvent::decode(self.client.wait_for_event(deadline)?)
2046    }
2047
2048    /// One-way method called from the driver index to the driver manager to notify it of
2049    /// new drivers.
2050    pub fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
2051        self.client.send::<fidl::encoding::EmptyPayload>(
2052            (),
2053            0x1642ffd065b6b48e,
2054            fidl::encoding::DynamicFlags::empty(),
2055        )
2056    }
2057}
2058
2059#[cfg(target_os = "fuchsia")]
2060impl From<DriverNotifierSynchronousProxy> for zx::NullableHandle {
2061    fn from(value: DriverNotifierSynchronousProxy) -> Self {
2062        value.into_channel().into()
2063    }
2064}
2065
2066#[cfg(target_os = "fuchsia")]
2067impl From<fidl::Channel> for DriverNotifierSynchronousProxy {
2068    fn from(value: fidl::Channel) -> Self {
2069        Self::new(value)
2070    }
2071}
2072
2073#[cfg(target_os = "fuchsia")]
2074impl fidl::endpoints::FromClient for DriverNotifierSynchronousProxy {
2075    type Protocol = DriverNotifierMarker;
2076
2077    fn from_client(value: fidl::endpoints::ClientEnd<DriverNotifierMarker>) -> Self {
2078        Self::new(value.into_channel())
2079    }
2080}
2081
2082#[derive(Debug, Clone)]
2083pub struct DriverNotifierProxy {
2084    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2085}
2086
2087impl fidl::endpoints::Proxy for DriverNotifierProxy {
2088    type Protocol = DriverNotifierMarker;
2089
2090    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2091        Self::new(inner)
2092    }
2093
2094    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2095        self.client.into_channel().map_err(|client| Self { client })
2096    }
2097
2098    fn as_channel(&self) -> &::fidl::AsyncChannel {
2099        self.client.as_channel()
2100    }
2101}
2102
2103impl DriverNotifierProxy {
2104    /// Create a new Proxy for fuchsia.driver.index/DriverNotifier.
2105    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2106        let protocol_name = <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2107        Self { client: fidl::client::Client::new(channel, protocol_name) }
2108    }
2109
2110    /// Get a Stream of events from the remote end of the protocol.
2111    ///
2112    /// # Panics
2113    ///
2114    /// Panics if the event stream was already taken.
2115    pub fn take_event_stream(&self) -> DriverNotifierEventStream {
2116        DriverNotifierEventStream { event_receiver: self.client.take_event_receiver() }
2117    }
2118
2119    /// One-way method called from the driver index to the driver manager to notify it of
2120    /// new drivers.
2121    pub fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
2122        DriverNotifierProxyInterface::r#new_driver_available(self)
2123    }
2124}
2125
2126impl DriverNotifierProxyInterface for DriverNotifierProxy {
2127    fn r#new_driver_available(&self) -> Result<(), fidl::Error> {
2128        self.client.send::<fidl::encoding::EmptyPayload>(
2129            (),
2130            0x1642ffd065b6b48e,
2131            fidl::encoding::DynamicFlags::empty(),
2132        )
2133    }
2134}
2135
2136pub struct DriverNotifierEventStream {
2137    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2138}
2139
2140impl std::marker::Unpin for DriverNotifierEventStream {}
2141
2142impl futures::stream::FusedStream for DriverNotifierEventStream {
2143    fn is_terminated(&self) -> bool {
2144        self.event_receiver.is_terminated()
2145    }
2146}
2147
2148impl futures::Stream for DriverNotifierEventStream {
2149    type Item = Result<DriverNotifierEvent, fidl::Error>;
2150
2151    fn poll_next(
2152        mut self: std::pin::Pin<&mut Self>,
2153        cx: &mut std::task::Context<'_>,
2154    ) -> std::task::Poll<Option<Self::Item>> {
2155        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2156            &mut self.event_receiver,
2157            cx
2158        )?) {
2159            Some(buf) => std::task::Poll::Ready(Some(DriverNotifierEvent::decode(buf))),
2160            None => std::task::Poll::Ready(None),
2161        }
2162    }
2163}
2164
2165#[derive(Debug)]
2166pub enum DriverNotifierEvent {}
2167
2168impl DriverNotifierEvent {
2169    /// Decodes a message buffer as a [`DriverNotifierEvent`].
2170    fn decode(
2171        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2172    ) -> Result<DriverNotifierEvent, fidl::Error> {
2173        let (bytes, _handles) = buf.split_mut();
2174        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2175        debug_assert_eq!(tx_header.tx_id, 0);
2176        match tx_header.ordinal {
2177            _ => Err(fidl::Error::UnknownOrdinal {
2178                ordinal: tx_header.ordinal,
2179                protocol_name:
2180                    <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2181            }),
2182        }
2183    }
2184}
2185
2186/// A Stream of incoming requests for fuchsia.driver.index/DriverNotifier.
2187pub struct DriverNotifierRequestStream {
2188    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2189    is_terminated: bool,
2190}
2191
2192impl std::marker::Unpin for DriverNotifierRequestStream {}
2193
2194impl futures::stream::FusedStream for DriverNotifierRequestStream {
2195    fn is_terminated(&self) -> bool {
2196        self.is_terminated
2197    }
2198}
2199
2200impl fidl::endpoints::RequestStream for DriverNotifierRequestStream {
2201    type Protocol = DriverNotifierMarker;
2202    type ControlHandle = DriverNotifierControlHandle;
2203
2204    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2205        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2206    }
2207
2208    fn control_handle(&self) -> Self::ControlHandle {
2209        DriverNotifierControlHandle { inner: self.inner.clone() }
2210    }
2211
2212    fn into_inner(
2213        self,
2214    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2215    {
2216        (self.inner, self.is_terminated)
2217    }
2218
2219    fn from_inner(
2220        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2221        is_terminated: bool,
2222    ) -> Self {
2223        Self { inner, is_terminated }
2224    }
2225}
2226
2227impl futures::Stream for DriverNotifierRequestStream {
2228    type Item = Result<DriverNotifierRequest, fidl::Error>;
2229
2230    fn poll_next(
2231        mut self: std::pin::Pin<&mut Self>,
2232        cx: &mut std::task::Context<'_>,
2233    ) -> std::task::Poll<Option<Self::Item>> {
2234        let this = &mut *self;
2235        if this.inner.check_shutdown(cx) {
2236            this.is_terminated = true;
2237            return std::task::Poll::Ready(None);
2238        }
2239        if this.is_terminated {
2240            panic!("polled DriverNotifierRequestStream after completion");
2241        }
2242        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2243            |bytes, handles| {
2244                match this.inner.channel().read_etc(cx, bytes, handles) {
2245                    std::task::Poll::Ready(Ok(())) => {}
2246                    std::task::Poll::Pending => return std::task::Poll::Pending,
2247                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2248                        this.is_terminated = true;
2249                        return std::task::Poll::Ready(None);
2250                    }
2251                    std::task::Poll::Ready(Err(e)) => {
2252                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2253                            e.into(),
2254                        ))));
2255                    }
2256                }
2257
2258                // A message has been received from the channel
2259                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2260
2261                std::task::Poll::Ready(Some(match header.ordinal {
2262                    0x1642ffd065b6b48e => {
2263                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2264                        let mut req = fidl::new_empty!(
2265                            fidl::encoding::EmptyPayload,
2266                            fidl::encoding::DefaultFuchsiaResourceDialect
2267                        );
2268                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2269                        let control_handle =
2270                            DriverNotifierControlHandle { inner: this.inner.clone() };
2271                        Ok(DriverNotifierRequest::NewDriverAvailable { control_handle })
2272                    }
2273                    _ => Err(fidl::Error::UnknownOrdinal {
2274                        ordinal: header.ordinal,
2275                        protocol_name:
2276                            <DriverNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2277                    }),
2278                }))
2279            },
2280        )
2281    }
2282}
2283
2284/// This is served by the driver manager for the driver index to use to notify it of new
2285/// drivers that are available on the driver index.
2286///
2287/// We are making this a separate protocol so that the DriverIndex protocol can be marked as
2288/// delivery: on_readable. This way no matter what protocol caused the index to wake up, we can
2289/// send notifications to the driver manager.
2290#[derive(Debug)]
2291pub enum DriverNotifierRequest {
2292    /// One-way method called from the driver index to the driver manager to notify it of
2293    /// new drivers.
2294    NewDriverAvailable { control_handle: DriverNotifierControlHandle },
2295}
2296
2297impl DriverNotifierRequest {
2298    #[allow(irrefutable_let_patterns)]
2299    pub fn into_new_driver_available(self) -> Option<(DriverNotifierControlHandle)> {
2300        if let DriverNotifierRequest::NewDriverAvailable { control_handle } = self {
2301            Some((control_handle))
2302        } else {
2303            None
2304        }
2305    }
2306
2307    /// Name of the method defined in FIDL
2308    pub fn method_name(&self) -> &'static str {
2309        match *self {
2310            DriverNotifierRequest::NewDriverAvailable { .. } => "new_driver_available",
2311        }
2312    }
2313}
2314
2315#[derive(Debug, Clone)]
2316pub struct DriverNotifierControlHandle {
2317    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2318}
2319
2320impl fidl::endpoints::ControlHandle for DriverNotifierControlHandle {
2321    fn shutdown(&self) {
2322        self.inner.shutdown()
2323    }
2324
2325    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2326        self.inner.shutdown_with_epitaph(status)
2327    }
2328
2329    fn is_closed(&self) -> bool {
2330        self.inner.channel().is_closed()
2331    }
2332    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2333        self.inner.channel().on_closed()
2334    }
2335
2336    #[cfg(target_os = "fuchsia")]
2337    fn signal_peer(
2338        &self,
2339        clear_mask: zx::Signals,
2340        set_mask: zx::Signals,
2341    ) -> Result<(), zx_status::Status> {
2342        use fidl::Peered;
2343        self.inner.channel().signal_peer(clear_mask, set_mask)
2344    }
2345}
2346
2347impl DriverNotifierControlHandle {}
2348
2349mod internal {
2350    use super::*;
2351
2352    impl fidl::encoding::ResourceTypeMarker for DevelopmentManagerGetCompositeNodeSpecsRequest {
2353        type Borrowed<'a> = &'a mut Self;
2354        fn take_or_borrow<'a>(
2355            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2356        ) -> Self::Borrowed<'a> {
2357            value
2358        }
2359    }
2360
2361    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerGetCompositeNodeSpecsRequest {
2362        type Owned = Self;
2363
2364        #[inline(always)]
2365        fn inline_align(_context: fidl::encoding::Context) -> usize {
2366            8
2367        }
2368
2369        #[inline(always)]
2370        fn inline_size(_context: fidl::encoding::Context) -> usize {
2371            24
2372        }
2373    }
2374
2375    unsafe impl
2376        fidl::encoding::Encode<
2377            DevelopmentManagerGetCompositeNodeSpecsRequest,
2378            fidl::encoding::DefaultFuchsiaResourceDialect,
2379        > for &mut DevelopmentManagerGetCompositeNodeSpecsRequest
2380    {
2381        #[inline]
2382        unsafe fn encode(
2383            self,
2384            encoder: &mut fidl::encoding::Encoder<
2385                '_,
2386                fidl::encoding::DefaultFuchsiaResourceDialect,
2387            >,
2388            offset: usize,
2389            _depth: fidl::encoding::Depth,
2390        ) -> fidl::Result<()> {
2391            encoder.debug_check_bounds::<DevelopmentManagerGetCompositeNodeSpecsRequest>(offset);
2392            // Delegate to tuple encoding.
2393            fidl::encoding::Encode::<DevelopmentManagerGetCompositeNodeSpecsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2394                (
2395                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name_filter),
2396                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2397                ),
2398                encoder, offset, _depth
2399            )
2400        }
2401    }
2402    unsafe impl<
2403        T0: fidl::encoding::Encode<
2404                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2405                fidl::encoding::DefaultFuchsiaResourceDialect,
2406            >,
2407        T1: fidl::encoding::Encode<
2408                fidl::encoding::Endpoint<
2409                    fidl::endpoints::ServerEnd<
2410                        fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
2411                    >,
2412                >,
2413                fidl::encoding::DefaultFuchsiaResourceDialect,
2414            >,
2415    >
2416        fidl::encoding::Encode<
2417            DevelopmentManagerGetCompositeNodeSpecsRequest,
2418            fidl::encoding::DefaultFuchsiaResourceDialect,
2419        > for (T0, T1)
2420    {
2421        #[inline]
2422        unsafe fn encode(
2423            self,
2424            encoder: &mut fidl::encoding::Encoder<
2425                '_,
2426                fidl::encoding::DefaultFuchsiaResourceDialect,
2427            >,
2428            offset: usize,
2429            depth: fidl::encoding::Depth,
2430        ) -> fidl::Result<()> {
2431            encoder.debug_check_bounds::<DevelopmentManagerGetCompositeNodeSpecsRequest>(offset);
2432            // Zero out padding regions. There's no need to apply masks
2433            // because the unmasked parts will be overwritten by fields.
2434            unsafe {
2435                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2436                (ptr as *mut u64).write_unaligned(0);
2437            }
2438            // Write the fields.
2439            self.0.encode(encoder, offset + 0, depth)?;
2440            self.1.encode(encoder, offset + 16, depth)?;
2441            Ok(())
2442        }
2443    }
2444
2445    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2446        for DevelopmentManagerGetCompositeNodeSpecsRequest
2447    {
2448        #[inline(always)]
2449        fn new_empty() -> Self {
2450            Self {
2451                name_filter: fidl::new_empty!(
2452                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2453                    fidl::encoding::DefaultFuchsiaResourceDialect
2454                ),
2455                iterator: fidl::new_empty!(
2456                    fidl::encoding::Endpoint<
2457                        fidl::endpoints::ServerEnd<
2458                            fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
2459                        >,
2460                    >,
2461                    fidl::encoding::DefaultFuchsiaResourceDialect
2462                ),
2463            }
2464        }
2465
2466        #[inline]
2467        unsafe fn decode(
2468            &mut self,
2469            decoder: &mut fidl::encoding::Decoder<
2470                '_,
2471                fidl::encoding::DefaultFuchsiaResourceDialect,
2472            >,
2473            offset: usize,
2474            _depth: fidl::encoding::Depth,
2475        ) -> fidl::Result<()> {
2476            decoder.debug_check_bounds::<Self>(offset);
2477            // Verify that padding bytes are zero.
2478            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2479            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2480            let mask = 0xffffffff00000000u64;
2481            let maskedval = padval & mask;
2482            if maskedval != 0 {
2483                return Err(fidl::Error::NonZeroPadding {
2484                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2485                });
2486            }
2487            fidl::decode!(
2488                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
2489                fidl::encoding::DefaultFuchsiaResourceDialect,
2490                &mut self.name_filter,
2491                decoder,
2492                offset + 0,
2493                _depth
2494            )?;
2495            fidl::decode!(
2496                fidl::encoding::Endpoint<
2497                    fidl::endpoints::ServerEnd<
2498                        fidl_fuchsia_driver_development::CompositeNodeSpecIteratorMarker,
2499                    >,
2500                >,
2501                fidl::encoding::DefaultFuchsiaResourceDialect,
2502                &mut self.iterator,
2503                decoder,
2504                offset + 16,
2505                _depth
2506            )?;
2507            Ok(())
2508        }
2509    }
2510
2511    impl fidl::encoding::ResourceTypeMarker for DevelopmentManagerGetDriverInfoRequest {
2512        type Borrowed<'a> = &'a mut Self;
2513        fn take_or_borrow<'a>(
2514            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2515        ) -> Self::Borrowed<'a> {
2516            value
2517        }
2518    }
2519
2520    unsafe impl fidl::encoding::TypeMarker for DevelopmentManagerGetDriverInfoRequest {
2521        type Owned = Self;
2522
2523        #[inline(always)]
2524        fn inline_align(_context: fidl::encoding::Context) -> usize {
2525            8
2526        }
2527
2528        #[inline(always)]
2529        fn inline_size(_context: fidl::encoding::Context) -> usize {
2530            24
2531        }
2532    }
2533
2534    unsafe impl
2535        fidl::encoding::Encode<
2536            DevelopmentManagerGetDriverInfoRequest,
2537            fidl::encoding::DefaultFuchsiaResourceDialect,
2538        > for &mut DevelopmentManagerGetDriverInfoRequest
2539    {
2540        #[inline]
2541        unsafe fn encode(
2542            self,
2543            encoder: &mut fidl::encoding::Encoder<
2544                '_,
2545                fidl::encoding::DefaultFuchsiaResourceDialect,
2546            >,
2547            offset: usize,
2548            _depth: fidl::encoding::Depth,
2549        ) -> fidl::Result<()> {
2550            encoder.debug_check_bounds::<DevelopmentManagerGetDriverInfoRequest>(offset);
2551            // Delegate to tuple encoding.
2552            fidl::encoding::Encode::<DevelopmentManagerGetDriverInfoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2553                (
2554                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.driver_filter),
2555                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_driver_development::DriverInfoIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
2556                ),
2557                encoder, offset, _depth
2558            )
2559        }
2560    }
2561    unsafe impl<
2562        T0: fidl::encoding::Encode<
2563                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2564                fidl::encoding::DefaultFuchsiaResourceDialect,
2565            >,
2566        T1: fidl::encoding::Encode<
2567                fidl::encoding::Endpoint<
2568                    fidl::endpoints::ServerEnd<
2569                        fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
2570                    >,
2571                >,
2572                fidl::encoding::DefaultFuchsiaResourceDialect,
2573            >,
2574    >
2575        fidl::encoding::Encode<
2576            DevelopmentManagerGetDriverInfoRequest,
2577            fidl::encoding::DefaultFuchsiaResourceDialect,
2578        > for (T0, T1)
2579    {
2580        #[inline]
2581        unsafe fn encode(
2582            self,
2583            encoder: &mut fidl::encoding::Encoder<
2584                '_,
2585                fidl::encoding::DefaultFuchsiaResourceDialect,
2586            >,
2587            offset: usize,
2588            depth: fidl::encoding::Depth,
2589        ) -> fidl::Result<()> {
2590            encoder.debug_check_bounds::<DevelopmentManagerGetDriverInfoRequest>(offset);
2591            // Zero out padding regions. There's no need to apply masks
2592            // because the unmasked parts will be overwritten by fields.
2593            unsafe {
2594                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2595                (ptr as *mut u64).write_unaligned(0);
2596            }
2597            // Write the fields.
2598            self.0.encode(encoder, offset + 0, depth)?;
2599            self.1.encode(encoder, offset + 16, depth)?;
2600            Ok(())
2601        }
2602    }
2603
2604    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2605        for DevelopmentManagerGetDriverInfoRequest
2606    {
2607        #[inline(always)]
2608        fn new_empty() -> Self {
2609            Self {
2610                driver_filter: fidl::new_empty!(
2611                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2612                    fidl::encoding::DefaultFuchsiaResourceDialect
2613                ),
2614                iterator: fidl::new_empty!(
2615                    fidl::encoding::Endpoint<
2616                        fidl::endpoints::ServerEnd<
2617                            fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
2618                        >,
2619                    >,
2620                    fidl::encoding::DefaultFuchsiaResourceDialect
2621                ),
2622            }
2623        }
2624
2625        #[inline]
2626        unsafe fn decode(
2627            &mut self,
2628            decoder: &mut fidl::encoding::Decoder<
2629                '_,
2630                fidl::encoding::DefaultFuchsiaResourceDialect,
2631            >,
2632            offset: usize,
2633            _depth: fidl::encoding::Depth,
2634        ) -> fidl::Result<()> {
2635            decoder.debug_check_bounds::<Self>(offset);
2636            // Verify that padding bytes are zero.
2637            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2638            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2639            let mask = 0xffffffff00000000u64;
2640            let maskedval = padval & mask;
2641            if maskedval != 0 {
2642                return Err(fidl::Error::NonZeroPadding {
2643                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2644                });
2645            }
2646            fidl::decode!(
2647                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2648                fidl::encoding::DefaultFuchsiaResourceDialect,
2649                &mut self.driver_filter,
2650                decoder,
2651                offset + 0,
2652                _depth
2653            )?;
2654            fidl::decode!(
2655                fidl::encoding::Endpoint<
2656                    fidl::endpoints::ServerEnd<
2657                        fidl_fuchsia_driver_development::DriverInfoIteratorMarker,
2658                    >,
2659                >,
2660                fidl::encoding::DefaultFuchsiaResourceDialect,
2661                &mut self.iterator,
2662                decoder,
2663                offset + 16,
2664                _depth
2665            )?;
2666            Ok(())
2667        }
2668    }
2669
2670    impl fidl::encoding::ResourceTypeMarker for DriverIndexSetNotifierRequest {
2671        type Borrowed<'a> = &'a mut Self;
2672        fn take_or_borrow<'a>(
2673            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2674        ) -> Self::Borrowed<'a> {
2675            value
2676        }
2677    }
2678
2679    unsafe impl fidl::encoding::TypeMarker for DriverIndexSetNotifierRequest {
2680        type Owned = Self;
2681
2682        #[inline(always)]
2683        fn inline_align(_context: fidl::encoding::Context) -> usize {
2684            4
2685        }
2686
2687        #[inline(always)]
2688        fn inline_size(_context: fidl::encoding::Context) -> usize {
2689            4
2690        }
2691    }
2692
2693    unsafe impl
2694        fidl::encoding::Encode<
2695            DriverIndexSetNotifierRequest,
2696            fidl::encoding::DefaultFuchsiaResourceDialect,
2697        > for &mut DriverIndexSetNotifierRequest
2698    {
2699        #[inline]
2700        unsafe fn encode(
2701            self,
2702            encoder: &mut fidl::encoding::Encoder<
2703                '_,
2704                fidl::encoding::DefaultFuchsiaResourceDialect,
2705            >,
2706            offset: usize,
2707            _depth: fidl::encoding::Depth,
2708        ) -> fidl::Result<()> {
2709            encoder.debug_check_bounds::<DriverIndexSetNotifierRequest>(offset);
2710            // Delegate to tuple encoding.
2711            fidl::encoding::Encode::<DriverIndexSetNotifierRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2712                (
2713                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.notifier),
2714                ),
2715                encoder, offset, _depth
2716            )
2717        }
2718    }
2719    unsafe impl<
2720        T0: fidl::encoding::Encode<
2721                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
2722                fidl::encoding::DefaultFuchsiaResourceDialect,
2723            >,
2724    >
2725        fidl::encoding::Encode<
2726            DriverIndexSetNotifierRequest,
2727            fidl::encoding::DefaultFuchsiaResourceDialect,
2728        > for (T0,)
2729    {
2730        #[inline]
2731        unsafe fn encode(
2732            self,
2733            encoder: &mut fidl::encoding::Encoder<
2734                '_,
2735                fidl::encoding::DefaultFuchsiaResourceDialect,
2736            >,
2737            offset: usize,
2738            depth: fidl::encoding::Depth,
2739        ) -> fidl::Result<()> {
2740            encoder.debug_check_bounds::<DriverIndexSetNotifierRequest>(offset);
2741            // Zero out padding regions. There's no need to apply masks
2742            // because the unmasked parts will be overwritten by fields.
2743            // Write the fields.
2744            self.0.encode(encoder, offset + 0, depth)?;
2745            Ok(())
2746        }
2747    }
2748
2749    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2750        for DriverIndexSetNotifierRequest
2751    {
2752        #[inline(always)]
2753        fn new_empty() -> Self {
2754            Self {
2755                notifier: fidl::new_empty!(
2756                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
2757                    fidl::encoding::DefaultFuchsiaResourceDialect
2758                ),
2759            }
2760        }
2761
2762        #[inline]
2763        unsafe fn decode(
2764            &mut self,
2765            decoder: &mut fidl::encoding::Decoder<
2766                '_,
2767                fidl::encoding::DefaultFuchsiaResourceDialect,
2768            >,
2769            offset: usize,
2770            _depth: fidl::encoding::Depth,
2771        ) -> fidl::Result<()> {
2772            decoder.debug_check_bounds::<Self>(offset);
2773            // Verify that padding bytes are zero.
2774            fidl::decode!(
2775                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverNotifierMarker>>,
2776                fidl::encoding::DefaultFuchsiaResourceDialect,
2777                &mut self.notifier,
2778                decoder,
2779                offset + 0,
2780                _depth
2781            )?;
2782            Ok(())
2783        }
2784    }
2785}