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