Skip to main content

fidl_fuchsia_driver_index/
fidl_fuchsia_driver_index.rs

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