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