Skip to main content

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