fidl_fuchsia_driver_index/
fidl_fuchsia_driver_index.rs

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