fidl_fuchsia_pkg/
fidl_fuchsia_pkg.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_pkg__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct FontResolverResolveRequest {
16    pub package_url: String,
17    pub directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for FontResolverResolveRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct NeededBlobsGetMissingBlobsRequest {
27    pub iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for NeededBlobsGetMissingBlobsRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct NeededBlobsOpenBlobResponse {
37    pub writer: Option<Box<BlobWriter>>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for NeededBlobsOpenBlobResponse
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct NeededBlobsOpenMetaBlobResponse {
47    pub writer: Option<Box<BlobWriter>>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51    for NeededBlobsOpenMetaBlobResponse
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct PackageCacheBasePackageIndexRequest {
57    pub iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for PackageCacheBasePackageIndexRequest
62{
63}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct PackageCacheCachePackageIndexRequest {
67    pub iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
71    for PackageCacheCachePackageIndexRequest
72{
73}
74
75#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76pub struct PackageCacheGetRequest {
77    pub meta_far_blob: BlobInfo,
78    pub gc_protection: GcProtection,
79    pub needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
80    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PackageCacheGetRequest {}
84
85#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct PackageCacheGetSubpackageRequest {
87    pub superpackage: BlobId,
88    pub subpackage: PackageUrl,
89    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for PackageCacheGetSubpackageRequest
94{
95}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct PackageCacheWriteBlobsRequest {
99    pub needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103    for PackageCacheWriteBlobsRequest
104{
105}
106
107#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
108pub struct PackageResolverResolveRequest {
109    pub package_url: String,
110    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
111}
112
113impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
114    for PackageResolverResolveRequest
115{
116}
117
118#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct PackageResolverResolveWithContextRequest {
120    pub package_url: String,
121    pub context: ResolutionContext,
122    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
126    for PackageResolverResolveWithContextRequest
127{
128}
129
130#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
131pub struct RepositoryManagerListRequest {
132    pub iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
133}
134
135impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
136    for RepositoryManagerListRequest
137{
138}
139
140#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
141pub struct RetainedBlobsReplaceRequest {
142    pub iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
143}
144
145impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
146    for RetainedBlobsReplaceRequest
147{
148}
149
150#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
151pub struct RetainedPackagesReplaceRequest {
152    pub iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
153}
154
155impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
156    for RetainedPackagesReplaceRequest
157{
158}
159
160/// Used to write a blob to the underlying storage.
161#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
162pub enum BlobWriter {
163    /// To write a blob with `file`:
164    ///   1. If the blob is uncompressed, use `fuchsia.io/File.Resize` to set
165    ///      the blob's uncompressed size.
166    ///   2. Use `fuchsia.io/File.Write` to write the blob's contents from
167    ///      start to finish (seeks are not supported).
168    /// A corrupt blob is indicated by a `Write()` (usually the final write),
169    /// failing with `ZX_ERR_IO_DATA_INTEGRITY`.
170    File(fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>),
171    /// To write a blob with `writer`, follow the instructions on the
172    /// `fuchsia.fxfs.BlobWriter` protocol.
173    Writer(fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>),
174}
175
176impl BlobWriter {
177    #[inline]
178    pub fn ordinal(&self) -> u64 {
179        match *self {
180            Self::File(_) => 1,
181            Self::Writer(_) => 2,
182        }
183    }
184}
185
186impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlobWriter {}
187
188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
189pub struct BlobIdIteratorMarker;
190
191impl fidl::endpoints::ProtocolMarker for BlobIdIteratorMarker {
192    type Proxy = BlobIdIteratorProxy;
193    type RequestStream = BlobIdIteratorRequestStream;
194    #[cfg(target_os = "fuchsia")]
195    type SynchronousProxy = BlobIdIteratorSynchronousProxy;
196
197    const DEBUG_NAME: &'static str = "(anonymous) BlobIdIterator";
198}
199
200pub trait BlobIdIteratorProxyInterface: Send + Sync {
201    type NextResponseFut: std::future::Future<Output = Result<Vec<BlobId>, fidl::Error>> + Send;
202    fn r#next(&self) -> Self::NextResponseFut;
203}
204#[derive(Debug)]
205#[cfg(target_os = "fuchsia")]
206pub struct BlobIdIteratorSynchronousProxy {
207    client: fidl::client::sync::Client,
208}
209
210#[cfg(target_os = "fuchsia")]
211impl fidl::endpoints::SynchronousProxy for BlobIdIteratorSynchronousProxy {
212    type Proxy = BlobIdIteratorProxy;
213    type Protocol = BlobIdIteratorMarker;
214
215    fn from_channel(inner: fidl::Channel) -> Self {
216        Self::new(inner)
217    }
218
219    fn into_channel(self) -> fidl::Channel {
220        self.client.into_channel()
221    }
222
223    fn as_channel(&self) -> &fidl::Channel {
224        self.client.as_channel()
225    }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl BlobIdIteratorSynchronousProxy {
230    pub fn new(channel: fidl::Channel) -> Self {
231        let protocol_name = <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
232        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
233    }
234
235    pub fn into_channel(self) -> fidl::Channel {
236        self.client.into_channel()
237    }
238
239    /// Waits until an event arrives and returns it. It is safe for other
240    /// threads to make concurrent requests while waiting for an event.
241    pub fn wait_for_event(
242        &self,
243        deadline: zx::MonotonicInstant,
244    ) -> Result<BlobIdIteratorEvent, fidl::Error> {
245        BlobIdIteratorEvent::decode(self.client.wait_for_event(deadline)?)
246    }
247
248    /// Responds with the next chunk of blob IDs. When the iterator is
249    /// exhausted, responds with an empty vector and closes the connection.
250    ///
251    /// - response `blobs` the next chunk of blob IDs.
252    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<BlobId>, fidl::Error> {
253        let _response =
254            self.client.send_query::<fidl::encoding::EmptyPayload, BlobIdIteratorNextResponse>(
255                (),
256                0x5eb0af0daeb8f537,
257                fidl::encoding::DynamicFlags::empty(),
258                ___deadline,
259            )?;
260        Ok(_response.blobs)
261    }
262}
263
264#[cfg(target_os = "fuchsia")]
265impl From<BlobIdIteratorSynchronousProxy> for zx::Handle {
266    fn from(value: BlobIdIteratorSynchronousProxy) -> Self {
267        value.into_channel().into()
268    }
269}
270
271#[cfg(target_os = "fuchsia")]
272impl From<fidl::Channel> for BlobIdIteratorSynchronousProxy {
273    fn from(value: fidl::Channel) -> Self {
274        Self::new(value)
275    }
276}
277
278#[cfg(target_os = "fuchsia")]
279impl fidl::endpoints::FromClient for BlobIdIteratorSynchronousProxy {
280    type Protocol = BlobIdIteratorMarker;
281
282    fn from_client(value: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>) -> Self {
283        Self::new(value.into_channel())
284    }
285}
286
287#[derive(Debug, Clone)]
288pub struct BlobIdIteratorProxy {
289    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
290}
291
292impl fidl::endpoints::Proxy for BlobIdIteratorProxy {
293    type Protocol = BlobIdIteratorMarker;
294
295    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
296        Self::new(inner)
297    }
298
299    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
300        self.client.into_channel().map_err(|client| Self { client })
301    }
302
303    fn as_channel(&self) -> &::fidl::AsyncChannel {
304        self.client.as_channel()
305    }
306}
307
308impl BlobIdIteratorProxy {
309    /// Create a new Proxy for fuchsia.pkg/BlobIdIterator.
310    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
311        let protocol_name = <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
312        Self { client: fidl::client::Client::new(channel, protocol_name) }
313    }
314
315    /// Get a Stream of events from the remote end of the protocol.
316    ///
317    /// # Panics
318    ///
319    /// Panics if the event stream was already taken.
320    pub fn take_event_stream(&self) -> BlobIdIteratorEventStream {
321        BlobIdIteratorEventStream { event_receiver: self.client.take_event_receiver() }
322    }
323
324    /// Responds with the next chunk of blob IDs. When the iterator is
325    /// exhausted, responds with an empty vector and closes the connection.
326    ///
327    /// - response `blobs` the next chunk of blob IDs.
328    pub fn r#next(
329        &self,
330    ) -> fidl::client::QueryResponseFut<Vec<BlobId>, fidl::encoding::DefaultFuchsiaResourceDialect>
331    {
332        BlobIdIteratorProxyInterface::r#next(self)
333    }
334}
335
336impl BlobIdIteratorProxyInterface for BlobIdIteratorProxy {
337    type NextResponseFut =
338        fidl::client::QueryResponseFut<Vec<BlobId>, fidl::encoding::DefaultFuchsiaResourceDialect>;
339    fn r#next(&self) -> Self::NextResponseFut {
340        fn _decode(
341            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
342        ) -> Result<Vec<BlobId>, fidl::Error> {
343            let _response = fidl::client::decode_transaction_body::<
344                BlobIdIteratorNextResponse,
345                fidl::encoding::DefaultFuchsiaResourceDialect,
346                0x5eb0af0daeb8f537,
347            >(_buf?)?;
348            Ok(_response.blobs)
349        }
350        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<BlobId>>(
351            (),
352            0x5eb0af0daeb8f537,
353            fidl::encoding::DynamicFlags::empty(),
354            _decode,
355        )
356    }
357}
358
359pub struct BlobIdIteratorEventStream {
360    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
361}
362
363impl std::marker::Unpin for BlobIdIteratorEventStream {}
364
365impl futures::stream::FusedStream for BlobIdIteratorEventStream {
366    fn is_terminated(&self) -> bool {
367        self.event_receiver.is_terminated()
368    }
369}
370
371impl futures::Stream for BlobIdIteratorEventStream {
372    type Item = Result<BlobIdIteratorEvent, fidl::Error>;
373
374    fn poll_next(
375        mut self: std::pin::Pin<&mut Self>,
376        cx: &mut std::task::Context<'_>,
377    ) -> std::task::Poll<Option<Self::Item>> {
378        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
379            &mut self.event_receiver,
380            cx
381        )?) {
382            Some(buf) => std::task::Poll::Ready(Some(BlobIdIteratorEvent::decode(buf))),
383            None => std::task::Poll::Ready(None),
384        }
385    }
386}
387
388#[derive(Debug)]
389pub enum BlobIdIteratorEvent {}
390
391impl BlobIdIteratorEvent {
392    /// Decodes a message buffer as a [`BlobIdIteratorEvent`].
393    fn decode(
394        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
395    ) -> Result<BlobIdIteratorEvent, fidl::Error> {
396        let (bytes, _handles) = buf.split_mut();
397        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
398        debug_assert_eq!(tx_header.tx_id, 0);
399        match tx_header.ordinal {
400            _ => Err(fidl::Error::UnknownOrdinal {
401                ordinal: tx_header.ordinal,
402                protocol_name:
403                    <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
404            }),
405        }
406    }
407}
408
409/// A Stream of incoming requests for fuchsia.pkg/BlobIdIterator.
410pub struct BlobIdIteratorRequestStream {
411    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
412    is_terminated: bool,
413}
414
415impl std::marker::Unpin for BlobIdIteratorRequestStream {}
416
417impl futures::stream::FusedStream for BlobIdIteratorRequestStream {
418    fn is_terminated(&self) -> bool {
419        self.is_terminated
420    }
421}
422
423impl fidl::endpoints::RequestStream for BlobIdIteratorRequestStream {
424    type Protocol = BlobIdIteratorMarker;
425    type ControlHandle = BlobIdIteratorControlHandle;
426
427    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
428        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
429    }
430
431    fn control_handle(&self) -> Self::ControlHandle {
432        BlobIdIteratorControlHandle { inner: self.inner.clone() }
433    }
434
435    fn into_inner(
436        self,
437    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
438    {
439        (self.inner, self.is_terminated)
440    }
441
442    fn from_inner(
443        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
444        is_terminated: bool,
445    ) -> Self {
446        Self { inner, is_terminated }
447    }
448}
449
450impl futures::Stream for BlobIdIteratorRequestStream {
451    type Item = Result<BlobIdIteratorRequest, fidl::Error>;
452
453    fn poll_next(
454        mut self: std::pin::Pin<&mut Self>,
455        cx: &mut std::task::Context<'_>,
456    ) -> std::task::Poll<Option<Self::Item>> {
457        let this = &mut *self;
458        if this.inner.check_shutdown(cx) {
459            this.is_terminated = true;
460            return std::task::Poll::Ready(None);
461        }
462        if this.is_terminated {
463            panic!("polled BlobIdIteratorRequestStream after completion");
464        }
465        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
466            |bytes, handles| {
467                match this.inner.channel().read_etc(cx, bytes, handles) {
468                    std::task::Poll::Ready(Ok(())) => {}
469                    std::task::Poll::Pending => return std::task::Poll::Pending,
470                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
471                        this.is_terminated = true;
472                        return std::task::Poll::Ready(None);
473                    }
474                    std::task::Poll::Ready(Err(e)) => {
475                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
476                            e.into(),
477                        ))));
478                    }
479                }
480
481                // A message has been received from the channel
482                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
483
484                std::task::Poll::Ready(Some(match header.ordinal {
485                    0x5eb0af0daeb8f537 => {
486                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
487                        let mut req = fidl::new_empty!(
488                            fidl::encoding::EmptyPayload,
489                            fidl::encoding::DefaultFuchsiaResourceDialect
490                        );
491                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
492                        let control_handle =
493                            BlobIdIteratorControlHandle { inner: this.inner.clone() };
494                        Ok(BlobIdIteratorRequest::Next {
495                            responder: BlobIdIteratorNextResponder {
496                                control_handle: std::mem::ManuallyDrop::new(control_handle),
497                                tx_id: header.tx_id,
498                            },
499                        })
500                    }
501                    _ => Err(fidl::Error::UnknownOrdinal {
502                        ordinal: header.ordinal,
503                        protocol_name:
504                            <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
505                    }),
506                }))
507            },
508        )
509    }
510}
511
512/// A chunked iterator of blob IDs, allowing transfer of more blob IDs that can
513/// fit in a single FIDL message.
514#[derive(Debug)]
515pub enum BlobIdIteratorRequest {
516    /// Responds with the next chunk of blob IDs. When the iterator is
517    /// exhausted, responds with an empty vector and closes the connection.
518    ///
519    /// - response `blobs` the next chunk of blob IDs.
520    Next { responder: BlobIdIteratorNextResponder },
521}
522
523impl BlobIdIteratorRequest {
524    #[allow(irrefutable_let_patterns)]
525    pub fn into_next(self) -> Option<(BlobIdIteratorNextResponder)> {
526        if let BlobIdIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
527    }
528
529    /// Name of the method defined in FIDL
530    pub fn method_name(&self) -> &'static str {
531        match *self {
532            BlobIdIteratorRequest::Next { .. } => "next",
533        }
534    }
535}
536
537#[derive(Debug, Clone)]
538pub struct BlobIdIteratorControlHandle {
539    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
540}
541
542impl fidl::endpoints::ControlHandle for BlobIdIteratorControlHandle {
543    fn shutdown(&self) {
544        self.inner.shutdown()
545    }
546    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
547        self.inner.shutdown_with_epitaph(status)
548    }
549
550    fn is_closed(&self) -> bool {
551        self.inner.channel().is_closed()
552    }
553    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
554        self.inner.channel().on_closed()
555    }
556
557    #[cfg(target_os = "fuchsia")]
558    fn signal_peer(
559        &self,
560        clear_mask: zx::Signals,
561        set_mask: zx::Signals,
562    ) -> Result<(), zx_status::Status> {
563        use fidl::Peered;
564        self.inner.channel().signal_peer(clear_mask, set_mask)
565    }
566}
567
568impl BlobIdIteratorControlHandle {}
569
570#[must_use = "FIDL methods require a response to be sent"]
571#[derive(Debug)]
572pub struct BlobIdIteratorNextResponder {
573    control_handle: std::mem::ManuallyDrop<BlobIdIteratorControlHandle>,
574    tx_id: u32,
575}
576
577/// Set the the channel to be shutdown (see [`BlobIdIteratorControlHandle::shutdown`])
578/// if the responder is dropped without sending a response, so that the client
579/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
580impl std::ops::Drop for BlobIdIteratorNextResponder {
581    fn drop(&mut self) {
582        self.control_handle.shutdown();
583        // Safety: drops once, never accessed again
584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
585    }
586}
587
588impl fidl::endpoints::Responder for BlobIdIteratorNextResponder {
589    type ControlHandle = BlobIdIteratorControlHandle;
590
591    fn control_handle(&self) -> &BlobIdIteratorControlHandle {
592        &self.control_handle
593    }
594
595    fn drop_without_shutdown(mut self) {
596        // Safety: drops once, never accessed again due to mem::forget
597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
598        // Prevent Drop from running (which would shut down the channel)
599        std::mem::forget(self);
600    }
601}
602
603impl BlobIdIteratorNextResponder {
604    /// Sends a response to the FIDL transaction.
605    ///
606    /// Sets the channel to shutdown if an error occurs.
607    pub fn send(self, mut blobs: &[BlobId]) -> Result<(), fidl::Error> {
608        let _result = self.send_raw(blobs);
609        if _result.is_err() {
610            self.control_handle.shutdown();
611        }
612        self.drop_without_shutdown();
613        _result
614    }
615
616    /// Similar to "send" but does not shutdown the channel if an error occurs.
617    pub fn send_no_shutdown_on_err(self, mut blobs: &[BlobId]) -> Result<(), fidl::Error> {
618        let _result = self.send_raw(blobs);
619        self.drop_without_shutdown();
620        _result
621    }
622
623    fn send_raw(&self, mut blobs: &[BlobId]) -> Result<(), fidl::Error> {
624        self.control_handle.inner.send::<BlobIdIteratorNextResponse>(
625            (blobs,),
626            self.tx_id,
627            0x5eb0af0daeb8f537,
628            fidl::encoding::DynamicFlags::empty(),
629        )
630    }
631}
632
633#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
634pub struct BlobInfoIteratorMarker;
635
636impl fidl::endpoints::ProtocolMarker for BlobInfoIteratorMarker {
637    type Proxy = BlobInfoIteratorProxy;
638    type RequestStream = BlobInfoIteratorRequestStream;
639    #[cfg(target_os = "fuchsia")]
640    type SynchronousProxy = BlobInfoIteratorSynchronousProxy;
641
642    const DEBUG_NAME: &'static str = "(anonymous) BlobInfoIterator";
643}
644
645pub trait BlobInfoIteratorProxyInterface: Send + Sync {
646    type NextResponseFut: std::future::Future<Output = Result<Vec<BlobInfo>, fidl::Error>> + Send;
647    fn r#next(&self) -> Self::NextResponseFut;
648}
649#[derive(Debug)]
650#[cfg(target_os = "fuchsia")]
651pub struct BlobInfoIteratorSynchronousProxy {
652    client: fidl::client::sync::Client,
653}
654
655#[cfg(target_os = "fuchsia")]
656impl fidl::endpoints::SynchronousProxy for BlobInfoIteratorSynchronousProxy {
657    type Proxy = BlobInfoIteratorProxy;
658    type Protocol = BlobInfoIteratorMarker;
659
660    fn from_channel(inner: fidl::Channel) -> Self {
661        Self::new(inner)
662    }
663
664    fn into_channel(self) -> fidl::Channel {
665        self.client.into_channel()
666    }
667
668    fn as_channel(&self) -> &fidl::Channel {
669        self.client.as_channel()
670    }
671}
672
673#[cfg(target_os = "fuchsia")]
674impl BlobInfoIteratorSynchronousProxy {
675    pub fn new(channel: fidl::Channel) -> Self {
676        let protocol_name = <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
677        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
678    }
679
680    pub fn into_channel(self) -> fidl::Channel {
681        self.client.into_channel()
682    }
683
684    /// Waits until an event arrives and returns it. It is safe for other
685    /// threads to make concurrent requests while waiting for an event.
686    pub fn wait_for_event(
687        &self,
688        deadline: zx::MonotonicInstant,
689    ) -> Result<BlobInfoIteratorEvent, fidl::Error> {
690        BlobInfoIteratorEvent::decode(self.client.wait_for_event(deadline)?)
691    }
692
693    /// Responds with the next chunk of [`BlobInfo`]s. When the iterator is
694    /// exhausted, responds with an empty vector and closes the connection.
695    ///
696    /// - response `blobs` the next chunk of [`BlobInfo`]s.
697    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<BlobInfo>, fidl::Error> {
698        let _response =
699            self.client.send_query::<fidl::encoding::EmptyPayload, BlobInfoIteratorNextResponse>(
700                (),
701                0x2b889489a59b6970,
702                fidl::encoding::DynamicFlags::empty(),
703                ___deadline,
704            )?;
705        Ok(_response.blobs)
706    }
707}
708
709#[cfg(target_os = "fuchsia")]
710impl From<BlobInfoIteratorSynchronousProxy> for zx::Handle {
711    fn from(value: BlobInfoIteratorSynchronousProxy) -> Self {
712        value.into_channel().into()
713    }
714}
715
716#[cfg(target_os = "fuchsia")]
717impl From<fidl::Channel> for BlobInfoIteratorSynchronousProxy {
718    fn from(value: fidl::Channel) -> Self {
719        Self::new(value)
720    }
721}
722
723#[cfg(target_os = "fuchsia")]
724impl fidl::endpoints::FromClient for BlobInfoIteratorSynchronousProxy {
725    type Protocol = BlobInfoIteratorMarker;
726
727    fn from_client(value: fidl::endpoints::ClientEnd<BlobInfoIteratorMarker>) -> Self {
728        Self::new(value.into_channel())
729    }
730}
731
732#[derive(Debug, Clone)]
733pub struct BlobInfoIteratorProxy {
734    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
735}
736
737impl fidl::endpoints::Proxy for BlobInfoIteratorProxy {
738    type Protocol = BlobInfoIteratorMarker;
739
740    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
741        Self::new(inner)
742    }
743
744    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
745        self.client.into_channel().map_err(|client| Self { client })
746    }
747
748    fn as_channel(&self) -> &::fidl::AsyncChannel {
749        self.client.as_channel()
750    }
751}
752
753impl BlobInfoIteratorProxy {
754    /// Create a new Proxy for fuchsia.pkg/BlobInfoIterator.
755    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
756        let protocol_name = <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
757        Self { client: fidl::client::Client::new(channel, protocol_name) }
758    }
759
760    /// Get a Stream of events from the remote end of the protocol.
761    ///
762    /// # Panics
763    ///
764    /// Panics if the event stream was already taken.
765    pub fn take_event_stream(&self) -> BlobInfoIteratorEventStream {
766        BlobInfoIteratorEventStream { event_receiver: self.client.take_event_receiver() }
767    }
768
769    /// Responds with the next chunk of [`BlobInfo`]s. When the iterator is
770    /// exhausted, responds with an empty vector and closes the connection.
771    ///
772    /// - response `blobs` the next chunk of [`BlobInfo`]s.
773    pub fn r#next(
774        &self,
775    ) -> fidl::client::QueryResponseFut<Vec<BlobInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
776    {
777        BlobInfoIteratorProxyInterface::r#next(self)
778    }
779}
780
781impl BlobInfoIteratorProxyInterface for BlobInfoIteratorProxy {
782    type NextResponseFut = fidl::client::QueryResponseFut<
783        Vec<BlobInfo>,
784        fidl::encoding::DefaultFuchsiaResourceDialect,
785    >;
786    fn r#next(&self) -> Self::NextResponseFut {
787        fn _decode(
788            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
789        ) -> Result<Vec<BlobInfo>, fidl::Error> {
790            let _response = fidl::client::decode_transaction_body::<
791                BlobInfoIteratorNextResponse,
792                fidl::encoding::DefaultFuchsiaResourceDialect,
793                0x2b889489a59b6970,
794            >(_buf?)?;
795            Ok(_response.blobs)
796        }
797        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<BlobInfo>>(
798            (),
799            0x2b889489a59b6970,
800            fidl::encoding::DynamicFlags::empty(),
801            _decode,
802        )
803    }
804}
805
806pub struct BlobInfoIteratorEventStream {
807    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
808}
809
810impl std::marker::Unpin for BlobInfoIteratorEventStream {}
811
812impl futures::stream::FusedStream for BlobInfoIteratorEventStream {
813    fn is_terminated(&self) -> bool {
814        self.event_receiver.is_terminated()
815    }
816}
817
818impl futures::Stream for BlobInfoIteratorEventStream {
819    type Item = Result<BlobInfoIteratorEvent, fidl::Error>;
820
821    fn poll_next(
822        mut self: std::pin::Pin<&mut Self>,
823        cx: &mut std::task::Context<'_>,
824    ) -> std::task::Poll<Option<Self::Item>> {
825        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
826            &mut self.event_receiver,
827            cx
828        )?) {
829            Some(buf) => std::task::Poll::Ready(Some(BlobInfoIteratorEvent::decode(buf))),
830            None => std::task::Poll::Ready(None),
831        }
832    }
833}
834
835#[derive(Debug)]
836pub enum BlobInfoIteratorEvent {}
837
838impl BlobInfoIteratorEvent {
839    /// Decodes a message buffer as a [`BlobInfoIteratorEvent`].
840    fn decode(
841        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
842    ) -> Result<BlobInfoIteratorEvent, fidl::Error> {
843        let (bytes, _handles) = buf.split_mut();
844        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
845        debug_assert_eq!(tx_header.tx_id, 0);
846        match tx_header.ordinal {
847            _ => Err(fidl::Error::UnknownOrdinal {
848                ordinal: tx_header.ordinal,
849                protocol_name:
850                    <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
851            }),
852        }
853    }
854}
855
856/// A Stream of incoming requests for fuchsia.pkg/BlobInfoIterator.
857pub struct BlobInfoIteratorRequestStream {
858    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
859    is_terminated: bool,
860}
861
862impl std::marker::Unpin for BlobInfoIteratorRequestStream {}
863
864impl futures::stream::FusedStream for BlobInfoIteratorRequestStream {
865    fn is_terminated(&self) -> bool {
866        self.is_terminated
867    }
868}
869
870impl fidl::endpoints::RequestStream for BlobInfoIteratorRequestStream {
871    type Protocol = BlobInfoIteratorMarker;
872    type ControlHandle = BlobInfoIteratorControlHandle;
873
874    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
875        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
876    }
877
878    fn control_handle(&self) -> Self::ControlHandle {
879        BlobInfoIteratorControlHandle { inner: self.inner.clone() }
880    }
881
882    fn into_inner(
883        self,
884    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
885    {
886        (self.inner, self.is_terminated)
887    }
888
889    fn from_inner(
890        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
891        is_terminated: bool,
892    ) -> Self {
893        Self { inner, is_terminated }
894    }
895}
896
897impl futures::Stream for BlobInfoIteratorRequestStream {
898    type Item = Result<BlobInfoIteratorRequest, fidl::Error>;
899
900    fn poll_next(
901        mut self: std::pin::Pin<&mut Self>,
902        cx: &mut std::task::Context<'_>,
903    ) -> std::task::Poll<Option<Self::Item>> {
904        let this = &mut *self;
905        if this.inner.check_shutdown(cx) {
906            this.is_terminated = true;
907            return std::task::Poll::Ready(None);
908        }
909        if this.is_terminated {
910            panic!("polled BlobInfoIteratorRequestStream after completion");
911        }
912        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
913            |bytes, handles| {
914                match this.inner.channel().read_etc(cx, bytes, handles) {
915                    std::task::Poll::Ready(Ok(())) => {}
916                    std::task::Poll::Pending => return std::task::Poll::Pending,
917                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
918                        this.is_terminated = true;
919                        return std::task::Poll::Ready(None);
920                    }
921                    std::task::Poll::Ready(Err(e)) => {
922                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
923                            e.into(),
924                        ))));
925                    }
926                }
927
928                // A message has been received from the channel
929                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
930
931                std::task::Poll::Ready(Some(match header.ordinal {
932                    0x2b889489a59b6970 => {
933                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
934                        let mut req = fidl::new_empty!(
935                            fidl::encoding::EmptyPayload,
936                            fidl::encoding::DefaultFuchsiaResourceDialect
937                        );
938                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
939                        let control_handle =
940                            BlobInfoIteratorControlHandle { inner: this.inner.clone() };
941                        Ok(BlobInfoIteratorRequest::Next {
942                            responder: BlobInfoIteratorNextResponder {
943                                control_handle: std::mem::ManuallyDrop::new(control_handle),
944                                tx_id: header.tx_id,
945                            },
946                        })
947                    }
948                    _ => Err(fidl::Error::UnknownOrdinal {
949                        ordinal: header.ordinal,
950                        protocol_name:
951                            <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
952                    }),
953                }))
954            },
955        )
956    }
957}
958
959/// A chunked iterator of [`BlobInfo`], allowing transfer of more [`BlobInfo`]s
960/// that can fit in a single FIDL message.
961#[derive(Debug)]
962pub enum BlobInfoIteratorRequest {
963    /// Responds with the next chunk of [`BlobInfo`]s. When the iterator is
964    /// exhausted, responds with an empty vector and closes the connection.
965    ///
966    /// - response `blobs` the next chunk of [`BlobInfo`]s.
967    Next { responder: BlobInfoIteratorNextResponder },
968}
969
970impl BlobInfoIteratorRequest {
971    #[allow(irrefutable_let_patterns)]
972    pub fn into_next(self) -> Option<(BlobInfoIteratorNextResponder)> {
973        if let BlobInfoIteratorRequest::Next { responder } = self {
974            Some((responder))
975        } else {
976            None
977        }
978    }
979
980    /// Name of the method defined in FIDL
981    pub fn method_name(&self) -> &'static str {
982        match *self {
983            BlobInfoIteratorRequest::Next { .. } => "next",
984        }
985    }
986}
987
988#[derive(Debug, Clone)]
989pub struct BlobInfoIteratorControlHandle {
990    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
991}
992
993impl fidl::endpoints::ControlHandle for BlobInfoIteratorControlHandle {
994    fn shutdown(&self) {
995        self.inner.shutdown()
996    }
997    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
998        self.inner.shutdown_with_epitaph(status)
999    }
1000
1001    fn is_closed(&self) -> bool {
1002        self.inner.channel().is_closed()
1003    }
1004    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1005        self.inner.channel().on_closed()
1006    }
1007
1008    #[cfg(target_os = "fuchsia")]
1009    fn signal_peer(
1010        &self,
1011        clear_mask: zx::Signals,
1012        set_mask: zx::Signals,
1013    ) -> Result<(), zx_status::Status> {
1014        use fidl::Peered;
1015        self.inner.channel().signal_peer(clear_mask, set_mask)
1016    }
1017}
1018
1019impl BlobInfoIteratorControlHandle {}
1020
1021#[must_use = "FIDL methods require a response to be sent"]
1022#[derive(Debug)]
1023pub struct BlobInfoIteratorNextResponder {
1024    control_handle: std::mem::ManuallyDrop<BlobInfoIteratorControlHandle>,
1025    tx_id: u32,
1026}
1027
1028/// Set the the channel to be shutdown (see [`BlobInfoIteratorControlHandle::shutdown`])
1029/// if the responder is dropped without sending a response, so that the client
1030/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1031impl std::ops::Drop for BlobInfoIteratorNextResponder {
1032    fn drop(&mut self) {
1033        self.control_handle.shutdown();
1034        // Safety: drops once, never accessed again
1035        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1036    }
1037}
1038
1039impl fidl::endpoints::Responder for BlobInfoIteratorNextResponder {
1040    type ControlHandle = BlobInfoIteratorControlHandle;
1041
1042    fn control_handle(&self) -> &BlobInfoIteratorControlHandle {
1043        &self.control_handle
1044    }
1045
1046    fn drop_without_shutdown(mut self) {
1047        // Safety: drops once, never accessed again due to mem::forget
1048        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1049        // Prevent Drop from running (which would shut down the channel)
1050        std::mem::forget(self);
1051    }
1052}
1053
1054impl BlobInfoIteratorNextResponder {
1055    /// Sends a response to the FIDL transaction.
1056    ///
1057    /// Sets the channel to shutdown if an error occurs.
1058    pub fn send(self, mut blobs: &[BlobInfo]) -> Result<(), fidl::Error> {
1059        let _result = self.send_raw(blobs);
1060        if _result.is_err() {
1061            self.control_handle.shutdown();
1062        }
1063        self.drop_without_shutdown();
1064        _result
1065    }
1066
1067    /// Similar to "send" but does not shutdown the channel if an error occurs.
1068    pub fn send_no_shutdown_on_err(self, mut blobs: &[BlobInfo]) -> Result<(), fidl::Error> {
1069        let _result = self.send_raw(blobs);
1070        self.drop_without_shutdown();
1071        _result
1072    }
1073
1074    fn send_raw(&self, mut blobs: &[BlobInfo]) -> Result<(), fidl::Error> {
1075        self.control_handle.inner.send::<BlobInfoIteratorNextResponse>(
1076            (blobs,),
1077            self.tx_id,
1078            0x2b889489a59b6970,
1079            fidl::encoding::DynamicFlags::empty(),
1080        )
1081    }
1082}
1083
1084#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1085pub struct CupMarker;
1086
1087impl fidl::endpoints::ProtocolMarker for CupMarker {
1088    type Proxy = CupProxy;
1089    type RequestStream = CupRequestStream;
1090    #[cfg(target_os = "fuchsia")]
1091    type SynchronousProxy = CupSynchronousProxy;
1092
1093    const DEBUG_NAME: &'static str = "fuchsia.pkg.Cup";
1094}
1095impl fidl::endpoints::DiscoverableProtocolMarker for CupMarker {}
1096pub type CupWriteResult = Result<(), WriteError>;
1097pub type CupGetInfoResult = Result<(String, String), GetInfoError>;
1098
1099pub trait CupProxyInterface: Send + Sync {
1100    type WriteResponseFut: std::future::Future<Output = Result<CupWriteResult, fidl::Error>> + Send;
1101    fn r#write(&self, url: &PackageUrl, cup: &CupData) -> Self::WriteResponseFut;
1102    type GetInfoResponseFut: std::future::Future<Output = Result<CupGetInfoResult, fidl::Error>>
1103        + Send;
1104    fn r#get_info(&self, url: &PackageUrl) -> Self::GetInfoResponseFut;
1105}
1106#[derive(Debug)]
1107#[cfg(target_os = "fuchsia")]
1108pub struct CupSynchronousProxy {
1109    client: fidl::client::sync::Client,
1110}
1111
1112#[cfg(target_os = "fuchsia")]
1113impl fidl::endpoints::SynchronousProxy for CupSynchronousProxy {
1114    type Proxy = CupProxy;
1115    type Protocol = CupMarker;
1116
1117    fn from_channel(inner: fidl::Channel) -> Self {
1118        Self::new(inner)
1119    }
1120
1121    fn into_channel(self) -> fidl::Channel {
1122        self.client.into_channel()
1123    }
1124
1125    fn as_channel(&self) -> &fidl::Channel {
1126        self.client.as_channel()
1127    }
1128}
1129
1130#[cfg(target_os = "fuchsia")]
1131impl CupSynchronousProxy {
1132    pub fn new(channel: fidl::Channel) -> Self {
1133        let protocol_name = <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1134        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1135    }
1136
1137    pub fn into_channel(self) -> fidl::Channel {
1138        self.client.into_channel()
1139    }
1140
1141    /// Waits until an event arrives and returns it. It is safe for other
1142    /// threads to make concurrent requests while waiting for an event.
1143    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<CupEvent, fidl::Error> {
1144        CupEvent::decode(self.client.wait_for_event(deadline)?)
1145    }
1146
1147    /// Resolve the eager package given by the pinned package URL, and write the
1148    /// CUP data to storage.
1149    pub fn r#write(
1150        &self,
1151        mut url: &PackageUrl,
1152        mut cup: &CupData,
1153        ___deadline: zx::MonotonicInstant,
1154    ) -> Result<CupWriteResult, fidl::Error> {
1155        let _response = self.client.send_query::<CupWriteRequest, fidl::encoding::ResultType<
1156            fidl::encoding::EmptyStruct,
1157            WriteError,
1158        >>(
1159            (url, cup),
1160            0x29f30e83bda39c37,
1161            fidl::encoding::DynamicFlags::empty(),
1162            ___deadline,
1163        )?;
1164        Ok(_response.map(|x| x))
1165    }
1166
1167    /// Returns the eager package version and channel of the given package URL.
1168    pub fn r#get_info(
1169        &self,
1170        mut url: &PackageUrl,
1171        ___deadline: zx::MonotonicInstant,
1172    ) -> Result<CupGetInfoResult, fidl::Error> {
1173        let _response = self.client.send_query::<
1174            CupGetInfoRequest,
1175            fidl::encoding::ResultType<CupGetInfoResponse, GetInfoError>,
1176        >(
1177            (url,),
1178            0x5b2cedd887209b9c,
1179            fidl::encoding::DynamicFlags::empty(),
1180            ___deadline,
1181        )?;
1182        Ok(_response.map(|x| (x.version, x.channel)))
1183    }
1184}
1185
1186#[cfg(target_os = "fuchsia")]
1187impl From<CupSynchronousProxy> for zx::Handle {
1188    fn from(value: CupSynchronousProxy) -> Self {
1189        value.into_channel().into()
1190    }
1191}
1192
1193#[cfg(target_os = "fuchsia")]
1194impl From<fidl::Channel> for CupSynchronousProxy {
1195    fn from(value: fidl::Channel) -> Self {
1196        Self::new(value)
1197    }
1198}
1199
1200#[cfg(target_os = "fuchsia")]
1201impl fidl::endpoints::FromClient for CupSynchronousProxy {
1202    type Protocol = CupMarker;
1203
1204    fn from_client(value: fidl::endpoints::ClientEnd<CupMarker>) -> Self {
1205        Self::new(value.into_channel())
1206    }
1207}
1208
1209#[derive(Debug, Clone)]
1210pub struct CupProxy {
1211    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1212}
1213
1214impl fidl::endpoints::Proxy for CupProxy {
1215    type Protocol = CupMarker;
1216
1217    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1218        Self::new(inner)
1219    }
1220
1221    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1222        self.client.into_channel().map_err(|client| Self { client })
1223    }
1224
1225    fn as_channel(&self) -> &::fidl::AsyncChannel {
1226        self.client.as_channel()
1227    }
1228}
1229
1230impl CupProxy {
1231    /// Create a new Proxy for fuchsia.pkg/Cup.
1232    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1233        let protocol_name = <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1234        Self { client: fidl::client::Client::new(channel, protocol_name) }
1235    }
1236
1237    /// Get a Stream of events from the remote end of the protocol.
1238    ///
1239    /// # Panics
1240    ///
1241    /// Panics if the event stream was already taken.
1242    pub fn take_event_stream(&self) -> CupEventStream {
1243        CupEventStream { event_receiver: self.client.take_event_receiver() }
1244    }
1245
1246    /// Resolve the eager package given by the pinned package URL, and write the
1247    /// CUP data to storage.
1248    pub fn r#write(
1249        &self,
1250        mut url: &PackageUrl,
1251        mut cup: &CupData,
1252    ) -> fidl::client::QueryResponseFut<CupWriteResult, fidl::encoding::DefaultFuchsiaResourceDialect>
1253    {
1254        CupProxyInterface::r#write(self, url, cup)
1255    }
1256
1257    /// Returns the eager package version and channel of the given package URL.
1258    pub fn r#get_info(
1259        &self,
1260        mut url: &PackageUrl,
1261    ) -> fidl::client::QueryResponseFut<
1262        CupGetInfoResult,
1263        fidl::encoding::DefaultFuchsiaResourceDialect,
1264    > {
1265        CupProxyInterface::r#get_info(self, url)
1266    }
1267}
1268
1269impl CupProxyInterface for CupProxy {
1270    type WriteResponseFut = fidl::client::QueryResponseFut<
1271        CupWriteResult,
1272        fidl::encoding::DefaultFuchsiaResourceDialect,
1273    >;
1274    fn r#write(&self, mut url: &PackageUrl, mut cup: &CupData) -> Self::WriteResponseFut {
1275        fn _decode(
1276            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1277        ) -> Result<CupWriteResult, fidl::Error> {
1278            let _response = fidl::client::decode_transaction_body::<
1279                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, WriteError>,
1280                fidl::encoding::DefaultFuchsiaResourceDialect,
1281                0x29f30e83bda39c37,
1282            >(_buf?)?;
1283            Ok(_response.map(|x| x))
1284        }
1285        self.client.send_query_and_decode::<CupWriteRequest, CupWriteResult>(
1286            (url, cup),
1287            0x29f30e83bda39c37,
1288            fidl::encoding::DynamicFlags::empty(),
1289            _decode,
1290        )
1291    }
1292
1293    type GetInfoResponseFut = fidl::client::QueryResponseFut<
1294        CupGetInfoResult,
1295        fidl::encoding::DefaultFuchsiaResourceDialect,
1296    >;
1297    fn r#get_info(&self, mut url: &PackageUrl) -> Self::GetInfoResponseFut {
1298        fn _decode(
1299            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1300        ) -> Result<CupGetInfoResult, fidl::Error> {
1301            let _response = fidl::client::decode_transaction_body::<
1302                fidl::encoding::ResultType<CupGetInfoResponse, GetInfoError>,
1303                fidl::encoding::DefaultFuchsiaResourceDialect,
1304                0x5b2cedd887209b9c,
1305            >(_buf?)?;
1306            Ok(_response.map(|x| (x.version, x.channel)))
1307        }
1308        self.client.send_query_and_decode::<CupGetInfoRequest, CupGetInfoResult>(
1309            (url,),
1310            0x5b2cedd887209b9c,
1311            fidl::encoding::DynamicFlags::empty(),
1312            _decode,
1313        )
1314    }
1315}
1316
1317pub struct CupEventStream {
1318    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1319}
1320
1321impl std::marker::Unpin for CupEventStream {}
1322
1323impl futures::stream::FusedStream for CupEventStream {
1324    fn is_terminated(&self) -> bool {
1325        self.event_receiver.is_terminated()
1326    }
1327}
1328
1329impl futures::Stream for CupEventStream {
1330    type Item = Result<CupEvent, fidl::Error>;
1331
1332    fn poll_next(
1333        mut self: std::pin::Pin<&mut Self>,
1334        cx: &mut std::task::Context<'_>,
1335    ) -> std::task::Poll<Option<Self::Item>> {
1336        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1337            &mut self.event_receiver,
1338            cx
1339        )?) {
1340            Some(buf) => std::task::Poll::Ready(Some(CupEvent::decode(buf))),
1341            None => std::task::Poll::Ready(None),
1342        }
1343    }
1344}
1345
1346#[derive(Debug)]
1347pub enum CupEvent {}
1348
1349impl CupEvent {
1350    /// Decodes a message buffer as a [`CupEvent`].
1351    fn decode(
1352        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1353    ) -> Result<CupEvent, fidl::Error> {
1354        let (bytes, _handles) = buf.split_mut();
1355        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1356        debug_assert_eq!(tx_header.tx_id, 0);
1357        match tx_header.ordinal {
1358            _ => Err(fidl::Error::UnknownOrdinal {
1359                ordinal: tx_header.ordinal,
1360                protocol_name: <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1361            }),
1362        }
1363    }
1364}
1365
1366/// A Stream of incoming requests for fuchsia.pkg/Cup.
1367pub struct CupRequestStream {
1368    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1369    is_terminated: bool,
1370}
1371
1372impl std::marker::Unpin for CupRequestStream {}
1373
1374impl futures::stream::FusedStream for CupRequestStream {
1375    fn is_terminated(&self) -> bool {
1376        self.is_terminated
1377    }
1378}
1379
1380impl fidl::endpoints::RequestStream for CupRequestStream {
1381    type Protocol = CupMarker;
1382    type ControlHandle = CupControlHandle;
1383
1384    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1385        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1386    }
1387
1388    fn control_handle(&self) -> Self::ControlHandle {
1389        CupControlHandle { inner: self.inner.clone() }
1390    }
1391
1392    fn into_inner(
1393        self,
1394    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1395    {
1396        (self.inner, self.is_terminated)
1397    }
1398
1399    fn from_inner(
1400        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1401        is_terminated: bool,
1402    ) -> Self {
1403        Self { inner, is_terminated }
1404    }
1405}
1406
1407impl futures::Stream for CupRequestStream {
1408    type Item = Result<CupRequest, fidl::Error>;
1409
1410    fn poll_next(
1411        mut self: std::pin::Pin<&mut Self>,
1412        cx: &mut std::task::Context<'_>,
1413    ) -> std::task::Poll<Option<Self::Item>> {
1414        let this = &mut *self;
1415        if this.inner.check_shutdown(cx) {
1416            this.is_terminated = true;
1417            return std::task::Poll::Ready(None);
1418        }
1419        if this.is_terminated {
1420            panic!("polled CupRequestStream after completion");
1421        }
1422        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1423            |bytes, handles| {
1424                match this.inner.channel().read_etc(cx, bytes, handles) {
1425                    std::task::Poll::Ready(Ok(())) => {}
1426                    std::task::Poll::Pending => return std::task::Poll::Pending,
1427                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1428                        this.is_terminated = true;
1429                        return std::task::Poll::Ready(None);
1430                    }
1431                    std::task::Poll::Ready(Err(e)) => {
1432                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1433                            e.into(),
1434                        ))));
1435                    }
1436                }
1437
1438                // A message has been received from the channel
1439                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1440
1441                std::task::Poll::Ready(Some(match header.ordinal {
1442                    0x29f30e83bda39c37 => {
1443                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1444                        let mut req = fidl::new_empty!(
1445                            CupWriteRequest,
1446                            fidl::encoding::DefaultFuchsiaResourceDialect
1447                        );
1448                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CupWriteRequest>(&header, _body_bytes, handles, &mut req)?;
1449                        let control_handle = CupControlHandle { inner: this.inner.clone() };
1450                        Ok(CupRequest::Write {
1451                            url: req.url,
1452                            cup: req.cup,
1453
1454                            responder: CupWriteResponder {
1455                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1456                                tx_id: header.tx_id,
1457                            },
1458                        })
1459                    }
1460                    0x5b2cedd887209b9c => {
1461                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1462                        let mut req = fidl::new_empty!(
1463                            CupGetInfoRequest,
1464                            fidl::encoding::DefaultFuchsiaResourceDialect
1465                        );
1466                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CupGetInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1467                        let control_handle = CupControlHandle { inner: this.inner.clone() };
1468                        Ok(CupRequest::GetInfo {
1469                            url: req.url,
1470
1471                            responder: CupGetInfoResponder {
1472                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1473                                tx_id: header.tx_id,
1474                            },
1475                        })
1476                    }
1477                    _ => Err(fidl::Error::UnknownOrdinal {
1478                        ordinal: header.ordinal,
1479                        protocol_name: <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1480                    }),
1481                }))
1482            },
1483        )
1484    }
1485}
1486
1487/// This protocol gives access to persisted CUP data for eager packages in
1488/// pkg-resolver.
1489#[derive(Debug)]
1490pub enum CupRequest {
1491    /// Resolve the eager package given by the pinned package URL, and write the
1492    /// CUP data to storage.
1493    Write { url: PackageUrl, cup: CupData, responder: CupWriteResponder },
1494    /// Returns the eager package version and channel of the given package URL.
1495    GetInfo { url: PackageUrl, responder: CupGetInfoResponder },
1496}
1497
1498impl CupRequest {
1499    #[allow(irrefutable_let_patterns)]
1500    pub fn into_write(self) -> Option<(PackageUrl, CupData, CupWriteResponder)> {
1501        if let CupRequest::Write { url, cup, responder } = self {
1502            Some((url, cup, responder))
1503        } else {
1504            None
1505        }
1506    }
1507
1508    #[allow(irrefutable_let_patterns)]
1509    pub fn into_get_info(self) -> Option<(PackageUrl, CupGetInfoResponder)> {
1510        if let CupRequest::GetInfo { url, responder } = self {
1511            Some((url, responder))
1512        } else {
1513            None
1514        }
1515    }
1516
1517    /// Name of the method defined in FIDL
1518    pub fn method_name(&self) -> &'static str {
1519        match *self {
1520            CupRequest::Write { .. } => "write",
1521            CupRequest::GetInfo { .. } => "get_info",
1522        }
1523    }
1524}
1525
1526#[derive(Debug, Clone)]
1527pub struct CupControlHandle {
1528    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1529}
1530
1531impl fidl::endpoints::ControlHandle for CupControlHandle {
1532    fn shutdown(&self) {
1533        self.inner.shutdown()
1534    }
1535    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1536        self.inner.shutdown_with_epitaph(status)
1537    }
1538
1539    fn is_closed(&self) -> bool {
1540        self.inner.channel().is_closed()
1541    }
1542    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1543        self.inner.channel().on_closed()
1544    }
1545
1546    #[cfg(target_os = "fuchsia")]
1547    fn signal_peer(
1548        &self,
1549        clear_mask: zx::Signals,
1550        set_mask: zx::Signals,
1551    ) -> Result<(), zx_status::Status> {
1552        use fidl::Peered;
1553        self.inner.channel().signal_peer(clear_mask, set_mask)
1554    }
1555}
1556
1557impl CupControlHandle {}
1558
1559#[must_use = "FIDL methods require a response to be sent"]
1560#[derive(Debug)]
1561pub struct CupWriteResponder {
1562    control_handle: std::mem::ManuallyDrop<CupControlHandle>,
1563    tx_id: u32,
1564}
1565
1566/// Set the the channel to be shutdown (see [`CupControlHandle::shutdown`])
1567/// if the responder is dropped without sending a response, so that the client
1568/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1569impl std::ops::Drop for CupWriteResponder {
1570    fn drop(&mut self) {
1571        self.control_handle.shutdown();
1572        // Safety: drops once, never accessed again
1573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1574    }
1575}
1576
1577impl fidl::endpoints::Responder for CupWriteResponder {
1578    type ControlHandle = CupControlHandle;
1579
1580    fn control_handle(&self) -> &CupControlHandle {
1581        &self.control_handle
1582    }
1583
1584    fn drop_without_shutdown(mut self) {
1585        // Safety: drops once, never accessed again due to mem::forget
1586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1587        // Prevent Drop from running (which would shut down the channel)
1588        std::mem::forget(self);
1589    }
1590}
1591
1592impl CupWriteResponder {
1593    /// Sends a response to the FIDL transaction.
1594    ///
1595    /// Sets the channel to shutdown if an error occurs.
1596    pub fn send(self, mut result: Result<(), WriteError>) -> Result<(), fidl::Error> {
1597        let _result = self.send_raw(result);
1598        if _result.is_err() {
1599            self.control_handle.shutdown();
1600        }
1601        self.drop_without_shutdown();
1602        _result
1603    }
1604
1605    /// Similar to "send" but does not shutdown the channel if an error occurs.
1606    pub fn send_no_shutdown_on_err(
1607        self,
1608        mut result: Result<(), WriteError>,
1609    ) -> Result<(), fidl::Error> {
1610        let _result = self.send_raw(result);
1611        self.drop_without_shutdown();
1612        _result
1613    }
1614
1615    fn send_raw(&self, mut result: Result<(), WriteError>) -> Result<(), fidl::Error> {
1616        self.control_handle
1617            .inner
1618            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, WriteError>>(
1619                result,
1620                self.tx_id,
1621                0x29f30e83bda39c37,
1622                fidl::encoding::DynamicFlags::empty(),
1623            )
1624    }
1625}
1626
1627#[must_use = "FIDL methods require a response to be sent"]
1628#[derive(Debug)]
1629pub struct CupGetInfoResponder {
1630    control_handle: std::mem::ManuallyDrop<CupControlHandle>,
1631    tx_id: u32,
1632}
1633
1634/// Set the the channel to be shutdown (see [`CupControlHandle::shutdown`])
1635/// if the responder is dropped without sending a response, so that the client
1636/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1637impl std::ops::Drop for CupGetInfoResponder {
1638    fn drop(&mut self) {
1639        self.control_handle.shutdown();
1640        // Safety: drops once, never accessed again
1641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1642    }
1643}
1644
1645impl fidl::endpoints::Responder for CupGetInfoResponder {
1646    type ControlHandle = CupControlHandle;
1647
1648    fn control_handle(&self) -> &CupControlHandle {
1649        &self.control_handle
1650    }
1651
1652    fn drop_without_shutdown(mut self) {
1653        // Safety: drops once, never accessed again due to mem::forget
1654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1655        // Prevent Drop from running (which would shut down the channel)
1656        std::mem::forget(self);
1657    }
1658}
1659
1660impl CupGetInfoResponder {
1661    /// Sends a response to the FIDL transaction.
1662    ///
1663    /// Sets the channel to shutdown if an error occurs.
1664    pub fn send(self, mut result: Result<(&str, &str), GetInfoError>) -> Result<(), fidl::Error> {
1665        let _result = self.send_raw(result);
1666        if _result.is_err() {
1667            self.control_handle.shutdown();
1668        }
1669        self.drop_without_shutdown();
1670        _result
1671    }
1672
1673    /// Similar to "send" but does not shutdown the channel if an error occurs.
1674    pub fn send_no_shutdown_on_err(
1675        self,
1676        mut result: Result<(&str, &str), GetInfoError>,
1677    ) -> Result<(), fidl::Error> {
1678        let _result = self.send_raw(result);
1679        self.drop_without_shutdown();
1680        _result
1681    }
1682
1683    fn send_raw(&self, mut result: Result<(&str, &str), GetInfoError>) -> Result<(), fidl::Error> {
1684        self.control_handle
1685            .inner
1686            .send::<fidl::encoding::ResultType<CupGetInfoResponse, GetInfoError>>(
1687                result,
1688                self.tx_id,
1689                0x5b2cedd887209b9c,
1690                fidl::encoding::DynamicFlags::empty(),
1691            )
1692    }
1693}
1694
1695#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1696pub struct FontResolverMarker;
1697
1698impl fidl::endpoints::ProtocolMarker for FontResolverMarker {
1699    type Proxy = FontResolverProxy;
1700    type RequestStream = FontResolverRequestStream;
1701    #[cfg(target_os = "fuchsia")]
1702    type SynchronousProxy = FontResolverSynchronousProxy;
1703
1704    const DEBUG_NAME: &'static str = "fuchsia.pkg.FontResolver";
1705}
1706impl fidl::endpoints::DiscoverableProtocolMarker for FontResolverMarker {}
1707pub type FontResolverResolveResult = Result<(), i32>;
1708
1709pub trait FontResolverProxyInterface: Send + Sync {
1710    type ResolveResponseFut: std::future::Future<Output = Result<FontResolverResolveResult, fidl::Error>>
1711        + Send;
1712    fn r#resolve(
1713        &self,
1714        package_url: &str,
1715        directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1716    ) -> Self::ResolveResponseFut;
1717}
1718#[derive(Debug)]
1719#[cfg(target_os = "fuchsia")]
1720pub struct FontResolverSynchronousProxy {
1721    client: fidl::client::sync::Client,
1722}
1723
1724#[cfg(target_os = "fuchsia")]
1725impl fidl::endpoints::SynchronousProxy for FontResolverSynchronousProxy {
1726    type Proxy = FontResolverProxy;
1727    type Protocol = FontResolverMarker;
1728
1729    fn from_channel(inner: fidl::Channel) -> Self {
1730        Self::new(inner)
1731    }
1732
1733    fn into_channel(self) -> fidl::Channel {
1734        self.client.into_channel()
1735    }
1736
1737    fn as_channel(&self) -> &fidl::Channel {
1738        self.client.as_channel()
1739    }
1740}
1741
1742#[cfg(target_os = "fuchsia")]
1743impl FontResolverSynchronousProxy {
1744    pub fn new(channel: fidl::Channel) -> Self {
1745        let protocol_name = <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1746        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1747    }
1748
1749    pub fn into_channel(self) -> fidl::Channel {
1750        self.client.into_channel()
1751    }
1752
1753    /// Waits until an event arrives and returns it. It is safe for other
1754    /// threads to make concurrent requests while waiting for an event.
1755    pub fn wait_for_event(
1756        &self,
1757        deadline: zx::MonotonicInstant,
1758    ) -> Result<FontResolverEvent, fidl::Error> {
1759        FontResolverEvent::decode(self.client.wait_for_event(deadline)?)
1760    }
1761
1762    /// Populates or updates the cache of a font package, fetching it if it is not present on the
1763    /// local system.
1764    ///
1765    /// + request `package_url` the package URL of a font package.
1766    /// + request `directory_request` a request for a directory that will be resolved when the
1767    ///   package has been successfully cached. The directory should contain a single file,
1768    ///   corresponding to the asset filename. The client should retain the directory handle
1769    ///   for as long as needed to prevent the package from being evicted from cache.
1770    /// * error a zx_status value indicating failure. One of the following:
1771    ///     * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a
1772    ///       package blob.
1773    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
1774    ///     * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is
1775    ///       not known to be a font package.
1776    ///     * `ZX_ERR_NO_SPACE` if there is no space available to store the package.
1777    ///     * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob.
1778    pub fn r#resolve(
1779        &self,
1780        mut package_url: &str,
1781        mut directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1782        ___deadline: zx::MonotonicInstant,
1783    ) -> Result<FontResolverResolveResult, fidl::Error> {
1784        let _response = self.client.send_query::<
1785            FontResolverResolveRequest,
1786            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1787        >(
1788            (package_url, directory_request,),
1789            0x159f60cc5ba432da,
1790            fidl::encoding::DynamicFlags::empty(),
1791            ___deadline,
1792        )?;
1793        Ok(_response.map(|x| x))
1794    }
1795}
1796
1797#[cfg(target_os = "fuchsia")]
1798impl From<FontResolverSynchronousProxy> for zx::Handle {
1799    fn from(value: FontResolverSynchronousProxy) -> Self {
1800        value.into_channel().into()
1801    }
1802}
1803
1804#[cfg(target_os = "fuchsia")]
1805impl From<fidl::Channel> for FontResolverSynchronousProxy {
1806    fn from(value: fidl::Channel) -> Self {
1807        Self::new(value)
1808    }
1809}
1810
1811#[cfg(target_os = "fuchsia")]
1812impl fidl::endpoints::FromClient for FontResolverSynchronousProxy {
1813    type Protocol = FontResolverMarker;
1814
1815    fn from_client(value: fidl::endpoints::ClientEnd<FontResolverMarker>) -> Self {
1816        Self::new(value.into_channel())
1817    }
1818}
1819
1820#[derive(Debug, Clone)]
1821pub struct FontResolverProxy {
1822    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1823}
1824
1825impl fidl::endpoints::Proxy for FontResolverProxy {
1826    type Protocol = FontResolverMarker;
1827
1828    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1829        Self::new(inner)
1830    }
1831
1832    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1833        self.client.into_channel().map_err(|client| Self { client })
1834    }
1835
1836    fn as_channel(&self) -> &::fidl::AsyncChannel {
1837        self.client.as_channel()
1838    }
1839}
1840
1841impl FontResolverProxy {
1842    /// Create a new Proxy for fuchsia.pkg/FontResolver.
1843    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1844        let protocol_name = <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1845        Self { client: fidl::client::Client::new(channel, protocol_name) }
1846    }
1847
1848    /// Get a Stream of events from the remote end of the protocol.
1849    ///
1850    /// # Panics
1851    ///
1852    /// Panics if the event stream was already taken.
1853    pub fn take_event_stream(&self) -> FontResolverEventStream {
1854        FontResolverEventStream { event_receiver: self.client.take_event_receiver() }
1855    }
1856
1857    /// Populates or updates the cache of a font package, fetching it if it is not present on the
1858    /// local system.
1859    ///
1860    /// + request `package_url` the package URL of a font package.
1861    /// + request `directory_request` a request for a directory that will be resolved when the
1862    ///   package has been successfully cached. The directory should contain a single file,
1863    ///   corresponding to the asset filename. The client should retain the directory handle
1864    ///   for as long as needed to prevent the package from being evicted from cache.
1865    /// * error a zx_status value indicating failure. One of the following:
1866    ///     * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a
1867    ///       package blob.
1868    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
1869    ///     * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is
1870    ///       not known to be a font package.
1871    ///     * `ZX_ERR_NO_SPACE` if there is no space available to store the package.
1872    ///     * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob.
1873    pub fn r#resolve(
1874        &self,
1875        mut package_url: &str,
1876        mut directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1877    ) -> fidl::client::QueryResponseFut<
1878        FontResolverResolveResult,
1879        fidl::encoding::DefaultFuchsiaResourceDialect,
1880    > {
1881        FontResolverProxyInterface::r#resolve(self, package_url, directory_request)
1882    }
1883}
1884
1885impl FontResolverProxyInterface for FontResolverProxy {
1886    type ResolveResponseFut = fidl::client::QueryResponseFut<
1887        FontResolverResolveResult,
1888        fidl::encoding::DefaultFuchsiaResourceDialect,
1889    >;
1890    fn r#resolve(
1891        &self,
1892        mut package_url: &str,
1893        mut directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1894    ) -> Self::ResolveResponseFut {
1895        fn _decode(
1896            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1897        ) -> Result<FontResolverResolveResult, fidl::Error> {
1898            let _response = fidl::client::decode_transaction_body::<
1899                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1900                fidl::encoding::DefaultFuchsiaResourceDialect,
1901                0x159f60cc5ba432da,
1902            >(_buf?)?;
1903            Ok(_response.map(|x| x))
1904        }
1905        self.client.send_query_and_decode::<FontResolverResolveRequest, FontResolverResolveResult>(
1906            (package_url, directory_request),
1907            0x159f60cc5ba432da,
1908            fidl::encoding::DynamicFlags::empty(),
1909            _decode,
1910        )
1911    }
1912}
1913
1914pub struct FontResolverEventStream {
1915    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1916}
1917
1918impl std::marker::Unpin for FontResolverEventStream {}
1919
1920impl futures::stream::FusedStream for FontResolverEventStream {
1921    fn is_terminated(&self) -> bool {
1922        self.event_receiver.is_terminated()
1923    }
1924}
1925
1926impl futures::Stream for FontResolverEventStream {
1927    type Item = Result<FontResolverEvent, fidl::Error>;
1928
1929    fn poll_next(
1930        mut self: std::pin::Pin<&mut Self>,
1931        cx: &mut std::task::Context<'_>,
1932    ) -> std::task::Poll<Option<Self::Item>> {
1933        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1934            &mut self.event_receiver,
1935            cx
1936        )?) {
1937            Some(buf) => std::task::Poll::Ready(Some(FontResolverEvent::decode(buf))),
1938            None => std::task::Poll::Ready(None),
1939        }
1940    }
1941}
1942
1943#[derive(Debug)]
1944pub enum FontResolverEvent {}
1945
1946impl FontResolverEvent {
1947    /// Decodes a message buffer as a [`FontResolverEvent`].
1948    fn decode(
1949        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1950    ) -> Result<FontResolverEvent, fidl::Error> {
1951        let (bytes, _handles) = buf.split_mut();
1952        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1953        debug_assert_eq!(tx_header.tx_id, 0);
1954        match tx_header.ordinal {
1955            _ => Err(fidl::Error::UnknownOrdinal {
1956                ordinal: tx_header.ordinal,
1957                protocol_name: <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1958            }),
1959        }
1960    }
1961}
1962
1963/// A Stream of incoming requests for fuchsia.pkg/FontResolver.
1964pub struct FontResolverRequestStream {
1965    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1966    is_terminated: bool,
1967}
1968
1969impl std::marker::Unpin for FontResolverRequestStream {}
1970
1971impl futures::stream::FusedStream for FontResolverRequestStream {
1972    fn is_terminated(&self) -> bool {
1973        self.is_terminated
1974    }
1975}
1976
1977impl fidl::endpoints::RequestStream for FontResolverRequestStream {
1978    type Protocol = FontResolverMarker;
1979    type ControlHandle = FontResolverControlHandle;
1980
1981    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1982        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1983    }
1984
1985    fn control_handle(&self) -> Self::ControlHandle {
1986        FontResolverControlHandle { inner: self.inner.clone() }
1987    }
1988
1989    fn into_inner(
1990        self,
1991    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1992    {
1993        (self.inner, self.is_terminated)
1994    }
1995
1996    fn from_inner(
1997        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1998        is_terminated: bool,
1999    ) -> Self {
2000        Self { inner, is_terminated }
2001    }
2002}
2003
2004impl futures::Stream for FontResolverRequestStream {
2005    type Item = Result<FontResolverRequest, fidl::Error>;
2006
2007    fn poll_next(
2008        mut self: std::pin::Pin<&mut Self>,
2009        cx: &mut std::task::Context<'_>,
2010    ) -> std::task::Poll<Option<Self::Item>> {
2011        let this = &mut *self;
2012        if this.inner.check_shutdown(cx) {
2013            this.is_terminated = true;
2014            return std::task::Poll::Ready(None);
2015        }
2016        if this.is_terminated {
2017            panic!("polled FontResolverRequestStream after completion");
2018        }
2019        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2020            |bytes, handles| {
2021                match this.inner.channel().read_etc(cx, bytes, handles) {
2022                    std::task::Poll::Ready(Ok(())) => {}
2023                    std::task::Poll::Pending => return std::task::Poll::Pending,
2024                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2025                        this.is_terminated = true;
2026                        return std::task::Poll::Ready(None);
2027                    }
2028                    std::task::Poll::Ready(Err(e)) => {
2029                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2030                            e.into(),
2031                        ))));
2032                    }
2033                }
2034
2035                // A message has been received from the channel
2036                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2037
2038                std::task::Poll::Ready(Some(match header.ordinal {
2039                    0x159f60cc5ba432da => {
2040                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2041                        let mut req = fidl::new_empty!(
2042                            FontResolverResolveRequest,
2043                            fidl::encoding::DefaultFuchsiaResourceDialect
2044                        );
2045                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FontResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
2046                        let control_handle =
2047                            FontResolverControlHandle { inner: this.inner.clone() };
2048                        Ok(FontResolverRequest::Resolve {
2049                            package_url: req.package_url,
2050                            directory_request: req.directory_request,
2051
2052                            responder: FontResolverResolveResponder {
2053                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2054                                tx_id: header.tx_id,
2055                            },
2056                        })
2057                    }
2058                    _ => Err(fidl::Error::UnknownOrdinal {
2059                        ordinal: header.ordinal,
2060                        protocol_name:
2061                            <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2062                    }),
2063                }))
2064            },
2065        )
2066    }
2067}
2068
2069/// This resolves font packages from a registry.
2070///
2071/// This is intended to be implemented by package resolver components, and used
2072/// exclusively by fuchsia.fonts.Provider.
2073///
2074/// DEPRECATED. This is an interim solution, and will be revisited when Component Framework v2
2075/// becomes available and allows non-component packages and easier directory routing.
2076#[derive(Debug)]
2077pub enum FontResolverRequest {
2078    /// Populates or updates the cache of a font package, fetching it if it is not present on the
2079    /// local system.
2080    ///
2081    /// + request `package_url` the package URL of a font package.
2082    /// + request `directory_request` a request for a directory that will be resolved when the
2083    ///   package has been successfully cached. The directory should contain a single file,
2084    ///   corresponding to the asset filename. The client should retain the directory handle
2085    ///   for as long as needed to prevent the package from being evicted from cache.
2086    /// * error a zx_status value indicating failure. One of the following:
2087    ///     * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a
2088    ///       package blob.
2089    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
2090    ///     * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is
2091    ///       not known to be a font package.
2092    ///     * `ZX_ERR_NO_SPACE` if there is no space available to store the package.
2093    ///     * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob.
2094    Resolve {
2095        package_url: String,
2096        directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2097        responder: FontResolverResolveResponder,
2098    },
2099}
2100
2101impl FontResolverRequest {
2102    #[allow(irrefutable_let_patterns)]
2103    pub fn into_resolve(
2104        self,
2105    ) -> Option<(
2106        String,
2107        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2108        FontResolverResolveResponder,
2109    )> {
2110        if let FontResolverRequest::Resolve { package_url, directory_request, responder } = self {
2111            Some((package_url, directory_request, responder))
2112        } else {
2113            None
2114        }
2115    }
2116
2117    /// Name of the method defined in FIDL
2118    pub fn method_name(&self) -> &'static str {
2119        match *self {
2120            FontResolverRequest::Resolve { .. } => "resolve",
2121        }
2122    }
2123}
2124
2125#[derive(Debug, Clone)]
2126pub struct FontResolverControlHandle {
2127    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2128}
2129
2130impl fidl::endpoints::ControlHandle for FontResolverControlHandle {
2131    fn shutdown(&self) {
2132        self.inner.shutdown()
2133    }
2134    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2135        self.inner.shutdown_with_epitaph(status)
2136    }
2137
2138    fn is_closed(&self) -> bool {
2139        self.inner.channel().is_closed()
2140    }
2141    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2142        self.inner.channel().on_closed()
2143    }
2144
2145    #[cfg(target_os = "fuchsia")]
2146    fn signal_peer(
2147        &self,
2148        clear_mask: zx::Signals,
2149        set_mask: zx::Signals,
2150    ) -> Result<(), zx_status::Status> {
2151        use fidl::Peered;
2152        self.inner.channel().signal_peer(clear_mask, set_mask)
2153    }
2154}
2155
2156impl FontResolverControlHandle {}
2157
2158#[must_use = "FIDL methods require a response to be sent"]
2159#[derive(Debug)]
2160pub struct FontResolverResolveResponder {
2161    control_handle: std::mem::ManuallyDrop<FontResolverControlHandle>,
2162    tx_id: u32,
2163}
2164
2165/// Set the the channel to be shutdown (see [`FontResolverControlHandle::shutdown`])
2166/// if the responder is dropped without sending a response, so that the client
2167/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2168impl std::ops::Drop for FontResolverResolveResponder {
2169    fn drop(&mut self) {
2170        self.control_handle.shutdown();
2171        // Safety: drops once, never accessed again
2172        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2173    }
2174}
2175
2176impl fidl::endpoints::Responder for FontResolverResolveResponder {
2177    type ControlHandle = FontResolverControlHandle;
2178
2179    fn control_handle(&self) -> &FontResolverControlHandle {
2180        &self.control_handle
2181    }
2182
2183    fn drop_without_shutdown(mut self) {
2184        // Safety: drops once, never accessed again due to mem::forget
2185        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2186        // Prevent Drop from running (which would shut down the channel)
2187        std::mem::forget(self);
2188    }
2189}
2190
2191impl FontResolverResolveResponder {
2192    /// Sends a response to the FIDL transaction.
2193    ///
2194    /// Sets the channel to shutdown if an error occurs.
2195    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2196        let _result = self.send_raw(result);
2197        if _result.is_err() {
2198            self.control_handle.shutdown();
2199        }
2200        self.drop_without_shutdown();
2201        _result
2202    }
2203
2204    /// Similar to "send" but does not shutdown the channel if an error occurs.
2205    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2206        let _result = self.send_raw(result);
2207        self.drop_without_shutdown();
2208        _result
2209    }
2210
2211    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2212        self.control_handle
2213            .inner
2214            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2215                result,
2216                self.tx_id,
2217                0x159f60cc5ba432da,
2218                fidl::encoding::DynamicFlags::empty(),
2219            )
2220    }
2221}
2222
2223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2224pub struct NeededBlobsMarker;
2225
2226impl fidl::endpoints::ProtocolMarker for NeededBlobsMarker {
2227    type Proxy = NeededBlobsProxy;
2228    type RequestStream = NeededBlobsRequestStream;
2229    #[cfg(target_os = "fuchsia")]
2230    type SynchronousProxy = NeededBlobsSynchronousProxy;
2231
2232    const DEBUG_NAME: &'static str = "(anonymous) NeededBlobs";
2233}
2234pub type NeededBlobsOpenMetaBlobResult = Result<Option<Box<BlobWriter>>, OpenBlobError>;
2235pub type NeededBlobsOpenBlobResult = Result<Option<Box<BlobWriter>>, OpenBlobError>;
2236pub type NeededBlobsBlobWrittenResult = Result<(), BlobWrittenError>;
2237
2238pub trait NeededBlobsProxyInterface: Send + Sync {
2239    type OpenMetaBlobResponseFut: std::future::Future<Output = Result<NeededBlobsOpenMetaBlobResult, fidl::Error>>
2240        + Send;
2241    fn r#open_meta_blob(&self) -> Self::OpenMetaBlobResponseFut;
2242    fn r#get_missing_blobs(
2243        &self,
2244        iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2245    ) -> Result<(), fidl::Error>;
2246    type OpenBlobResponseFut: std::future::Future<Output = Result<NeededBlobsOpenBlobResult, fidl::Error>>
2247        + Send;
2248    fn r#open_blob(&self, blob_id: &BlobId) -> Self::OpenBlobResponseFut;
2249    type BlobWrittenResponseFut: std::future::Future<Output = Result<NeededBlobsBlobWrittenResult, fidl::Error>>
2250        + Send;
2251    fn r#blob_written(&self, blob_id: &BlobId) -> Self::BlobWrittenResponseFut;
2252    type AbortResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2253    fn r#abort(&self) -> Self::AbortResponseFut;
2254}
2255#[derive(Debug)]
2256#[cfg(target_os = "fuchsia")]
2257pub struct NeededBlobsSynchronousProxy {
2258    client: fidl::client::sync::Client,
2259}
2260
2261#[cfg(target_os = "fuchsia")]
2262impl fidl::endpoints::SynchronousProxy for NeededBlobsSynchronousProxy {
2263    type Proxy = NeededBlobsProxy;
2264    type Protocol = NeededBlobsMarker;
2265
2266    fn from_channel(inner: fidl::Channel) -> Self {
2267        Self::new(inner)
2268    }
2269
2270    fn into_channel(self) -> fidl::Channel {
2271        self.client.into_channel()
2272    }
2273
2274    fn as_channel(&self) -> &fidl::Channel {
2275        self.client.as_channel()
2276    }
2277}
2278
2279#[cfg(target_os = "fuchsia")]
2280impl NeededBlobsSynchronousProxy {
2281    pub fn new(channel: fidl::Channel) -> Self {
2282        let protocol_name = <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2283        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2284    }
2285
2286    pub fn into_channel(self) -> fidl::Channel {
2287        self.client.into_channel()
2288    }
2289
2290    /// Waits until an event arrives and returns it. It is safe for other
2291    /// threads to make concurrent requests while waiting for an event.
2292    pub fn wait_for_event(
2293        &self,
2294        deadline: zx::MonotonicInstant,
2295    ) -> Result<NeededBlobsEvent, fidl::Error> {
2296        NeededBlobsEvent::decode(self.client.wait_for_event(deadline)?)
2297    }
2298
2299    /// Opens the package's metadata blob for writing. `GetMissingBlobs()`
2300    /// should not be called until writing the meta blob or this request
2301    /// responds with `false`.
2302    ///
2303    /// If the package was already cached, server will close the channel with a
2304    /// `ZX_OK` epitaph.
2305    ///
2306    /// - response `writer` is used to write the blob. If `writer` is absent,
2307    ///   the blob is already cached and so does not need to be written.
2308    /// * error an OpenBlobError indicating failure. Clients may retry this
2309    ///   request, though the server end may abort this cache operation on
2310    ///   errors it considers to be fatal.
2311    pub fn r#open_meta_blob(
2312        &self,
2313        ___deadline: zx::MonotonicInstant,
2314    ) -> Result<NeededBlobsOpenMetaBlobResult, fidl::Error> {
2315        let _response =
2316            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
2317                NeededBlobsOpenMetaBlobResponse,
2318                OpenBlobError,
2319            >>(
2320                (),
2321                0x42f385a58180f5fb,
2322                fidl::encoding::DynamicFlags::empty(),
2323                ___deadline,
2324            )?;
2325        Ok(_response.map(|x| x.writer))
2326    }
2327
2328    /// Returns an iterator of blobs that are not present on the system that
2329    /// must be written using the `OpenBlob` request before the package will be
2330    /// fully cached.
2331    ///
2332    /// Client should call `OpenMetaBlob`, and write it if needed, before
2333    /// calling `GetMissingBlobs`.
2334    ///
2335    /// A client should make this request no more than once per `NeededBlobs`
2336    /// connection. Once all blobs yielded by this iterator are written, the
2337    /// package open request will complete.
2338    ///
2339    /// New items may be added to the obtained `BlobInfoIterator` as the client
2340    /// calls `OpenBlob`, so, to guaranatee termination of the iterator, clients
2341    /// should call `OpenBlob` concurrently with reading the iterator.
2342    ///
2343    /// + request `iterator` a request for an iterator of [`BlobInfo`] of blobs
2344    ///   that the client should try to write.
2345    pub fn r#get_missing_blobs(
2346        &self,
2347        mut iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2348    ) -> Result<(), fidl::Error> {
2349        self.client.send::<NeededBlobsGetMissingBlobsRequest>(
2350            (iterator,),
2351            0x44eaf14fd56e7ae1,
2352            fidl::encoding::DynamicFlags::empty(),
2353        )
2354    }
2355
2356    /// Opens a blob for writing.
2357    ///
2358    /// + request `blob_id` the blob id describing this blob.
2359    /// - response `writer` is used to write the blob. If `writer` is absent,
2360    ///   the blob is already cached and so does not need to be written.
2361    /// * error an OpenBlobError indicating failure. Clients may retry this
2362    ///   request, though the server end may abort this cache operation on
2363    ///   errors it considers to be fatal.
2364    pub fn r#open_blob(
2365        &self,
2366        mut blob_id: &BlobId,
2367        ___deadline: zx::MonotonicInstant,
2368    ) -> Result<NeededBlobsOpenBlobResult, fidl::Error> {
2369        let _response = self.client.send_query::<
2370            NeededBlobsOpenBlobRequest,
2371            fidl::encoding::ResultType<NeededBlobsOpenBlobResponse, OpenBlobError>,
2372        >(
2373            (blob_id,),
2374            0x67cd4c4cd10ea9e0,
2375            fidl::encoding::DynamicFlags::empty(),
2376            ___deadline,
2377        )?;
2378        Ok(_response.map(|x| x.writer))
2379    }
2380
2381    /// Indicates that a blob opened by `Open[Meta]Blob` has been successfully
2382    /// written.
2383    ///
2384    /// A client should call this once the blob has been fully written using
2385    /// the `writer` returned by `Open[Meta]Blob`.
2386    ///
2387    /// + request `blob_id` the blob id describing this blob.
2388    /// * error a BlobWrittenError indicating failure. Clients may retry the
2389    ///   `Open[Meta]Blob` request that prompted this call, though the server
2390    ///   end may abort this cache operation on errors it considers to be fatal.
2391    pub fn r#blob_written(
2392        &self,
2393        mut blob_id: &BlobId,
2394        ___deadline: zx::MonotonicInstant,
2395    ) -> Result<NeededBlobsBlobWrittenResult, fidl::Error> {
2396        let _response = self.client.send_query::<
2397            NeededBlobsBlobWrittenRequest,
2398            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BlobWrittenError>,
2399        >(
2400            (blob_id,),
2401            0x222f80ec77433f44,
2402            fidl::encoding::DynamicFlags::empty(),
2403            ___deadline,
2404        )?;
2405        Ok(_response.map(|x| x))
2406    }
2407
2408    /// Aborts this caching operation for the package.
2409    ///
2410    /// Any open blobs and any missing blobs iterator will be closed. Any `dir`
2411    /// provided to the associated [`PackageCache.Get`] request will also be
2412    /// closed. Once this request is acknowledged, this channel will be closed.
2413    ///
2414    /// Note, dropping this NeededBlobs channel without writing all needed blobs
2415    /// will also abort the package cache operation. However, this API provides
2416    /// the ability to wait for the operation to be torn down.
2417    pub fn r#abort(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2418        let _response =
2419            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
2420                (),
2421                0x6fda8d5ebea74cbb,
2422                fidl::encoding::DynamicFlags::empty(),
2423                ___deadline,
2424            )?;
2425        Ok(_response)
2426    }
2427}
2428
2429#[cfg(target_os = "fuchsia")]
2430impl From<NeededBlobsSynchronousProxy> for zx::Handle {
2431    fn from(value: NeededBlobsSynchronousProxy) -> Self {
2432        value.into_channel().into()
2433    }
2434}
2435
2436#[cfg(target_os = "fuchsia")]
2437impl From<fidl::Channel> for NeededBlobsSynchronousProxy {
2438    fn from(value: fidl::Channel) -> Self {
2439        Self::new(value)
2440    }
2441}
2442
2443#[cfg(target_os = "fuchsia")]
2444impl fidl::endpoints::FromClient for NeededBlobsSynchronousProxy {
2445    type Protocol = NeededBlobsMarker;
2446
2447    fn from_client(value: fidl::endpoints::ClientEnd<NeededBlobsMarker>) -> Self {
2448        Self::new(value.into_channel())
2449    }
2450}
2451
2452#[derive(Debug, Clone)]
2453pub struct NeededBlobsProxy {
2454    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2455}
2456
2457impl fidl::endpoints::Proxy for NeededBlobsProxy {
2458    type Protocol = NeededBlobsMarker;
2459
2460    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2461        Self::new(inner)
2462    }
2463
2464    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2465        self.client.into_channel().map_err(|client| Self { client })
2466    }
2467
2468    fn as_channel(&self) -> &::fidl::AsyncChannel {
2469        self.client.as_channel()
2470    }
2471}
2472
2473impl NeededBlobsProxy {
2474    /// Create a new Proxy for fuchsia.pkg/NeededBlobs.
2475    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2476        let protocol_name = <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2477        Self { client: fidl::client::Client::new(channel, protocol_name) }
2478    }
2479
2480    /// Get a Stream of events from the remote end of the protocol.
2481    ///
2482    /// # Panics
2483    ///
2484    /// Panics if the event stream was already taken.
2485    pub fn take_event_stream(&self) -> NeededBlobsEventStream {
2486        NeededBlobsEventStream { event_receiver: self.client.take_event_receiver() }
2487    }
2488
2489    /// Opens the package's metadata blob for writing. `GetMissingBlobs()`
2490    /// should not be called until writing the meta blob or this request
2491    /// responds with `false`.
2492    ///
2493    /// If the package was already cached, server will close the channel with a
2494    /// `ZX_OK` epitaph.
2495    ///
2496    /// - response `writer` is used to write the blob. If `writer` is absent,
2497    ///   the blob is already cached and so does not need to be written.
2498    /// * error an OpenBlobError indicating failure. Clients may retry this
2499    ///   request, though the server end may abort this cache operation on
2500    ///   errors it considers to be fatal.
2501    pub fn r#open_meta_blob(
2502        &self,
2503    ) -> fidl::client::QueryResponseFut<
2504        NeededBlobsOpenMetaBlobResult,
2505        fidl::encoding::DefaultFuchsiaResourceDialect,
2506    > {
2507        NeededBlobsProxyInterface::r#open_meta_blob(self)
2508    }
2509
2510    /// Returns an iterator of blobs that are not present on the system that
2511    /// must be written using the `OpenBlob` request before the package will be
2512    /// fully cached.
2513    ///
2514    /// Client should call `OpenMetaBlob`, and write it if needed, before
2515    /// calling `GetMissingBlobs`.
2516    ///
2517    /// A client should make this request no more than once per `NeededBlobs`
2518    /// connection. Once all blobs yielded by this iterator are written, the
2519    /// package open request will complete.
2520    ///
2521    /// New items may be added to the obtained `BlobInfoIterator` as the client
2522    /// calls `OpenBlob`, so, to guaranatee termination of the iterator, clients
2523    /// should call `OpenBlob` concurrently with reading the iterator.
2524    ///
2525    /// + request `iterator` a request for an iterator of [`BlobInfo`] of blobs
2526    ///   that the client should try to write.
2527    pub fn r#get_missing_blobs(
2528        &self,
2529        mut iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2530    ) -> Result<(), fidl::Error> {
2531        NeededBlobsProxyInterface::r#get_missing_blobs(self, iterator)
2532    }
2533
2534    /// Opens a blob for writing.
2535    ///
2536    /// + request `blob_id` the blob id describing this blob.
2537    /// - response `writer` is used to write the blob. If `writer` is absent,
2538    ///   the blob is already cached and so does not need to be written.
2539    /// * error an OpenBlobError indicating failure. Clients may retry this
2540    ///   request, though the server end may abort this cache operation on
2541    ///   errors it considers to be fatal.
2542    pub fn r#open_blob(
2543        &self,
2544        mut blob_id: &BlobId,
2545    ) -> fidl::client::QueryResponseFut<
2546        NeededBlobsOpenBlobResult,
2547        fidl::encoding::DefaultFuchsiaResourceDialect,
2548    > {
2549        NeededBlobsProxyInterface::r#open_blob(self, blob_id)
2550    }
2551
2552    /// Indicates that a blob opened by `Open[Meta]Blob` has been successfully
2553    /// written.
2554    ///
2555    /// A client should call this once the blob has been fully written using
2556    /// the `writer` returned by `Open[Meta]Blob`.
2557    ///
2558    /// + request `blob_id` the blob id describing this blob.
2559    /// * error a BlobWrittenError indicating failure. Clients may retry the
2560    ///   `Open[Meta]Blob` request that prompted this call, though the server
2561    ///   end may abort this cache operation on errors it considers to be fatal.
2562    pub fn r#blob_written(
2563        &self,
2564        mut blob_id: &BlobId,
2565    ) -> fidl::client::QueryResponseFut<
2566        NeededBlobsBlobWrittenResult,
2567        fidl::encoding::DefaultFuchsiaResourceDialect,
2568    > {
2569        NeededBlobsProxyInterface::r#blob_written(self, blob_id)
2570    }
2571
2572    /// Aborts this caching operation for the package.
2573    ///
2574    /// Any open blobs and any missing blobs iterator will be closed. Any `dir`
2575    /// provided to the associated [`PackageCache.Get`] request will also be
2576    /// closed. Once this request is acknowledged, this channel will be closed.
2577    ///
2578    /// Note, dropping this NeededBlobs channel without writing all needed blobs
2579    /// will also abort the package cache operation. However, this API provides
2580    /// the ability to wait for the operation to be torn down.
2581    pub fn r#abort(
2582        &self,
2583    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2584        NeededBlobsProxyInterface::r#abort(self)
2585    }
2586}
2587
2588impl NeededBlobsProxyInterface for NeededBlobsProxy {
2589    type OpenMetaBlobResponseFut = fidl::client::QueryResponseFut<
2590        NeededBlobsOpenMetaBlobResult,
2591        fidl::encoding::DefaultFuchsiaResourceDialect,
2592    >;
2593    fn r#open_meta_blob(&self) -> Self::OpenMetaBlobResponseFut {
2594        fn _decode(
2595            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2596        ) -> Result<NeededBlobsOpenMetaBlobResult, fidl::Error> {
2597            let _response = fidl::client::decode_transaction_body::<
2598                fidl::encoding::ResultType<NeededBlobsOpenMetaBlobResponse, OpenBlobError>,
2599                fidl::encoding::DefaultFuchsiaResourceDialect,
2600                0x42f385a58180f5fb,
2601            >(_buf?)?;
2602            Ok(_response.map(|x| x.writer))
2603        }
2604        self.client
2605            .send_query_and_decode::<fidl::encoding::EmptyPayload, NeededBlobsOpenMetaBlobResult>(
2606                (),
2607                0x42f385a58180f5fb,
2608                fidl::encoding::DynamicFlags::empty(),
2609                _decode,
2610            )
2611    }
2612
2613    fn r#get_missing_blobs(
2614        &self,
2615        mut iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2616    ) -> Result<(), fidl::Error> {
2617        self.client.send::<NeededBlobsGetMissingBlobsRequest>(
2618            (iterator,),
2619            0x44eaf14fd56e7ae1,
2620            fidl::encoding::DynamicFlags::empty(),
2621        )
2622    }
2623
2624    type OpenBlobResponseFut = fidl::client::QueryResponseFut<
2625        NeededBlobsOpenBlobResult,
2626        fidl::encoding::DefaultFuchsiaResourceDialect,
2627    >;
2628    fn r#open_blob(&self, mut blob_id: &BlobId) -> Self::OpenBlobResponseFut {
2629        fn _decode(
2630            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2631        ) -> Result<NeededBlobsOpenBlobResult, fidl::Error> {
2632            let _response = fidl::client::decode_transaction_body::<
2633                fidl::encoding::ResultType<NeededBlobsOpenBlobResponse, OpenBlobError>,
2634                fidl::encoding::DefaultFuchsiaResourceDialect,
2635                0x67cd4c4cd10ea9e0,
2636            >(_buf?)?;
2637            Ok(_response.map(|x| x.writer))
2638        }
2639        self.client.send_query_and_decode::<NeededBlobsOpenBlobRequest, NeededBlobsOpenBlobResult>(
2640            (blob_id,),
2641            0x67cd4c4cd10ea9e0,
2642            fidl::encoding::DynamicFlags::empty(),
2643            _decode,
2644        )
2645    }
2646
2647    type BlobWrittenResponseFut = fidl::client::QueryResponseFut<
2648        NeededBlobsBlobWrittenResult,
2649        fidl::encoding::DefaultFuchsiaResourceDialect,
2650    >;
2651    fn r#blob_written(&self, mut blob_id: &BlobId) -> Self::BlobWrittenResponseFut {
2652        fn _decode(
2653            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2654        ) -> Result<NeededBlobsBlobWrittenResult, fidl::Error> {
2655            let _response = fidl::client::decode_transaction_body::<
2656                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BlobWrittenError>,
2657                fidl::encoding::DefaultFuchsiaResourceDialect,
2658                0x222f80ec77433f44,
2659            >(_buf?)?;
2660            Ok(_response.map(|x| x))
2661        }
2662        self.client
2663            .send_query_and_decode::<NeededBlobsBlobWrittenRequest, NeededBlobsBlobWrittenResult>(
2664                (blob_id,),
2665                0x222f80ec77433f44,
2666                fidl::encoding::DynamicFlags::empty(),
2667                _decode,
2668            )
2669    }
2670
2671    type AbortResponseFut =
2672        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2673    fn r#abort(&self) -> Self::AbortResponseFut {
2674        fn _decode(
2675            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2676        ) -> Result<(), fidl::Error> {
2677            let _response = fidl::client::decode_transaction_body::<
2678                fidl::encoding::EmptyPayload,
2679                fidl::encoding::DefaultFuchsiaResourceDialect,
2680                0x6fda8d5ebea74cbb,
2681            >(_buf?)?;
2682            Ok(_response)
2683        }
2684        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2685            (),
2686            0x6fda8d5ebea74cbb,
2687            fidl::encoding::DynamicFlags::empty(),
2688            _decode,
2689        )
2690    }
2691}
2692
2693pub struct NeededBlobsEventStream {
2694    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2695}
2696
2697impl std::marker::Unpin for NeededBlobsEventStream {}
2698
2699impl futures::stream::FusedStream for NeededBlobsEventStream {
2700    fn is_terminated(&self) -> bool {
2701        self.event_receiver.is_terminated()
2702    }
2703}
2704
2705impl futures::Stream for NeededBlobsEventStream {
2706    type Item = Result<NeededBlobsEvent, fidl::Error>;
2707
2708    fn poll_next(
2709        mut self: std::pin::Pin<&mut Self>,
2710        cx: &mut std::task::Context<'_>,
2711    ) -> std::task::Poll<Option<Self::Item>> {
2712        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2713            &mut self.event_receiver,
2714            cx
2715        )?) {
2716            Some(buf) => std::task::Poll::Ready(Some(NeededBlobsEvent::decode(buf))),
2717            None => std::task::Poll::Ready(None),
2718        }
2719    }
2720}
2721
2722#[derive(Debug)]
2723pub enum NeededBlobsEvent {}
2724
2725impl NeededBlobsEvent {
2726    /// Decodes a message buffer as a [`NeededBlobsEvent`].
2727    fn decode(
2728        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2729    ) -> Result<NeededBlobsEvent, fidl::Error> {
2730        let (bytes, _handles) = buf.split_mut();
2731        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2732        debug_assert_eq!(tx_header.tx_id, 0);
2733        match tx_header.ordinal {
2734            _ => Err(fidl::Error::UnknownOrdinal {
2735                ordinal: tx_header.ordinal,
2736                protocol_name: <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2737            }),
2738        }
2739    }
2740}
2741
2742/// A Stream of incoming requests for fuchsia.pkg/NeededBlobs.
2743pub struct NeededBlobsRequestStream {
2744    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2745    is_terminated: bool,
2746}
2747
2748impl std::marker::Unpin for NeededBlobsRequestStream {}
2749
2750impl futures::stream::FusedStream for NeededBlobsRequestStream {
2751    fn is_terminated(&self) -> bool {
2752        self.is_terminated
2753    }
2754}
2755
2756impl fidl::endpoints::RequestStream for NeededBlobsRequestStream {
2757    type Protocol = NeededBlobsMarker;
2758    type ControlHandle = NeededBlobsControlHandle;
2759
2760    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2761        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2762    }
2763
2764    fn control_handle(&self) -> Self::ControlHandle {
2765        NeededBlobsControlHandle { inner: self.inner.clone() }
2766    }
2767
2768    fn into_inner(
2769        self,
2770    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2771    {
2772        (self.inner, self.is_terminated)
2773    }
2774
2775    fn from_inner(
2776        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2777        is_terminated: bool,
2778    ) -> Self {
2779        Self { inner, is_terminated }
2780    }
2781}
2782
2783impl futures::Stream for NeededBlobsRequestStream {
2784    type Item = Result<NeededBlobsRequest, fidl::Error>;
2785
2786    fn poll_next(
2787        mut self: std::pin::Pin<&mut Self>,
2788        cx: &mut std::task::Context<'_>,
2789    ) -> std::task::Poll<Option<Self::Item>> {
2790        let this = &mut *self;
2791        if this.inner.check_shutdown(cx) {
2792            this.is_terminated = true;
2793            return std::task::Poll::Ready(None);
2794        }
2795        if this.is_terminated {
2796            panic!("polled NeededBlobsRequestStream after completion");
2797        }
2798        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2799            |bytes, handles| {
2800                match this.inner.channel().read_etc(cx, bytes, handles) {
2801                    std::task::Poll::Ready(Ok(())) => {}
2802                    std::task::Poll::Pending => return std::task::Poll::Pending,
2803                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2804                        this.is_terminated = true;
2805                        return std::task::Poll::Ready(None);
2806                    }
2807                    std::task::Poll::Ready(Err(e)) => {
2808                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2809                            e.into(),
2810                        ))));
2811                    }
2812                }
2813
2814                // A message has been received from the channel
2815                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2816
2817                std::task::Poll::Ready(Some(match header.ordinal {
2818                    0x42f385a58180f5fb => {
2819                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2820                        let mut req = fidl::new_empty!(
2821                            fidl::encoding::EmptyPayload,
2822                            fidl::encoding::DefaultFuchsiaResourceDialect
2823                        );
2824                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2825                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
2826                        Ok(NeededBlobsRequest::OpenMetaBlob {
2827                            responder: NeededBlobsOpenMetaBlobResponder {
2828                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2829                                tx_id: header.tx_id,
2830                            },
2831                        })
2832                    }
2833                    0x44eaf14fd56e7ae1 => {
2834                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2835                        let mut req = fidl::new_empty!(
2836                            NeededBlobsGetMissingBlobsRequest,
2837                            fidl::encoding::DefaultFuchsiaResourceDialect
2838                        );
2839                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NeededBlobsGetMissingBlobsRequest>(&header, _body_bytes, handles, &mut req)?;
2840                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
2841                        Ok(NeededBlobsRequest::GetMissingBlobs {
2842                            iterator: req.iterator,
2843
2844                            control_handle,
2845                        })
2846                    }
2847                    0x67cd4c4cd10ea9e0 => {
2848                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2849                        let mut req = fidl::new_empty!(
2850                            NeededBlobsOpenBlobRequest,
2851                            fidl::encoding::DefaultFuchsiaResourceDialect
2852                        );
2853                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NeededBlobsOpenBlobRequest>(&header, _body_bytes, handles, &mut req)?;
2854                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
2855                        Ok(NeededBlobsRequest::OpenBlob {
2856                            blob_id: req.blob_id,
2857
2858                            responder: NeededBlobsOpenBlobResponder {
2859                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2860                                tx_id: header.tx_id,
2861                            },
2862                        })
2863                    }
2864                    0x222f80ec77433f44 => {
2865                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2866                        let mut req = fidl::new_empty!(
2867                            NeededBlobsBlobWrittenRequest,
2868                            fidl::encoding::DefaultFuchsiaResourceDialect
2869                        );
2870                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NeededBlobsBlobWrittenRequest>(&header, _body_bytes, handles, &mut req)?;
2871                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
2872                        Ok(NeededBlobsRequest::BlobWritten {
2873                            blob_id: req.blob_id,
2874
2875                            responder: NeededBlobsBlobWrittenResponder {
2876                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2877                                tx_id: header.tx_id,
2878                            },
2879                        })
2880                    }
2881                    0x6fda8d5ebea74cbb => {
2882                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2883                        let mut req = fidl::new_empty!(
2884                            fidl::encoding::EmptyPayload,
2885                            fidl::encoding::DefaultFuchsiaResourceDialect
2886                        );
2887                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2888                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
2889                        Ok(NeededBlobsRequest::Abort {
2890                            responder: NeededBlobsAbortResponder {
2891                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2892                                tx_id: header.tx_id,
2893                            },
2894                        })
2895                    }
2896                    _ => Err(fidl::Error::UnknownOrdinal {
2897                        ordinal: header.ordinal,
2898                        protocol_name:
2899                            <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2900                    }),
2901                }))
2902            },
2903        )
2904    }
2905}
2906
2907/// Represents the transaction for caching a particular package.
2908///
2909/// Server expects client to follow the normal operation sequence defined below.
2910/// Violating the protocol (e.g. calling wrong methods at the wrong time) will result
2911/// in the channel being closed by the package cache with a `ZX_ERR_BAD_STATE` epitaph
2912/// and aborting the package cache operation.
2913/// If a fatal error occurs at any step, server will close the channel, and client
2914/// should not proceed with the sequence.
2915/// Non-fatal errors could be retried, as long as the channel remains open.
2916///
2917/// Normal operation sequence:
2918/// 1. Clients should start by requesting to `OpenMetaBlob()`, and fetch and write
2919/// the metadata blob if needed, calling `BlobWritten()` when done to indicate the
2920/// write is complete.
2921/// 2. `GetMissingBlobs()` should be used to determine which blobs need to be
2922/// fetched and written.
2923/// 3. Each of the missing blobs needs to be written using `OpenBlob()` and
2924/// `BlobWritten()` should be called after each blob is written.
2925///
2926/// Clients are responsible for avoiding concurrent creation of the same blob if the underlying
2927/// blobstore does not support it.
2928/// This manifests as the following constraints (applied per `BlobId`):
2929/// 1. If the `BlobWriter` returned by calls to `Open[Meta]Blob` is the `file` variant, once Clients
2930///    call Resize on a file, they must close *all* file connections obtained from `Open[Meta]Blob`
2931///    before calling `Open[Meta]Blob` again.
2932/// 2. If the `BlobWriter` returned by calls to `Open[Meta]Blob` is the `writer` variant, Clients
2933///    must not write all the bytes to more than one of the `writer`s.
2934/// This applies per `BlobId` to all `BlobWriter`s returned by all calls to `Open[Meta]Blob` across
2935/// all `NeededBlobs` connections across all `PackageCache` connections.
2936/// Once c++blobfs support is removed and fxblob is changed to support duplicate concurrent creation
2937/// requests (https://fxbug.dev/335870456#comment9), this requirement can be dropped.
2938///
2939/// Once all needed blobs are written by the client, the package cache will
2940/// complete the pending [`PackageCache.Get`] request and close this channel
2941/// with a `ZX_OK` epitaph.
2942#[derive(Debug)]
2943pub enum NeededBlobsRequest {
2944    /// Opens the package's metadata blob for writing. `GetMissingBlobs()`
2945    /// should not be called until writing the meta blob or this request
2946    /// responds with `false`.
2947    ///
2948    /// If the package was already cached, server will close the channel with a
2949    /// `ZX_OK` epitaph.
2950    ///
2951    /// - response `writer` is used to write the blob. If `writer` is absent,
2952    ///   the blob is already cached and so does not need to be written.
2953    /// * error an OpenBlobError indicating failure. Clients may retry this
2954    ///   request, though the server end may abort this cache operation on
2955    ///   errors it considers to be fatal.
2956    OpenMetaBlob { responder: NeededBlobsOpenMetaBlobResponder },
2957    /// Returns an iterator of blobs that are not present on the system that
2958    /// must be written using the `OpenBlob` request before the package will be
2959    /// fully cached.
2960    ///
2961    /// Client should call `OpenMetaBlob`, and write it if needed, before
2962    /// calling `GetMissingBlobs`.
2963    ///
2964    /// A client should make this request no more than once per `NeededBlobs`
2965    /// connection. Once all blobs yielded by this iterator are written, the
2966    /// package open request will complete.
2967    ///
2968    /// New items may be added to the obtained `BlobInfoIterator` as the client
2969    /// calls `OpenBlob`, so, to guaranatee termination of the iterator, clients
2970    /// should call `OpenBlob` concurrently with reading the iterator.
2971    ///
2972    /// + request `iterator` a request for an iterator of [`BlobInfo`] of blobs
2973    ///   that the client should try to write.
2974    GetMissingBlobs {
2975        iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2976        control_handle: NeededBlobsControlHandle,
2977    },
2978    /// Opens a blob for writing.
2979    ///
2980    /// + request `blob_id` the blob id describing this blob.
2981    /// - response `writer` is used to write the blob. If `writer` is absent,
2982    ///   the blob is already cached and so does not need to be written.
2983    /// * error an OpenBlobError indicating failure. Clients may retry this
2984    ///   request, though the server end may abort this cache operation on
2985    ///   errors it considers to be fatal.
2986    OpenBlob { blob_id: BlobId, responder: NeededBlobsOpenBlobResponder },
2987    /// Indicates that a blob opened by `Open[Meta]Blob` has been successfully
2988    /// written.
2989    ///
2990    /// A client should call this once the blob has been fully written using
2991    /// the `writer` returned by `Open[Meta]Blob`.
2992    ///
2993    /// + request `blob_id` the blob id describing this blob.
2994    /// * error a BlobWrittenError indicating failure. Clients may retry the
2995    ///   `Open[Meta]Blob` request that prompted this call, though the server
2996    ///   end may abort this cache operation on errors it considers to be fatal.
2997    BlobWritten { blob_id: BlobId, responder: NeededBlobsBlobWrittenResponder },
2998    /// Aborts this caching operation for the package.
2999    ///
3000    /// Any open blobs and any missing blobs iterator will be closed. Any `dir`
3001    /// provided to the associated [`PackageCache.Get`] request will also be
3002    /// closed. Once this request is acknowledged, this channel will be closed.
3003    ///
3004    /// Note, dropping this NeededBlobs channel without writing all needed blobs
3005    /// will also abort the package cache operation. However, this API provides
3006    /// the ability to wait for the operation to be torn down.
3007    Abort { responder: NeededBlobsAbortResponder },
3008}
3009
3010impl NeededBlobsRequest {
3011    #[allow(irrefutable_let_patterns)]
3012    pub fn into_open_meta_blob(self) -> Option<(NeededBlobsOpenMetaBlobResponder)> {
3013        if let NeededBlobsRequest::OpenMetaBlob { responder } = self {
3014            Some((responder))
3015        } else {
3016            None
3017        }
3018    }
3019
3020    #[allow(irrefutable_let_patterns)]
3021    pub fn into_get_missing_blobs(
3022        self,
3023    ) -> Option<(fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>, NeededBlobsControlHandle)>
3024    {
3025        if let NeededBlobsRequest::GetMissingBlobs { iterator, control_handle } = self {
3026            Some((iterator, control_handle))
3027        } else {
3028            None
3029        }
3030    }
3031
3032    #[allow(irrefutable_let_patterns)]
3033    pub fn into_open_blob(self) -> Option<(BlobId, NeededBlobsOpenBlobResponder)> {
3034        if let NeededBlobsRequest::OpenBlob { blob_id, responder } = self {
3035            Some((blob_id, responder))
3036        } else {
3037            None
3038        }
3039    }
3040
3041    #[allow(irrefutable_let_patterns)]
3042    pub fn into_blob_written(self) -> Option<(BlobId, NeededBlobsBlobWrittenResponder)> {
3043        if let NeededBlobsRequest::BlobWritten { blob_id, responder } = self {
3044            Some((blob_id, responder))
3045        } else {
3046            None
3047        }
3048    }
3049
3050    #[allow(irrefutable_let_patterns)]
3051    pub fn into_abort(self) -> Option<(NeededBlobsAbortResponder)> {
3052        if let NeededBlobsRequest::Abort { responder } = self { Some((responder)) } else { None }
3053    }
3054
3055    /// Name of the method defined in FIDL
3056    pub fn method_name(&self) -> &'static str {
3057        match *self {
3058            NeededBlobsRequest::OpenMetaBlob { .. } => "open_meta_blob",
3059            NeededBlobsRequest::GetMissingBlobs { .. } => "get_missing_blobs",
3060            NeededBlobsRequest::OpenBlob { .. } => "open_blob",
3061            NeededBlobsRequest::BlobWritten { .. } => "blob_written",
3062            NeededBlobsRequest::Abort { .. } => "abort",
3063        }
3064    }
3065}
3066
3067#[derive(Debug, Clone)]
3068pub struct NeededBlobsControlHandle {
3069    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3070}
3071
3072impl fidl::endpoints::ControlHandle for NeededBlobsControlHandle {
3073    fn shutdown(&self) {
3074        self.inner.shutdown()
3075    }
3076    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3077        self.inner.shutdown_with_epitaph(status)
3078    }
3079
3080    fn is_closed(&self) -> bool {
3081        self.inner.channel().is_closed()
3082    }
3083    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3084        self.inner.channel().on_closed()
3085    }
3086
3087    #[cfg(target_os = "fuchsia")]
3088    fn signal_peer(
3089        &self,
3090        clear_mask: zx::Signals,
3091        set_mask: zx::Signals,
3092    ) -> Result<(), zx_status::Status> {
3093        use fidl::Peered;
3094        self.inner.channel().signal_peer(clear_mask, set_mask)
3095    }
3096}
3097
3098impl NeededBlobsControlHandle {}
3099
3100#[must_use = "FIDL methods require a response to be sent"]
3101#[derive(Debug)]
3102pub struct NeededBlobsOpenMetaBlobResponder {
3103    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3104    tx_id: u32,
3105}
3106
3107/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3108/// if the responder is dropped without sending a response, so that the client
3109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3110impl std::ops::Drop for NeededBlobsOpenMetaBlobResponder {
3111    fn drop(&mut self) {
3112        self.control_handle.shutdown();
3113        // Safety: drops once, never accessed again
3114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3115    }
3116}
3117
3118impl fidl::endpoints::Responder for NeededBlobsOpenMetaBlobResponder {
3119    type ControlHandle = NeededBlobsControlHandle;
3120
3121    fn control_handle(&self) -> &NeededBlobsControlHandle {
3122        &self.control_handle
3123    }
3124
3125    fn drop_without_shutdown(mut self) {
3126        // Safety: drops once, never accessed again due to mem::forget
3127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3128        // Prevent Drop from running (which would shut down the channel)
3129        std::mem::forget(self);
3130    }
3131}
3132
3133impl NeededBlobsOpenMetaBlobResponder {
3134    /// Sends a response to the FIDL transaction.
3135    ///
3136    /// Sets the channel to shutdown if an error occurs.
3137    pub fn send(
3138        self,
3139        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3140    ) -> Result<(), fidl::Error> {
3141        let _result = self.send_raw(result);
3142        if _result.is_err() {
3143            self.control_handle.shutdown();
3144        }
3145        self.drop_without_shutdown();
3146        _result
3147    }
3148
3149    /// Similar to "send" but does not shutdown the channel if an error occurs.
3150    pub fn send_no_shutdown_on_err(
3151        self,
3152        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3153    ) -> Result<(), fidl::Error> {
3154        let _result = self.send_raw(result);
3155        self.drop_without_shutdown();
3156        _result
3157    }
3158
3159    fn send_raw(
3160        &self,
3161        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3162    ) -> Result<(), fidl::Error> {
3163        self.control_handle.inner.send::<fidl::encoding::ResultType<
3164            NeededBlobsOpenMetaBlobResponse,
3165            OpenBlobError,
3166        >>(
3167            result.as_mut().map_err(|e| *e).map(|writer| (writer.as_mut(),)),
3168            self.tx_id,
3169            0x42f385a58180f5fb,
3170            fidl::encoding::DynamicFlags::empty(),
3171        )
3172    }
3173}
3174
3175#[must_use = "FIDL methods require a response to be sent"]
3176#[derive(Debug)]
3177pub struct NeededBlobsOpenBlobResponder {
3178    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3179    tx_id: u32,
3180}
3181
3182/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3183/// if the responder is dropped without sending a response, so that the client
3184/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3185impl std::ops::Drop for NeededBlobsOpenBlobResponder {
3186    fn drop(&mut self) {
3187        self.control_handle.shutdown();
3188        // Safety: drops once, never accessed again
3189        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3190    }
3191}
3192
3193impl fidl::endpoints::Responder for NeededBlobsOpenBlobResponder {
3194    type ControlHandle = NeededBlobsControlHandle;
3195
3196    fn control_handle(&self) -> &NeededBlobsControlHandle {
3197        &self.control_handle
3198    }
3199
3200    fn drop_without_shutdown(mut self) {
3201        // Safety: drops once, never accessed again due to mem::forget
3202        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3203        // Prevent Drop from running (which would shut down the channel)
3204        std::mem::forget(self);
3205    }
3206}
3207
3208impl NeededBlobsOpenBlobResponder {
3209    /// Sends a response to the FIDL transaction.
3210    ///
3211    /// Sets the channel to shutdown if an error occurs.
3212    pub fn send(
3213        self,
3214        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3215    ) -> Result<(), fidl::Error> {
3216        let _result = self.send_raw(result);
3217        if _result.is_err() {
3218            self.control_handle.shutdown();
3219        }
3220        self.drop_without_shutdown();
3221        _result
3222    }
3223
3224    /// Similar to "send" but does not shutdown the channel if an error occurs.
3225    pub fn send_no_shutdown_on_err(
3226        self,
3227        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3228    ) -> Result<(), fidl::Error> {
3229        let _result = self.send_raw(result);
3230        self.drop_without_shutdown();
3231        _result
3232    }
3233
3234    fn send_raw(
3235        &self,
3236        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3237    ) -> Result<(), fidl::Error> {
3238        self.control_handle.inner.send::<fidl::encoding::ResultType<
3239            NeededBlobsOpenBlobResponse,
3240            OpenBlobError,
3241        >>(
3242            result.as_mut().map_err(|e| *e).map(|writer| (writer.as_mut(),)),
3243            self.tx_id,
3244            0x67cd4c4cd10ea9e0,
3245            fidl::encoding::DynamicFlags::empty(),
3246        )
3247    }
3248}
3249
3250#[must_use = "FIDL methods require a response to be sent"]
3251#[derive(Debug)]
3252pub struct NeededBlobsBlobWrittenResponder {
3253    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3254    tx_id: u32,
3255}
3256
3257/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3258/// if the responder is dropped without sending a response, so that the client
3259/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3260impl std::ops::Drop for NeededBlobsBlobWrittenResponder {
3261    fn drop(&mut self) {
3262        self.control_handle.shutdown();
3263        // Safety: drops once, never accessed again
3264        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3265    }
3266}
3267
3268impl fidl::endpoints::Responder for NeededBlobsBlobWrittenResponder {
3269    type ControlHandle = NeededBlobsControlHandle;
3270
3271    fn control_handle(&self) -> &NeededBlobsControlHandle {
3272        &self.control_handle
3273    }
3274
3275    fn drop_without_shutdown(mut self) {
3276        // Safety: drops once, never accessed again due to mem::forget
3277        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3278        // Prevent Drop from running (which would shut down the channel)
3279        std::mem::forget(self);
3280    }
3281}
3282
3283impl NeededBlobsBlobWrittenResponder {
3284    /// Sends a response to the FIDL transaction.
3285    ///
3286    /// Sets the channel to shutdown if an error occurs.
3287    pub fn send(self, mut result: Result<(), BlobWrittenError>) -> Result<(), fidl::Error> {
3288        let _result = self.send_raw(result);
3289        if _result.is_err() {
3290            self.control_handle.shutdown();
3291        }
3292        self.drop_without_shutdown();
3293        _result
3294    }
3295
3296    /// Similar to "send" but does not shutdown the channel if an error occurs.
3297    pub fn send_no_shutdown_on_err(
3298        self,
3299        mut result: Result<(), BlobWrittenError>,
3300    ) -> Result<(), fidl::Error> {
3301        let _result = self.send_raw(result);
3302        self.drop_without_shutdown();
3303        _result
3304    }
3305
3306    fn send_raw(&self, mut result: Result<(), BlobWrittenError>) -> Result<(), fidl::Error> {
3307        self.control_handle.inner.send::<fidl::encoding::ResultType<
3308            fidl::encoding::EmptyStruct,
3309            BlobWrittenError,
3310        >>(
3311            result,
3312            self.tx_id,
3313            0x222f80ec77433f44,
3314            fidl::encoding::DynamicFlags::empty(),
3315        )
3316    }
3317}
3318
3319#[must_use = "FIDL methods require a response to be sent"]
3320#[derive(Debug)]
3321pub struct NeededBlobsAbortResponder {
3322    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3323    tx_id: u32,
3324}
3325
3326/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3327/// if the responder is dropped without sending a response, so that the client
3328/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3329impl std::ops::Drop for NeededBlobsAbortResponder {
3330    fn drop(&mut self) {
3331        self.control_handle.shutdown();
3332        // Safety: drops once, never accessed again
3333        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3334    }
3335}
3336
3337impl fidl::endpoints::Responder for NeededBlobsAbortResponder {
3338    type ControlHandle = NeededBlobsControlHandle;
3339
3340    fn control_handle(&self) -> &NeededBlobsControlHandle {
3341        &self.control_handle
3342    }
3343
3344    fn drop_without_shutdown(mut self) {
3345        // Safety: drops once, never accessed again due to mem::forget
3346        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3347        // Prevent Drop from running (which would shut down the channel)
3348        std::mem::forget(self);
3349    }
3350}
3351
3352impl NeededBlobsAbortResponder {
3353    /// Sends a response to the FIDL transaction.
3354    ///
3355    /// Sets the channel to shutdown if an error occurs.
3356    pub fn send(self) -> Result<(), fidl::Error> {
3357        let _result = self.send_raw();
3358        if _result.is_err() {
3359            self.control_handle.shutdown();
3360        }
3361        self.drop_without_shutdown();
3362        _result
3363    }
3364
3365    /// Similar to "send" but does not shutdown the channel if an error occurs.
3366    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3367        let _result = self.send_raw();
3368        self.drop_without_shutdown();
3369        _result
3370    }
3371
3372    fn send_raw(&self) -> Result<(), fidl::Error> {
3373        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3374            (),
3375            self.tx_id,
3376            0x6fda8d5ebea74cbb,
3377            fidl::encoding::DynamicFlags::empty(),
3378        )
3379    }
3380}
3381
3382#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3383pub struct PackageCacheMarker;
3384
3385impl fidl::endpoints::ProtocolMarker for PackageCacheMarker {
3386    type Proxy = PackageCacheProxy;
3387    type RequestStream = PackageCacheRequestStream;
3388    #[cfg(target_os = "fuchsia")]
3389    type SynchronousProxy = PackageCacheSynchronousProxy;
3390
3391    const DEBUG_NAME: &'static str = "fuchsia.pkg.PackageCache";
3392}
3393impl fidl::endpoints::DiscoverableProtocolMarker for PackageCacheMarker {}
3394pub type PackageCacheGetResult = Result<(), i32>;
3395pub type PackageCacheGetSubpackageResult = Result<(), GetSubpackageError>;
3396pub type PackageCacheSyncResult = Result<(), i32>;
3397pub type PackageCacheSetUpgradableUrlsResult = Result<(), SetUpgradableUrlsError>;
3398
3399pub trait PackageCacheProxyInterface: Send + Sync {
3400    type GetResponseFut: std::future::Future<Output = Result<PackageCacheGetResult, fidl::Error>>
3401        + Send;
3402    fn r#get(
3403        &self,
3404        meta_far_blob: &BlobInfo,
3405        gc_protection: GcProtection,
3406        needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3407        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3408    ) -> Self::GetResponseFut;
3409    fn r#write_blobs(
3410        &self,
3411        needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3412    ) -> Result<(), fidl::Error>;
3413    type GetSubpackageResponseFut: std::future::Future<Output = Result<PackageCacheGetSubpackageResult, fidl::Error>>
3414        + Send;
3415    fn r#get_subpackage(
3416        &self,
3417        superpackage: &BlobId,
3418        subpackage: &PackageUrl,
3419        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3420    ) -> Self::GetSubpackageResponseFut;
3421    fn r#base_package_index(
3422        &self,
3423        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3424    ) -> Result<(), fidl::Error>;
3425    fn r#cache_package_index(
3426        &self,
3427        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3428    ) -> Result<(), fidl::Error>;
3429    type SyncResponseFut: std::future::Future<Output = Result<PackageCacheSyncResult, fidl::Error>>
3430        + Send;
3431    fn r#sync(&self) -> Self::SyncResponseFut;
3432    type SetUpgradableUrlsResponseFut: std::future::Future<Output = Result<PackageCacheSetUpgradableUrlsResult, fidl::Error>>
3433        + Send;
3434    fn r#set_upgradable_urls(
3435        &self,
3436        pinned_urls: &[PackageUrl],
3437    ) -> Self::SetUpgradableUrlsResponseFut;
3438}
3439#[derive(Debug)]
3440#[cfg(target_os = "fuchsia")]
3441pub struct PackageCacheSynchronousProxy {
3442    client: fidl::client::sync::Client,
3443}
3444
3445#[cfg(target_os = "fuchsia")]
3446impl fidl::endpoints::SynchronousProxy for PackageCacheSynchronousProxy {
3447    type Proxy = PackageCacheProxy;
3448    type Protocol = PackageCacheMarker;
3449
3450    fn from_channel(inner: fidl::Channel) -> Self {
3451        Self::new(inner)
3452    }
3453
3454    fn into_channel(self) -> fidl::Channel {
3455        self.client.into_channel()
3456    }
3457
3458    fn as_channel(&self) -> &fidl::Channel {
3459        self.client.as_channel()
3460    }
3461}
3462
3463#[cfg(target_os = "fuchsia")]
3464impl PackageCacheSynchronousProxy {
3465    pub fn new(channel: fidl::Channel) -> Self {
3466        let protocol_name = <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3467        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3468    }
3469
3470    pub fn into_channel(self) -> fidl::Channel {
3471        self.client.into_channel()
3472    }
3473
3474    /// Waits until an event arrives and returns it. It is safe for other
3475    /// threads to make concurrent requests while waiting for an event.
3476    pub fn wait_for_event(
3477        &self,
3478        deadline: zx::MonotonicInstant,
3479    ) -> Result<PackageCacheEvent, fidl::Error> {
3480        PackageCacheEvent::decode(self.client.wait_for_event(deadline)?)
3481    }
3482
3483    /// Gets the package directory if it is present on the local system. If it is not, the
3484    /// `missing_blobs` iterator will provide all the blobs in the package that are missing from
3485    /// the system, and the ability to write those blobs to blobfs. If all the missing blobs are
3486    /// downloaded and written to by the client, the `dir` directory will be resolved. This method
3487    /// will return successfully when the package has been fully resolved, or return an error if
3488    /// the client closes `needed_blobs` or `dir` handle before the package has been resolved.
3489    ///
3490    /// This method does not guarantee the missing blobs have been persisted. In order to guarantee
3491    /// missing blobs are persisted, clients should call ['Sync'].
3492    ///
3493    /// Clients must not make concurrent `Get()` calls for the same `meta_far_blob`, even across
3494    /// different `PackageCache` connections, *unless* the `meta_far_blob` is in base or already
3495    /// active in the dynamic index. Violating this may result in `Get()` errors.
3496    ///
3497    /// + request `meta_far_blob` the blob info for the package's meta.far.
3498    /// + request `needed_blobs` an iterator over all the blobs in the package that
3499    ///   are not present on the system.
3500    /// + request `dir` the channel on which the package directory will be served.
3501    /// * error a zx_status value indicating failure. One of the following:
3502    ///     * `ZX_ERR_UNAVAILABLE` if the client closed `needed_blobs` handles before
3503    ///       all the missing blobs were downloaded to the system.
3504    pub fn r#get(
3505        &self,
3506        mut meta_far_blob: &BlobInfo,
3507        mut gc_protection: GcProtection,
3508        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3509        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3510        ___deadline: zx::MonotonicInstant,
3511    ) -> Result<PackageCacheGetResult, fidl::Error> {
3512        let _response = self.client.send_query::<
3513            PackageCacheGetRequest,
3514            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3515        >(
3516            (meta_far_blob, gc_protection, needed_blobs, dir,),
3517            0x15e1963f4bf123b5,
3518            fidl::encoding::DynamicFlags::empty(),
3519            ___deadline,
3520        )?;
3521        Ok(_response.map(|x| x))
3522    }
3523
3524    /// Writes blobs to the system.
3525    ///
3526    /// This method is intended to be used by package resolver components to write individual blobs
3527    /// that are missing from the system.
3528    ///
3529    /// Clients must avoid write collisions of any blobs with `Get()` or another `WriteBlobs()`,
3530    /// even across different `PackageCache` connections.
3531    ///
3532    /// + request `needed_blobs` a protocol can be used to write multiple blobs. This `NeededBlobs`
3533    ///   only supports `OpenBlob` and `BlobWritten`.
3534    pub fn r#write_blobs(
3535        &self,
3536        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3537    ) -> Result<(), fidl::Error> {
3538        self.client.send::<PackageCacheWriteBlobsRequest>(
3539            (needed_blobs,),
3540            0x5d0ed48035931dbe,
3541            fidl::encoding::DynamicFlags::empty(),
3542        )
3543    }
3544
3545    /// Gets the package directory for a subpackage.
3546    /// The connection to the superpackage's package directory must still be open when this is
3547    /// called.
3548    /// The returned package will be protected by open package tracking.
3549    ///
3550    /// + request `superpackage` the hash of the superpackage's meta.far.
3551    /// + request `subpackage` the relative package URL of the subpackage.
3552    /// + request `dir` the channel on which the package directory will be served.
3553    /// * error a GetSubpackageError value indicating failure.
3554    pub fn r#get_subpackage(
3555        &self,
3556        mut superpackage: &BlobId,
3557        mut subpackage: &PackageUrl,
3558        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3559        ___deadline: zx::MonotonicInstant,
3560    ) -> Result<PackageCacheGetSubpackageResult, fidl::Error> {
3561        let _response =
3562            self.client.send_query::<PackageCacheGetSubpackageRequest, fidl::encoding::ResultType<
3563                fidl::encoding::EmptyStruct,
3564                GetSubpackageError,
3565            >>(
3566                (superpackage, subpackage, dir),
3567                0x29478df87c29ffa3,
3568                fidl::encoding::DynamicFlags::empty(),
3569                ___deadline,
3570            )?;
3571        Ok(_response.map(|x| x))
3572    }
3573
3574    /// Retrieves a chunk iterator to the base package index.
3575    ///
3576    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
3577    ///   `PackageIndexEntry` objects until all packages in the base index have been iterated.
3578    pub fn r#base_package_index(
3579        &self,
3580        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3581    ) -> Result<(), fidl::Error> {
3582        self.client.send::<PackageCacheBasePackageIndexRequest>(
3583            (iterator,),
3584            0x46af9e595f8eced4,
3585            fidl::encoding::DynamicFlags::empty(),
3586        )
3587    }
3588
3589    /// Retrieves a chunk iterator to the cache package index.
3590    ///
3591    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
3592    ///   `PackageIndexEntry` objects until all packages in the cache index have been iterated.
3593    pub fn r#cache_package_index(
3594        &self,
3595        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3596    ) -> Result<(), fidl::Error> {
3597        self.client.send::<PackageCacheCachePackageIndexRequest>(
3598            (iterator,),
3599            0x14a48fdb8f26ed26,
3600            fidl::encoding::DynamicFlags::empty(),
3601        )
3602    }
3603
3604    /// Synchronizes updates to the cached packages to the underlying persistent storage.
3605    ///
3606    /// * error a zx_status value indicating failure. One of the following:
3607    ///     * `ZX_ERR_INTERNAL` if the sync fails.
3608    pub fn r#sync(
3609        &self,
3610        ___deadline: zx::MonotonicInstant,
3611    ) -> Result<PackageCacheSyncResult, fidl::Error> {
3612        let _response = self.client.send_query::<
3613            fidl::encoding::EmptyPayload,
3614            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3615        >(
3616            (),
3617            0x5c10a84094535a74,
3618            fidl::encoding::DynamicFlags::empty(),
3619            ___deadline,
3620        )?;
3621        Ok(_response.map(|x| x))
3622    }
3623
3624    /// Sets which package URLs correspond to upgradable packages and the hash they should resolve
3625    /// to.
3626    ///
3627    /// If upgradable packages are enabled in pkg-cache, this method must be called once on start up
3628    /// to set the hashes for persisted upgradable packages. All such packages must not be base
3629    /// packages. If none of the upgradable packages are persisted, a call with an empty vector
3630    /// still needs to be made. Package resolution of non base packages and GC (and therefore OTA)
3631    /// will block until this is done.
3632    ///
3633    /// Subsequent calls can be made to set new upgradable packages or change the hashes associated
3634    /// with upgradable packages.
3635    ///
3636    /// The hash most recently associated with an upgradable package URL will be protected from GC.
3637    ///
3638    /// + request `pinned_urls` packages URLs pinned to the new hash.
3639    pub fn r#set_upgradable_urls(
3640        &self,
3641        mut pinned_urls: &[PackageUrl],
3642        ___deadline: zx::MonotonicInstant,
3643    ) -> Result<PackageCacheSetUpgradableUrlsResult, fidl::Error> {
3644        let _response = self.client.send_query::<
3645            PackageCacheSetUpgradableUrlsRequest,
3646            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, SetUpgradableUrlsError>,
3647        >(
3648            (pinned_urls,),
3649            0x2c235f7efdb5e2d1,
3650            fidl::encoding::DynamicFlags::FLEXIBLE,
3651            ___deadline,
3652        )?
3653        .into_result::<PackageCacheMarker>("set_upgradable_urls")?;
3654        Ok(_response.map(|x| x))
3655    }
3656}
3657
3658#[cfg(target_os = "fuchsia")]
3659impl From<PackageCacheSynchronousProxy> for zx::Handle {
3660    fn from(value: PackageCacheSynchronousProxy) -> Self {
3661        value.into_channel().into()
3662    }
3663}
3664
3665#[cfg(target_os = "fuchsia")]
3666impl From<fidl::Channel> for PackageCacheSynchronousProxy {
3667    fn from(value: fidl::Channel) -> Self {
3668        Self::new(value)
3669    }
3670}
3671
3672#[cfg(target_os = "fuchsia")]
3673impl fidl::endpoints::FromClient for PackageCacheSynchronousProxy {
3674    type Protocol = PackageCacheMarker;
3675
3676    fn from_client(value: fidl::endpoints::ClientEnd<PackageCacheMarker>) -> Self {
3677        Self::new(value.into_channel())
3678    }
3679}
3680
3681#[derive(Debug, Clone)]
3682pub struct PackageCacheProxy {
3683    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3684}
3685
3686impl fidl::endpoints::Proxy for PackageCacheProxy {
3687    type Protocol = PackageCacheMarker;
3688
3689    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3690        Self::new(inner)
3691    }
3692
3693    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3694        self.client.into_channel().map_err(|client| Self { client })
3695    }
3696
3697    fn as_channel(&self) -> &::fidl::AsyncChannel {
3698        self.client.as_channel()
3699    }
3700}
3701
3702impl PackageCacheProxy {
3703    /// Create a new Proxy for fuchsia.pkg/PackageCache.
3704    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3705        let protocol_name = <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3706        Self { client: fidl::client::Client::new(channel, protocol_name) }
3707    }
3708
3709    /// Get a Stream of events from the remote end of the protocol.
3710    ///
3711    /// # Panics
3712    ///
3713    /// Panics if the event stream was already taken.
3714    pub fn take_event_stream(&self) -> PackageCacheEventStream {
3715        PackageCacheEventStream { event_receiver: self.client.take_event_receiver() }
3716    }
3717
3718    /// Gets the package directory if it is present on the local system. If it is not, the
3719    /// `missing_blobs` iterator will provide all the blobs in the package that are missing from
3720    /// the system, and the ability to write those blobs to blobfs. If all the missing blobs are
3721    /// downloaded and written to by the client, the `dir` directory will be resolved. This method
3722    /// will return successfully when the package has been fully resolved, or return an error if
3723    /// the client closes `needed_blobs` or `dir` handle before the package has been resolved.
3724    ///
3725    /// This method does not guarantee the missing blobs have been persisted. In order to guarantee
3726    /// missing blobs are persisted, clients should call ['Sync'].
3727    ///
3728    /// Clients must not make concurrent `Get()` calls for the same `meta_far_blob`, even across
3729    /// different `PackageCache` connections, *unless* the `meta_far_blob` is in base or already
3730    /// active in the dynamic index. Violating this may result in `Get()` errors.
3731    ///
3732    /// + request `meta_far_blob` the blob info for the package's meta.far.
3733    /// + request `needed_blobs` an iterator over all the blobs in the package that
3734    ///   are not present on the system.
3735    /// + request `dir` the channel on which the package directory will be served.
3736    /// * error a zx_status value indicating failure. One of the following:
3737    ///     * `ZX_ERR_UNAVAILABLE` if the client closed `needed_blobs` handles before
3738    ///       all the missing blobs were downloaded to the system.
3739    pub fn r#get(
3740        &self,
3741        mut meta_far_blob: &BlobInfo,
3742        mut gc_protection: GcProtection,
3743        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3744        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3745    ) -> fidl::client::QueryResponseFut<
3746        PackageCacheGetResult,
3747        fidl::encoding::DefaultFuchsiaResourceDialect,
3748    > {
3749        PackageCacheProxyInterface::r#get(self, meta_far_blob, gc_protection, needed_blobs, dir)
3750    }
3751
3752    /// Writes blobs to the system.
3753    ///
3754    /// This method is intended to be used by package resolver components to write individual blobs
3755    /// that are missing from the system.
3756    ///
3757    /// Clients must avoid write collisions of any blobs with `Get()` or another `WriteBlobs()`,
3758    /// even across different `PackageCache` connections.
3759    ///
3760    /// + request `needed_blobs` a protocol can be used to write multiple blobs. This `NeededBlobs`
3761    ///   only supports `OpenBlob` and `BlobWritten`.
3762    pub fn r#write_blobs(
3763        &self,
3764        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3765    ) -> Result<(), fidl::Error> {
3766        PackageCacheProxyInterface::r#write_blobs(self, needed_blobs)
3767    }
3768
3769    /// Gets the package directory for a subpackage.
3770    /// The connection to the superpackage's package directory must still be open when this is
3771    /// called.
3772    /// The returned package will be protected by open package tracking.
3773    ///
3774    /// + request `superpackage` the hash of the superpackage's meta.far.
3775    /// + request `subpackage` the relative package URL of the subpackage.
3776    /// + request `dir` the channel on which the package directory will be served.
3777    /// * error a GetSubpackageError value indicating failure.
3778    pub fn r#get_subpackage(
3779        &self,
3780        mut superpackage: &BlobId,
3781        mut subpackage: &PackageUrl,
3782        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3783    ) -> fidl::client::QueryResponseFut<
3784        PackageCacheGetSubpackageResult,
3785        fidl::encoding::DefaultFuchsiaResourceDialect,
3786    > {
3787        PackageCacheProxyInterface::r#get_subpackage(self, superpackage, subpackage, dir)
3788    }
3789
3790    /// Retrieves a chunk iterator to the base package index.
3791    ///
3792    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
3793    ///   `PackageIndexEntry` objects until all packages in the base index have been iterated.
3794    pub fn r#base_package_index(
3795        &self,
3796        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3797    ) -> Result<(), fidl::Error> {
3798        PackageCacheProxyInterface::r#base_package_index(self, iterator)
3799    }
3800
3801    /// Retrieves a chunk iterator to the cache package index.
3802    ///
3803    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
3804    ///   `PackageIndexEntry` objects until all packages in the cache index have been iterated.
3805    pub fn r#cache_package_index(
3806        &self,
3807        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3808    ) -> Result<(), fidl::Error> {
3809        PackageCacheProxyInterface::r#cache_package_index(self, iterator)
3810    }
3811
3812    /// Synchronizes updates to the cached packages to the underlying persistent storage.
3813    ///
3814    /// * error a zx_status value indicating failure. One of the following:
3815    ///     * `ZX_ERR_INTERNAL` if the sync fails.
3816    pub fn r#sync(
3817        &self,
3818    ) -> fidl::client::QueryResponseFut<
3819        PackageCacheSyncResult,
3820        fidl::encoding::DefaultFuchsiaResourceDialect,
3821    > {
3822        PackageCacheProxyInterface::r#sync(self)
3823    }
3824
3825    /// Sets which package URLs correspond to upgradable packages and the hash they should resolve
3826    /// to.
3827    ///
3828    /// If upgradable packages are enabled in pkg-cache, this method must be called once on start up
3829    /// to set the hashes for persisted upgradable packages. All such packages must not be base
3830    /// packages. If none of the upgradable packages are persisted, a call with an empty vector
3831    /// still needs to be made. Package resolution of non base packages and GC (and therefore OTA)
3832    /// will block until this is done.
3833    ///
3834    /// Subsequent calls can be made to set new upgradable packages or change the hashes associated
3835    /// with upgradable packages.
3836    ///
3837    /// The hash most recently associated with an upgradable package URL will be protected from GC.
3838    ///
3839    /// + request `pinned_urls` packages URLs pinned to the new hash.
3840    pub fn r#set_upgradable_urls(
3841        &self,
3842        mut pinned_urls: &[PackageUrl],
3843    ) -> fidl::client::QueryResponseFut<
3844        PackageCacheSetUpgradableUrlsResult,
3845        fidl::encoding::DefaultFuchsiaResourceDialect,
3846    > {
3847        PackageCacheProxyInterface::r#set_upgradable_urls(self, pinned_urls)
3848    }
3849}
3850
3851impl PackageCacheProxyInterface for PackageCacheProxy {
3852    type GetResponseFut = fidl::client::QueryResponseFut<
3853        PackageCacheGetResult,
3854        fidl::encoding::DefaultFuchsiaResourceDialect,
3855    >;
3856    fn r#get(
3857        &self,
3858        mut meta_far_blob: &BlobInfo,
3859        mut gc_protection: GcProtection,
3860        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3861        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3862    ) -> Self::GetResponseFut {
3863        fn _decode(
3864            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3865        ) -> Result<PackageCacheGetResult, fidl::Error> {
3866            let _response = fidl::client::decode_transaction_body::<
3867                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3868                fidl::encoding::DefaultFuchsiaResourceDialect,
3869                0x15e1963f4bf123b5,
3870            >(_buf?)?;
3871            Ok(_response.map(|x| x))
3872        }
3873        self.client.send_query_and_decode::<PackageCacheGetRequest, PackageCacheGetResult>(
3874            (meta_far_blob, gc_protection, needed_blobs, dir),
3875            0x15e1963f4bf123b5,
3876            fidl::encoding::DynamicFlags::empty(),
3877            _decode,
3878        )
3879    }
3880
3881    fn r#write_blobs(
3882        &self,
3883        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3884    ) -> Result<(), fidl::Error> {
3885        self.client.send::<PackageCacheWriteBlobsRequest>(
3886            (needed_blobs,),
3887            0x5d0ed48035931dbe,
3888            fidl::encoding::DynamicFlags::empty(),
3889        )
3890    }
3891
3892    type GetSubpackageResponseFut = fidl::client::QueryResponseFut<
3893        PackageCacheGetSubpackageResult,
3894        fidl::encoding::DefaultFuchsiaResourceDialect,
3895    >;
3896    fn r#get_subpackage(
3897        &self,
3898        mut superpackage: &BlobId,
3899        mut subpackage: &PackageUrl,
3900        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3901    ) -> Self::GetSubpackageResponseFut {
3902        fn _decode(
3903            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3904        ) -> Result<PackageCacheGetSubpackageResult, fidl::Error> {
3905            let _response = fidl::client::decode_transaction_body::<
3906                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GetSubpackageError>,
3907                fidl::encoding::DefaultFuchsiaResourceDialect,
3908                0x29478df87c29ffa3,
3909            >(_buf?)?;
3910            Ok(_response.map(|x| x))
3911        }
3912        self.client.send_query_and_decode::<
3913            PackageCacheGetSubpackageRequest,
3914            PackageCacheGetSubpackageResult,
3915        >(
3916            (superpackage, subpackage, dir,),
3917            0x29478df87c29ffa3,
3918            fidl::encoding::DynamicFlags::empty(),
3919            _decode,
3920        )
3921    }
3922
3923    fn r#base_package_index(
3924        &self,
3925        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3926    ) -> Result<(), fidl::Error> {
3927        self.client.send::<PackageCacheBasePackageIndexRequest>(
3928            (iterator,),
3929            0x46af9e595f8eced4,
3930            fidl::encoding::DynamicFlags::empty(),
3931        )
3932    }
3933
3934    fn r#cache_package_index(
3935        &self,
3936        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3937    ) -> Result<(), fidl::Error> {
3938        self.client.send::<PackageCacheCachePackageIndexRequest>(
3939            (iterator,),
3940            0x14a48fdb8f26ed26,
3941            fidl::encoding::DynamicFlags::empty(),
3942        )
3943    }
3944
3945    type SyncResponseFut = fidl::client::QueryResponseFut<
3946        PackageCacheSyncResult,
3947        fidl::encoding::DefaultFuchsiaResourceDialect,
3948    >;
3949    fn r#sync(&self) -> Self::SyncResponseFut {
3950        fn _decode(
3951            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3952        ) -> Result<PackageCacheSyncResult, fidl::Error> {
3953            let _response = fidl::client::decode_transaction_body::<
3954                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3955                fidl::encoding::DefaultFuchsiaResourceDialect,
3956                0x5c10a84094535a74,
3957            >(_buf?)?;
3958            Ok(_response.map(|x| x))
3959        }
3960        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PackageCacheSyncResult>(
3961            (),
3962            0x5c10a84094535a74,
3963            fidl::encoding::DynamicFlags::empty(),
3964            _decode,
3965        )
3966    }
3967
3968    type SetUpgradableUrlsResponseFut = fidl::client::QueryResponseFut<
3969        PackageCacheSetUpgradableUrlsResult,
3970        fidl::encoding::DefaultFuchsiaResourceDialect,
3971    >;
3972    fn r#set_upgradable_urls(
3973        &self,
3974        mut pinned_urls: &[PackageUrl],
3975    ) -> Self::SetUpgradableUrlsResponseFut {
3976        fn _decode(
3977            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3978        ) -> Result<PackageCacheSetUpgradableUrlsResult, fidl::Error> {
3979            let _response = fidl::client::decode_transaction_body::<
3980                fidl::encoding::FlexibleResultType<
3981                    fidl::encoding::EmptyStruct,
3982                    SetUpgradableUrlsError,
3983                >,
3984                fidl::encoding::DefaultFuchsiaResourceDialect,
3985                0x2c235f7efdb5e2d1,
3986            >(_buf?)?
3987            .into_result::<PackageCacheMarker>("set_upgradable_urls")?;
3988            Ok(_response.map(|x| x))
3989        }
3990        self.client.send_query_and_decode::<
3991            PackageCacheSetUpgradableUrlsRequest,
3992            PackageCacheSetUpgradableUrlsResult,
3993        >(
3994            (pinned_urls,),
3995            0x2c235f7efdb5e2d1,
3996            fidl::encoding::DynamicFlags::FLEXIBLE,
3997            _decode,
3998        )
3999    }
4000}
4001
4002pub struct PackageCacheEventStream {
4003    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4004}
4005
4006impl std::marker::Unpin for PackageCacheEventStream {}
4007
4008impl futures::stream::FusedStream for PackageCacheEventStream {
4009    fn is_terminated(&self) -> bool {
4010        self.event_receiver.is_terminated()
4011    }
4012}
4013
4014impl futures::Stream for PackageCacheEventStream {
4015    type Item = Result<PackageCacheEvent, fidl::Error>;
4016
4017    fn poll_next(
4018        mut self: std::pin::Pin<&mut Self>,
4019        cx: &mut std::task::Context<'_>,
4020    ) -> std::task::Poll<Option<Self::Item>> {
4021        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4022            &mut self.event_receiver,
4023            cx
4024        )?) {
4025            Some(buf) => std::task::Poll::Ready(Some(PackageCacheEvent::decode(buf))),
4026            None => std::task::Poll::Ready(None),
4027        }
4028    }
4029}
4030
4031#[derive(Debug)]
4032pub enum PackageCacheEvent {
4033    #[non_exhaustive]
4034    _UnknownEvent {
4035        /// Ordinal of the event that was sent.
4036        ordinal: u64,
4037    },
4038}
4039
4040impl PackageCacheEvent {
4041    /// Decodes a message buffer as a [`PackageCacheEvent`].
4042    fn decode(
4043        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4044    ) -> Result<PackageCacheEvent, fidl::Error> {
4045        let (bytes, _handles) = buf.split_mut();
4046        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4047        debug_assert_eq!(tx_header.tx_id, 0);
4048        match tx_header.ordinal {
4049            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4050                Ok(PackageCacheEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4051            }
4052            _ => Err(fidl::Error::UnknownOrdinal {
4053                ordinal: tx_header.ordinal,
4054                protocol_name: <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4055            }),
4056        }
4057    }
4058}
4059
4060/// A Stream of incoming requests for fuchsia.pkg/PackageCache.
4061pub struct PackageCacheRequestStream {
4062    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4063    is_terminated: bool,
4064}
4065
4066impl std::marker::Unpin for PackageCacheRequestStream {}
4067
4068impl futures::stream::FusedStream for PackageCacheRequestStream {
4069    fn is_terminated(&self) -> bool {
4070        self.is_terminated
4071    }
4072}
4073
4074impl fidl::endpoints::RequestStream for PackageCacheRequestStream {
4075    type Protocol = PackageCacheMarker;
4076    type ControlHandle = PackageCacheControlHandle;
4077
4078    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4079        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4080    }
4081
4082    fn control_handle(&self) -> Self::ControlHandle {
4083        PackageCacheControlHandle { inner: self.inner.clone() }
4084    }
4085
4086    fn into_inner(
4087        self,
4088    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4089    {
4090        (self.inner, self.is_terminated)
4091    }
4092
4093    fn from_inner(
4094        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4095        is_terminated: bool,
4096    ) -> Self {
4097        Self { inner, is_terminated }
4098    }
4099}
4100
4101impl futures::Stream for PackageCacheRequestStream {
4102    type Item = Result<PackageCacheRequest, fidl::Error>;
4103
4104    fn poll_next(
4105        mut self: std::pin::Pin<&mut Self>,
4106        cx: &mut std::task::Context<'_>,
4107    ) -> std::task::Poll<Option<Self::Item>> {
4108        let this = &mut *self;
4109        if this.inner.check_shutdown(cx) {
4110            this.is_terminated = true;
4111            return std::task::Poll::Ready(None);
4112        }
4113        if this.is_terminated {
4114            panic!("polled PackageCacheRequestStream after completion");
4115        }
4116        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4117            |bytes, handles| {
4118                match this.inner.channel().read_etc(cx, bytes, handles) {
4119                    std::task::Poll::Ready(Ok(())) => {}
4120                    std::task::Poll::Pending => return std::task::Poll::Pending,
4121                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4122                        this.is_terminated = true;
4123                        return std::task::Poll::Ready(None);
4124                    }
4125                    std::task::Poll::Ready(Err(e)) => {
4126                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4127                            e.into(),
4128                        ))));
4129                    }
4130                }
4131
4132                // A message has been received from the channel
4133                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4134
4135                std::task::Poll::Ready(Some(match header.ordinal {
4136                    0x15e1963f4bf123b5 => {
4137                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4138                        let mut req = fidl::new_empty!(
4139                            PackageCacheGetRequest,
4140                            fidl::encoding::DefaultFuchsiaResourceDialect
4141                        );
4142                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheGetRequest>(&header, _body_bytes, handles, &mut req)?;
4143                        let control_handle =
4144                            PackageCacheControlHandle { inner: this.inner.clone() };
4145                        Ok(PackageCacheRequest::Get {
4146                            meta_far_blob: req.meta_far_blob,
4147                            gc_protection: req.gc_protection,
4148                            needed_blobs: req.needed_blobs,
4149                            dir: req.dir,
4150
4151                            responder: PackageCacheGetResponder {
4152                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4153                                tx_id: header.tx_id,
4154                            },
4155                        })
4156                    }
4157                    0x5d0ed48035931dbe => {
4158                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4159                        let mut req = fidl::new_empty!(
4160                            PackageCacheWriteBlobsRequest,
4161                            fidl::encoding::DefaultFuchsiaResourceDialect
4162                        );
4163                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheWriteBlobsRequest>(&header, _body_bytes, handles, &mut req)?;
4164                        let control_handle =
4165                            PackageCacheControlHandle { inner: this.inner.clone() };
4166                        Ok(PackageCacheRequest::WriteBlobs {
4167                            needed_blobs: req.needed_blobs,
4168
4169                            control_handle,
4170                        })
4171                    }
4172                    0x29478df87c29ffa3 => {
4173                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4174                        let mut req = fidl::new_empty!(
4175                            PackageCacheGetSubpackageRequest,
4176                            fidl::encoding::DefaultFuchsiaResourceDialect
4177                        );
4178                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheGetSubpackageRequest>(&header, _body_bytes, handles, &mut req)?;
4179                        let control_handle =
4180                            PackageCacheControlHandle { inner: this.inner.clone() };
4181                        Ok(PackageCacheRequest::GetSubpackage {
4182                            superpackage: req.superpackage,
4183                            subpackage: req.subpackage,
4184                            dir: req.dir,
4185
4186                            responder: PackageCacheGetSubpackageResponder {
4187                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4188                                tx_id: header.tx_id,
4189                            },
4190                        })
4191                    }
4192                    0x46af9e595f8eced4 => {
4193                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4194                        let mut req = fidl::new_empty!(
4195                            PackageCacheBasePackageIndexRequest,
4196                            fidl::encoding::DefaultFuchsiaResourceDialect
4197                        );
4198                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheBasePackageIndexRequest>(&header, _body_bytes, handles, &mut req)?;
4199                        let control_handle =
4200                            PackageCacheControlHandle { inner: this.inner.clone() };
4201                        Ok(PackageCacheRequest::BasePackageIndex {
4202                            iterator: req.iterator,
4203
4204                            control_handle,
4205                        })
4206                    }
4207                    0x14a48fdb8f26ed26 => {
4208                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4209                        let mut req = fidl::new_empty!(
4210                            PackageCacheCachePackageIndexRequest,
4211                            fidl::encoding::DefaultFuchsiaResourceDialect
4212                        );
4213                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheCachePackageIndexRequest>(&header, _body_bytes, handles, &mut req)?;
4214                        let control_handle =
4215                            PackageCacheControlHandle { inner: this.inner.clone() };
4216                        Ok(PackageCacheRequest::CachePackageIndex {
4217                            iterator: req.iterator,
4218
4219                            control_handle,
4220                        })
4221                    }
4222                    0x5c10a84094535a74 => {
4223                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4224                        let mut req = fidl::new_empty!(
4225                            fidl::encoding::EmptyPayload,
4226                            fidl::encoding::DefaultFuchsiaResourceDialect
4227                        );
4228                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4229                        let control_handle =
4230                            PackageCacheControlHandle { inner: this.inner.clone() };
4231                        Ok(PackageCacheRequest::Sync {
4232                            responder: PackageCacheSyncResponder {
4233                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4234                                tx_id: header.tx_id,
4235                            },
4236                        })
4237                    }
4238                    0x2c235f7efdb5e2d1 => {
4239                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4240                        let mut req = fidl::new_empty!(
4241                            PackageCacheSetUpgradableUrlsRequest,
4242                            fidl::encoding::DefaultFuchsiaResourceDialect
4243                        );
4244                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheSetUpgradableUrlsRequest>(&header, _body_bytes, handles, &mut req)?;
4245                        let control_handle =
4246                            PackageCacheControlHandle { inner: this.inner.clone() };
4247                        Ok(PackageCacheRequest::SetUpgradableUrls {
4248                            pinned_urls: req.pinned_urls,
4249
4250                            responder: PackageCacheSetUpgradableUrlsResponder {
4251                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4252                                tx_id: header.tx_id,
4253                            },
4254                        })
4255                    }
4256                    _ if header.tx_id == 0
4257                        && header
4258                            .dynamic_flags()
4259                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4260                    {
4261                        Ok(PackageCacheRequest::_UnknownMethod {
4262                            ordinal: header.ordinal,
4263                            control_handle: PackageCacheControlHandle { inner: this.inner.clone() },
4264                            method_type: fidl::MethodType::OneWay,
4265                        })
4266                    }
4267                    _ if header
4268                        .dynamic_flags()
4269                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4270                    {
4271                        this.inner.send_framework_err(
4272                            fidl::encoding::FrameworkErr::UnknownMethod,
4273                            header.tx_id,
4274                            header.ordinal,
4275                            header.dynamic_flags(),
4276                            (bytes, handles),
4277                        )?;
4278                        Ok(PackageCacheRequest::_UnknownMethod {
4279                            ordinal: header.ordinal,
4280                            control_handle: PackageCacheControlHandle { inner: this.inner.clone() },
4281                            method_type: fidl::MethodType::TwoWay,
4282                        })
4283                    }
4284                    _ => Err(fidl::Error::UnknownOrdinal {
4285                        ordinal: header.ordinal,
4286                        protocol_name:
4287                            <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4288                    }),
4289                }))
4290            },
4291        )
4292    }
4293}
4294
4295/// This manages the system package cache.
4296///
4297/// This is intended to be implemented by the package manager component and used by
4298/// package resolver components.
4299#[derive(Debug)]
4300pub enum PackageCacheRequest {
4301    /// Gets the package directory if it is present on the local system. If it is not, the
4302    /// `missing_blobs` iterator will provide all the blobs in the package that are missing from
4303    /// the system, and the ability to write those blobs to blobfs. If all the missing blobs are
4304    /// downloaded and written to by the client, the `dir` directory will be resolved. This method
4305    /// will return successfully when the package has been fully resolved, or return an error if
4306    /// the client closes `needed_blobs` or `dir` handle before the package has been resolved.
4307    ///
4308    /// This method does not guarantee the missing blobs have been persisted. In order to guarantee
4309    /// missing blobs are persisted, clients should call ['Sync'].
4310    ///
4311    /// Clients must not make concurrent `Get()` calls for the same `meta_far_blob`, even across
4312    /// different `PackageCache` connections, *unless* the `meta_far_blob` is in base or already
4313    /// active in the dynamic index. Violating this may result in `Get()` errors.
4314    ///
4315    /// + request `meta_far_blob` the blob info for the package's meta.far.
4316    /// + request `needed_blobs` an iterator over all the blobs in the package that
4317    ///   are not present on the system.
4318    /// + request `dir` the channel on which the package directory will be served.
4319    /// * error a zx_status value indicating failure. One of the following:
4320    ///     * `ZX_ERR_UNAVAILABLE` if the client closed `needed_blobs` handles before
4321    ///       all the missing blobs were downloaded to the system.
4322    Get {
4323        meta_far_blob: BlobInfo,
4324        gc_protection: GcProtection,
4325        needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4326        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4327        responder: PackageCacheGetResponder,
4328    },
4329    /// Writes blobs to the system.
4330    ///
4331    /// This method is intended to be used by package resolver components to write individual blobs
4332    /// that are missing from the system.
4333    ///
4334    /// Clients must avoid write collisions of any blobs with `Get()` or another `WriteBlobs()`,
4335    /// even across different `PackageCache` connections.
4336    ///
4337    /// + request `needed_blobs` a protocol can be used to write multiple blobs. This `NeededBlobs`
4338    ///   only supports `OpenBlob` and `BlobWritten`.
4339    WriteBlobs {
4340        needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4341        control_handle: PackageCacheControlHandle,
4342    },
4343    /// Gets the package directory for a subpackage.
4344    /// The connection to the superpackage's package directory must still be open when this is
4345    /// called.
4346    /// The returned package will be protected by open package tracking.
4347    ///
4348    /// + request `superpackage` the hash of the superpackage's meta.far.
4349    /// + request `subpackage` the relative package URL of the subpackage.
4350    /// + request `dir` the channel on which the package directory will be served.
4351    /// * error a GetSubpackageError value indicating failure.
4352    GetSubpackage {
4353        superpackage: BlobId,
4354        subpackage: PackageUrl,
4355        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4356        responder: PackageCacheGetSubpackageResponder,
4357    },
4358    /// Retrieves a chunk iterator to the base package index.
4359    ///
4360    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4361    ///   `PackageIndexEntry` objects until all packages in the base index have been iterated.
4362    BasePackageIndex {
4363        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4364        control_handle: PackageCacheControlHandle,
4365    },
4366    /// Retrieves a chunk iterator to the cache package index.
4367    ///
4368    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4369    ///   `PackageIndexEntry` objects until all packages in the cache index have been iterated.
4370    CachePackageIndex {
4371        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4372        control_handle: PackageCacheControlHandle,
4373    },
4374    /// Synchronizes updates to the cached packages to the underlying persistent storage.
4375    ///
4376    /// * error a zx_status value indicating failure. One of the following:
4377    ///     * `ZX_ERR_INTERNAL` if the sync fails.
4378    Sync { responder: PackageCacheSyncResponder },
4379    /// Sets which package URLs correspond to upgradable packages and the hash they should resolve
4380    /// to.
4381    ///
4382    /// If upgradable packages are enabled in pkg-cache, this method must be called once on start up
4383    /// to set the hashes for persisted upgradable packages. All such packages must not be base
4384    /// packages. If none of the upgradable packages are persisted, a call with an empty vector
4385    /// still needs to be made. Package resolution of non base packages and GC (and therefore OTA)
4386    /// will block until this is done.
4387    ///
4388    /// Subsequent calls can be made to set new upgradable packages or change the hashes associated
4389    /// with upgradable packages.
4390    ///
4391    /// The hash most recently associated with an upgradable package URL will be protected from GC.
4392    ///
4393    /// + request `pinned_urls` packages URLs pinned to the new hash.
4394    SetUpgradableUrls {
4395        pinned_urls: Vec<PackageUrl>,
4396        responder: PackageCacheSetUpgradableUrlsResponder,
4397    },
4398    /// An interaction was received which does not match any known method.
4399    #[non_exhaustive]
4400    _UnknownMethod {
4401        /// Ordinal of the method that was called.
4402        ordinal: u64,
4403        control_handle: PackageCacheControlHandle,
4404        method_type: fidl::MethodType,
4405    },
4406}
4407
4408impl PackageCacheRequest {
4409    #[allow(irrefutable_let_patterns)]
4410    pub fn into_get(
4411        self,
4412    ) -> Option<(
4413        BlobInfo,
4414        GcProtection,
4415        fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4416        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4417        PackageCacheGetResponder,
4418    )> {
4419        if let PackageCacheRequest::Get {
4420            meta_far_blob,
4421            gc_protection,
4422            needed_blobs,
4423            dir,
4424            responder,
4425        } = self
4426        {
4427            Some((meta_far_blob, gc_protection, needed_blobs, dir, responder))
4428        } else {
4429            None
4430        }
4431    }
4432
4433    #[allow(irrefutable_let_patterns)]
4434    pub fn into_write_blobs(
4435        self,
4436    ) -> Option<(fidl::endpoints::ServerEnd<NeededBlobsMarker>, PackageCacheControlHandle)> {
4437        if let PackageCacheRequest::WriteBlobs { needed_blobs, control_handle } = self {
4438            Some((needed_blobs, control_handle))
4439        } else {
4440            None
4441        }
4442    }
4443
4444    #[allow(irrefutable_let_patterns)]
4445    pub fn into_get_subpackage(
4446        self,
4447    ) -> Option<(
4448        BlobId,
4449        PackageUrl,
4450        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4451        PackageCacheGetSubpackageResponder,
4452    )> {
4453        if let PackageCacheRequest::GetSubpackage { superpackage, subpackage, dir, responder } =
4454            self
4455        {
4456            Some((superpackage, subpackage, dir, responder))
4457        } else {
4458            None
4459        }
4460    }
4461
4462    #[allow(irrefutable_let_patterns)]
4463    pub fn into_base_package_index(
4464        self,
4465    ) -> Option<(fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>, PackageCacheControlHandle)>
4466    {
4467        if let PackageCacheRequest::BasePackageIndex { iterator, control_handle } = self {
4468            Some((iterator, control_handle))
4469        } else {
4470            None
4471        }
4472    }
4473
4474    #[allow(irrefutable_let_patterns)]
4475    pub fn into_cache_package_index(
4476        self,
4477    ) -> Option<(fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>, PackageCacheControlHandle)>
4478    {
4479        if let PackageCacheRequest::CachePackageIndex { iterator, control_handle } = self {
4480            Some((iterator, control_handle))
4481        } else {
4482            None
4483        }
4484    }
4485
4486    #[allow(irrefutable_let_patterns)]
4487    pub fn into_sync(self) -> Option<(PackageCacheSyncResponder)> {
4488        if let PackageCacheRequest::Sync { responder } = self { Some((responder)) } else { None }
4489    }
4490
4491    #[allow(irrefutable_let_patterns)]
4492    pub fn into_set_upgradable_urls(
4493        self,
4494    ) -> Option<(Vec<PackageUrl>, PackageCacheSetUpgradableUrlsResponder)> {
4495        if let PackageCacheRequest::SetUpgradableUrls { pinned_urls, responder } = self {
4496            Some((pinned_urls, responder))
4497        } else {
4498            None
4499        }
4500    }
4501
4502    /// Name of the method defined in FIDL
4503    pub fn method_name(&self) -> &'static str {
4504        match *self {
4505            PackageCacheRequest::Get { .. } => "get",
4506            PackageCacheRequest::WriteBlobs { .. } => "write_blobs",
4507            PackageCacheRequest::GetSubpackage { .. } => "get_subpackage",
4508            PackageCacheRequest::BasePackageIndex { .. } => "base_package_index",
4509            PackageCacheRequest::CachePackageIndex { .. } => "cache_package_index",
4510            PackageCacheRequest::Sync { .. } => "sync",
4511            PackageCacheRequest::SetUpgradableUrls { .. } => "set_upgradable_urls",
4512            PackageCacheRequest::_UnknownMethod {
4513                method_type: fidl::MethodType::OneWay, ..
4514            } => "unknown one-way method",
4515            PackageCacheRequest::_UnknownMethod {
4516                method_type: fidl::MethodType::TwoWay, ..
4517            } => "unknown two-way method",
4518        }
4519    }
4520}
4521
4522#[derive(Debug, Clone)]
4523pub struct PackageCacheControlHandle {
4524    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4525}
4526
4527impl fidl::endpoints::ControlHandle for PackageCacheControlHandle {
4528    fn shutdown(&self) {
4529        self.inner.shutdown()
4530    }
4531    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4532        self.inner.shutdown_with_epitaph(status)
4533    }
4534
4535    fn is_closed(&self) -> bool {
4536        self.inner.channel().is_closed()
4537    }
4538    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4539        self.inner.channel().on_closed()
4540    }
4541
4542    #[cfg(target_os = "fuchsia")]
4543    fn signal_peer(
4544        &self,
4545        clear_mask: zx::Signals,
4546        set_mask: zx::Signals,
4547    ) -> Result<(), zx_status::Status> {
4548        use fidl::Peered;
4549        self.inner.channel().signal_peer(clear_mask, set_mask)
4550    }
4551}
4552
4553impl PackageCacheControlHandle {}
4554
4555#[must_use = "FIDL methods require a response to be sent"]
4556#[derive(Debug)]
4557pub struct PackageCacheGetResponder {
4558    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
4559    tx_id: u32,
4560}
4561
4562/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
4563/// if the responder is dropped without sending a response, so that the client
4564/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4565impl std::ops::Drop for PackageCacheGetResponder {
4566    fn drop(&mut self) {
4567        self.control_handle.shutdown();
4568        // Safety: drops once, never accessed again
4569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4570    }
4571}
4572
4573impl fidl::endpoints::Responder for PackageCacheGetResponder {
4574    type ControlHandle = PackageCacheControlHandle;
4575
4576    fn control_handle(&self) -> &PackageCacheControlHandle {
4577        &self.control_handle
4578    }
4579
4580    fn drop_without_shutdown(mut self) {
4581        // Safety: drops once, never accessed again due to mem::forget
4582        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4583        // Prevent Drop from running (which would shut down the channel)
4584        std::mem::forget(self);
4585    }
4586}
4587
4588impl PackageCacheGetResponder {
4589    /// Sends a response to the FIDL transaction.
4590    ///
4591    /// Sets the channel to shutdown if an error occurs.
4592    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4593        let _result = self.send_raw(result);
4594        if _result.is_err() {
4595            self.control_handle.shutdown();
4596        }
4597        self.drop_without_shutdown();
4598        _result
4599    }
4600
4601    /// Similar to "send" but does not shutdown the channel if an error occurs.
4602    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4603        let _result = self.send_raw(result);
4604        self.drop_without_shutdown();
4605        _result
4606    }
4607
4608    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4609        self.control_handle
4610            .inner
4611            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4612                result,
4613                self.tx_id,
4614                0x15e1963f4bf123b5,
4615                fidl::encoding::DynamicFlags::empty(),
4616            )
4617    }
4618}
4619
4620#[must_use = "FIDL methods require a response to be sent"]
4621#[derive(Debug)]
4622pub struct PackageCacheGetSubpackageResponder {
4623    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
4624    tx_id: u32,
4625}
4626
4627/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
4628/// if the responder is dropped without sending a response, so that the client
4629/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4630impl std::ops::Drop for PackageCacheGetSubpackageResponder {
4631    fn drop(&mut self) {
4632        self.control_handle.shutdown();
4633        // Safety: drops once, never accessed again
4634        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4635    }
4636}
4637
4638impl fidl::endpoints::Responder for PackageCacheGetSubpackageResponder {
4639    type ControlHandle = PackageCacheControlHandle;
4640
4641    fn control_handle(&self) -> &PackageCacheControlHandle {
4642        &self.control_handle
4643    }
4644
4645    fn drop_without_shutdown(mut self) {
4646        // Safety: drops once, never accessed again due to mem::forget
4647        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4648        // Prevent Drop from running (which would shut down the channel)
4649        std::mem::forget(self);
4650    }
4651}
4652
4653impl PackageCacheGetSubpackageResponder {
4654    /// Sends a response to the FIDL transaction.
4655    ///
4656    /// Sets the channel to shutdown if an error occurs.
4657    pub fn send(self, mut result: Result<(), GetSubpackageError>) -> Result<(), fidl::Error> {
4658        let _result = self.send_raw(result);
4659        if _result.is_err() {
4660            self.control_handle.shutdown();
4661        }
4662        self.drop_without_shutdown();
4663        _result
4664    }
4665
4666    /// Similar to "send" but does not shutdown the channel if an error occurs.
4667    pub fn send_no_shutdown_on_err(
4668        self,
4669        mut result: Result<(), GetSubpackageError>,
4670    ) -> Result<(), fidl::Error> {
4671        let _result = self.send_raw(result);
4672        self.drop_without_shutdown();
4673        _result
4674    }
4675
4676    fn send_raw(&self, mut result: Result<(), GetSubpackageError>) -> Result<(), fidl::Error> {
4677        self.control_handle.inner.send::<fidl::encoding::ResultType<
4678            fidl::encoding::EmptyStruct,
4679            GetSubpackageError,
4680        >>(
4681            result,
4682            self.tx_id,
4683            0x29478df87c29ffa3,
4684            fidl::encoding::DynamicFlags::empty(),
4685        )
4686    }
4687}
4688
4689#[must_use = "FIDL methods require a response to be sent"]
4690#[derive(Debug)]
4691pub struct PackageCacheSyncResponder {
4692    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
4693    tx_id: u32,
4694}
4695
4696/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
4697/// if the responder is dropped without sending a response, so that the client
4698/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4699impl std::ops::Drop for PackageCacheSyncResponder {
4700    fn drop(&mut self) {
4701        self.control_handle.shutdown();
4702        // Safety: drops once, never accessed again
4703        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4704    }
4705}
4706
4707impl fidl::endpoints::Responder for PackageCacheSyncResponder {
4708    type ControlHandle = PackageCacheControlHandle;
4709
4710    fn control_handle(&self) -> &PackageCacheControlHandle {
4711        &self.control_handle
4712    }
4713
4714    fn drop_without_shutdown(mut self) {
4715        // Safety: drops once, never accessed again due to mem::forget
4716        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4717        // Prevent Drop from running (which would shut down the channel)
4718        std::mem::forget(self);
4719    }
4720}
4721
4722impl PackageCacheSyncResponder {
4723    /// Sends a response to the FIDL transaction.
4724    ///
4725    /// Sets the channel to shutdown if an error occurs.
4726    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4727        let _result = self.send_raw(result);
4728        if _result.is_err() {
4729            self.control_handle.shutdown();
4730        }
4731        self.drop_without_shutdown();
4732        _result
4733    }
4734
4735    /// Similar to "send" but does not shutdown the channel if an error occurs.
4736    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4737        let _result = self.send_raw(result);
4738        self.drop_without_shutdown();
4739        _result
4740    }
4741
4742    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4743        self.control_handle
4744            .inner
4745            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4746                result,
4747                self.tx_id,
4748                0x5c10a84094535a74,
4749                fidl::encoding::DynamicFlags::empty(),
4750            )
4751    }
4752}
4753
4754#[must_use = "FIDL methods require a response to be sent"]
4755#[derive(Debug)]
4756pub struct PackageCacheSetUpgradableUrlsResponder {
4757    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
4758    tx_id: u32,
4759}
4760
4761/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
4762/// if the responder is dropped without sending a response, so that the client
4763/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4764impl std::ops::Drop for PackageCacheSetUpgradableUrlsResponder {
4765    fn drop(&mut self) {
4766        self.control_handle.shutdown();
4767        // Safety: drops once, never accessed again
4768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4769    }
4770}
4771
4772impl fidl::endpoints::Responder for PackageCacheSetUpgradableUrlsResponder {
4773    type ControlHandle = PackageCacheControlHandle;
4774
4775    fn control_handle(&self) -> &PackageCacheControlHandle {
4776        &self.control_handle
4777    }
4778
4779    fn drop_without_shutdown(mut self) {
4780        // Safety: drops once, never accessed again due to mem::forget
4781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4782        // Prevent Drop from running (which would shut down the channel)
4783        std::mem::forget(self);
4784    }
4785}
4786
4787impl PackageCacheSetUpgradableUrlsResponder {
4788    /// Sends a response to the FIDL transaction.
4789    ///
4790    /// Sets the channel to shutdown if an error occurs.
4791    pub fn send(self, mut result: Result<(), SetUpgradableUrlsError>) -> Result<(), fidl::Error> {
4792        let _result = self.send_raw(result);
4793        if _result.is_err() {
4794            self.control_handle.shutdown();
4795        }
4796        self.drop_without_shutdown();
4797        _result
4798    }
4799
4800    /// Similar to "send" but does not shutdown the channel if an error occurs.
4801    pub fn send_no_shutdown_on_err(
4802        self,
4803        mut result: Result<(), SetUpgradableUrlsError>,
4804    ) -> Result<(), fidl::Error> {
4805        let _result = self.send_raw(result);
4806        self.drop_without_shutdown();
4807        _result
4808    }
4809
4810    fn send_raw(&self, mut result: Result<(), SetUpgradableUrlsError>) -> Result<(), fidl::Error> {
4811        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4812            fidl::encoding::EmptyStruct,
4813            SetUpgradableUrlsError,
4814        >>(
4815            fidl::encoding::FlexibleResult::new(result),
4816            self.tx_id,
4817            0x2c235f7efdb5e2d1,
4818            fidl::encoding::DynamicFlags::FLEXIBLE,
4819        )
4820    }
4821}
4822
4823#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4824pub struct PackageIndexIteratorMarker;
4825
4826impl fidl::endpoints::ProtocolMarker for PackageIndexIteratorMarker {
4827    type Proxy = PackageIndexIteratorProxy;
4828    type RequestStream = PackageIndexIteratorRequestStream;
4829    #[cfg(target_os = "fuchsia")]
4830    type SynchronousProxy = PackageIndexIteratorSynchronousProxy;
4831
4832    const DEBUG_NAME: &'static str = "(anonymous) PackageIndexIterator";
4833}
4834
4835pub trait PackageIndexIteratorProxyInterface: Send + Sync {
4836    type NextResponseFut: std::future::Future<Output = Result<Vec<PackageIndexEntry>, fidl::Error>>
4837        + Send;
4838    fn r#next(&self) -> Self::NextResponseFut;
4839}
4840#[derive(Debug)]
4841#[cfg(target_os = "fuchsia")]
4842pub struct PackageIndexIteratorSynchronousProxy {
4843    client: fidl::client::sync::Client,
4844}
4845
4846#[cfg(target_os = "fuchsia")]
4847impl fidl::endpoints::SynchronousProxy for PackageIndexIteratorSynchronousProxy {
4848    type Proxy = PackageIndexIteratorProxy;
4849    type Protocol = PackageIndexIteratorMarker;
4850
4851    fn from_channel(inner: fidl::Channel) -> Self {
4852        Self::new(inner)
4853    }
4854
4855    fn into_channel(self) -> fidl::Channel {
4856        self.client.into_channel()
4857    }
4858
4859    fn as_channel(&self) -> &fidl::Channel {
4860        self.client.as_channel()
4861    }
4862}
4863
4864#[cfg(target_os = "fuchsia")]
4865impl PackageIndexIteratorSynchronousProxy {
4866    pub fn new(channel: fidl::Channel) -> Self {
4867        let protocol_name =
4868            <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4869        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4870    }
4871
4872    pub fn into_channel(self) -> fidl::Channel {
4873        self.client.into_channel()
4874    }
4875
4876    /// Waits until an event arrives and returns it. It is safe for other
4877    /// threads to make concurrent requests while waiting for an event.
4878    pub fn wait_for_event(
4879        &self,
4880        deadline: zx::MonotonicInstant,
4881    ) -> Result<PackageIndexIteratorEvent, fidl::Error> {
4882        PackageIndexIteratorEvent::decode(self.client.wait_for_event(deadline)?)
4883    }
4884
4885    /// Returns the next chunk of package index entries. When the iterator is exhausted,
4886    /// this returns an empty vector.
4887    ///
4888    /// - response `entries` the next chunk of entries in the package index.
4889    pub fn r#next(
4890        &self,
4891        ___deadline: zx::MonotonicInstant,
4892    ) -> Result<Vec<PackageIndexEntry>, fidl::Error> {
4893        let _response = self
4894            .client
4895            .send_query::<fidl::encoding::EmptyPayload, PackageIndexIteratorNextResponse>(
4896                (),
4897                0x9de6bbc87c314d9,
4898                fidl::encoding::DynamicFlags::empty(),
4899                ___deadline,
4900            )?;
4901        Ok(_response.entries)
4902    }
4903}
4904
4905#[cfg(target_os = "fuchsia")]
4906impl From<PackageIndexIteratorSynchronousProxy> for zx::Handle {
4907    fn from(value: PackageIndexIteratorSynchronousProxy) -> Self {
4908        value.into_channel().into()
4909    }
4910}
4911
4912#[cfg(target_os = "fuchsia")]
4913impl From<fidl::Channel> for PackageIndexIteratorSynchronousProxy {
4914    fn from(value: fidl::Channel) -> Self {
4915        Self::new(value)
4916    }
4917}
4918
4919#[cfg(target_os = "fuchsia")]
4920impl fidl::endpoints::FromClient for PackageIndexIteratorSynchronousProxy {
4921    type Protocol = PackageIndexIteratorMarker;
4922
4923    fn from_client(value: fidl::endpoints::ClientEnd<PackageIndexIteratorMarker>) -> Self {
4924        Self::new(value.into_channel())
4925    }
4926}
4927
4928#[derive(Debug, Clone)]
4929pub struct PackageIndexIteratorProxy {
4930    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4931}
4932
4933impl fidl::endpoints::Proxy for PackageIndexIteratorProxy {
4934    type Protocol = PackageIndexIteratorMarker;
4935
4936    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4937        Self::new(inner)
4938    }
4939
4940    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4941        self.client.into_channel().map_err(|client| Self { client })
4942    }
4943
4944    fn as_channel(&self) -> &::fidl::AsyncChannel {
4945        self.client.as_channel()
4946    }
4947}
4948
4949impl PackageIndexIteratorProxy {
4950    /// Create a new Proxy for fuchsia.pkg/PackageIndexIterator.
4951    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4952        let protocol_name =
4953            <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4954        Self { client: fidl::client::Client::new(channel, protocol_name) }
4955    }
4956
4957    /// Get a Stream of events from the remote end of the protocol.
4958    ///
4959    /// # Panics
4960    ///
4961    /// Panics if the event stream was already taken.
4962    pub fn take_event_stream(&self) -> PackageIndexIteratorEventStream {
4963        PackageIndexIteratorEventStream { event_receiver: self.client.take_event_receiver() }
4964    }
4965
4966    /// Returns the next chunk of package index entries. When the iterator is exhausted,
4967    /// this returns an empty vector.
4968    ///
4969    /// - response `entries` the next chunk of entries in the package index.
4970    pub fn r#next(
4971        &self,
4972    ) -> fidl::client::QueryResponseFut<
4973        Vec<PackageIndexEntry>,
4974        fidl::encoding::DefaultFuchsiaResourceDialect,
4975    > {
4976        PackageIndexIteratorProxyInterface::r#next(self)
4977    }
4978}
4979
4980impl PackageIndexIteratorProxyInterface for PackageIndexIteratorProxy {
4981    type NextResponseFut = fidl::client::QueryResponseFut<
4982        Vec<PackageIndexEntry>,
4983        fidl::encoding::DefaultFuchsiaResourceDialect,
4984    >;
4985    fn r#next(&self) -> Self::NextResponseFut {
4986        fn _decode(
4987            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4988        ) -> Result<Vec<PackageIndexEntry>, fidl::Error> {
4989            let _response = fidl::client::decode_transaction_body::<
4990                PackageIndexIteratorNextResponse,
4991                fidl::encoding::DefaultFuchsiaResourceDialect,
4992                0x9de6bbc87c314d9,
4993            >(_buf?)?;
4994            Ok(_response.entries)
4995        }
4996        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PackageIndexEntry>>(
4997            (),
4998            0x9de6bbc87c314d9,
4999            fidl::encoding::DynamicFlags::empty(),
5000            _decode,
5001        )
5002    }
5003}
5004
5005pub struct PackageIndexIteratorEventStream {
5006    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5007}
5008
5009impl std::marker::Unpin for PackageIndexIteratorEventStream {}
5010
5011impl futures::stream::FusedStream for PackageIndexIteratorEventStream {
5012    fn is_terminated(&self) -> bool {
5013        self.event_receiver.is_terminated()
5014    }
5015}
5016
5017impl futures::Stream for PackageIndexIteratorEventStream {
5018    type Item = Result<PackageIndexIteratorEvent, fidl::Error>;
5019
5020    fn poll_next(
5021        mut self: std::pin::Pin<&mut Self>,
5022        cx: &mut std::task::Context<'_>,
5023    ) -> std::task::Poll<Option<Self::Item>> {
5024        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5025            &mut self.event_receiver,
5026            cx
5027        )?) {
5028            Some(buf) => std::task::Poll::Ready(Some(PackageIndexIteratorEvent::decode(buf))),
5029            None => std::task::Poll::Ready(None),
5030        }
5031    }
5032}
5033
5034#[derive(Debug)]
5035pub enum PackageIndexIteratorEvent {}
5036
5037impl PackageIndexIteratorEvent {
5038    /// Decodes a message buffer as a [`PackageIndexIteratorEvent`].
5039    fn decode(
5040        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5041    ) -> Result<PackageIndexIteratorEvent, fidl::Error> {
5042        let (bytes, _handles) = buf.split_mut();
5043        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5044        debug_assert_eq!(tx_header.tx_id, 0);
5045        match tx_header.ordinal {
5046            _ => Err(fidl::Error::UnknownOrdinal {
5047                ordinal: tx_header.ordinal,
5048                protocol_name:
5049                    <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5050            }),
5051        }
5052    }
5053}
5054
5055/// A Stream of incoming requests for fuchsia.pkg/PackageIndexIterator.
5056pub struct PackageIndexIteratorRequestStream {
5057    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5058    is_terminated: bool,
5059}
5060
5061impl std::marker::Unpin for PackageIndexIteratorRequestStream {}
5062
5063impl futures::stream::FusedStream for PackageIndexIteratorRequestStream {
5064    fn is_terminated(&self) -> bool {
5065        self.is_terminated
5066    }
5067}
5068
5069impl fidl::endpoints::RequestStream for PackageIndexIteratorRequestStream {
5070    type Protocol = PackageIndexIteratorMarker;
5071    type ControlHandle = PackageIndexIteratorControlHandle;
5072
5073    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5074        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5075    }
5076
5077    fn control_handle(&self) -> Self::ControlHandle {
5078        PackageIndexIteratorControlHandle { inner: self.inner.clone() }
5079    }
5080
5081    fn into_inner(
5082        self,
5083    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5084    {
5085        (self.inner, self.is_terminated)
5086    }
5087
5088    fn from_inner(
5089        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5090        is_terminated: bool,
5091    ) -> Self {
5092        Self { inner, is_terminated }
5093    }
5094}
5095
5096impl futures::Stream for PackageIndexIteratorRequestStream {
5097    type Item = Result<PackageIndexIteratorRequest, fidl::Error>;
5098
5099    fn poll_next(
5100        mut self: std::pin::Pin<&mut Self>,
5101        cx: &mut std::task::Context<'_>,
5102    ) -> std::task::Poll<Option<Self::Item>> {
5103        let this = &mut *self;
5104        if this.inner.check_shutdown(cx) {
5105            this.is_terminated = true;
5106            return std::task::Poll::Ready(None);
5107        }
5108        if this.is_terminated {
5109            panic!("polled PackageIndexIteratorRequestStream after completion");
5110        }
5111        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5112            |bytes, handles| {
5113                match this.inner.channel().read_etc(cx, bytes, handles) {
5114                    std::task::Poll::Ready(Ok(())) => {}
5115                    std::task::Poll::Pending => return std::task::Poll::Pending,
5116                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5117                        this.is_terminated = true;
5118                        return std::task::Poll::Ready(None);
5119                    }
5120                    std::task::Poll::Ready(Err(e)) => {
5121                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5122                            e.into(),
5123                        ))));
5124                    }
5125                }
5126
5127                // A message has been received from the channel
5128                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5129
5130                std::task::Poll::Ready(Some(match header.ordinal {
5131                0x9de6bbc87c314d9 => {
5132                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5133                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5134                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5135                    let control_handle = PackageIndexIteratorControlHandle {
5136                        inner: this.inner.clone(),
5137                    };
5138                    Ok(PackageIndexIteratorRequest::Next {
5139                        responder: PackageIndexIteratorNextResponder {
5140                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5141                            tx_id: header.tx_id,
5142                        },
5143                    })
5144                }
5145                _ => Err(fidl::Error::UnknownOrdinal {
5146                    ordinal: header.ordinal,
5147                    protocol_name: <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5148                }),
5149            }))
5150            },
5151        )
5152    }
5153}
5154
5155/// A chunk iterator for the package index. This is required because it is possible for the
5156/// package index to be too large to send over in a single request (over 64KiB).
5157#[derive(Debug)]
5158pub enum PackageIndexIteratorRequest {
5159    /// Returns the next chunk of package index entries. When the iterator is exhausted,
5160    /// this returns an empty vector.
5161    ///
5162    /// - response `entries` the next chunk of entries in the package index.
5163    Next { responder: PackageIndexIteratorNextResponder },
5164}
5165
5166impl PackageIndexIteratorRequest {
5167    #[allow(irrefutable_let_patterns)]
5168    pub fn into_next(self) -> Option<(PackageIndexIteratorNextResponder)> {
5169        if let PackageIndexIteratorRequest::Next { responder } = self {
5170            Some((responder))
5171        } else {
5172            None
5173        }
5174    }
5175
5176    /// Name of the method defined in FIDL
5177    pub fn method_name(&self) -> &'static str {
5178        match *self {
5179            PackageIndexIteratorRequest::Next { .. } => "next",
5180        }
5181    }
5182}
5183
5184#[derive(Debug, Clone)]
5185pub struct PackageIndexIteratorControlHandle {
5186    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5187}
5188
5189impl fidl::endpoints::ControlHandle for PackageIndexIteratorControlHandle {
5190    fn shutdown(&self) {
5191        self.inner.shutdown()
5192    }
5193    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5194        self.inner.shutdown_with_epitaph(status)
5195    }
5196
5197    fn is_closed(&self) -> bool {
5198        self.inner.channel().is_closed()
5199    }
5200    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5201        self.inner.channel().on_closed()
5202    }
5203
5204    #[cfg(target_os = "fuchsia")]
5205    fn signal_peer(
5206        &self,
5207        clear_mask: zx::Signals,
5208        set_mask: zx::Signals,
5209    ) -> Result<(), zx_status::Status> {
5210        use fidl::Peered;
5211        self.inner.channel().signal_peer(clear_mask, set_mask)
5212    }
5213}
5214
5215impl PackageIndexIteratorControlHandle {}
5216
5217#[must_use = "FIDL methods require a response to be sent"]
5218#[derive(Debug)]
5219pub struct PackageIndexIteratorNextResponder {
5220    control_handle: std::mem::ManuallyDrop<PackageIndexIteratorControlHandle>,
5221    tx_id: u32,
5222}
5223
5224/// Set the the channel to be shutdown (see [`PackageIndexIteratorControlHandle::shutdown`])
5225/// if the responder is dropped without sending a response, so that the client
5226/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5227impl std::ops::Drop for PackageIndexIteratorNextResponder {
5228    fn drop(&mut self) {
5229        self.control_handle.shutdown();
5230        // Safety: drops once, never accessed again
5231        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5232    }
5233}
5234
5235impl fidl::endpoints::Responder for PackageIndexIteratorNextResponder {
5236    type ControlHandle = PackageIndexIteratorControlHandle;
5237
5238    fn control_handle(&self) -> &PackageIndexIteratorControlHandle {
5239        &self.control_handle
5240    }
5241
5242    fn drop_without_shutdown(mut self) {
5243        // Safety: drops once, never accessed again due to mem::forget
5244        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5245        // Prevent Drop from running (which would shut down the channel)
5246        std::mem::forget(self);
5247    }
5248}
5249
5250impl PackageIndexIteratorNextResponder {
5251    /// Sends a response to the FIDL transaction.
5252    ///
5253    /// Sets the channel to shutdown if an error occurs.
5254    pub fn send(self, mut entries: &[PackageIndexEntry]) -> Result<(), fidl::Error> {
5255        let _result = self.send_raw(entries);
5256        if _result.is_err() {
5257            self.control_handle.shutdown();
5258        }
5259        self.drop_without_shutdown();
5260        _result
5261    }
5262
5263    /// Similar to "send" but does not shutdown the channel if an error occurs.
5264    pub fn send_no_shutdown_on_err(
5265        self,
5266        mut entries: &[PackageIndexEntry],
5267    ) -> Result<(), fidl::Error> {
5268        let _result = self.send_raw(entries);
5269        self.drop_without_shutdown();
5270        _result
5271    }
5272
5273    fn send_raw(&self, mut entries: &[PackageIndexEntry]) -> Result<(), fidl::Error> {
5274        self.control_handle.inner.send::<PackageIndexIteratorNextResponse>(
5275            (entries,),
5276            self.tx_id,
5277            0x9de6bbc87c314d9,
5278            fidl::encoding::DynamicFlags::empty(),
5279        )
5280    }
5281}
5282
5283#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5284pub struct PackageResolverMarker;
5285
5286impl fidl::endpoints::ProtocolMarker for PackageResolverMarker {
5287    type Proxy = PackageResolverProxy;
5288    type RequestStream = PackageResolverRequestStream;
5289    #[cfg(target_os = "fuchsia")]
5290    type SynchronousProxy = PackageResolverSynchronousProxy;
5291
5292    const DEBUG_NAME: &'static str = "fuchsia.pkg.PackageResolver";
5293}
5294impl fidl::endpoints::DiscoverableProtocolMarker for PackageResolverMarker {}
5295pub type PackageResolverResolveResult = Result<ResolutionContext, ResolveError>;
5296pub type PackageResolverResolveWithContextResult = Result<ResolutionContext, ResolveError>;
5297pub type PackageResolverGetHashResult = Result<BlobId, i32>;
5298
5299pub trait PackageResolverProxyInterface: Send + Sync {
5300    type ResolveResponseFut: std::future::Future<Output = Result<PackageResolverResolveResult, fidl::Error>>
5301        + Send;
5302    fn r#resolve(
5303        &self,
5304        package_url: &str,
5305        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5306    ) -> Self::ResolveResponseFut;
5307    type ResolveWithContextResponseFut: std::future::Future<Output = Result<PackageResolverResolveWithContextResult, fidl::Error>>
5308        + Send;
5309    fn r#resolve_with_context(
5310        &self,
5311        package_url: &str,
5312        context: &ResolutionContext,
5313        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5314    ) -> Self::ResolveWithContextResponseFut;
5315    type GetHashResponseFut: std::future::Future<Output = Result<PackageResolverGetHashResult, fidl::Error>>
5316        + Send;
5317    fn r#get_hash(&self, package_url: &PackageUrl) -> Self::GetHashResponseFut;
5318}
5319#[derive(Debug)]
5320#[cfg(target_os = "fuchsia")]
5321pub struct PackageResolverSynchronousProxy {
5322    client: fidl::client::sync::Client,
5323}
5324
5325#[cfg(target_os = "fuchsia")]
5326impl fidl::endpoints::SynchronousProxy for PackageResolverSynchronousProxy {
5327    type Proxy = PackageResolverProxy;
5328    type Protocol = PackageResolverMarker;
5329
5330    fn from_channel(inner: fidl::Channel) -> Self {
5331        Self::new(inner)
5332    }
5333
5334    fn into_channel(self) -> fidl::Channel {
5335        self.client.into_channel()
5336    }
5337
5338    fn as_channel(&self) -> &fidl::Channel {
5339        self.client.as_channel()
5340    }
5341}
5342
5343#[cfg(target_os = "fuchsia")]
5344impl PackageResolverSynchronousProxy {
5345    pub fn new(channel: fidl::Channel) -> Self {
5346        let protocol_name = <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5347        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5348    }
5349
5350    pub fn into_channel(self) -> fidl::Channel {
5351        self.client.into_channel()
5352    }
5353
5354    /// Waits until an event arrives and returns it. It is safe for other
5355    /// threads to make concurrent requests while waiting for an event.
5356    pub fn wait_for_event(
5357        &self,
5358        deadline: zx::MonotonicInstant,
5359    ) -> Result<PackageResolverEvent, fidl::Error> {
5360        PackageResolverEvent::decode(self.client.wait_for_event(deadline)?)
5361    }
5362
5363    /// Populates or updates the cache of a package using an absolute package
5364    /// URL.
5365    ///
5366    /// Ensures that a package, and any transitive subpackages, are on the local
5367    /// filesystem.
5368    ///
5369    /// + request `package_url` the absolute package URL for a package.  The
5370    ///   following link describes the format:
5371    ///   https://fuchsia.dev/fuchsia-src/concepts/packages/package_url.
5372    ///   Resource paths are not allowed.
5373    /// + request `dir` a request for a directory that will be resolved when the
5374    ///   package has been successfully cached.
5375    /// + returns a `resolved_context`, which can be passed to
5376    ///   `ResolveWithContext`, with a relative URL, to resolve a subpackage of
5377    ///   this package.
5378    /// * error indicates failure. See `ResolveError` for values and error
5379    ///   scenarios.
5380    pub fn r#resolve(
5381        &self,
5382        mut package_url: &str,
5383        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5384        ___deadline: zx::MonotonicInstant,
5385    ) -> Result<PackageResolverResolveResult, fidl::Error> {
5386        let _response = self.client.send_query::<
5387            PackageResolverResolveRequest,
5388            fidl::encoding::ResultType<PackageResolverResolveResponse, ResolveError>,
5389        >(
5390            (package_url, dir,),
5391            0x6611263be4052d4f,
5392            fidl::encoding::DynamicFlags::empty(),
5393            ___deadline,
5394        )?;
5395        Ok(_response.map(|x| x.resolved_context))
5396    }
5397
5398    /// Populates or updates the cache of a package using either an absolute or
5399    /// a relative package URL. If relative, the package will be resolved
5400    /// relative to the supplied `context`.
5401    ///
5402    /// Ensures that a package is on the local filesystem.
5403    ///
5404    /// + request `package_url` the absolute or relative package URL for a
5405    ///   package. If absolute, the `context` is ignored, and the behavior is
5406    ///   identical to calling `Resolve()`. A relative `package_url` is a
5407    ///   subpackage name.
5408    /// + request `context` a `ResolutionContext` associated with a previously
5409    ///   resolved package, for resolving subpackages relative to that package.
5410    /// + request `dir` a request for a directory that will be resolved when the
5411    ///   package has been successfully cached.
5412    /// + returns a `resolved_context`, which can be passed to a subsequent call
5413    ///   to `ResolveWithContext`, with a relative URL, to resolve a subpackage
5414    ///   of this package or subpackage.
5415    /// * error indicates failure. See `ResolveError` for values and error
5416    ///   scenarios.
5417    pub fn r#resolve_with_context(
5418        &self,
5419        mut package_url: &str,
5420        mut context: &ResolutionContext,
5421        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5422        ___deadline: zx::MonotonicInstant,
5423    ) -> Result<PackageResolverResolveWithContextResult, fidl::Error> {
5424        let _response =
5425            self.client
5426                .send_query::<PackageResolverResolveWithContextRequest, fidl::encoding::ResultType<
5427                    PackageResolverResolveWithContextResponse,
5428                    ResolveError,
5429                >>(
5430                    (package_url, context, dir),
5431                    0x4c255ae7260298d4,
5432                    fidl::encoding::DynamicFlags::empty(),
5433                    ___deadline,
5434                )?;
5435        Ok(_response.map(|x| x.resolved_context))
5436    }
5437
5438    /// Determines the hash of a package.
5439    ///
5440    /// + request `package_url` the package URL for a package.
5441    /// - response `meta_far_blob_id` the hash of the package.
5442    /// * error a zx_status value indicating failure. One of the following:
5443    ///     * `ZX_ERR_INTERNAL` if the resolver encountered an otherwise unspecified error
5444    ///       while handling the request.
5445    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist in the repository specified by
5446    ///       `package_url`.
5447    ///     * `ZX_ERR_BAD_STATE` if the resolver does not know about the repository specified by
5448    ///       `package_url`.
5449    pub fn r#get_hash(
5450        &self,
5451        mut package_url: &PackageUrl,
5452        ___deadline: zx::MonotonicInstant,
5453    ) -> Result<PackageResolverGetHashResult, fidl::Error> {
5454        let _response = self.client.send_query::<
5455            PackageResolverGetHashRequest,
5456            fidl::encoding::ResultType<PackageResolverGetHashResponse, i32>,
5457        >(
5458            (package_url,),
5459            0x594e8b4db51efd87,
5460            fidl::encoding::DynamicFlags::empty(),
5461            ___deadline,
5462        )?;
5463        Ok(_response.map(|x| x.meta_far_blob_id))
5464    }
5465}
5466
5467#[cfg(target_os = "fuchsia")]
5468impl From<PackageResolverSynchronousProxy> for zx::Handle {
5469    fn from(value: PackageResolverSynchronousProxy) -> Self {
5470        value.into_channel().into()
5471    }
5472}
5473
5474#[cfg(target_os = "fuchsia")]
5475impl From<fidl::Channel> for PackageResolverSynchronousProxy {
5476    fn from(value: fidl::Channel) -> Self {
5477        Self::new(value)
5478    }
5479}
5480
5481#[cfg(target_os = "fuchsia")]
5482impl fidl::endpoints::FromClient for PackageResolverSynchronousProxy {
5483    type Protocol = PackageResolverMarker;
5484
5485    fn from_client(value: fidl::endpoints::ClientEnd<PackageResolverMarker>) -> Self {
5486        Self::new(value.into_channel())
5487    }
5488}
5489
5490#[derive(Debug, Clone)]
5491pub struct PackageResolverProxy {
5492    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5493}
5494
5495impl fidl::endpoints::Proxy for PackageResolverProxy {
5496    type Protocol = PackageResolverMarker;
5497
5498    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5499        Self::new(inner)
5500    }
5501
5502    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5503        self.client.into_channel().map_err(|client| Self { client })
5504    }
5505
5506    fn as_channel(&self) -> &::fidl::AsyncChannel {
5507        self.client.as_channel()
5508    }
5509}
5510
5511impl PackageResolverProxy {
5512    /// Create a new Proxy for fuchsia.pkg/PackageResolver.
5513    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5514        let protocol_name = <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5515        Self { client: fidl::client::Client::new(channel, protocol_name) }
5516    }
5517
5518    /// Get a Stream of events from the remote end of the protocol.
5519    ///
5520    /// # Panics
5521    ///
5522    /// Panics if the event stream was already taken.
5523    pub fn take_event_stream(&self) -> PackageResolverEventStream {
5524        PackageResolverEventStream { event_receiver: self.client.take_event_receiver() }
5525    }
5526
5527    /// Populates or updates the cache of a package using an absolute package
5528    /// URL.
5529    ///
5530    /// Ensures that a package, and any transitive subpackages, are on the local
5531    /// filesystem.
5532    ///
5533    /// + request `package_url` the absolute package URL for a package.  The
5534    ///   following link describes the format:
5535    ///   https://fuchsia.dev/fuchsia-src/concepts/packages/package_url.
5536    ///   Resource paths are not allowed.
5537    /// + request `dir` a request for a directory that will be resolved when the
5538    ///   package has been successfully cached.
5539    /// + returns a `resolved_context`, which can be passed to
5540    ///   `ResolveWithContext`, with a relative URL, to resolve a subpackage of
5541    ///   this package.
5542    /// * error indicates failure. See `ResolveError` for values and error
5543    ///   scenarios.
5544    pub fn r#resolve(
5545        &self,
5546        mut package_url: &str,
5547        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5548    ) -> fidl::client::QueryResponseFut<
5549        PackageResolverResolveResult,
5550        fidl::encoding::DefaultFuchsiaResourceDialect,
5551    > {
5552        PackageResolverProxyInterface::r#resolve(self, package_url, dir)
5553    }
5554
5555    /// Populates or updates the cache of a package using either an absolute or
5556    /// a relative package URL. If relative, the package will be resolved
5557    /// relative to the supplied `context`.
5558    ///
5559    /// Ensures that a package is on the local filesystem.
5560    ///
5561    /// + request `package_url` the absolute or relative package URL for a
5562    ///   package. If absolute, the `context` is ignored, and the behavior is
5563    ///   identical to calling `Resolve()`. A relative `package_url` is a
5564    ///   subpackage name.
5565    /// + request `context` a `ResolutionContext` associated with a previously
5566    ///   resolved package, for resolving subpackages relative to that package.
5567    /// + request `dir` a request for a directory that will be resolved when the
5568    ///   package has been successfully cached.
5569    /// + returns a `resolved_context`, which can be passed to a subsequent call
5570    ///   to `ResolveWithContext`, with a relative URL, to resolve a subpackage
5571    ///   of this package or subpackage.
5572    /// * error indicates failure. See `ResolveError` for values and error
5573    ///   scenarios.
5574    pub fn r#resolve_with_context(
5575        &self,
5576        mut package_url: &str,
5577        mut context: &ResolutionContext,
5578        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5579    ) -> fidl::client::QueryResponseFut<
5580        PackageResolverResolveWithContextResult,
5581        fidl::encoding::DefaultFuchsiaResourceDialect,
5582    > {
5583        PackageResolverProxyInterface::r#resolve_with_context(self, package_url, context, dir)
5584    }
5585
5586    /// Determines the hash of a package.
5587    ///
5588    /// + request `package_url` the package URL for a package.
5589    /// - response `meta_far_blob_id` the hash of the package.
5590    /// * error a zx_status value indicating failure. One of the following:
5591    ///     * `ZX_ERR_INTERNAL` if the resolver encountered an otherwise unspecified error
5592    ///       while handling the request.
5593    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist in the repository specified by
5594    ///       `package_url`.
5595    ///     * `ZX_ERR_BAD_STATE` if the resolver does not know about the repository specified by
5596    ///       `package_url`.
5597    pub fn r#get_hash(
5598        &self,
5599        mut package_url: &PackageUrl,
5600    ) -> fidl::client::QueryResponseFut<
5601        PackageResolverGetHashResult,
5602        fidl::encoding::DefaultFuchsiaResourceDialect,
5603    > {
5604        PackageResolverProxyInterface::r#get_hash(self, package_url)
5605    }
5606}
5607
5608impl PackageResolverProxyInterface for PackageResolverProxy {
5609    type ResolveResponseFut = fidl::client::QueryResponseFut<
5610        PackageResolverResolveResult,
5611        fidl::encoding::DefaultFuchsiaResourceDialect,
5612    >;
5613    fn r#resolve(
5614        &self,
5615        mut package_url: &str,
5616        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5617    ) -> Self::ResolveResponseFut {
5618        fn _decode(
5619            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5620        ) -> Result<PackageResolverResolveResult, fidl::Error> {
5621            let _response = fidl::client::decode_transaction_body::<
5622                fidl::encoding::ResultType<PackageResolverResolveResponse, ResolveError>,
5623                fidl::encoding::DefaultFuchsiaResourceDialect,
5624                0x6611263be4052d4f,
5625            >(_buf?)?;
5626            Ok(_response.map(|x| x.resolved_context))
5627        }
5628        self.client
5629            .send_query_and_decode::<PackageResolverResolveRequest, PackageResolverResolveResult>(
5630                (package_url, dir),
5631                0x6611263be4052d4f,
5632                fidl::encoding::DynamicFlags::empty(),
5633                _decode,
5634            )
5635    }
5636
5637    type ResolveWithContextResponseFut = fidl::client::QueryResponseFut<
5638        PackageResolverResolveWithContextResult,
5639        fidl::encoding::DefaultFuchsiaResourceDialect,
5640    >;
5641    fn r#resolve_with_context(
5642        &self,
5643        mut package_url: &str,
5644        mut context: &ResolutionContext,
5645        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5646    ) -> Self::ResolveWithContextResponseFut {
5647        fn _decode(
5648            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5649        ) -> Result<PackageResolverResolveWithContextResult, fidl::Error> {
5650            let _response = fidl::client::decode_transaction_body::<
5651                fidl::encoding::ResultType<PackageResolverResolveWithContextResponse, ResolveError>,
5652                fidl::encoding::DefaultFuchsiaResourceDialect,
5653                0x4c255ae7260298d4,
5654            >(_buf?)?;
5655            Ok(_response.map(|x| x.resolved_context))
5656        }
5657        self.client.send_query_and_decode::<
5658            PackageResolverResolveWithContextRequest,
5659            PackageResolverResolveWithContextResult,
5660        >(
5661            (package_url, context, dir,),
5662            0x4c255ae7260298d4,
5663            fidl::encoding::DynamicFlags::empty(),
5664            _decode,
5665        )
5666    }
5667
5668    type GetHashResponseFut = fidl::client::QueryResponseFut<
5669        PackageResolverGetHashResult,
5670        fidl::encoding::DefaultFuchsiaResourceDialect,
5671    >;
5672    fn r#get_hash(&self, mut package_url: &PackageUrl) -> Self::GetHashResponseFut {
5673        fn _decode(
5674            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5675        ) -> Result<PackageResolverGetHashResult, fidl::Error> {
5676            let _response = fidl::client::decode_transaction_body::<
5677                fidl::encoding::ResultType<PackageResolverGetHashResponse, i32>,
5678                fidl::encoding::DefaultFuchsiaResourceDialect,
5679                0x594e8b4db51efd87,
5680            >(_buf?)?;
5681            Ok(_response.map(|x| x.meta_far_blob_id))
5682        }
5683        self.client
5684            .send_query_and_decode::<PackageResolverGetHashRequest, PackageResolverGetHashResult>(
5685                (package_url,),
5686                0x594e8b4db51efd87,
5687                fidl::encoding::DynamicFlags::empty(),
5688                _decode,
5689            )
5690    }
5691}
5692
5693pub struct PackageResolverEventStream {
5694    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5695}
5696
5697impl std::marker::Unpin for PackageResolverEventStream {}
5698
5699impl futures::stream::FusedStream for PackageResolverEventStream {
5700    fn is_terminated(&self) -> bool {
5701        self.event_receiver.is_terminated()
5702    }
5703}
5704
5705impl futures::Stream for PackageResolverEventStream {
5706    type Item = Result<PackageResolverEvent, fidl::Error>;
5707
5708    fn poll_next(
5709        mut self: std::pin::Pin<&mut Self>,
5710        cx: &mut std::task::Context<'_>,
5711    ) -> std::task::Poll<Option<Self::Item>> {
5712        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5713            &mut self.event_receiver,
5714            cx
5715        )?) {
5716            Some(buf) => std::task::Poll::Ready(Some(PackageResolverEvent::decode(buf))),
5717            None => std::task::Poll::Ready(None),
5718        }
5719    }
5720}
5721
5722#[derive(Debug)]
5723pub enum PackageResolverEvent {}
5724
5725impl PackageResolverEvent {
5726    /// Decodes a message buffer as a [`PackageResolverEvent`].
5727    fn decode(
5728        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5729    ) -> Result<PackageResolverEvent, fidl::Error> {
5730        let (bytes, _handles) = buf.split_mut();
5731        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5732        debug_assert_eq!(tx_header.tx_id, 0);
5733        match tx_header.ordinal {
5734            _ => Err(fidl::Error::UnknownOrdinal {
5735                ordinal: tx_header.ordinal,
5736                protocol_name:
5737                    <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5738            }),
5739        }
5740    }
5741}
5742
5743/// A Stream of incoming requests for fuchsia.pkg/PackageResolver.
5744pub struct PackageResolverRequestStream {
5745    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5746    is_terminated: bool,
5747}
5748
5749impl std::marker::Unpin for PackageResolverRequestStream {}
5750
5751impl futures::stream::FusedStream for PackageResolverRequestStream {
5752    fn is_terminated(&self) -> bool {
5753        self.is_terminated
5754    }
5755}
5756
5757impl fidl::endpoints::RequestStream for PackageResolverRequestStream {
5758    type Protocol = PackageResolverMarker;
5759    type ControlHandle = PackageResolverControlHandle;
5760
5761    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5762        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5763    }
5764
5765    fn control_handle(&self) -> Self::ControlHandle {
5766        PackageResolverControlHandle { inner: self.inner.clone() }
5767    }
5768
5769    fn into_inner(
5770        self,
5771    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5772    {
5773        (self.inner, self.is_terminated)
5774    }
5775
5776    fn from_inner(
5777        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5778        is_terminated: bool,
5779    ) -> Self {
5780        Self { inner, is_terminated }
5781    }
5782}
5783
5784impl futures::Stream for PackageResolverRequestStream {
5785    type Item = Result<PackageResolverRequest, fidl::Error>;
5786
5787    fn poll_next(
5788        mut self: std::pin::Pin<&mut Self>,
5789        cx: &mut std::task::Context<'_>,
5790    ) -> std::task::Poll<Option<Self::Item>> {
5791        let this = &mut *self;
5792        if this.inner.check_shutdown(cx) {
5793            this.is_terminated = true;
5794            return std::task::Poll::Ready(None);
5795        }
5796        if this.is_terminated {
5797            panic!("polled PackageResolverRequestStream after completion");
5798        }
5799        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5800            |bytes, handles| {
5801                match this.inner.channel().read_etc(cx, bytes, handles) {
5802                    std::task::Poll::Ready(Ok(())) => {}
5803                    std::task::Poll::Pending => return std::task::Poll::Pending,
5804                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5805                        this.is_terminated = true;
5806                        return std::task::Poll::Ready(None);
5807                    }
5808                    std::task::Poll::Ready(Err(e)) => {
5809                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5810                            e.into(),
5811                        ))));
5812                    }
5813                }
5814
5815                // A message has been received from the channel
5816                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5817
5818                std::task::Poll::Ready(Some(match header.ordinal {
5819                    0x6611263be4052d4f => {
5820                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5821                        let mut req = fidl::new_empty!(
5822                            PackageResolverResolveRequest,
5823                            fidl::encoding::DefaultFuchsiaResourceDialect
5824                        );
5825                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
5826                        let control_handle =
5827                            PackageResolverControlHandle { inner: this.inner.clone() };
5828                        Ok(PackageResolverRequest::Resolve {
5829                            package_url: req.package_url,
5830                            dir: req.dir,
5831
5832                            responder: PackageResolverResolveResponder {
5833                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5834                                tx_id: header.tx_id,
5835                            },
5836                        })
5837                    }
5838                    0x4c255ae7260298d4 => {
5839                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5840                        let mut req = fidl::new_empty!(
5841                            PackageResolverResolveWithContextRequest,
5842                            fidl::encoding::DefaultFuchsiaResourceDialect
5843                        );
5844                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageResolverResolveWithContextRequest>(&header, _body_bytes, handles, &mut req)?;
5845                        let control_handle =
5846                            PackageResolverControlHandle { inner: this.inner.clone() };
5847                        Ok(PackageResolverRequest::ResolveWithContext {
5848                            package_url: req.package_url,
5849                            context: req.context,
5850                            dir: req.dir,
5851
5852                            responder: PackageResolverResolveWithContextResponder {
5853                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5854                                tx_id: header.tx_id,
5855                            },
5856                        })
5857                    }
5858                    0x594e8b4db51efd87 => {
5859                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5860                        let mut req = fidl::new_empty!(
5861                            PackageResolverGetHashRequest,
5862                            fidl::encoding::DefaultFuchsiaResourceDialect
5863                        );
5864                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageResolverGetHashRequest>(&header, _body_bytes, handles, &mut req)?;
5865                        let control_handle =
5866                            PackageResolverControlHandle { inner: this.inner.clone() };
5867                        Ok(PackageResolverRequest::GetHash {
5868                            package_url: req.package_url,
5869
5870                            responder: PackageResolverGetHashResponder {
5871                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5872                                tx_id: header.tx_id,
5873                            },
5874                        })
5875                    }
5876                    _ => Err(fidl::Error::UnknownOrdinal {
5877                        ordinal: header.ordinal,
5878                        protocol_name:
5879                            <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5880                    }),
5881                }))
5882            },
5883        )
5884    }
5885}
5886
5887/// This resolves packages from a repository.
5888///
5889/// This is intended to be implemented by package resolver components, and used by
5890/// repository administration tools.
5891#[derive(Debug)]
5892pub enum PackageResolverRequest {
5893    /// Populates or updates the cache of a package using an absolute package
5894    /// URL.
5895    ///
5896    /// Ensures that a package, and any transitive subpackages, are on the local
5897    /// filesystem.
5898    ///
5899    /// + request `package_url` the absolute package URL for a package.  The
5900    ///   following link describes the format:
5901    ///   https://fuchsia.dev/fuchsia-src/concepts/packages/package_url.
5902    ///   Resource paths are not allowed.
5903    /// + request `dir` a request for a directory that will be resolved when the
5904    ///   package has been successfully cached.
5905    /// + returns a `resolved_context`, which can be passed to
5906    ///   `ResolveWithContext`, with a relative URL, to resolve a subpackage of
5907    ///   this package.
5908    /// * error indicates failure. See `ResolveError` for values and error
5909    ///   scenarios.
5910    Resolve {
5911        package_url: String,
5912        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5913        responder: PackageResolverResolveResponder,
5914    },
5915    /// Populates or updates the cache of a package using either an absolute or
5916    /// a relative package URL. If relative, the package will be resolved
5917    /// relative to the supplied `context`.
5918    ///
5919    /// Ensures that a package is on the local filesystem.
5920    ///
5921    /// + request `package_url` the absolute or relative package URL for a
5922    ///   package. If absolute, the `context` is ignored, and the behavior is
5923    ///   identical to calling `Resolve()`. A relative `package_url` is a
5924    ///   subpackage name.
5925    /// + request `context` a `ResolutionContext` associated with a previously
5926    ///   resolved package, for resolving subpackages relative to that package.
5927    /// + request `dir` a request for a directory that will be resolved when the
5928    ///   package has been successfully cached.
5929    /// + returns a `resolved_context`, which can be passed to a subsequent call
5930    ///   to `ResolveWithContext`, with a relative URL, to resolve a subpackage
5931    ///   of this package or subpackage.
5932    /// * error indicates failure. See `ResolveError` for values and error
5933    ///   scenarios.
5934    ResolveWithContext {
5935        package_url: String,
5936        context: ResolutionContext,
5937        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5938        responder: PackageResolverResolveWithContextResponder,
5939    },
5940    /// Determines the hash of a package.
5941    ///
5942    /// + request `package_url` the package URL for a package.
5943    /// - response `meta_far_blob_id` the hash of the package.
5944    /// * error a zx_status value indicating failure. One of the following:
5945    ///     * `ZX_ERR_INTERNAL` if the resolver encountered an otherwise unspecified error
5946    ///       while handling the request.
5947    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist in the repository specified by
5948    ///       `package_url`.
5949    ///     * `ZX_ERR_BAD_STATE` if the resolver does not know about the repository specified by
5950    ///       `package_url`.
5951    GetHash { package_url: PackageUrl, responder: PackageResolverGetHashResponder },
5952}
5953
5954impl PackageResolverRequest {
5955    #[allow(irrefutable_let_patterns)]
5956    pub fn into_resolve(
5957        self,
5958    ) -> Option<(
5959        String,
5960        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5961        PackageResolverResolveResponder,
5962    )> {
5963        if let PackageResolverRequest::Resolve { package_url, dir, responder } = self {
5964            Some((package_url, dir, responder))
5965        } else {
5966            None
5967        }
5968    }
5969
5970    #[allow(irrefutable_let_patterns)]
5971    pub fn into_resolve_with_context(
5972        self,
5973    ) -> Option<(
5974        String,
5975        ResolutionContext,
5976        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5977        PackageResolverResolveWithContextResponder,
5978    )> {
5979        if let PackageResolverRequest::ResolveWithContext { package_url, context, dir, responder } =
5980            self
5981        {
5982            Some((package_url, context, dir, responder))
5983        } else {
5984            None
5985        }
5986    }
5987
5988    #[allow(irrefutable_let_patterns)]
5989    pub fn into_get_hash(self) -> Option<(PackageUrl, PackageResolverGetHashResponder)> {
5990        if let PackageResolverRequest::GetHash { package_url, responder } = self {
5991            Some((package_url, responder))
5992        } else {
5993            None
5994        }
5995    }
5996
5997    /// Name of the method defined in FIDL
5998    pub fn method_name(&self) -> &'static str {
5999        match *self {
6000            PackageResolverRequest::Resolve { .. } => "resolve",
6001            PackageResolverRequest::ResolveWithContext { .. } => "resolve_with_context",
6002            PackageResolverRequest::GetHash { .. } => "get_hash",
6003        }
6004    }
6005}
6006
6007#[derive(Debug, Clone)]
6008pub struct PackageResolverControlHandle {
6009    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6010}
6011
6012impl fidl::endpoints::ControlHandle for PackageResolverControlHandle {
6013    fn shutdown(&self) {
6014        self.inner.shutdown()
6015    }
6016    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6017        self.inner.shutdown_with_epitaph(status)
6018    }
6019
6020    fn is_closed(&self) -> bool {
6021        self.inner.channel().is_closed()
6022    }
6023    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6024        self.inner.channel().on_closed()
6025    }
6026
6027    #[cfg(target_os = "fuchsia")]
6028    fn signal_peer(
6029        &self,
6030        clear_mask: zx::Signals,
6031        set_mask: zx::Signals,
6032    ) -> Result<(), zx_status::Status> {
6033        use fidl::Peered;
6034        self.inner.channel().signal_peer(clear_mask, set_mask)
6035    }
6036}
6037
6038impl PackageResolverControlHandle {}
6039
6040#[must_use = "FIDL methods require a response to be sent"]
6041#[derive(Debug)]
6042pub struct PackageResolverResolveResponder {
6043    control_handle: std::mem::ManuallyDrop<PackageResolverControlHandle>,
6044    tx_id: u32,
6045}
6046
6047/// Set the the channel to be shutdown (see [`PackageResolverControlHandle::shutdown`])
6048/// if the responder is dropped without sending a response, so that the client
6049/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6050impl std::ops::Drop for PackageResolverResolveResponder {
6051    fn drop(&mut self) {
6052        self.control_handle.shutdown();
6053        // Safety: drops once, never accessed again
6054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6055    }
6056}
6057
6058impl fidl::endpoints::Responder for PackageResolverResolveResponder {
6059    type ControlHandle = PackageResolverControlHandle;
6060
6061    fn control_handle(&self) -> &PackageResolverControlHandle {
6062        &self.control_handle
6063    }
6064
6065    fn drop_without_shutdown(mut self) {
6066        // Safety: drops once, never accessed again due to mem::forget
6067        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6068        // Prevent Drop from running (which would shut down the channel)
6069        std::mem::forget(self);
6070    }
6071}
6072
6073impl PackageResolverResolveResponder {
6074    /// Sends a response to the FIDL transaction.
6075    ///
6076    /// Sets the channel to shutdown if an error occurs.
6077    pub fn send(
6078        self,
6079        mut result: Result<&ResolutionContext, ResolveError>,
6080    ) -> Result<(), fidl::Error> {
6081        let _result = self.send_raw(result);
6082        if _result.is_err() {
6083            self.control_handle.shutdown();
6084        }
6085        self.drop_without_shutdown();
6086        _result
6087    }
6088
6089    /// Similar to "send" but does not shutdown the channel if an error occurs.
6090    pub fn send_no_shutdown_on_err(
6091        self,
6092        mut result: Result<&ResolutionContext, ResolveError>,
6093    ) -> Result<(), fidl::Error> {
6094        let _result = self.send_raw(result);
6095        self.drop_without_shutdown();
6096        _result
6097    }
6098
6099    fn send_raw(
6100        &self,
6101        mut result: Result<&ResolutionContext, ResolveError>,
6102    ) -> Result<(), fidl::Error> {
6103        self.control_handle.inner.send::<fidl::encoding::ResultType<
6104            PackageResolverResolveResponse,
6105            ResolveError,
6106        >>(
6107            result.map(|resolved_context| (resolved_context,)),
6108            self.tx_id,
6109            0x6611263be4052d4f,
6110            fidl::encoding::DynamicFlags::empty(),
6111        )
6112    }
6113}
6114
6115#[must_use = "FIDL methods require a response to be sent"]
6116#[derive(Debug)]
6117pub struct PackageResolverResolveWithContextResponder {
6118    control_handle: std::mem::ManuallyDrop<PackageResolverControlHandle>,
6119    tx_id: u32,
6120}
6121
6122/// Set the the channel to be shutdown (see [`PackageResolverControlHandle::shutdown`])
6123/// if the responder is dropped without sending a response, so that the client
6124/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6125impl std::ops::Drop for PackageResolverResolveWithContextResponder {
6126    fn drop(&mut self) {
6127        self.control_handle.shutdown();
6128        // Safety: drops once, never accessed again
6129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6130    }
6131}
6132
6133impl fidl::endpoints::Responder for PackageResolverResolveWithContextResponder {
6134    type ControlHandle = PackageResolverControlHandle;
6135
6136    fn control_handle(&self) -> &PackageResolverControlHandle {
6137        &self.control_handle
6138    }
6139
6140    fn drop_without_shutdown(mut self) {
6141        // Safety: drops once, never accessed again due to mem::forget
6142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6143        // Prevent Drop from running (which would shut down the channel)
6144        std::mem::forget(self);
6145    }
6146}
6147
6148impl PackageResolverResolveWithContextResponder {
6149    /// Sends a response to the FIDL transaction.
6150    ///
6151    /// Sets the channel to shutdown if an error occurs.
6152    pub fn send(
6153        self,
6154        mut result: Result<&ResolutionContext, ResolveError>,
6155    ) -> Result<(), fidl::Error> {
6156        let _result = self.send_raw(result);
6157        if _result.is_err() {
6158            self.control_handle.shutdown();
6159        }
6160        self.drop_without_shutdown();
6161        _result
6162    }
6163
6164    /// Similar to "send" but does not shutdown the channel if an error occurs.
6165    pub fn send_no_shutdown_on_err(
6166        self,
6167        mut result: Result<&ResolutionContext, ResolveError>,
6168    ) -> Result<(), fidl::Error> {
6169        let _result = self.send_raw(result);
6170        self.drop_without_shutdown();
6171        _result
6172    }
6173
6174    fn send_raw(
6175        &self,
6176        mut result: Result<&ResolutionContext, ResolveError>,
6177    ) -> Result<(), fidl::Error> {
6178        self.control_handle.inner.send::<fidl::encoding::ResultType<
6179            PackageResolverResolveWithContextResponse,
6180            ResolveError,
6181        >>(
6182            result.map(|resolved_context| (resolved_context,)),
6183            self.tx_id,
6184            0x4c255ae7260298d4,
6185            fidl::encoding::DynamicFlags::empty(),
6186        )
6187    }
6188}
6189
6190#[must_use = "FIDL methods require a response to be sent"]
6191#[derive(Debug)]
6192pub struct PackageResolverGetHashResponder {
6193    control_handle: std::mem::ManuallyDrop<PackageResolverControlHandle>,
6194    tx_id: u32,
6195}
6196
6197/// Set the the channel to be shutdown (see [`PackageResolverControlHandle::shutdown`])
6198/// if the responder is dropped without sending a response, so that the client
6199/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6200impl std::ops::Drop for PackageResolverGetHashResponder {
6201    fn drop(&mut self) {
6202        self.control_handle.shutdown();
6203        // Safety: drops once, never accessed again
6204        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6205    }
6206}
6207
6208impl fidl::endpoints::Responder for PackageResolverGetHashResponder {
6209    type ControlHandle = PackageResolverControlHandle;
6210
6211    fn control_handle(&self) -> &PackageResolverControlHandle {
6212        &self.control_handle
6213    }
6214
6215    fn drop_without_shutdown(mut self) {
6216        // Safety: drops once, never accessed again due to mem::forget
6217        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6218        // Prevent Drop from running (which would shut down the channel)
6219        std::mem::forget(self);
6220    }
6221}
6222
6223impl PackageResolverGetHashResponder {
6224    /// Sends a response to the FIDL transaction.
6225    ///
6226    /// Sets the channel to shutdown if an error occurs.
6227    pub fn send(self, mut result: Result<&BlobId, i32>) -> Result<(), fidl::Error> {
6228        let _result = self.send_raw(result);
6229        if _result.is_err() {
6230            self.control_handle.shutdown();
6231        }
6232        self.drop_without_shutdown();
6233        _result
6234    }
6235
6236    /// Similar to "send" but does not shutdown the channel if an error occurs.
6237    pub fn send_no_shutdown_on_err(
6238        self,
6239        mut result: Result<&BlobId, i32>,
6240    ) -> Result<(), fidl::Error> {
6241        let _result = self.send_raw(result);
6242        self.drop_without_shutdown();
6243        _result
6244    }
6245
6246    fn send_raw(&self, mut result: Result<&BlobId, i32>) -> Result<(), fidl::Error> {
6247        self.control_handle
6248            .inner
6249            .send::<fidl::encoding::ResultType<PackageResolverGetHashResponse, i32>>(
6250                result.map(|meta_far_blob_id| (meta_far_blob_id,)),
6251                self.tx_id,
6252                0x594e8b4db51efd87,
6253                fidl::encoding::DynamicFlags::empty(),
6254            )
6255    }
6256}
6257
6258#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6259pub struct RepositoryIteratorMarker;
6260
6261impl fidl::endpoints::ProtocolMarker for RepositoryIteratorMarker {
6262    type Proxy = RepositoryIteratorProxy;
6263    type RequestStream = RepositoryIteratorRequestStream;
6264    #[cfg(target_os = "fuchsia")]
6265    type SynchronousProxy = RepositoryIteratorSynchronousProxy;
6266
6267    const DEBUG_NAME: &'static str = "(anonymous) RepositoryIterator";
6268}
6269
6270pub trait RepositoryIteratorProxyInterface: Send + Sync {
6271    type NextResponseFut: std::future::Future<Output = Result<Vec<RepositoryConfig>, fidl::Error>>
6272        + Send;
6273    fn r#next(&self) -> Self::NextResponseFut;
6274}
6275#[derive(Debug)]
6276#[cfg(target_os = "fuchsia")]
6277pub struct RepositoryIteratorSynchronousProxy {
6278    client: fidl::client::sync::Client,
6279}
6280
6281#[cfg(target_os = "fuchsia")]
6282impl fidl::endpoints::SynchronousProxy for RepositoryIteratorSynchronousProxy {
6283    type Proxy = RepositoryIteratorProxy;
6284    type Protocol = RepositoryIteratorMarker;
6285
6286    fn from_channel(inner: fidl::Channel) -> Self {
6287        Self::new(inner)
6288    }
6289
6290    fn into_channel(self) -> fidl::Channel {
6291        self.client.into_channel()
6292    }
6293
6294    fn as_channel(&self) -> &fidl::Channel {
6295        self.client.as_channel()
6296    }
6297}
6298
6299#[cfg(target_os = "fuchsia")]
6300impl RepositoryIteratorSynchronousProxy {
6301    pub fn new(channel: fidl::Channel) -> Self {
6302        let protocol_name =
6303            <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6304        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6305    }
6306
6307    pub fn into_channel(self) -> fidl::Channel {
6308        self.client.into_channel()
6309    }
6310
6311    /// Waits until an event arrives and returns it. It is safe for other
6312    /// threads to make concurrent requests while waiting for an event.
6313    pub fn wait_for_event(
6314        &self,
6315        deadline: zx::MonotonicInstant,
6316    ) -> Result<RepositoryIteratorEvent, fidl::Error> {
6317        RepositoryIteratorEvent::decode(self.client.wait_for_event(deadline)?)
6318    }
6319
6320    /// Advances the iterator and returns the next batch of repositories.
6321    ///
6322    /// - response `repos` a vector of `RepositoryConfig` repositories.
6323    ///   Will return an empty vector when there are no more repositories.
6324    pub fn r#next(
6325        &self,
6326        ___deadline: zx::MonotonicInstant,
6327    ) -> Result<Vec<RepositoryConfig>, fidl::Error> {
6328        let _response = self
6329            .client
6330            .send_query::<fidl::encoding::EmptyPayload, RepositoryIteratorNextResponse>(
6331                (),
6332                0x5502086bc0cdd25e,
6333                fidl::encoding::DynamicFlags::empty(),
6334                ___deadline,
6335            )?;
6336        Ok(_response.repos)
6337    }
6338}
6339
6340#[cfg(target_os = "fuchsia")]
6341impl From<RepositoryIteratorSynchronousProxy> for zx::Handle {
6342    fn from(value: RepositoryIteratorSynchronousProxy) -> Self {
6343        value.into_channel().into()
6344    }
6345}
6346
6347#[cfg(target_os = "fuchsia")]
6348impl From<fidl::Channel> for RepositoryIteratorSynchronousProxy {
6349    fn from(value: fidl::Channel) -> Self {
6350        Self::new(value)
6351    }
6352}
6353
6354#[cfg(target_os = "fuchsia")]
6355impl fidl::endpoints::FromClient for RepositoryIteratorSynchronousProxy {
6356    type Protocol = RepositoryIteratorMarker;
6357
6358    fn from_client(value: fidl::endpoints::ClientEnd<RepositoryIteratorMarker>) -> Self {
6359        Self::new(value.into_channel())
6360    }
6361}
6362
6363#[derive(Debug, Clone)]
6364pub struct RepositoryIteratorProxy {
6365    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6366}
6367
6368impl fidl::endpoints::Proxy for RepositoryIteratorProxy {
6369    type Protocol = RepositoryIteratorMarker;
6370
6371    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6372        Self::new(inner)
6373    }
6374
6375    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6376        self.client.into_channel().map_err(|client| Self { client })
6377    }
6378
6379    fn as_channel(&self) -> &::fidl::AsyncChannel {
6380        self.client.as_channel()
6381    }
6382}
6383
6384impl RepositoryIteratorProxy {
6385    /// Create a new Proxy for fuchsia.pkg/RepositoryIterator.
6386    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6387        let protocol_name =
6388            <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6389        Self { client: fidl::client::Client::new(channel, protocol_name) }
6390    }
6391
6392    /// Get a Stream of events from the remote end of the protocol.
6393    ///
6394    /// # Panics
6395    ///
6396    /// Panics if the event stream was already taken.
6397    pub fn take_event_stream(&self) -> RepositoryIteratorEventStream {
6398        RepositoryIteratorEventStream { event_receiver: self.client.take_event_receiver() }
6399    }
6400
6401    /// Advances the iterator and returns the next batch of repositories.
6402    ///
6403    /// - response `repos` a vector of `RepositoryConfig` repositories.
6404    ///   Will return an empty vector when there are no more repositories.
6405    pub fn r#next(
6406        &self,
6407    ) -> fidl::client::QueryResponseFut<
6408        Vec<RepositoryConfig>,
6409        fidl::encoding::DefaultFuchsiaResourceDialect,
6410    > {
6411        RepositoryIteratorProxyInterface::r#next(self)
6412    }
6413}
6414
6415impl RepositoryIteratorProxyInterface for RepositoryIteratorProxy {
6416    type NextResponseFut = fidl::client::QueryResponseFut<
6417        Vec<RepositoryConfig>,
6418        fidl::encoding::DefaultFuchsiaResourceDialect,
6419    >;
6420    fn r#next(&self) -> Self::NextResponseFut {
6421        fn _decode(
6422            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6423        ) -> Result<Vec<RepositoryConfig>, fidl::Error> {
6424            let _response = fidl::client::decode_transaction_body::<
6425                RepositoryIteratorNextResponse,
6426                fidl::encoding::DefaultFuchsiaResourceDialect,
6427                0x5502086bc0cdd25e,
6428            >(_buf?)?;
6429            Ok(_response.repos)
6430        }
6431        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RepositoryConfig>>(
6432            (),
6433            0x5502086bc0cdd25e,
6434            fidl::encoding::DynamicFlags::empty(),
6435            _decode,
6436        )
6437    }
6438}
6439
6440pub struct RepositoryIteratorEventStream {
6441    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6442}
6443
6444impl std::marker::Unpin for RepositoryIteratorEventStream {}
6445
6446impl futures::stream::FusedStream for RepositoryIteratorEventStream {
6447    fn is_terminated(&self) -> bool {
6448        self.event_receiver.is_terminated()
6449    }
6450}
6451
6452impl futures::Stream for RepositoryIteratorEventStream {
6453    type Item = Result<RepositoryIteratorEvent, fidl::Error>;
6454
6455    fn poll_next(
6456        mut self: std::pin::Pin<&mut Self>,
6457        cx: &mut std::task::Context<'_>,
6458    ) -> std::task::Poll<Option<Self::Item>> {
6459        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6460            &mut self.event_receiver,
6461            cx
6462        )?) {
6463            Some(buf) => std::task::Poll::Ready(Some(RepositoryIteratorEvent::decode(buf))),
6464            None => std::task::Poll::Ready(None),
6465        }
6466    }
6467}
6468
6469#[derive(Debug)]
6470pub enum RepositoryIteratorEvent {}
6471
6472impl RepositoryIteratorEvent {
6473    /// Decodes a message buffer as a [`RepositoryIteratorEvent`].
6474    fn decode(
6475        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6476    ) -> Result<RepositoryIteratorEvent, fidl::Error> {
6477        let (bytes, _handles) = buf.split_mut();
6478        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6479        debug_assert_eq!(tx_header.tx_id, 0);
6480        match tx_header.ordinal {
6481            _ => Err(fidl::Error::UnknownOrdinal {
6482                ordinal: tx_header.ordinal,
6483                protocol_name:
6484                    <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6485            }),
6486        }
6487    }
6488}
6489
6490/// A Stream of incoming requests for fuchsia.pkg/RepositoryIterator.
6491pub struct RepositoryIteratorRequestStream {
6492    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6493    is_terminated: bool,
6494}
6495
6496impl std::marker::Unpin for RepositoryIteratorRequestStream {}
6497
6498impl futures::stream::FusedStream for RepositoryIteratorRequestStream {
6499    fn is_terminated(&self) -> bool {
6500        self.is_terminated
6501    }
6502}
6503
6504impl fidl::endpoints::RequestStream for RepositoryIteratorRequestStream {
6505    type Protocol = RepositoryIteratorMarker;
6506    type ControlHandle = RepositoryIteratorControlHandle;
6507
6508    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6509        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6510    }
6511
6512    fn control_handle(&self) -> Self::ControlHandle {
6513        RepositoryIteratorControlHandle { inner: self.inner.clone() }
6514    }
6515
6516    fn into_inner(
6517        self,
6518    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6519    {
6520        (self.inner, self.is_terminated)
6521    }
6522
6523    fn from_inner(
6524        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6525        is_terminated: bool,
6526    ) -> Self {
6527        Self { inner, is_terminated }
6528    }
6529}
6530
6531impl futures::Stream for RepositoryIteratorRequestStream {
6532    type Item = Result<RepositoryIteratorRequest, fidl::Error>;
6533
6534    fn poll_next(
6535        mut self: std::pin::Pin<&mut Self>,
6536        cx: &mut std::task::Context<'_>,
6537    ) -> std::task::Poll<Option<Self::Item>> {
6538        let this = &mut *self;
6539        if this.inner.check_shutdown(cx) {
6540            this.is_terminated = true;
6541            return std::task::Poll::Ready(None);
6542        }
6543        if this.is_terminated {
6544            panic!("polled RepositoryIteratorRequestStream after completion");
6545        }
6546        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6547            |bytes, handles| {
6548                match this.inner.channel().read_etc(cx, bytes, handles) {
6549                    std::task::Poll::Ready(Ok(())) => {}
6550                    std::task::Poll::Pending => return std::task::Poll::Pending,
6551                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6552                        this.is_terminated = true;
6553                        return std::task::Poll::Ready(None);
6554                    }
6555                    std::task::Poll::Ready(Err(e)) => {
6556                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6557                            e.into(),
6558                        ))));
6559                    }
6560                }
6561
6562                // A message has been received from the channel
6563                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6564
6565                std::task::Poll::Ready(Some(match header.ordinal {
6566                0x5502086bc0cdd25e => {
6567                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6568                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6569                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6570                    let control_handle = RepositoryIteratorControlHandle {
6571                        inner: this.inner.clone(),
6572                    };
6573                    Ok(RepositoryIteratorRequest::Next {
6574                        responder: RepositoryIteratorNextResponder {
6575                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6576                            tx_id: header.tx_id,
6577                        },
6578                    })
6579                }
6580                _ => Err(fidl::Error::UnknownOrdinal {
6581                    ordinal: header.ordinal,
6582                    protocol_name: <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6583                }),
6584            }))
6585            },
6586        )
6587    }
6588}
6589
6590/// The iterator over all the repositories defined in a `PackageResolver`.
6591#[derive(Debug)]
6592pub enum RepositoryIteratorRequest {
6593    /// Advances the iterator and returns the next batch of repositories.
6594    ///
6595    /// - response `repos` a vector of `RepositoryConfig` repositories.
6596    ///   Will return an empty vector when there are no more repositories.
6597    Next { responder: RepositoryIteratorNextResponder },
6598}
6599
6600impl RepositoryIteratorRequest {
6601    #[allow(irrefutable_let_patterns)]
6602    pub fn into_next(self) -> Option<(RepositoryIteratorNextResponder)> {
6603        if let RepositoryIteratorRequest::Next { responder } = self {
6604            Some((responder))
6605        } else {
6606            None
6607        }
6608    }
6609
6610    /// Name of the method defined in FIDL
6611    pub fn method_name(&self) -> &'static str {
6612        match *self {
6613            RepositoryIteratorRequest::Next { .. } => "next",
6614        }
6615    }
6616}
6617
6618#[derive(Debug, Clone)]
6619pub struct RepositoryIteratorControlHandle {
6620    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6621}
6622
6623impl fidl::endpoints::ControlHandle for RepositoryIteratorControlHandle {
6624    fn shutdown(&self) {
6625        self.inner.shutdown()
6626    }
6627    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6628        self.inner.shutdown_with_epitaph(status)
6629    }
6630
6631    fn is_closed(&self) -> bool {
6632        self.inner.channel().is_closed()
6633    }
6634    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6635        self.inner.channel().on_closed()
6636    }
6637
6638    #[cfg(target_os = "fuchsia")]
6639    fn signal_peer(
6640        &self,
6641        clear_mask: zx::Signals,
6642        set_mask: zx::Signals,
6643    ) -> Result<(), zx_status::Status> {
6644        use fidl::Peered;
6645        self.inner.channel().signal_peer(clear_mask, set_mask)
6646    }
6647}
6648
6649impl RepositoryIteratorControlHandle {}
6650
6651#[must_use = "FIDL methods require a response to be sent"]
6652#[derive(Debug)]
6653pub struct RepositoryIteratorNextResponder {
6654    control_handle: std::mem::ManuallyDrop<RepositoryIteratorControlHandle>,
6655    tx_id: u32,
6656}
6657
6658/// Set the the channel to be shutdown (see [`RepositoryIteratorControlHandle::shutdown`])
6659/// if the responder is dropped without sending a response, so that the client
6660/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6661impl std::ops::Drop for RepositoryIteratorNextResponder {
6662    fn drop(&mut self) {
6663        self.control_handle.shutdown();
6664        // Safety: drops once, never accessed again
6665        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6666    }
6667}
6668
6669impl fidl::endpoints::Responder for RepositoryIteratorNextResponder {
6670    type ControlHandle = RepositoryIteratorControlHandle;
6671
6672    fn control_handle(&self) -> &RepositoryIteratorControlHandle {
6673        &self.control_handle
6674    }
6675
6676    fn drop_without_shutdown(mut self) {
6677        // Safety: drops once, never accessed again due to mem::forget
6678        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6679        // Prevent Drop from running (which would shut down the channel)
6680        std::mem::forget(self);
6681    }
6682}
6683
6684impl RepositoryIteratorNextResponder {
6685    /// Sends a response to the FIDL transaction.
6686    ///
6687    /// Sets the channel to shutdown if an error occurs.
6688    pub fn send(self, mut repos: &[RepositoryConfig]) -> Result<(), fidl::Error> {
6689        let _result = self.send_raw(repos);
6690        if _result.is_err() {
6691            self.control_handle.shutdown();
6692        }
6693        self.drop_without_shutdown();
6694        _result
6695    }
6696
6697    /// Similar to "send" but does not shutdown the channel if an error occurs.
6698    pub fn send_no_shutdown_on_err(
6699        self,
6700        mut repos: &[RepositoryConfig],
6701    ) -> Result<(), fidl::Error> {
6702        let _result = self.send_raw(repos);
6703        self.drop_without_shutdown();
6704        _result
6705    }
6706
6707    fn send_raw(&self, mut repos: &[RepositoryConfig]) -> Result<(), fidl::Error> {
6708        self.control_handle.inner.send::<RepositoryIteratorNextResponse>(
6709            (repos,),
6710            self.tx_id,
6711            0x5502086bc0cdd25e,
6712            fidl::encoding::DynamicFlags::empty(),
6713        )
6714    }
6715}
6716
6717#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6718pub struct RepositoryManagerMarker;
6719
6720impl fidl::endpoints::ProtocolMarker for RepositoryManagerMarker {
6721    type Proxy = RepositoryManagerProxy;
6722    type RequestStream = RepositoryManagerRequestStream;
6723    #[cfg(target_os = "fuchsia")]
6724    type SynchronousProxy = RepositoryManagerSynchronousProxy;
6725
6726    const DEBUG_NAME: &'static str = "fuchsia.pkg.RepositoryManager";
6727}
6728impl fidl::endpoints::DiscoverableProtocolMarker for RepositoryManagerMarker {}
6729pub type RepositoryManagerAddResult = Result<(), i32>;
6730pub type RepositoryManagerRemoveResult = Result<(), i32>;
6731pub type RepositoryManagerAddMirrorResult = Result<(), i32>;
6732pub type RepositoryManagerRemoveMirrorResult = Result<(), i32>;
6733
6734pub trait RepositoryManagerProxyInterface: Send + Sync {
6735    type AddResponseFut: std::future::Future<Output = Result<RepositoryManagerAddResult, fidl::Error>>
6736        + Send;
6737    fn r#add(&self, repo: &RepositoryConfig) -> Self::AddResponseFut;
6738    type RemoveResponseFut: std::future::Future<Output = Result<RepositoryManagerRemoveResult, fidl::Error>>
6739        + Send;
6740    fn r#remove(&self, repo_url: &str) -> Self::RemoveResponseFut;
6741    type AddMirrorResponseFut: std::future::Future<Output = Result<RepositoryManagerAddMirrorResult, fidl::Error>>
6742        + Send;
6743    fn r#add_mirror(&self, repo_url: &str, mirror: &MirrorConfig) -> Self::AddMirrorResponseFut;
6744    type RemoveMirrorResponseFut: std::future::Future<Output = Result<RepositoryManagerRemoveMirrorResult, fidl::Error>>
6745        + Send;
6746    fn r#remove_mirror(&self, repo_url: &str, mirror_url: &str) -> Self::RemoveMirrorResponseFut;
6747    fn r#list(
6748        &self,
6749        iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
6750    ) -> Result<(), fidl::Error>;
6751}
6752#[derive(Debug)]
6753#[cfg(target_os = "fuchsia")]
6754pub struct RepositoryManagerSynchronousProxy {
6755    client: fidl::client::sync::Client,
6756}
6757
6758#[cfg(target_os = "fuchsia")]
6759impl fidl::endpoints::SynchronousProxy for RepositoryManagerSynchronousProxy {
6760    type Proxy = RepositoryManagerProxy;
6761    type Protocol = RepositoryManagerMarker;
6762
6763    fn from_channel(inner: fidl::Channel) -> Self {
6764        Self::new(inner)
6765    }
6766
6767    fn into_channel(self) -> fidl::Channel {
6768        self.client.into_channel()
6769    }
6770
6771    fn as_channel(&self) -> &fidl::Channel {
6772        self.client.as_channel()
6773    }
6774}
6775
6776#[cfg(target_os = "fuchsia")]
6777impl RepositoryManagerSynchronousProxy {
6778    pub fn new(channel: fidl::Channel) -> Self {
6779        let protocol_name =
6780            <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6781        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6782    }
6783
6784    pub fn into_channel(self) -> fidl::Channel {
6785        self.client.into_channel()
6786    }
6787
6788    /// Waits until an event arrives and returns it. It is safe for other
6789    /// threads to make concurrent requests while waiting for an event.
6790    pub fn wait_for_event(
6791        &self,
6792        deadline: zx::MonotonicInstant,
6793    ) -> Result<RepositoryManagerEvent, fidl::Error> {
6794        RepositoryManagerEvent::decode(self.client.wait_for_event(deadline)?)
6795    }
6796
6797    /// Adds a repository. This will overwrite the repository if it already exists.
6798    ///
6799    /// + request `repo` a repository to add to the resolver.
6800    /// * error a zx_status value indicating failure. One of the following:
6801    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
6802    ///     * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
6803    ///     * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
6804    pub fn r#add(
6805        &self,
6806        mut repo: &RepositoryConfig,
6807        ___deadline: zx::MonotonicInstant,
6808    ) -> Result<RepositoryManagerAddResult, fidl::Error> {
6809        let _response = self.client.send_query::<
6810            RepositoryManagerAddRequest,
6811            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6812        >(
6813            (repo,),
6814            0x7fff4b8c733c7151,
6815            fidl::encoding::DynamicFlags::empty(),
6816            ___deadline,
6817        )?;
6818        Ok(_response.map(|x| x))
6819    }
6820
6821    /// Removes a repository.
6822    ///
6823    /// Removing a repository will prevent future packages from being cached from this repository,
6824    /// but in-flight downloads may not be interrupted.
6825    ///
6826    /// + request `repo_url` the URL of the repository we want to remove.
6827    /// * error a zx_status value indicating failure. One of the following:
6828    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
6829    ///       `repo_url` matches a static repository.
6830    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
6831    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
6832    pub fn r#remove(
6833        &self,
6834        mut repo_url: &str,
6835        ___deadline: zx::MonotonicInstant,
6836    ) -> Result<RepositoryManagerRemoveResult, fidl::Error> {
6837        let _response = self.client.send_query::<
6838            RepositoryManagerRemoveRequest,
6839            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6840        >(
6841            (repo_url,),
6842            0x5de23dc0e0dea4ba,
6843            fidl::encoding::DynamicFlags::empty(),
6844            ___deadline,
6845        )?;
6846        Ok(_response.map(|x| x))
6847    }
6848
6849    /// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
6850    ///
6851    /// + request `repo_url` the URL of the repository to add the mirror to.
6852    /// + request `mirror` the mirror config used to add the mirror.
6853    /// * error a zx_status value indicating failure. One of the following:
6854    ///     * `ZX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
6855    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
6856    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
6857    pub fn r#add_mirror(
6858        &self,
6859        mut repo_url: &str,
6860        mut mirror: &MirrorConfig,
6861        ___deadline: zx::MonotonicInstant,
6862    ) -> Result<RepositoryManagerAddMirrorResult, fidl::Error> {
6863        let _response = self.client.send_query::<
6864            RepositoryManagerAddMirrorRequest,
6865            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6866        >(
6867            (repo_url, mirror,),
6868            0x3b7ef213730dd24c,
6869            fidl::encoding::DynamicFlags::empty(),
6870            ___deadline,
6871        )?;
6872        Ok(_response.map(|x| x))
6873    }
6874
6875    /// Removes a mirror from a repository.
6876    ///
6877    /// Removing a mirror will prevent future packages from being cached from that mirror, but
6878    /// in-flight downloads may not be interrupted.
6879    ///
6880    /// + request `repo_url` the URL of the mirror's repository.
6881    /// + request `mirror_url` the URL of the mirror we want to remove.
6882    /// * error a zx_status value indicating failure. One of the following:
6883    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
6884    ///     * `ZX_ERR_NOT_FOUND` if the repository or mirror does not exist.
6885    pub fn r#remove_mirror(
6886        &self,
6887        mut repo_url: &str,
6888        mut mirror_url: &str,
6889        ___deadline: zx::MonotonicInstant,
6890    ) -> Result<RepositoryManagerRemoveMirrorResult, fidl::Error> {
6891        let _response = self.client.send_query::<
6892            RepositoryManagerRemoveMirrorRequest,
6893            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6894        >(
6895            (repo_url, mirror_url,),
6896            0x4682584cc47c23a2,
6897            fidl::encoding::DynamicFlags::empty(),
6898            ___deadline,
6899        )?;
6900        Ok(_response.map(|x| x))
6901    }
6902
6903    /// Returns an iterator over all repositories.
6904    ///
6905    /// + request `iterator` a request for an iterator.
6906    pub fn r#list(
6907        &self,
6908        mut iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
6909    ) -> Result<(), fidl::Error> {
6910        self.client.send::<RepositoryManagerListRequest>(
6911            (iterator,),
6912            0x61837314ba6f4afb,
6913            fidl::encoding::DynamicFlags::empty(),
6914        )
6915    }
6916}
6917
6918#[cfg(target_os = "fuchsia")]
6919impl From<RepositoryManagerSynchronousProxy> for zx::Handle {
6920    fn from(value: RepositoryManagerSynchronousProxy) -> Self {
6921        value.into_channel().into()
6922    }
6923}
6924
6925#[cfg(target_os = "fuchsia")]
6926impl From<fidl::Channel> for RepositoryManagerSynchronousProxy {
6927    fn from(value: fidl::Channel) -> Self {
6928        Self::new(value)
6929    }
6930}
6931
6932#[cfg(target_os = "fuchsia")]
6933impl fidl::endpoints::FromClient for RepositoryManagerSynchronousProxy {
6934    type Protocol = RepositoryManagerMarker;
6935
6936    fn from_client(value: fidl::endpoints::ClientEnd<RepositoryManagerMarker>) -> Self {
6937        Self::new(value.into_channel())
6938    }
6939}
6940
6941#[derive(Debug, Clone)]
6942pub struct RepositoryManagerProxy {
6943    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6944}
6945
6946impl fidl::endpoints::Proxy for RepositoryManagerProxy {
6947    type Protocol = RepositoryManagerMarker;
6948
6949    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6950        Self::new(inner)
6951    }
6952
6953    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6954        self.client.into_channel().map_err(|client| Self { client })
6955    }
6956
6957    fn as_channel(&self) -> &::fidl::AsyncChannel {
6958        self.client.as_channel()
6959    }
6960}
6961
6962impl RepositoryManagerProxy {
6963    /// Create a new Proxy for fuchsia.pkg/RepositoryManager.
6964    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6965        let protocol_name =
6966            <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6967        Self { client: fidl::client::Client::new(channel, protocol_name) }
6968    }
6969
6970    /// Get a Stream of events from the remote end of the protocol.
6971    ///
6972    /// # Panics
6973    ///
6974    /// Panics if the event stream was already taken.
6975    pub fn take_event_stream(&self) -> RepositoryManagerEventStream {
6976        RepositoryManagerEventStream { event_receiver: self.client.take_event_receiver() }
6977    }
6978
6979    /// Adds a repository. This will overwrite the repository if it already exists.
6980    ///
6981    /// + request `repo` a repository to add to the resolver.
6982    /// * error a zx_status value indicating failure. One of the following:
6983    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
6984    ///     * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
6985    ///     * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
6986    pub fn r#add(
6987        &self,
6988        mut repo: &RepositoryConfig,
6989    ) -> fidl::client::QueryResponseFut<
6990        RepositoryManagerAddResult,
6991        fidl::encoding::DefaultFuchsiaResourceDialect,
6992    > {
6993        RepositoryManagerProxyInterface::r#add(self, repo)
6994    }
6995
6996    /// Removes a repository.
6997    ///
6998    /// Removing a repository will prevent future packages from being cached from this repository,
6999    /// but in-flight downloads may not be interrupted.
7000    ///
7001    /// + request `repo_url` the URL of the repository we want to remove.
7002    /// * error a zx_status value indicating failure. One of the following:
7003    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
7004    ///       `repo_url` matches a static repository.
7005    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
7006    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7007    pub fn r#remove(
7008        &self,
7009        mut repo_url: &str,
7010    ) -> fidl::client::QueryResponseFut<
7011        RepositoryManagerRemoveResult,
7012        fidl::encoding::DefaultFuchsiaResourceDialect,
7013    > {
7014        RepositoryManagerProxyInterface::r#remove(self, repo_url)
7015    }
7016
7017    /// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
7018    ///
7019    /// + request `repo_url` the URL of the repository to add the mirror to.
7020    /// + request `mirror` the mirror config used to add the mirror.
7021    /// * error a zx_status value indicating failure. One of the following:
7022    ///     * `ZX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
7023    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
7024    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7025    pub fn r#add_mirror(
7026        &self,
7027        mut repo_url: &str,
7028        mut mirror: &MirrorConfig,
7029    ) -> fidl::client::QueryResponseFut<
7030        RepositoryManagerAddMirrorResult,
7031        fidl::encoding::DefaultFuchsiaResourceDialect,
7032    > {
7033        RepositoryManagerProxyInterface::r#add_mirror(self, repo_url, mirror)
7034    }
7035
7036    /// Removes a mirror from a repository.
7037    ///
7038    /// Removing a mirror will prevent future packages from being cached from that mirror, but
7039    /// in-flight downloads may not be interrupted.
7040    ///
7041    /// + request `repo_url` the URL of the mirror's repository.
7042    /// + request `mirror_url` the URL of the mirror we want to remove.
7043    /// * error a zx_status value indicating failure. One of the following:
7044    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
7045    ///     * `ZX_ERR_NOT_FOUND` if the repository or mirror does not exist.
7046    pub fn r#remove_mirror(
7047        &self,
7048        mut repo_url: &str,
7049        mut mirror_url: &str,
7050    ) -> fidl::client::QueryResponseFut<
7051        RepositoryManagerRemoveMirrorResult,
7052        fidl::encoding::DefaultFuchsiaResourceDialect,
7053    > {
7054        RepositoryManagerProxyInterface::r#remove_mirror(self, repo_url, mirror_url)
7055    }
7056
7057    /// Returns an iterator over all repositories.
7058    ///
7059    /// + request `iterator` a request for an iterator.
7060    pub fn r#list(
7061        &self,
7062        mut iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7063    ) -> Result<(), fidl::Error> {
7064        RepositoryManagerProxyInterface::r#list(self, iterator)
7065    }
7066}
7067
7068impl RepositoryManagerProxyInterface for RepositoryManagerProxy {
7069    type AddResponseFut = fidl::client::QueryResponseFut<
7070        RepositoryManagerAddResult,
7071        fidl::encoding::DefaultFuchsiaResourceDialect,
7072    >;
7073    fn r#add(&self, mut repo: &RepositoryConfig) -> Self::AddResponseFut {
7074        fn _decode(
7075            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7076        ) -> Result<RepositoryManagerAddResult, fidl::Error> {
7077            let _response = fidl::client::decode_transaction_body::<
7078                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7079                fidl::encoding::DefaultFuchsiaResourceDialect,
7080                0x7fff4b8c733c7151,
7081            >(_buf?)?;
7082            Ok(_response.map(|x| x))
7083        }
7084        self.client
7085            .send_query_and_decode::<RepositoryManagerAddRequest, RepositoryManagerAddResult>(
7086                (repo,),
7087                0x7fff4b8c733c7151,
7088                fidl::encoding::DynamicFlags::empty(),
7089                _decode,
7090            )
7091    }
7092
7093    type RemoveResponseFut = fidl::client::QueryResponseFut<
7094        RepositoryManagerRemoveResult,
7095        fidl::encoding::DefaultFuchsiaResourceDialect,
7096    >;
7097    fn r#remove(&self, mut repo_url: &str) -> Self::RemoveResponseFut {
7098        fn _decode(
7099            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7100        ) -> Result<RepositoryManagerRemoveResult, fidl::Error> {
7101            let _response = fidl::client::decode_transaction_body::<
7102                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7103                fidl::encoding::DefaultFuchsiaResourceDialect,
7104                0x5de23dc0e0dea4ba,
7105            >(_buf?)?;
7106            Ok(_response.map(|x| x))
7107        }
7108        self.client
7109            .send_query_and_decode::<RepositoryManagerRemoveRequest, RepositoryManagerRemoveResult>(
7110                (repo_url,),
7111                0x5de23dc0e0dea4ba,
7112                fidl::encoding::DynamicFlags::empty(),
7113                _decode,
7114            )
7115    }
7116
7117    type AddMirrorResponseFut = fidl::client::QueryResponseFut<
7118        RepositoryManagerAddMirrorResult,
7119        fidl::encoding::DefaultFuchsiaResourceDialect,
7120    >;
7121    fn r#add_mirror(
7122        &self,
7123        mut repo_url: &str,
7124        mut mirror: &MirrorConfig,
7125    ) -> Self::AddMirrorResponseFut {
7126        fn _decode(
7127            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7128        ) -> Result<RepositoryManagerAddMirrorResult, fidl::Error> {
7129            let _response = fidl::client::decode_transaction_body::<
7130                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7131                fidl::encoding::DefaultFuchsiaResourceDialect,
7132                0x3b7ef213730dd24c,
7133            >(_buf?)?;
7134            Ok(_response.map(|x| x))
7135        }
7136        self.client.send_query_and_decode::<
7137            RepositoryManagerAddMirrorRequest,
7138            RepositoryManagerAddMirrorResult,
7139        >(
7140            (repo_url, mirror,),
7141            0x3b7ef213730dd24c,
7142            fidl::encoding::DynamicFlags::empty(),
7143            _decode,
7144        )
7145    }
7146
7147    type RemoveMirrorResponseFut = fidl::client::QueryResponseFut<
7148        RepositoryManagerRemoveMirrorResult,
7149        fidl::encoding::DefaultFuchsiaResourceDialect,
7150    >;
7151    fn r#remove_mirror(
7152        &self,
7153        mut repo_url: &str,
7154        mut mirror_url: &str,
7155    ) -> Self::RemoveMirrorResponseFut {
7156        fn _decode(
7157            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7158        ) -> Result<RepositoryManagerRemoveMirrorResult, fidl::Error> {
7159            let _response = fidl::client::decode_transaction_body::<
7160                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7161                fidl::encoding::DefaultFuchsiaResourceDialect,
7162                0x4682584cc47c23a2,
7163            >(_buf?)?;
7164            Ok(_response.map(|x| x))
7165        }
7166        self.client.send_query_and_decode::<
7167            RepositoryManagerRemoveMirrorRequest,
7168            RepositoryManagerRemoveMirrorResult,
7169        >(
7170            (repo_url, mirror_url,),
7171            0x4682584cc47c23a2,
7172            fidl::encoding::DynamicFlags::empty(),
7173            _decode,
7174        )
7175    }
7176
7177    fn r#list(
7178        &self,
7179        mut iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7180    ) -> Result<(), fidl::Error> {
7181        self.client.send::<RepositoryManagerListRequest>(
7182            (iterator,),
7183            0x61837314ba6f4afb,
7184            fidl::encoding::DynamicFlags::empty(),
7185        )
7186    }
7187}
7188
7189pub struct RepositoryManagerEventStream {
7190    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7191}
7192
7193impl std::marker::Unpin for RepositoryManagerEventStream {}
7194
7195impl futures::stream::FusedStream for RepositoryManagerEventStream {
7196    fn is_terminated(&self) -> bool {
7197        self.event_receiver.is_terminated()
7198    }
7199}
7200
7201impl futures::Stream for RepositoryManagerEventStream {
7202    type Item = Result<RepositoryManagerEvent, fidl::Error>;
7203
7204    fn poll_next(
7205        mut self: std::pin::Pin<&mut Self>,
7206        cx: &mut std::task::Context<'_>,
7207    ) -> std::task::Poll<Option<Self::Item>> {
7208        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7209            &mut self.event_receiver,
7210            cx
7211        )?) {
7212            Some(buf) => std::task::Poll::Ready(Some(RepositoryManagerEvent::decode(buf))),
7213            None => std::task::Poll::Ready(None),
7214        }
7215    }
7216}
7217
7218#[derive(Debug)]
7219pub enum RepositoryManagerEvent {}
7220
7221impl RepositoryManagerEvent {
7222    /// Decodes a message buffer as a [`RepositoryManagerEvent`].
7223    fn decode(
7224        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7225    ) -> Result<RepositoryManagerEvent, fidl::Error> {
7226        let (bytes, _handles) = buf.split_mut();
7227        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7228        debug_assert_eq!(tx_header.tx_id, 0);
7229        match tx_header.ordinal {
7230            _ => Err(fidl::Error::UnknownOrdinal {
7231                ordinal: tx_header.ordinal,
7232                protocol_name:
7233                    <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7234            }),
7235        }
7236    }
7237}
7238
7239/// A Stream of incoming requests for fuchsia.pkg/RepositoryManager.
7240pub struct RepositoryManagerRequestStream {
7241    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7242    is_terminated: bool,
7243}
7244
7245impl std::marker::Unpin for RepositoryManagerRequestStream {}
7246
7247impl futures::stream::FusedStream for RepositoryManagerRequestStream {
7248    fn is_terminated(&self) -> bool {
7249        self.is_terminated
7250    }
7251}
7252
7253impl fidl::endpoints::RequestStream for RepositoryManagerRequestStream {
7254    type Protocol = RepositoryManagerMarker;
7255    type ControlHandle = RepositoryManagerControlHandle;
7256
7257    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7258        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7259    }
7260
7261    fn control_handle(&self) -> Self::ControlHandle {
7262        RepositoryManagerControlHandle { inner: self.inner.clone() }
7263    }
7264
7265    fn into_inner(
7266        self,
7267    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7268    {
7269        (self.inner, self.is_terminated)
7270    }
7271
7272    fn from_inner(
7273        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7274        is_terminated: bool,
7275    ) -> Self {
7276        Self { inner, is_terminated }
7277    }
7278}
7279
7280impl futures::Stream for RepositoryManagerRequestStream {
7281    type Item = Result<RepositoryManagerRequest, fidl::Error>;
7282
7283    fn poll_next(
7284        mut self: std::pin::Pin<&mut Self>,
7285        cx: &mut std::task::Context<'_>,
7286    ) -> std::task::Poll<Option<Self::Item>> {
7287        let this = &mut *self;
7288        if this.inner.check_shutdown(cx) {
7289            this.is_terminated = true;
7290            return std::task::Poll::Ready(None);
7291        }
7292        if this.is_terminated {
7293            panic!("polled RepositoryManagerRequestStream after completion");
7294        }
7295        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7296            |bytes, handles| {
7297                match this.inner.channel().read_etc(cx, bytes, handles) {
7298                    std::task::Poll::Ready(Ok(())) => {}
7299                    std::task::Poll::Pending => return std::task::Poll::Pending,
7300                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7301                        this.is_terminated = true;
7302                        return std::task::Poll::Ready(None);
7303                    }
7304                    std::task::Poll::Ready(Err(e)) => {
7305                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7306                            e.into(),
7307                        ))));
7308                    }
7309                }
7310
7311                // A message has been received from the channel
7312                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7313
7314                std::task::Poll::Ready(Some(match header.ordinal {
7315                    0x7fff4b8c733c7151 => {
7316                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7317                        let mut req = fidl::new_empty!(
7318                            RepositoryManagerAddRequest,
7319                            fidl::encoding::DefaultFuchsiaResourceDialect
7320                        );
7321                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerAddRequest>(&header, _body_bytes, handles, &mut req)?;
7322                        let control_handle =
7323                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7324                        Ok(RepositoryManagerRequest::Add {
7325                            repo: req.repo,
7326
7327                            responder: RepositoryManagerAddResponder {
7328                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7329                                tx_id: header.tx_id,
7330                            },
7331                        })
7332                    }
7333                    0x5de23dc0e0dea4ba => {
7334                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7335                        let mut req = fidl::new_empty!(
7336                            RepositoryManagerRemoveRequest,
7337                            fidl::encoding::DefaultFuchsiaResourceDialect
7338                        );
7339                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
7340                        let control_handle =
7341                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7342                        Ok(RepositoryManagerRequest::Remove {
7343                            repo_url: req.repo_url,
7344
7345                            responder: RepositoryManagerRemoveResponder {
7346                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7347                                tx_id: header.tx_id,
7348                            },
7349                        })
7350                    }
7351                    0x3b7ef213730dd24c => {
7352                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7353                        let mut req = fidl::new_empty!(
7354                            RepositoryManagerAddMirrorRequest,
7355                            fidl::encoding::DefaultFuchsiaResourceDialect
7356                        );
7357                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerAddMirrorRequest>(&header, _body_bytes, handles, &mut req)?;
7358                        let control_handle =
7359                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7360                        Ok(RepositoryManagerRequest::AddMirror {
7361                            repo_url: req.repo_url,
7362                            mirror: req.mirror,
7363
7364                            responder: RepositoryManagerAddMirrorResponder {
7365                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7366                                tx_id: header.tx_id,
7367                            },
7368                        })
7369                    }
7370                    0x4682584cc47c23a2 => {
7371                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7372                        let mut req = fidl::new_empty!(
7373                            RepositoryManagerRemoveMirrorRequest,
7374                            fidl::encoding::DefaultFuchsiaResourceDialect
7375                        );
7376                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerRemoveMirrorRequest>(&header, _body_bytes, handles, &mut req)?;
7377                        let control_handle =
7378                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7379                        Ok(RepositoryManagerRequest::RemoveMirror {
7380                            repo_url: req.repo_url,
7381                            mirror_url: req.mirror_url,
7382
7383                            responder: RepositoryManagerRemoveMirrorResponder {
7384                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7385                                tx_id: header.tx_id,
7386                            },
7387                        })
7388                    }
7389                    0x61837314ba6f4afb => {
7390                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7391                        let mut req = fidl::new_empty!(
7392                            RepositoryManagerListRequest,
7393                            fidl::encoding::DefaultFuchsiaResourceDialect
7394                        );
7395                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerListRequest>(&header, _body_bytes, handles, &mut req)?;
7396                        let control_handle =
7397                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7398                        Ok(RepositoryManagerRequest::List {
7399                            iterator: req.iterator,
7400
7401                            control_handle,
7402                        })
7403                    }
7404                    _ => Err(fidl::Error::UnknownOrdinal {
7405                        ordinal: header.ordinal,
7406                        protocol_name:
7407                            <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7408                    }),
7409                }))
7410            },
7411        )
7412    }
7413}
7414
7415/// This manages package repositories.
7416///
7417/// This is intended to be implemented by package resolver components, and used by
7418/// repository administration tools.
7419#[derive(Debug)]
7420pub enum RepositoryManagerRequest {
7421    /// Adds a repository. This will overwrite the repository if it already exists.
7422    ///
7423    /// + request `repo` a repository to add to the resolver.
7424    /// * error a zx_status value indicating failure. One of the following:
7425    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
7426    ///     * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
7427    ///     * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
7428    Add { repo: RepositoryConfig, responder: RepositoryManagerAddResponder },
7429    /// Removes a repository.
7430    ///
7431    /// Removing a repository will prevent future packages from being cached from this repository,
7432    /// but in-flight downloads may not be interrupted.
7433    ///
7434    /// + request `repo_url` the URL of the repository we want to remove.
7435    /// * error a zx_status value indicating failure. One of the following:
7436    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
7437    ///       `repo_url` matches a static repository.
7438    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
7439    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7440    Remove { repo_url: String, responder: RepositoryManagerRemoveResponder },
7441    /// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
7442    ///
7443    /// + request `repo_url` the URL of the repository to add the mirror to.
7444    /// + request `mirror` the mirror config used to add the mirror.
7445    /// * error a zx_status value indicating failure. One of the following:
7446    ///     * `ZX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
7447    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
7448    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7449    AddMirror {
7450        repo_url: String,
7451        mirror: MirrorConfig,
7452        responder: RepositoryManagerAddMirrorResponder,
7453    },
7454    /// Removes a mirror from a repository.
7455    ///
7456    /// Removing a mirror will prevent future packages from being cached from that mirror, but
7457    /// in-flight downloads may not be interrupted.
7458    ///
7459    /// + request `repo_url` the URL of the mirror's repository.
7460    /// + request `mirror_url` the URL of the mirror we want to remove.
7461    /// * error a zx_status value indicating failure. One of the following:
7462    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
7463    ///     * `ZX_ERR_NOT_FOUND` if the repository or mirror does not exist.
7464    RemoveMirror {
7465        repo_url: String,
7466        mirror_url: String,
7467        responder: RepositoryManagerRemoveMirrorResponder,
7468    },
7469    /// Returns an iterator over all repositories.
7470    ///
7471    /// + request `iterator` a request for an iterator.
7472    List {
7473        iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7474        control_handle: RepositoryManagerControlHandle,
7475    },
7476}
7477
7478impl RepositoryManagerRequest {
7479    #[allow(irrefutable_let_patterns)]
7480    pub fn into_add(self) -> Option<(RepositoryConfig, RepositoryManagerAddResponder)> {
7481        if let RepositoryManagerRequest::Add { repo, responder } = self {
7482            Some((repo, responder))
7483        } else {
7484            None
7485        }
7486    }
7487
7488    #[allow(irrefutable_let_patterns)]
7489    pub fn into_remove(self) -> Option<(String, RepositoryManagerRemoveResponder)> {
7490        if let RepositoryManagerRequest::Remove { repo_url, responder } = self {
7491            Some((repo_url, responder))
7492        } else {
7493            None
7494        }
7495    }
7496
7497    #[allow(irrefutable_let_patterns)]
7498    pub fn into_add_mirror(
7499        self,
7500    ) -> Option<(String, MirrorConfig, RepositoryManagerAddMirrorResponder)> {
7501        if let RepositoryManagerRequest::AddMirror { repo_url, mirror, responder } = self {
7502            Some((repo_url, mirror, responder))
7503        } else {
7504            None
7505        }
7506    }
7507
7508    #[allow(irrefutable_let_patterns)]
7509    pub fn into_remove_mirror(
7510        self,
7511    ) -> Option<(String, String, RepositoryManagerRemoveMirrorResponder)> {
7512        if let RepositoryManagerRequest::RemoveMirror { repo_url, mirror_url, responder } = self {
7513            Some((repo_url, mirror_url, responder))
7514        } else {
7515            None
7516        }
7517    }
7518
7519    #[allow(irrefutable_let_patterns)]
7520    pub fn into_list(
7521        self,
7522    ) -> Option<(
7523        fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7524        RepositoryManagerControlHandle,
7525    )> {
7526        if let RepositoryManagerRequest::List { iterator, control_handle } = self {
7527            Some((iterator, control_handle))
7528        } else {
7529            None
7530        }
7531    }
7532
7533    /// Name of the method defined in FIDL
7534    pub fn method_name(&self) -> &'static str {
7535        match *self {
7536            RepositoryManagerRequest::Add { .. } => "add",
7537            RepositoryManagerRequest::Remove { .. } => "remove",
7538            RepositoryManagerRequest::AddMirror { .. } => "add_mirror",
7539            RepositoryManagerRequest::RemoveMirror { .. } => "remove_mirror",
7540            RepositoryManagerRequest::List { .. } => "list",
7541        }
7542    }
7543}
7544
7545#[derive(Debug, Clone)]
7546pub struct RepositoryManagerControlHandle {
7547    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7548}
7549
7550impl fidl::endpoints::ControlHandle for RepositoryManagerControlHandle {
7551    fn shutdown(&self) {
7552        self.inner.shutdown()
7553    }
7554    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7555        self.inner.shutdown_with_epitaph(status)
7556    }
7557
7558    fn is_closed(&self) -> bool {
7559        self.inner.channel().is_closed()
7560    }
7561    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7562        self.inner.channel().on_closed()
7563    }
7564
7565    #[cfg(target_os = "fuchsia")]
7566    fn signal_peer(
7567        &self,
7568        clear_mask: zx::Signals,
7569        set_mask: zx::Signals,
7570    ) -> Result<(), zx_status::Status> {
7571        use fidl::Peered;
7572        self.inner.channel().signal_peer(clear_mask, set_mask)
7573    }
7574}
7575
7576impl RepositoryManagerControlHandle {}
7577
7578#[must_use = "FIDL methods require a response to be sent"]
7579#[derive(Debug)]
7580pub struct RepositoryManagerAddResponder {
7581    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
7582    tx_id: u32,
7583}
7584
7585/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
7586/// if the responder is dropped without sending a response, so that the client
7587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7588impl std::ops::Drop for RepositoryManagerAddResponder {
7589    fn drop(&mut self) {
7590        self.control_handle.shutdown();
7591        // Safety: drops once, never accessed again
7592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7593    }
7594}
7595
7596impl fidl::endpoints::Responder for RepositoryManagerAddResponder {
7597    type ControlHandle = RepositoryManagerControlHandle;
7598
7599    fn control_handle(&self) -> &RepositoryManagerControlHandle {
7600        &self.control_handle
7601    }
7602
7603    fn drop_without_shutdown(mut self) {
7604        // Safety: drops once, never accessed again due to mem::forget
7605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7606        // Prevent Drop from running (which would shut down the channel)
7607        std::mem::forget(self);
7608    }
7609}
7610
7611impl RepositoryManagerAddResponder {
7612    /// Sends a response to the FIDL transaction.
7613    ///
7614    /// Sets the channel to shutdown if an error occurs.
7615    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7616        let _result = self.send_raw(result);
7617        if _result.is_err() {
7618            self.control_handle.shutdown();
7619        }
7620        self.drop_without_shutdown();
7621        _result
7622    }
7623
7624    /// Similar to "send" but does not shutdown the channel if an error occurs.
7625    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7626        let _result = self.send_raw(result);
7627        self.drop_without_shutdown();
7628        _result
7629    }
7630
7631    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7632        self.control_handle
7633            .inner
7634            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7635                result,
7636                self.tx_id,
7637                0x7fff4b8c733c7151,
7638                fidl::encoding::DynamicFlags::empty(),
7639            )
7640    }
7641}
7642
7643#[must_use = "FIDL methods require a response to be sent"]
7644#[derive(Debug)]
7645pub struct RepositoryManagerRemoveResponder {
7646    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
7647    tx_id: u32,
7648}
7649
7650/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
7651/// if the responder is dropped without sending a response, so that the client
7652/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7653impl std::ops::Drop for RepositoryManagerRemoveResponder {
7654    fn drop(&mut self) {
7655        self.control_handle.shutdown();
7656        // Safety: drops once, never accessed again
7657        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7658    }
7659}
7660
7661impl fidl::endpoints::Responder for RepositoryManagerRemoveResponder {
7662    type ControlHandle = RepositoryManagerControlHandle;
7663
7664    fn control_handle(&self) -> &RepositoryManagerControlHandle {
7665        &self.control_handle
7666    }
7667
7668    fn drop_without_shutdown(mut self) {
7669        // Safety: drops once, never accessed again due to mem::forget
7670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7671        // Prevent Drop from running (which would shut down the channel)
7672        std::mem::forget(self);
7673    }
7674}
7675
7676impl RepositoryManagerRemoveResponder {
7677    /// Sends a response to the FIDL transaction.
7678    ///
7679    /// Sets the channel to shutdown if an error occurs.
7680    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7681        let _result = self.send_raw(result);
7682        if _result.is_err() {
7683            self.control_handle.shutdown();
7684        }
7685        self.drop_without_shutdown();
7686        _result
7687    }
7688
7689    /// Similar to "send" but does not shutdown the channel if an error occurs.
7690    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7691        let _result = self.send_raw(result);
7692        self.drop_without_shutdown();
7693        _result
7694    }
7695
7696    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7697        self.control_handle
7698            .inner
7699            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7700                result,
7701                self.tx_id,
7702                0x5de23dc0e0dea4ba,
7703                fidl::encoding::DynamicFlags::empty(),
7704            )
7705    }
7706}
7707
7708#[must_use = "FIDL methods require a response to be sent"]
7709#[derive(Debug)]
7710pub struct RepositoryManagerAddMirrorResponder {
7711    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
7712    tx_id: u32,
7713}
7714
7715/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
7716/// if the responder is dropped without sending a response, so that the client
7717/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7718impl std::ops::Drop for RepositoryManagerAddMirrorResponder {
7719    fn drop(&mut self) {
7720        self.control_handle.shutdown();
7721        // Safety: drops once, never accessed again
7722        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7723    }
7724}
7725
7726impl fidl::endpoints::Responder for RepositoryManagerAddMirrorResponder {
7727    type ControlHandle = RepositoryManagerControlHandle;
7728
7729    fn control_handle(&self) -> &RepositoryManagerControlHandle {
7730        &self.control_handle
7731    }
7732
7733    fn drop_without_shutdown(mut self) {
7734        // Safety: drops once, never accessed again due to mem::forget
7735        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7736        // Prevent Drop from running (which would shut down the channel)
7737        std::mem::forget(self);
7738    }
7739}
7740
7741impl RepositoryManagerAddMirrorResponder {
7742    /// Sends a response to the FIDL transaction.
7743    ///
7744    /// Sets the channel to shutdown if an error occurs.
7745    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7746        let _result = self.send_raw(result);
7747        if _result.is_err() {
7748            self.control_handle.shutdown();
7749        }
7750        self.drop_without_shutdown();
7751        _result
7752    }
7753
7754    /// Similar to "send" but does not shutdown the channel if an error occurs.
7755    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7756        let _result = self.send_raw(result);
7757        self.drop_without_shutdown();
7758        _result
7759    }
7760
7761    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7762        self.control_handle
7763            .inner
7764            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7765                result,
7766                self.tx_id,
7767                0x3b7ef213730dd24c,
7768                fidl::encoding::DynamicFlags::empty(),
7769            )
7770    }
7771}
7772
7773#[must_use = "FIDL methods require a response to be sent"]
7774#[derive(Debug)]
7775pub struct RepositoryManagerRemoveMirrorResponder {
7776    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
7777    tx_id: u32,
7778}
7779
7780/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
7781/// if the responder is dropped without sending a response, so that the client
7782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7783impl std::ops::Drop for RepositoryManagerRemoveMirrorResponder {
7784    fn drop(&mut self) {
7785        self.control_handle.shutdown();
7786        // Safety: drops once, never accessed again
7787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7788    }
7789}
7790
7791impl fidl::endpoints::Responder for RepositoryManagerRemoveMirrorResponder {
7792    type ControlHandle = RepositoryManagerControlHandle;
7793
7794    fn control_handle(&self) -> &RepositoryManagerControlHandle {
7795        &self.control_handle
7796    }
7797
7798    fn drop_without_shutdown(mut self) {
7799        // Safety: drops once, never accessed again due to mem::forget
7800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7801        // Prevent Drop from running (which would shut down the channel)
7802        std::mem::forget(self);
7803    }
7804}
7805
7806impl RepositoryManagerRemoveMirrorResponder {
7807    /// Sends a response to the FIDL transaction.
7808    ///
7809    /// Sets the channel to shutdown if an error occurs.
7810    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7811        let _result = self.send_raw(result);
7812        if _result.is_err() {
7813            self.control_handle.shutdown();
7814        }
7815        self.drop_without_shutdown();
7816        _result
7817    }
7818
7819    /// Similar to "send" but does not shutdown the channel if an error occurs.
7820    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7821        let _result = self.send_raw(result);
7822        self.drop_without_shutdown();
7823        _result
7824    }
7825
7826    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7827        self.control_handle
7828            .inner
7829            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7830                result,
7831                self.tx_id,
7832                0x4682584cc47c23a2,
7833                fidl::encoding::DynamicFlags::empty(),
7834            )
7835    }
7836}
7837
7838#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7839pub struct RetainedBlobsMarker;
7840
7841impl fidl::endpoints::ProtocolMarker for RetainedBlobsMarker {
7842    type Proxy = RetainedBlobsProxy;
7843    type RequestStream = RetainedBlobsRequestStream;
7844    #[cfg(target_os = "fuchsia")]
7845    type SynchronousProxy = RetainedBlobsSynchronousProxy;
7846
7847    const DEBUG_NAME: &'static str = "fuchsia.pkg.RetainedBlobs";
7848}
7849impl fidl::endpoints::DiscoverableProtocolMarker for RetainedBlobsMarker {}
7850
7851pub trait RetainedBlobsProxyInterface: Send + Sync {
7852    type ClearResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7853    fn r#clear(&self) -> Self::ClearResponseFut;
7854    type ReplaceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7855    fn r#replace(
7856        &self,
7857        iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
7858    ) -> Self::ReplaceResponseFut;
7859}
7860#[derive(Debug)]
7861#[cfg(target_os = "fuchsia")]
7862pub struct RetainedBlobsSynchronousProxy {
7863    client: fidl::client::sync::Client,
7864}
7865
7866#[cfg(target_os = "fuchsia")]
7867impl fidl::endpoints::SynchronousProxy for RetainedBlobsSynchronousProxy {
7868    type Proxy = RetainedBlobsProxy;
7869    type Protocol = RetainedBlobsMarker;
7870
7871    fn from_channel(inner: fidl::Channel) -> Self {
7872        Self::new(inner)
7873    }
7874
7875    fn into_channel(self) -> fidl::Channel {
7876        self.client.into_channel()
7877    }
7878
7879    fn as_channel(&self) -> &fidl::Channel {
7880        self.client.as_channel()
7881    }
7882}
7883
7884#[cfg(target_os = "fuchsia")]
7885impl RetainedBlobsSynchronousProxy {
7886    pub fn new(channel: fidl::Channel) -> Self {
7887        let protocol_name = <RetainedBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7888        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7889    }
7890
7891    pub fn into_channel(self) -> fidl::Channel {
7892        self.client.into_channel()
7893    }
7894
7895    /// Waits until an event arrives and returns it. It is safe for other
7896    /// threads to make concurrent requests while waiting for an event.
7897    pub fn wait_for_event(
7898        &self,
7899        deadline: zx::MonotonicInstant,
7900    ) -> Result<RetainedBlobsEvent, fidl::Error> {
7901        RetainedBlobsEvent::decode(self.client.wait_for_event(deadline)?)
7902    }
7903
7904    /// Atomically clear the retained blob set, releasing any previously
7905    /// retained blobs.
7906    pub fn r#clear(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
7907        let _response =
7908            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
7909                (),
7910                0x3005cab30c671164,
7911                fidl::encoding::DynamicFlags::empty(),
7912                ___deadline,
7913            )?;
7914        Ok(_response)
7915    }
7916
7917    /// Atomically replace the retained blob set with the blob hashes
7918    /// provided by the given iterator.
7919    /// Duplicate IDs provided will be merged and processed as a single one.
7920    ///
7921    /// + request `iterator` an iterator of blob IDs that should be
7922    ///   retained.
7923    pub fn r#replace(
7924        &self,
7925        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
7926        ___deadline: zx::MonotonicInstant,
7927    ) -> Result<(), fidl::Error> {
7928        let _response =
7929            self.client.send_query::<RetainedBlobsReplaceRequest, fidl::encoding::EmptyPayload>(
7930                (iterator,),
7931                0x2c049d51026cd0b3,
7932                fidl::encoding::DynamicFlags::empty(),
7933                ___deadline,
7934            )?;
7935        Ok(_response)
7936    }
7937}
7938
7939#[cfg(target_os = "fuchsia")]
7940impl From<RetainedBlobsSynchronousProxy> for zx::Handle {
7941    fn from(value: RetainedBlobsSynchronousProxy) -> Self {
7942        value.into_channel().into()
7943    }
7944}
7945
7946#[cfg(target_os = "fuchsia")]
7947impl From<fidl::Channel> for RetainedBlobsSynchronousProxy {
7948    fn from(value: fidl::Channel) -> Self {
7949        Self::new(value)
7950    }
7951}
7952
7953#[cfg(target_os = "fuchsia")]
7954impl fidl::endpoints::FromClient for RetainedBlobsSynchronousProxy {
7955    type Protocol = RetainedBlobsMarker;
7956
7957    fn from_client(value: fidl::endpoints::ClientEnd<RetainedBlobsMarker>) -> Self {
7958        Self::new(value.into_channel())
7959    }
7960}
7961
7962#[derive(Debug, Clone)]
7963pub struct RetainedBlobsProxy {
7964    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7965}
7966
7967impl fidl::endpoints::Proxy for RetainedBlobsProxy {
7968    type Protocol = RetainedBlobsMarker;
7969
7970    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7971        Self::new(inner)
7972    }
7973
7974    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7975        self.client.into_channel().map_err(|client| Self { client })
7976    }
7977
7978    fn as_channel(&self) -> &::fidl::AsyncChannel {
7979        self.client.as_channel()
7980    }
7981}
7982
7983impl RetainedBlobsProxy {
7984    /// Create a new Proxy for fuchsia.pkg/RetainedBlobs.
7985    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7986        let protocol_name = <RetainedBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7987        Self { client: fidl::client::Client::new(channel, protocol_name) }
7988    }
7989
7990    /// Get a Stream of events from the remote end of the protocol.
7991    ///
7992    /// # Panics
7993    ///
7994    /// Panics if the event stream was already taken.
7995    pub fn take_event_stream(&self) -> RetainedBlobsEventStream {
7996        RetainedBlobsEventStream { event_receiver: self.client.take_event_receiver() }
7997    }
7998
7999    /// Atomically clear the retained blob set, releasing any previously
8000    /// retained blobs.
8001    pub fn r#clear(
8002        &self,
8003    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8004        RetainedBlobsProxyInterface::r#clear(self)
8005    }
8006
8007    /// Atomically replace the retained blob set with the blob hashes
8008    /// provided by the given iterator.
8009    /// Duplicate IDs provided will be merged and processed as a single one.
8010    ///
8011    /// + request `iterator` an iterator of blob IDs that should be
8012    ///   retained.
8013    pub fn r#replace(
8014        &self,
8015        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8016    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8017        RetainedBlobsProxyInterface::r#replace(self, iterator)
8018    }
8019}
8020
8021impl RetainedBlobsProxyInterface for RetainedBlobsProxy {
8022    type ClearResponseFut =
8023        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8024    fn r#clear(&self) -> Self::ClearResponseFut {
8025        fn _decode(
8026            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8027        ) -> Result<(), fidl::Error> {
8028            let _response = fidl::client::decode_transaction_body::<
8029                fidl::encoding::EmptyPayload,
8030                fidl::encoding::DefaultFuchsiaResourceDialect,
8031                0x3005cab30c671164,
8032            >(_buf?)?;
8033            Ok(_response)
8034        }
8035        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8036            (),
8037            0x3005cab30c671164,
8038            fidl::encoding::DynamicFlags::empty(),
8039            _decode,
8040        )
8041    }
8042
8043    type ReplaceResponseFut =
8044        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8045    fn r#replace(
8046        &self,
8047        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8048    ) -> Self::ReplaceResponseFut {
8049        fn _decode(
8050            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8051        ) -> Result<(), fidl::Error> {
8052            let _response = fidl::client::decode_transaction_body::<
8053                fidl::encoding::EmptyPayload,
8054                fidl::encoding::DefaultFuchsiaResourceDialect,
8055                0x2c049d51026cd0b3,
8056            >(_buf?)?;
8057            Ok(_response)
8058        }
8059        self.client.send_query_and_decode::<RetainedBlobsReplaceRequest, ()>(
8060            (iterator,),
8061            0x2c049d51026cd0b3,
8062            fidl::encoding::DynamicFlags::empty(),
8063            _decode,
8064        )
8065    }
8066}
8067
8068pub struct RetainedBlobsEventStream {
8069    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8070}
8071
8072impl std::marker::Unpin for RetainedBlobsEventStream {}
8073
8074impl futures::stream::FusedStream for RetainedBlobsEventStream {
8075    fn is_terminated(&self) -> bool {
8076        self.event_receiver.is_terminated()
8077    }
8078}
8079
8080impl futures::Stream for RetainedBlobsEventStream {
8081    type Item = Result<RetainedBlobsEvent, fidl::Error>;
8082
8083    fn poll_next(
8084        mut self: std::pin::Pin<&mut Self>,
8085        cx: &mut std::task::Context<'_>,
8086    ) -> std::task::Poll<Option<Self::Item>> {
8087        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8088            &mut self.event_receiver,
8089            cx
8090        )?) {
8091            Some(buf) => std::task::Poll::Ready(Some(RetainedBlobsEvent::decode(buf))),
8092            None => std::task::Poll::Ready(None),
8093        }
8094    }
8095}
8096
8097#[derive(Debug)]
8098pub enum RetainedBlobsEvent {}
8099
8100impl RetainedBlobsEvent {
8101    /// Decodes a message buffer as a [`RetainedBlobsEvent`].
8102    fn decode(
8103        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8104    ) -> Result<RetainedBlobsEvent, fidl::Error> {
8105        let (bytes, _handles) = buf.split_mut();
8106        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8107        debug_assert_eq!(tx_header.tx_id, 0);
8108        match tx_header.ordinal {
8109            _ => Err(fidl::Error::UnknownOrdinal {
8110                ordinal: tx_header.ordinal,
8111                protocol_name: <RetainedBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8112            }),
8113        }
8114    }
8115}
8116
8117/// A Stream of incoming requests for fuchsia.pkg/RetainedBlobs.
8118pub struct RetainedBlobsRequestStream {
8119    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8120    is_terminated: bool,
8121}
8122
8123impl std::marker::Unpin for RetainedBlobsRequestStream {}
8124
8125impl futures::stream::FusedStream for RetainedBlobsRequestStream {
8126    fn is_terminated(&self) -> bool {
8127        self.is_terminated
8128    }
8129}
8130
8131impl fidl::endpoints::RequestStream for RetainedBlobsRequestStream {
8132    type Protocol = RetainedBlobsMarker;
8133    type ControlHandle = RetainedBlobsControlHandle;
8134
8135    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8136        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8137    }
8138
8139    fn control_handle(&self) -> Self::ControlHandle {
8140        RetainedBlobsControlHandle { inner: self.inner.clone() }
8141    }
8142
8143    fn into_inner(
8144        self,
8145    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8146    {
8147        (self.inner, self.is_terminated)
8148    }
8149
8150    fn from_inner(
8151        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8152        is_terminated: bool,
8153    ) -> Self {
8154        Self { inner, is_terminated }
8155    }
8156}
8157
8158impl futures::Stream for RetainedBlobsRequestStream {
8159    type Item = Result<RetainedBlobsRequest, fidl::Error>;
8160
8161    fn poll_next(
8162        mut self: std::pin::Pin<&mut Self>,
8163        cx: &mut std::task::Context<'_>,
8164    ) -> std::task::Poll<Option<Self::Item>> {
8165        let this = &mut *self;
8166        if this.inner.check_shutdown(cx) {
8167            this.is_terminated = true;
8168            return std::task::Poll::Ready(None);
8169        }
8170        if this.is_terminated {
8171            panic!("polled RetainedBlobsRequestStream after completion");
8172        }
8173        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8174            |bytes, handles| {
8175                match this.inner.channel().read_etc(cx, bytes, handles) {
8176                    std::task::Poll::Ready(Ok(())) => {}
8177                    std::task::Poll::Pending => return std::task::Poll::Pending,
8178                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8179                        this.is_terminated = true;
8180                        return std::task::Poll::Ready(None);
8181                    }
8182                    std::task::Poll::Ready(Err(e)) => {
8183                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8184                            e.into(),
8185                        ))));
8186                    }
8187                }
8188
8189                // A message has been received from the channel
8190                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8191
8192                std::task::Poll::Ready(Some(match header.ordinal {
8193                    0x3005cab30c671164 => {
8194                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8195                        let mut req = fidl::new_empty!(
8196                            fidl::encoding::EmptyPayload,
8197                            fidl::encoding::DefaultFuchsiaResourceDialect
8198                        );
8199                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8200                        let control_handle =
8201                            RetainedBlobsControlHandle { inner: this.inner.clone() };
8202                        Ok(RetainedBlobsRequest::Clear {
8203                            responder: RetainedBlobsClearResponder {
8204                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8205                                tx_id: header.tx_id,
8206                            },
8207                        })
8208                    }
8209                    0x2c049d51026cd0b3 => {
8210                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8211                        let mut req = fidl::new_empty!(
8212                            RetainedBlobsReplaceRequest,
8213                            fidl::encoding::DefaultFuchsiaResourceDialect
8214                        );
8215                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RetainedBlobsReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
8216                        let control_handle =
8217                            RetainedBlobsControlHandle { inner: this.inner.clone() };
8218                        Ok(RetainedBlobsRequest::Replace {
8219                            iterator: req.iterator,
8220
8221                            responder: RetainedBlobsReplaceResponder {
8222                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8223                                tx_id: header.tx_id,
8224                            },
8225                        })
8226                    }
8227                    _ => Err(fidl::Error::UnknownOrdinal {
8228                        ordinal: header.ordinal,
8229                        protocol_name:
8230                            <RetainedBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8231                    }),
8232                }))
8233            },
8234        )
8235    }
8236}
8237
8238/// Manages the set of retained blobs.
8239///
8240/// Retained blobs will not be removed from the package cache, even if they
8241/// aren't fully present. There is only a single set active at once, and the
8242/// provided APIs for configuring the set atomically replace the retained blobs
8243/// set, it will not affect the retained packages set. On boot, the retained
8244/// blobs set is always initialized to the empty set.
8245/// Documentation on [garbage collection](
8246/// https://fuchsia.dev/fuchsia-src/concepts/packages/garbage_collection) contains
8247/// details on various types of package indexes (static, retained, etc) and
8248/// describes when a blob will be garbage collected or retained.
8249#[derive(Debug)]
8250pub enum RetainedBlobsRequest {
8251    /// Atomically clear the retained blob set, releasing any previously
8252    /// retained blobs.
8253    Clear { responder: RetainedBlobsClearResponder },
8254    /// Atomically replace the retained blob set with the blob hashes
8255    /// provided by the given iterator.
8256    /// Duplicate IDs provided will be merged and processed as a single one.
8257    ///
8258    /// + request `iterator` an iterator of blob IDs that should be
8259    ///   retained.
8260    Replace {
8261        iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8262        responder: RetainedBlobsReplaceResponder,
8263    },
8264}
8265
8266impl RetainedBlobsRequest {
8267    #[allow(irrefutable_let_patterns)]
8268    pub fn into_clear(self) -> Option<(RetainedBlobsClearResponder)> {
8269        if let RetainedBlobsRequest::Clear { responder } = self { Some((responder)) } else { None }
8270    }
8271
8272    #[allow(irrefutable_let_patterns)]
8273    pub fn into_replace(
8274        self,
8275    ) -> Option<(fidl::endpoints::ClientEnd<BlobIdIteratorMarker>, RetainedBlobsReplaceResponder)>
8276    {
8277        if let RetainedBlobsRequest::Replace { iterator, responder } = self {
8278            Some((iterator, responder))
8279        } else {
8280            None
8281        }
8282    }
8283
8284    /// Name of the method defined in FIDL
8285    pub fn method_name(&self) -> &'static str {
8286        match *self {
8287            RetainedBlobsRequest::Clear { .. } => "clear",
8288            RetainedBlobsRequest::Replace { .. } => "replace",
8289        }
8290    }
8291}
8292
8293#[derive(Debug, Clone)]
8294pub struct RetainedBlobsControlHandle {
8295    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8296}
8297
8298impl fidl::endpoints::ControlHandle for RetainedBlobsControlHandle {
8299    fn shutdown(&self) {
8300        self.inner.shutdown()
8301    }
8302    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8303        self.inner.shutdown_with_epitaph(status)
8304    }
8305
8306    fn is_closed(&self) -> bool {
8307        self.inner.channel().is_closed()
8308    }
8309    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8310        self.inner.channel().on_closed()
8311    }
8312
8313    #[cfg(target_os = "fuchsia")]
8314    fn signal_peer(
8315        &self,
8316        clear_mask: zx::Signals,
8317        set_mask: zx::Signals,
8318    ) -> Result<(), zx_status::Status> {
8319        use fidl::Peered;
8320        self.inner.channel().signal_peer(clear_mask, set_mask)
8321    }
8322}
8323
8324impl RetainedBlobsControlHandle {}
8325
8326#[must_use = "FIDL methods require a response to be sent"]
8327#[derive(Debug)]
8328pub struct RetainedBlobsClearResponder {
8329    control_handle: std::mem::ManuallyDrop<RetainedBlobsControlHandle>,
8330    tx_id: u32,
8331}
8332
8333/// Set the the channel to be shutdown (see [`RetainedBlobsControlHandle::shutdown`])
8334/// if the responder is dropped without sending a response, so that the client
8335/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8336impl std::ops::Drop for RetainedBlobsClearResponder {
8337    fn drop(&mut self) {
8338        self.control_handle.shutdown();
8339        // Safety: drops once, never accessed again
8340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8341    }
8342}
8343
8344impl fidl::endpoints::Responder for RetainedBlobsClearResponder {
8345    type ControlHandle = RetainedBlobsControlHandle;
8346
8347    fn control_handle(&self) -> &RetainedBlobsControlHandle {
8348        &self.control_handle
8349    }
8350
8351    fn drop_without_shutdown(mut self) {
8352        // Safety: drops once, never accessed again due to mem::forget
8353        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8354        // Prevent Drop from running (which would shut down the channel)
8355        std::mem::forget(self);
8356    }
8357}
8358
8359impl RetainedBlobsClearResponder {
8360    /// Sends a response to the FIDL transaction.
8361    ///
8362    /// Sets the channel to shutdown if an error occurs.
8363    pub fn send(self) -> Result<(), fidl::Error> {
8364        let _result = self.send_raw();
8365        if _result.is_err() {
8366            self.control_handle.shutdown();
8367        }
8368        self.drop_without_shutdown();
8369        _result
8370    }
8371
8372    /// Similar to "send" but does not shutdown the channel if an error occurs.
8373    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8374        let _result = self.send_raw();
8375        self.drop_without_shutdown();
8376        _result
8377    }
8378
8379    fn send_raw(&self) -> Result<(), fidl::Error> {
8380        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8381            (),
8382            self.tx_id,
8383            0x3005cab30c671164,
8384            fidl::encoding::DynamicFlags::empty(),
8385        )
8386    }
8387}
8388
8389#[must_use = "FIDL methods require a response to be sent"]
8390#[derive(Debug)]
8391pub struct RetainedBlobsReplaceResponder {
8392    control_handle: std::mem::ManuallyDrop<RetainedBlobsControlHandle>,
8393    tx_id: u32,
8394}
8395
8396/// Set the the channel to be shutdown (see [`RetainedBlobsControlHandle::shutdown`])
8397/// if the responder is dropped without sending a response, so that the client
8398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8399impl std::ops::Drop for RetainedBlobsReplaceResponder {
8400    fn drop(&mut self) {
8401        self.control_handle.shutdown();
8402        // Safety: drops once, never accessed again
8403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8404    }
8405}
8406
8407impl fidl::endpoints::Responder for RetainedBlobsReplaceResponder {
8408    type ControlHandle = RetainedBlobsControlHandle;
8409
8410    fn control_handle(&self) -> &RetainedBlobsControlHandle {
8411        &self.control_handle
8412    }
8413
8414    fn drop_without_shutdown(mut self) {
8415        // Safety: drops once, never accessed again due to mem::forget
8416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8417        // Prevent Drop from running (which would shut down the channel)
8418        std::mem::forget(self);
8419    }
8420}
8421
8422impl RetainedBlobsReplaceResponder {
8423    /// Sends a response to the FIDL transaction.
8424    ///
8425    /// Sets the channel to shutdown if an error occurs.
8426    pub fn send(self) -> Result<(), fidl::Error> {
8427        let _result = self.send_raw();
8428        if _result.is_err() {
8429            self.control_handle.shutdown();
8430        }
8431        self.drop_without_shutdown();
8432        _result
8433    }
8434
8435    /// Similar to "send" but does not shutdown the channel if an error occurs.
8436    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8437        let _result = self.send_raw();
8438        self.drop_without_shutdown();
8439        _result
8440    }
8441
8442    fn send_raw(&self) -> Result<(), fidl::Error> {
8443        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8444            (),
8445            self.tx_id,
8446            0x2c049d51026cd0b3,
8447            fidl::encoding::DynamicFlags::empty(),
8448        )
8449    }
8450}
8451
8452#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8453pub struct RetainedPackagesMarker;
8454
8455impl fidl::endpoints::ProtocolMarker for RetainedPackagesMarker {
8456    type Proxy = RetainedPackagesProxy;
8457    type RequestStream = RetainedPackagesRequestStream;
8458    #[cfg(target_os = "fuchsia")]
8459    type SynchronousProxy = RetainedPackagesSynchronousProxy;
8460
8461    const DEBUG_NAME: &'static str = "fuchsia.pkg.RetainedPackages";
8462}
8463impl fidl::endpoints::DiscoverableProtocolMarker for RetainedPackagesMarker {}
8464
8465pub trait RetainedPackagesProxyInterface: Send + Sync {
8466    type ClearResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8467    fn r#clear(&self) -> Self::ClearResponseFut;
8468    type ReplaceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8469    fn r#replace(
8470        &self,
8471        iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8472    ) -> Self::ReplaceResponseFut;
8473}
8474#[derive(Debug)]
8475#[cfg(target_os = "fuchsia")]
8476pub struct RetainedPackagesSynchronousProxy {
8477    client: fidl::client::sync::Client,
8478}
8479
8480#[cfg(target_os = "fuchsia")]
8481impl fidl::endpoints::SynchronousProxy for RetainedPackagesSynchronousProxy {
8482    type Proxy = RetainedPackagesProxy;
8483    type Protocol = RetainedPackagesMarker;
8484
8485    fn from_channel(inner: fidl::Channel) -> Self {
8486        Self::new(inner)
8487    }
8488
8489    fn into_channel(self) -> fidl::Channel {
8490        self.client.into_channel()
8491    }
8492
8493    fn as_channel(&self) -> &fidl::Channel {
8494        self.client.as_channel()
8495    }
8496}
8497
8498#[cfg(target_os = "fuchsia")]
8499impl RetainedPackagesSynchronousProxy {
8500    pub fn new(channel: fidl::Channel) -> Self {
8501        let protocol_name = <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8502        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8503    }
8504
8505    pub fn into_channel(self) -> fidl::Channel {
8506        self.client.into_channel()
8507    }
8508
8509    /// Waits until an event arrives and returns it. It is safe for other
8510    /// threads to make concurrent requests while waiting for an event.
8511    pub fn wait_for_event(
8512        &self,
8513        deadline: zx::MonotonicInstant,
8514    ) -> Result<RetainedPackagesEvent, fidl::Error> {
8515        RetainedPackagesEvent::decode(self.client.wait_for_event(deadline)?)
8516    }
8517
8518    /// Atomically clear the retained package set, releasing any previously
8519    /// retained packages.
8520    pub fn r#clear(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
8521        let _response =
8522            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
8523                (),
8524                0x7f17476f097961ac,
8525                fidl::encoding::DynamicFlags::empty(),
8526                ___deadline,
8527            )?;
8528        Ok(_response)
8529    }
8530
8531    /// Atomically replace the retained package set with the [package hashes](
8532    /// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package-hash)
8533    /// provided by the given iterator.
8534    /// Duplicate IDs provided will be merged and processed as a single one.
8535    ///
8536    /// + request `iterator` an iterator of package blob IDs that should be
8537    ///   retained.
8538    pub fn r#replace(
8539        &self,
8540        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8541        ___deadline: zx::MonotonicInstant,
8542    ) -> Result<(), fidl::Error> {
8543        let _response = self
8544            .client
8545            .send_query::<RetainedPackagesReplaceRequest, fidl::encoding::EmptyPayload>(
8546                (iterator,),
8547                0x5021e479570f3a9f,
8548                fidl::encoding::DynamicFlags::empty(),
8549                ___deadline,
8550            )?;
8551        Ok(_response)
8552    }
8553}
8554
8555#[cfg(target_os = "fuchsia")]
8556impl From<RetainedPackagesSynchronousProxy> for zx::Handle {
8557    fn from(value: RetainedPackagesSynchronousProxy) -> Self {
8558        value.into_channel().into()
8559    }
8560}
8561
8562#[cfg(target_os = "fuchsia")]
8563impl From<fidl::Channel> for RetainedPackagesSynchronousProxy {
8564    fn from(value: fidl::Channel) -> Self {
8565        Self::new(value)
8566    }
8567}
8568
8569#[cfg(target_os = "fuchsia")]
8570impl fidl::endpoints::FromClient for RetainedPackagesSynchronousProxy {
8571    type Protocol = RetainedPackagesMarker;
8572
8573    fn from_client(value: fidl::endpoints::ClientEnd<RetainedPackagesMarker>) -> Self {
8574        Self::new(value.into_channel())
8575    }
8576}
8577
8578#[derive(Debug, Clone)]
8579pub struct RetainedPackagesProxy {
8580    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8581}
8582
8583impl fidl::endpoints::Proxy for RetainedPackagesProxy {
8584    type Protocol = RetainedPackagesMarker;
8585
8586    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8587        Self::new(inner)
8588    }
8589
8590    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8591        self.client.into_channel().map_err(|client| Self { client })
8592    }
8593
8594    fn as_channel(&self) -> &::fidl::AsyncChannel {
8595        self.client.as_channel()
8596    }
8597}
8598
8599impl RetainedPackagesProxy {
8600    /// Create a new Proxy for fuchsia.pkg/RetainedPackages.
8601    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8602        let protocol_name = <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8603        Self { client: fidl::client::Client::new(channel, protocol_name) }
8604    }
8605
8606    /// Get a Stream of events from the remote end of the protocol.
8607    ///
8608    /// # Panics
8609    ///
8610    /// Panics if the event stream was already taken.
8611    pub fn take_event_stream(&self) -> RetainedPackagesEventStream {
8612        RetainedPackagesEventStream { event_receiver: self.client.take_event_receiver() }
8613    }
8614
8615    /// Atomically clear the retained package set, releasing any previously
8616    /// retained packages.
8617    pub fn r#clear(
8618        &self,
8619    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8620        RetainedPackagesProxyInterface::r#clear(self)
8621    }
8622
8623    /// Atomically replace the retained package set with the [package hashes](
8624    /// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package-hash)
8625    /// provided by the given iterator.
8626    /// Duplicate IDs provided will be merged and processed as a single one.
8627    ///
8628    /// + request `iterator` an iterator of package blob IDs that should be
8629    ///   retained.
8630    pub fn r#replace(
8631        &self,
8632        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8633    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8634        RetainedPackagesProxyInterface::r#replace(self, iterator)
8635    }
8636}
8637
8638impl RetainedPackagesProxyInterface for RetainedPackagesProxy {
8639    type ClearResponseFut =
8640        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8641    fn r#clear(&self) -> Self::ClearResponseFut {
8642        fn _decode(
8643            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8644        ) -> Result<(), fidl::Error> {
8645            let _response = fidl::client::decode_transaction_body::<
8646                fidl::encoding::EmptyPayload,
8647                fidl::encoding::DefaultFuchsiaResourceDialect,
8648                0x7f17476f097961ac,
8649            >(_buf?)?;
8650            Ok(_response)
8651        }
8652        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8653            (),
8654            0x7f17476f097961ac,
8655            fidl::encoding::DynamicFlags::empty(),
8656            _decode,
8657        )
8658    }
8659
8660    type ReplaceResponseFut =
8661        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8662    fn r#replace(
8663        &self,
8664        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8665    ) -> Self::ReplaceResponseFut {
8666        fn _decode(
8667            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8668        ) -> Result<(), fidl::Error> {
8669            let _response = fidl::client::decode_transaction_body::<
8670                fidl::encoding::EmptyPayload,
8671                fidl::encoding::DefaultFuchsiaResourceDialect,
8672                0x5021e479570f3a9f,
8673            >(_buf?)?;
8674            Ok(_response)
8675        }
8676        self.client.send_query_and_decode::<RetainedPackagesReplaceRequest, ()>(
8677            (iterator,),
8678            0x5021e479570f3a9f,
8679            fidl::encoding::DynamicFlags::empty(),
8680            _decode,
8681        )
8682    }
8683}
8684
8685pub struct RetainedPackagesEventStream {
8686    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8687}
8688
8689impl std::marker::Unpin for RetainedPackagesEventStream {}
8690
8691impl futures::stream::FusedStream for RetainedPackagesEventStream {
8692    fn is_terminated(&self) -> bool {
8693        self.event_receiver.is_terminated()
8694    }
8695}
8696
8697impl futures::Stream for RetainedPackagesEventStream {
8698    type Item = Result<RetainedPackagesEvent, fidl::Error>;
8699
8700    fn poll_next(
8701        mut self: std::pin::Pin<&mut Self>,
8702        cx: &mut std::task::Context<'_>,
8703    ) -> std::task::Poll<Option<Self::Item>> {
8704        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8705            &mut self.event_receiver,
8706            cx
8707        )?) {
8708            Some(buf) => std::task::Poll::Ready(Some(RetainedPackagesEvent::decode(buf))),
8709            None => std::task::Poll::Ready(None),
8710        }
8711    }
8712}
8713
8714#[derive(Debug)]
8715pub enum RetainedPackagesEvent {}
8716
8717impl RetainedPackagesEvent {
8718    /// Decodes a message buffer as a [`RetainedPackagesEvent`].
8719    fn decode(
8720        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8721    ) -> Result<RetainedPackagesEvent, fidl::Error> {
8722        let (bytes, _handles) = buf.split_mut();
8723        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8724        debug_assert_eq!(tx_header.tx_id, 0);
8725        match tx_header.ordinal {
8726            _ => Err(fidl::Error::UnknownOrdinal {
8727                ordinal: tx_header.ordinal,
8728                protocol_name:
8729                    <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8730            }),
8731        }
8732    }
8733}
8734
8735/// A Stream of incoming requests for fuchsia.pkg/RetainedPackages.
8736pub struct RetainedPackagesRequestStream {
8737    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8738    is_terminated: bool,
8739}
8740
8741impl std::marker::Unpin for RetainedPackagesRequestStream {}
8742
8743impl futures::stream::FusedStream for RetainedPackagesRequestStream {
8744    fn is_terminated(&self) -> bool {
8745        self.is_terminated
8746    }
8747}
8748
8749impl fidl::endpoints::RequestStream for RetainedPackagesRequestStream {
8750    type Protocol = RetainedPackagesMarker;
8751    type ControlHandle = RetainedPackagesControlHandle;
8752
8753    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8754        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8755    }
8756
8757    fn control_handle(&self) -> Self::ControlHandle {
8758        RetainedPackagesControlHandle { inner: self.inner.clone() }
8759    }
8760
8761    fn into_inner(
8762        self,
8763    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8764    {
8765        (self.inner, self.is_terminated)
8766    }
8767
8768    fn from_inner(
8769        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8770        is_terminated: bool,
8771    ) -> Self {
8772        Self { inner, is_terminated }
8773    }
8774}
8775
8776impl futures::Stream for RetainedPackagesRequestStream {
8777    type Item = Result<RetainedPackagesRequest, fidl::Error>;
8778
8779    fn poll_next(
8780        mut self: std::pin::Pin<&mut Self>,
8781        cx: &mut std::task::Context<'_>,
8782    ) -> std::task::Poll<Option<Self::Item>> {
8783        let this = &mut *self;
8784        if this.inner.check_shutdown(cx) {
8785            this.is_terminated = true;
8786            return std::task::Poll::Ready(None);
8787        }
8788        if this.is_terminated {
8789            panic!("polled RetainedPackagesRequestStream after completion");
8790        }
8791        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8792            |bytes, handles| {
8793                match this.inner.channel().read_etc(cx, bytes, handles) {
8794                    std::task::Poll::Ready(Ok(())) => {}
8795                    std::task::Poll::Pending => return std::task::Poll::Pending,
8796                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8797                        this.is_terminated = true;
8798                        return std::task::Poll::Ready(None);
8799                    }
8800                    std::task::Poll::Ready(Err(e)) => {
8801                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8802                            e.into(),
8803                        ))));
8804                    }
8805                }
8806
8807                // A message has been received from the channel
8808                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8809
8810                std::task::Poll::Ready(Some(match header.ordinal {
8811                    0x7f17476f097961ac => {
8812                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8813                        let mut req = fidl::new_empty!(
8814                            fidl::encoding::EmptyPayload,
8815                            fidl::encoding::DefaultFuchsiaResourceDialect
8816                        );
8817                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8818                        let control_handle =
8819                            RetainedPackagesControlHandle { inner: this.inner.clone() };
8820                        Ok(RetainedPackagesRequest::Clear {
8821                            responder: RetainedPackagesClearResponder {
8822                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8823                                tx_id: header.tx_id,
8824                            },
8825                        })
8826                    }
8827                    0x5021e479570f3a9f => {
8828                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8829                        let mut req = fidl::new_empty!(
8830                            RetainedPackagesReplaceRequest,
8831                            fidl::encoding::DefaultFuchsiaResourceDialect
8832                        );
8833                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RetainedPackagesReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
8834                        let control_handle =
8835                            RetainedPackagesControlHandle { inner: this.inner.clone() };
8836                        Ok(RetainedPackagesRequest::Replace {
8837                            iterator: req.iterator,
8838
8839                            responder: RetainedPackagesReplaceResponder {
8840                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8841                                tx_id: header.tx_id,
8842                            },
8843                        })
8844                    }
8845                    _ => Err(fidl::Error::UnknownOrdinal {
8846                        ordinal: header.ordinal,
8847                        protocol_name:
8848                            <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8849                    }),
8850                }))
8851            },
8852        )
8853    }
8854}
8855
8856/// Manages the set of retained packages.
8857///
8858/// Retained packages will not be removed from the package cache, even if they
8859/// aren't fully present. There is only a single set active at once, and the
8860/// provided APIs for configuring the set atomically replace the retained
8861/// packages set, it will not affect the retained blobs set. On boot, the
8862/// retained packages set is always initialized to the empty set.
8863/// Documentation on [garbage collection](
8864/// https://fuchsia.dev/fuchsia-src/concepts/packages/garbage_collection) contains
8865/// details on various types of package indexes (static, retained, etc) and
8866/// describes when a package will be garbage collected or retained.
8867#[derive(Debug)]
8868pub enum RetainedPackagesRequest {
8869    /// Atomically clear the retained package set, releasing any previously
8870    /// retained packages.
8871    Clear { responder: RetainedPackagesClearResponder },
8872    /// Atomically replace the retained package set with the [package hashes](
8873    /// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package-hash)
8874    /// provided by the given iterator.
8875    /// Duplicate IDs provided will be merged and processed as a single one.
8876    ///
8877    /// + request `iterator` an iterator of package blob IDs that should be
8878    ///   retained.
8879    Replace {
8880        iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8881        responder: RetainedPackagesReplaceResponder,
8882    },
8883}
8884
8885impl RetainedPackagesRequest {
8886    #[allow(irrefutable_let_patterns)]
8887    pub fn into_clear(self) -> Option<(RetainedPackagesClearResponder)> {
8888        if let RetainedPackagesRequest::Clear { responder } = self {
8889            Some((responder))
8890        } else {
8891            None
8892        }
8893    }
8894
8895    #[allow(irrefutable_let_patterns)]
8896    pub fn into_replace(
8897        self,
8898    ) -> Option<(fidl::endpoints::ClientEnd<BlobIdIteratorMarker>, RetainedPackagesReplaceResponder)>
8899    {
8900        if let RetainedPackagesRequest::Replace { iterator, responder } = self {
8901            Some((iterator, responder))
8902        } else {
8903            None
8904        }
8905    }
8906
8907    /// Name of the method defined in FIDL
8908    pub fn method_name(&self) -> &'static str {
8909        match *self {
8910            RetainedPackagesRequest::Clear { .. } => "clear",
8911            RetainedPackagesRequest::Replace { .. } => "replace",
8912        }
8913    }
8914}
8915
8916#[derive(Debug, Clone)]
8917pub struct RetainedPackagesControlHandle {
8918    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8919}
8920
8921impl fidl::endpoints::ControlHandle for RetainedPackagesControlHandle {
8922    fn shutdown(&self) {
8923        self.inner.shutdown()
8924    }
8925    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8926        self.inner.shutdown_with_epitaph(status)
8927    }
8928
8929    fn is_closed(&self) -> bool {
8930        self.inner.channel().is_closed()
8931    }
8932    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8933        self.inner.channel().on_closed()
8934    }
8935
8936    #[cfg(target_os = "fuchsia")]
8937    fn signal_peer(
8938        &self,
8939        clear_mask: zx::Signals,
8940        set_mask: zx::Signals,
8941    ) -> Result<(), zx_status::Status> {
8942        use fidl::Peered;
8943        self.inner.channel().signal_peer(clear_mask, set_mask)
8944    }
8945}
8946
8947impl RetainedPackagesControlHandle {}
8948
8949#[must_use = "FIDL methods require a response to be sent"]
8950#[derive(Debug)]
8951pub struct RetainedPackagesClearResponder {
8952    control_handle: std::mem::ManuallyDrop<RetainedPackagesControlHandle>,
8953    tx_id: u32,
8954}
8955
8956/// Set the the channel to be shutdown (see [`RetainedPackagesControlHandle::shutdown`])
8957/// if the responder is dropped without sending a response, so that the client
8958/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8959impl std::ops::Drop for RetainedPackagesClearResponder {
8960    fn drop(&mut self) {
8961        self.control_handle.shutdown();
8962        // Safety: drops once, never accessed again
8963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8964    }
8965}
8966
8967impl fidl::endpoints::Responder for RetainedPackagesClearResponder {
8968    type ControlHandle = RetainedPackagesControlHandle;
8969
8970    fn control_handle(&self) -> &RetainedPackagesControlHandle {
8971        &self.control_handle
8972    }
8973
8974    fn drop_without_shutdown(mut self) {
8975        // Safety: drops once, never accessed again due to mem::forget
8976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8977        // Prevent Drop from running (which would shut down the channel)
8978        std::mem::forget(self);
8979    }
8980}
8981
8982impl RetainedPackagesClearResponder {
8983    /// Sends a response to the FIDL transaction.
8984    ///
8985    /// Sets the channel to shutdown if an error occurs.
8986    pub fn send(self) -> Result<(), fidl::Error> {
8987        let _result = self.send_raw();
8988        if _result.is_err() {
8989            self.control_handle.shutdown();
8990        }
8991        self.drop_without_shutdown();
8992        _result
8993    }
8994
8995    /// Similar to "send" but does not shutdown the channel if an error occurs.
8996    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8997        let _result = self.send_raw();
8998        self.drop_without_shutdown();
8999        _result
9000    }
9001
9002    fn send_raw(&self) -> Result<(), fidl::Error> {
9003        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9004            (),
9005            self.tx_id,
9006            0x7f17476f097961ac,
9007            fidl::encoding::DynamicFlags::empty(),
9008        )
9009    }
9010}
9011
9012#[must_use = "FIDL methods require a response to be sent"]
9013#[derive(Debug)]
9014pub struct RetainedPackagesReplaceResponder {
9015    control_handle: std::mem::ManuallyDrop<RetainedPackagesControlHandle>,
9016    tx_id: u32,
9017}
9018
9019/// Set the the channel to be shutdown (see [`RetainedPackagesControlHandle::shutdown`])
9020/// if the responder is dropped without sending a response, so that the client
9021/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9022impl std::ops::Drop for RetainedPackagesReplaceResponder {
9023    fn drop(&mut self) {
9024        self.control_handle.shutdown();
9025        // Safety: drops once, never accessed again
9026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9027    }
9028}
9029
9030impl fidl::endpoints::Responder for RetainedPackagesReplaceResponder {
9031    type ControlHandle = RetainedPackagesControlHandle;
9032
9033    fn control_handle(&self) -> &RetainedPackagesControlHandle {
9034        &self.control_handle
9035    }
9036
9037    fn drop_without_shutdown(mut self) {
9038        // Safety: drops once, never accessed again due to mem::forget
9039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9040        // Prevent Drop from running (which would shut down the channel)
9041        std::mem::forget(self);
9042    }
9043}
9044
9045impl RetainedPackagesReplaceResponder {
9046    /// Sends a response to the FIDL transaction.
9047    ///
9048    /// Sets the channel to shutdown if an error occurs.
9049    pub fn send(self) -> Result<(), fidl::Error> {
9050        let _result = self.send_raw();
9051        if _result.is_err() {
9052            self.control_handle.shutdown();
9053        }
9054        self.drop_without_shutdown();
9055        _result
9056    }
9057
9058    /// Similar to "send" but does not shutdown the channel if an error occurs.
9059    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9060        let _result = self.send_raw();
9061        self.drop_without_shutdown();
9062        _result
9063    }
9064
9065    fn send_raw(&self) -> Result<(), fidl::Error> {
9066        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9067            (),
9068            self.tx_id,
9069            0x5021e479570f3a9f,
9070            fidl::encoding::DynamicFlags::empty(),
9071        )
9072    }
9073}
9074
9075mod internal {
9076    use super::*;
9077
9078    impl fidl::encoding::ResourceTypeMarker for FontResolverResolveRequest {
9079        type Borrowed<'a> = &'a mut Self;
9080        fn take_or_borrow<'a>(
9081            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9082        ) -> Self::Borrowed<'a> {
9083            value
9084        }
9085    }
9086
9087    unsafe impl fidl::encoding::TypeMarker for FontResolverResolveRequest {
9088        type Owned = Self;
9089
9090        #[inline(always)]
9091        fn inline_align(_context: fidl::encoding::Context) -> usize {
9092            8
9093        }
9094
9095        #[inline(always)]
9096        fn inline_size(_context: fidl::encoding::Context) -> usize {
9097            24
9098        }
9099    }
9100
9101    unsafe impl
9102        fidl::encoding::Encode<
9103            FontResolverResolveRequest,
9104            fidl::encoding::DefaultFuchsiaResourceDialect,
9105        > for &mut FontResolverResolveRequest
9106    {
9107        #[inline]
9108        unsafe fn encode(
9109            self,
9110            encoder: &mut fidl::encoding::Encoder<
9111                '_,
9112                fidl::encoding::DefaultFuchsiaResourceDialect,
9113            >,
9114            offset: usize,
9115            _depth: fidl::encoding::Depth,
9116        ) -> fidl::Result<()> {
9117            encoder.debug_check_bounds::<FontResolverResolveRequest>(offset);
9118            // Delegate to tuple encoding.
9119            fidl::encoding::Encode::<
9120                FontResolverResolveRequest,
9121                fidl::encoding::DefaultFuchsiaResourceDialect,
9122            >::encode(
9123                (
9124                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
9125                        &self.package_url,
9126                    ),
9127                    <fidl::encoding::Endpoint<
9128                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9129                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9130                        &mut self.directory_request,
9131                    ),
9132                ),
9133                encoder,
9134                offset,
9135                _depth,
9136            )
9137        }
9138    }
9139    unsafe impl<
9140        T0: fidl::encoding::Encode<
9141                fidl::encoding::UnboundedString,
9142                fidl::encoding::DefaultFuchsiaResourceDialect,
9143            >,
9144        T1: fidl::encoding::Encode<
9145                fidl::encoding::Endpoint<
9146                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9147                >,
9148                fidl::encoding::DefaultFuchsiaResourceDialect,
9149            >,
9150    >
9151        fidl::encoding::Encode<
9152            FontResolverResolveRequest,
9153            fidl::encoding::DefaultFuchsiaResourceDialect,
9154        > for (T0, T1)
9155    {
9156        #[inline]
9157        unsafe fn encode(
9158            self,
9159            encoder: &mut fidl::encoding::Encoder<
9160                '_,
9161                fidl::encoding::DefaultFuchsiaResourceDialect,
9162            >,
9163            offset: usize,
9164            depth: fidl::encoding::Depth,
9165        ) -> fidl::Result<()> {
9166            encoder.debug_check_bounds::<FontResolverResolveRequest>(offset);
9167            // Zero out padding regions. There's no need to apply masks
9168            // because the unmasked parts will be overwritten by fields.
9169            unsafe {
9170                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9171                (ptr as *mut u64).write_unaligned(0);
9172            }
9173            // Write the fields.
9174            self.0.encode(encoder, offset + 0, depth)?;
9175            self.1.encode(encoder, offset + 16, depth)?;
9176            Ok(())
9177        }
9178    }
9179
9180    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9181        for FontResolverResolveRequest
9182    {
9183        #[inline(always)]
9184        fn new_empty() -> Self {
9185            Self {
9186                package_url: fidl::new_empty!(
9187                    fidl::encoding::UnboundedString,
9188                    fidl::encoding::DefaultFuchsiaResourceDialect
9189                ),
9190                directory_request: fidl::new_empty!(
9191                    fidl::encoding::Endpoint<
9192                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9193                    >,
9194                    fidl::encoding::DefaultFuchsiaResourceDialect
9195                ),
9196            }
9197        }
9198
9199        #[inline]
9200        unsafe fn decode(
9201            &mut self,
9202            decoder: &mut fidl::encoding::Decoder<
9203                '_,
9204                fidl::encoding::DefaultFuchsiaResourceDialect,
9205            >,
9206            offset: usize,
9207            _depth: fidl::encoding::Depth,
9208        ) -> fidl::Result<()> {
9209            decoder.debug_check_bounds::<Self>(offset);
9210            // Verify that padding bytes are zero.
9211            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9212            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9213            let mask = 0xffffffff00000000u64;
9214            let maskedval = padval & mask;
9215            if maskedval != 0 {
9216                return Err(fidl::Error::NonZeroPadding {
9217                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9218                });
9219            }
9220            fidl::decode!(
9221                fidl::encoding::UnboundedString,
9222                fidl::encoding::DefaultFuchsiaResourceDialect,
9223                &mut self.package_url,
9224                decoder,
9225                offset + 0,
9226                _depth
9227            )?;
9228            fidl::decode!(
9229                fidl::encoding::Endpoint<
9230                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9231                >,
9232                fidl::encoding::DefaultFuchsiaResourceDialect,
9233                &mut self.directory_request,
9234                decoder,
9235                offset + 16,
9236                _depth
9237            )?;
9238            Ok(())
9239        }
9240    }
9241
9242    impl fidl::encoding::ResourceTypeMarker for NeededBlobsGetMissingBlobsRequest {
9243        type Borrowed<'a> = &'a mut Self;
9244        fn take_or_borrow<'a>(
9245            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9246        ) -> Self::Borrowed<'a> {
9247            value
9248        }
9249    }
9250
9251    unsafe impl fidl::encoding::TypeMarker for NeededBlobsGetMissingBlobsRequest {
9252        type Owned = Self;
9253
9254        #[inline(always)]
9255        fn inline_align(_context: fidl::encoding::Context) -> usize {
9256            4
9257        }
9258
9259        #[inline(always)]
9260        fn inline_size(_context: fidl::encoding::Context) -> usize {
9261            4
9262        }
9263    }
9264
9265    unsafe impl
9266        fidl::encoding::Encode<
9267            NeededBlobsGetMissingBlobsRequest,
9268            fidl::encoding::DefaultFuchsiaResourceDialect,
9269        > for &mut NeededBlobsGetMissingBlobsRequest
9270    {
9271        #[inline]
9272        unsafe fn encode(
9273            self,
9274            encoder: &mut fidl::encoding::Encoder<
9275                '_,
9276                fidl::encoding::DefaultFuchsiaResourceDialect,
9277            >,
9278            offset: usize,
9279            _depth: fidl::encoding::Depth,
9280        ) -> fidl::Result<()> {
9281            encoder.debug_check_bounds::<NeededBlobsGetMissingBlobsRequest>(offset);
9282            // Delegate to tuple encoding.
9283            fidl::encoding::Encode::<NeededBlobsGetMissingBlobsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9284                (
9285                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
9286                ),
9287                encoder, offset, _depth
9288            )
9289        }
9290    }
9291    unsafe impl<
9292        T0: fidl::encoding::Encode<
9293                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>>,
9294                fidl::encoding::DefaultFuchsiaResourceDialect,
9295            >,
9296    >
9297        fidl::encoding::Encode<
9298            NeededBlobsGetMissingBlobsRequest,
9299            fidl::encoding::DefaultFuchsiaResourceDialect,
9300        > for (T0,)
9301    {
9302        #[inline]
9303        unsafe fn encode(
9304            self,
9305            encoder: &mut fidl::encoding::Encoder<
9306                '_,
9307                fidl::encoding::DefaultFuchsiaResourceDialect,
9308            >,
9309            offset: usize,
9310            depth: fidl::encoding::Depth,
9311        ) -> fidl::Result<()> {
9312            encoder.debug_check_bounds::<NeededBlobsGetMissingBlobsRequest>(offset);
9313            // Zero out padding regions. There's no need to apply masks
9314            // because the unmasked parts will be overwritten by fields.
9315            // Write the fields.
9316            self.0.encode(encoder, offset + 0, depth)?;
9317            Ok(())
9318        }
9319    }
9320
9321    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9322        for NeededBlobsGetMissingBlobsRequest
9323    {
9324        #[inline(always)]
9325        fn new_empty() -> Self {
9326            Self {
9327                iterator: fidl::new_empty!(
9328                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>>,
9329                    fidl::encoding::DefaultFuchsiaResourceDialect
9330                ),
9331            }
9332        }
9333
9334        #[inline]
9335        unsafe fn decode(
9336            &mut self,
9337            decoder: &mut fidl::encoding::Decoder<
9338                '_,
9339                fidl::encoding::DefaultFuchsiaResourceDialect,
9340            >,
9341            offset: usize,
9342            _depth: fidl::encoding::Depth,
9343        ) -> fidl::Result<()> {
9344            decoder.debug_check_bounds::<Self>(offset);
9345            // Verify that padding bytes are zero.
9346            fidl::decode!(
9347                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>>,
9348                fidl::encoding::DefaultFuchsiaResourceDialect,
9349                &mut self.iterator,
9350                decoder,
9351                offset + 0,
9352                _depth
9353            )?;
9354            Ok(())
9355        }
9356    }
9357
9358    impl fidl::encoding::ResourceTypeMarker for NeededBlobsOpenBlobResponse {
9359        type Borrowed<'a> = &'a mut Self;
9360        fn take_or_borrow<'a>(
9361            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9362        ) -> Self::Borrowed<'a> {
9363            value
9364        }
9365    }
9366
9367    unsafe impl fidl::encoding::TypeMarker for NeededBlobsOpenBlobResponse {
9368        type Owned = Self;
9369
9370        #[inline(always)]
9371        fn inline_align(_context: fidl::encoding::Context) -> usize {
9372            8
9373        }
9374
9375        #[inline(always)]
9376        fn inline_size(_context: fidl::encoding::Context) -> usize {
9377            16
9378        }
9379    }
9380
9381    unsafe impl
9382        fidl::encoding::Encode<
9383            NeededBlobsOpenBlobResponse,
9384            fidl::encoding::DefaultFuchsiaResourceDialect,
9385        > for &mut NeededBlobsOpenBlobResponse
9386    {
9387        #[inline]
9388        unsafe fn encode(
9389            self,
9390            encoder: &mut fidl::encoding::Encoder<
9391                '_,
9392                fidl::encoding::DefaultFuchsiaResourceDialect,
9393            >,
9394            offset: usize,
9395            _depth: fidl::encoding::Depth,
9396        ) -> fidl::Result<()> {
9397            encoder.debug_check_bounds::<NeededBlobsOpenBlobResponse>(offset);
9398            // Delegate to tuple encoding.
9399            fidl::encoding::Encode::<NeededBlobsOpenBlobResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9400                (
9401                    <fidl::encoding::OptionalUnion<BlobWriter> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
9402                ),
9403                encoder, offset, _depth
9404            )
9405        }
9406    }
9407    unsafe impl<
9408        T0: fidl::encoding::Encode<
9409                fidl::encoding::OptionalUnion<BlobWriter>,
9410                fidl::encoding::DefaultFuchsiaResourceDialect,
9411            >,
9412    >
9413        fidl::encoding::Encode<
9414            NeededBlobsOpenBlobResponse,
9415            fidl::encoding::DefaultFuchsiaResourceDialect,
9416        > for (T0,)
9417    {
9418        #[inline]
9419        unsafe fn encode(
9420            self,
9421            encoder: &mut fidl::encoding::Encoder<
9422                '_,
9423                fidl::encoding::DefaultFuchsiaResourceDialect,
9424            >,
9425            offset: usize,
9426            depth: fidl::encoding::Depth,
9427        ) -> fidl::Result<()> {
9428            encoder.debug_check_bounds::<NeededBlobsOpenBlobResponse>(offset);
9429            // Zero out padding regions. There's no need to apply masks
9430            // because the unmasked parts will be overwritten by fields.
9431            // Write the fields.
9432            self.0.encode(encoder, offset + 0, depth)?;
9433            Ok(())
9434        }
9435    }
9436
9437    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9438        for NeededBlobsOpenBlobResponse
9439    {
9440        #[inline(always)]
9441        fn new_empty() -> Self {
9442            Self {
9443                writer: fidl::new_empty!(
9444                    fidl::encoding::OptionalUnion<BlobWriter>,
9445                    fidl::encoding::DefaultFuchsiaResourceDialect
9446                ),
9447            }
9448        }
9449
9450        #[inline]
9451        unsafe fn decode(
9452            &mut self,
9453            decoder: &mut fidl::encoding::Decoder<
9454                '_,
9455                fidl::encoding::DefaultFuchsiaResourceDialect,
9456            >,
9457            offset: usize,
9458            _depth: fidl::encoding::Depth,
9459        ) -> fidl::Result<()> {
9460            decoder.debug_check_bounds::<Self>(offset);
9461            // Verify that padding bytes are zero.
9462            fidl::decode!(
9463                fidl::encoding::OptionalUnion<BlobWriter>,
9464                fidl::encoding::DefaultFuchsiaResourceDialect,
9465                &mut self.writer,
9466                decoder,
9467                offset + 0,
9468                _depth
9469            )?;
9470            Ok(())
9471        }
9472    }
9473
9474    impl fidl::encoding::ResourceTypeMarker for NeededBlobsOpenMetaBlobResponse {
9475        type Borrowed<'a> = &'a mut Self;
9476        fn take_or_borrow<'a>(
9477            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9478        ) -> Self::Borrowed<'a> {
9479            value
9480        }
9481    }
9482
9483    unsafe impl fidl::encoding::TypeMarker for NeededBlobsOpenMetaBlobResponse {
9484        type Owned = Self;
9485
9486        #[inline(always)]
9487        fn inline_align(_context: fidl::encoding::Context) -> usize {
9488            8
9489        }
9490
9491        #[inline(always)]
9492        fn inline_size(_context: fidl::encoding::Context) -> usize {
9493            16
9494        }
9495    }
9496
9497    unsafe impl
9498        fidl::encoding::Encode<
9499            NeededBlobsOpenMetaBlobResponse,
9500            fidl::encoding::DefaultFuchsiaResourceDialect,
9501        > for &mut NeededBlobsOpenMetaBlobResponse
9502    {
9503        #[inline]
9504        unsafe fn encode(
9505            self,
9506            encoder: &mut fidl::encoding::Encoder<
9507                '_,
9508                fidl::encoding::DefaultFuchsiaResourceDialect,
9509            >,
9510            offset: usize,
9511            _depth: fidl::encoding::Depth,
9512        ) -> fidl::Result<()> {
9513            encoder.debug_check_bounds::<NeededBlobsOpenMetaBlobResponse>(offset);
9514            // Delegate to tuple encoding.
9515            fidl::encoding::Encode::<NeededBlobsOpenMetaBlobResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9516                (
9517                    <fidl::encoding::OptionalUnion<BlobWriter> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
9518                ),
9519                encoder, offset, _depth
9520            )
9521        }
9522    }
9523    unsafe impl<
9524        T0: fidl::encoding::Encode<
9525                fidl::encoding::OptionalUnion<BlobWriter>,
9526                fidl::encoding::DefaultFuchsiaResourceDialect,
9527            >,
9528    >
9529        fidl::encoding::Encode<
9530            NeededBlobsOpenMetaBlobResponse,
9531            fidl::encoding::DefaultFuchsiaResourceDialect,
9532        > for (T0,)
9533    {
9534        #[inline]
9535        unsafe fn encode(
9536            self,
9537            encoder: &mut fidl::encoding::Encoder<
9538                '_,
9539                fidl::encoding::DefaultFuchsiaResourceDialect,
9540            >,
9541            offset: usize,
9542            depth: fidl::encoding::Depth,
9543        ) -> fidl::Result<()> {
9544            encoder.debug_check_bounds::<NeededBlobsOpenMetaBlobResponse>(offset);
9545            // Zero out padding regions. There's no need to apply masks
9546            // because the unmasked parts will be overwritten by fields.
9547            // Write the fields.
9548            self.0.encode(encoder, offset + 0, depth)?;
9549            Ok(())
9550        }
9551    }
9552
9553    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9554        for NeededBlobsOpenMetaBlobResponse
9555    {
9556        #[inline(always)]
9557        fn new_empty() -> Self {
9558            Self {
9559                writer: fidl::new_empty!(
9560                    fidl::encoding::OptionalUnion<BlobWriter>,
9561                    fidl::encoding::DefaultFuchsiaResourceDialect
9562                ),
9563            }
9564        }
9565
9566        #[inline]
9567        unsafe fn decode(
9568            &mut self,
9569            decoder: &mut fidl::encoding::Decoder<
9570                '_,
9571                fidl::encoding::DefaultFuchsiaResourceDialect,
9572            >,
9573            offset: usize,
9574            _depth: fidl::encoding::Depth,
9575        ) -> fidl::Result<()> {
9576            decoder.debug_check_bounds::<Self>(offset);
9577            // Verify that padding bytes are zero.
9578            fidl::decode!(
9579                fidl::encoding::OptionalUnion<BlobWriter>,
9580                fidl::encoding::DefaultFuchsiaResourceDialect,
9581                &mut self.writer,
9582                decoder,
9583                offset + 0,
9584                _depth
9585            )?;
9586            Ok(())
9587        }
9588    }
9589
9590    impl fidl::encoding::ResourceTypeMarker for PackageCacheBasePackageIndexRequest {
9591        type Borrowed<'a> = &'a mut Self;
9592        fn take_or_borrow<'a>(
9593            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9594        ) -> Self::Borrowed<'a> {
9595            value
9596        }
9597    }
9598
9599    unsafe impl fidl::encoding::TypeMarker for PackageCacheBasePackageIndexRequest {
9600        type Owned = Self;
9601
9602        #[inline(always)]
9603        fn inline_align(_context: fidl::encoding::Context) -> usize {
9604            4
9605        }
9606
9607        #[inline(always)]
9608        fn inline_size(_context: fidl::encoding::Context) -> usize {
9609            4
9610        }
9611    }
9612
9613    unsafe impl
9614        fidl::encoding::Encode<
9615            PackageCacheBasePackageIndexRequest,
9616            fidl::encoding::DefaultFuchsiaResourceDialect,
9617        > for &mut PackageCacheBasePackageIndexRequest
9618    {
9619        #[inline]
9620        unsafe fn encode(
9621            self,
9622            encoder: &mut fidl::encoding::Encoder<
9623                '_,
9624                fidl::encoding::DefaultFuchsiaResourceDialect,
9625            >,
9626            offset: usize,
9627            _depth: fidl::encoding::Depth,
9628        ) -> fidl::Result<()> {
9629            encoder.debug_check_bounds::<PackageCacheBasePackageIndexRequest>(offset);
9630            // Delegate to tuple encoding.
9631            fidl::encoding::Encode::<
9632                PackageCacheBasePackageIndexRequest,
9633                fidl::encoding::DefaultFuchsiaResourceDialect,
9634            >::encode(
9635                (
9636                    <fidl::encoding::Endpoint<
9637                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
9638                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9639                        &mut self.iterator
9640                    ),
9641                ),
9642                encoder,
9643                offset,
9644                _depth,
9645            )
9646        }
9647    }
9648    unsafe impl<
9649        T0: fidl::encoding::Encode<
9650                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
9651                fidl::encoding::DefaultFuchsiaResourceDialect,
9652            >,
9653    >
9654        fidl::encoding::Encode<
9655            PackageCacheBasePackageIndexRequest,
9656            fidl::encoding::DefaultFuchsiaResourceDialect,
9657        > for (T0,)
9658    {
9659        #[inline]
9660        unsafe fn encode(
9661            self,
9662            encoder: &mut fidl::encoding::Encoder<
9663                '_,
9664                fidl::encoding::DefaultFuchsiaResourceDialect,
9665            >,
9666            offset: usize,
9667            depth: fidl::encoding::Depth,
9668        ) -> fidl::Result<()> {
9669            encoder.debug_check_bounds::<PackageCacheBasePackageIndexRequest>(offset);
9670            // Zero out padding regions. There's no need to apply masks
9671            // because the unmasked parts will be overwritten by fields.
9672            // Write the fields.
9673            self.0.encode(encoder, offset + 0, depth)?;
9674            Ok(())
9675        }
9676    }
9677
9678    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9679        for PackageCacheBasePackageIndexRequest
9680    {
9681        #[inline(always)]
9682        fn new_empty() -> Self {
9683            Self {
9684                iterator: fidl::new_empty!(
9685                    fidl::encoding::Endpoint<
9686                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
9687                    >,
9688                    fidl::encoding::DefaultFuchsiaResourceDialect
9689                ),
9690            }
9691        }
9692
9693        #[inline]
9694        unsafe fn decode(
9695            &mut self,
9696            decoder: &mut fidl::encoding::Decoder<
9697                '_,
9698                fidl::encoding::DefaultFuchsiaResourceDialect,
9699            >,
9700            offset: usize,
9701            _depth: fidl::encoding::Depth,
9702        ) -> fidl::Result<()> {
9703            decoder.debug_check_bounds::<Self>(offset);
9704            // Verify that padding bytes are zero.
9705            fidl::decode!(
9706                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
9707                fidl::encoding::DefaultFuchsiaResourceDialect,
9708                &mut self.iterator,
9709                decoder,
9710                offset + 0,
9711                _depth
9712            )?;
9713            Ok(())
9714        }
9715    }
9716
9717    impl fidl::encoding::ResourceTypeMarker for PackageCacheCachePackageIndexRequest {
9718        type Borrowed<'a> = &'a mut Self;
9719        fn take_or_borrow<'a>(
9720            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9721        ) -> Self::Borrowed<'a> {
9722            value
9723        }
9724    }
9725
9726    unsafe impl fidl::encoding::TypeMarker for PackageCacheCachePackageIndexRequest {
9727        type Owned = Self;
9728
9729        #[inline(always)]
9730        fn inline_align(_context: fidl::encoding::Context) -> usize {
9731            4
9732        }
9733
9734        #[inline(always)]
9735        fn inline_size(_context: fidl::encoding::Context) -> usize {
9736            4
9737        }
9738    }
9739
9740    unsafe impl
9741        fidl::encoding::Encode<
9742            PackageCacheCachePackageIndexRequest,
9743            fidl::encoding::DefaultFuchsiaResourceDialect,
9744        > for &mut PackageCacheCachePackageIndexRequest
9745    {
9746        #[inline]
9747        unsafe fn encode(
9748            self,
9749            encoder: &mut fidl::encoding::Encoder<
9750                '_,
9751                fidl::encoding::DefaultFuchsiaResourceDialect,
9752            >,
9753            offset: usize,
9754            _depth: fidl::encoding::Depth,
9755        ) -> fidl::Result<()> {
9756            encoder.debug_check_bounds::<PackageCacheCachePackageIndexRequest>(offset);
9757            // Delegate to tuple encoding.
9758            fidl::encoding::Encode::<
9759                PackageCacheCachePackageIndexRequest,
9760                fidl::encoding::DefaultFuchsiaResourceDialect,
9761            >::encode(
9762                (
9763                    <fidl::encoding::Endpoint<
9764                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
9765                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9766                        &mut self.iterator
9767                    ),
9768                ),
9769                encoder,
9770                offset,
9771                _depth,
9772            )
9773        }
9774    }
9775    unsafe impl<
9776        T0: fidl::encoding::Encode<
9777                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
9778                fidl::encoding::DefaultFuchsiaResourceDialect,
9779            >,
9780    >
9781        fidl::encoding::Encode<
9782            PackageCacheCachePackageIndexRequest,
9783            fidl::encoding::DefaultFuchsiaResourceDialect,
9784        > for (T0,)
9785    {
9786        #[inline]
9787        unsafe fn encode(
9788            self,
9789            encoder: &mut fidl::encoding::Encoder<
9790                '_,
9791                fidl::encoding::DefaultFuchsiaResourceDialect,
9792            >,
9793            offset: usize,
9794            depth: fidl::encoding::Depth,
9795        ) -> fidl::Result<()> {
9796            encoder.debug_check_bounds::<PackageCacheCachePackageIndexRequest>(offset);
9797            // Zero out padding regions. There's no need to apply masks
9798            // because the unmasked parts will be overwritten by fields.
9799            // Write the fields.
9800            self.0.encode(encoder, offset + 0, depth)?;
9801            Ok(())
9802        }
9803    }
9804
9805    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9806        for PackageCacheCachePackageIndexRequest
9807    {
9808        #[inline(always)]
9809        fn new_empty() -> Self {
9810            Self {
9811                iterator: fidl::new_empty!(
9812                    fidl::encoding::Endpoint<
9813                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
9814                    >,
9815                    fidl::encoding::DefaultFuchsiaResourceDialect
9816                ),
9817            }
9818        }
9819
9820        #[inline]
9821        unsafe fn decode(
9822            &mut self,
9823            decoder: &mut fidl::encoding::Decoder<
9824                '_,
9825                fidl::encoding::DefaultFuchsiaResourceDialect,
9826            >,
9827            offset: usize,
9828            _depth: fidl::encoding::Depth,
9829        ) -> fidl::Result<()> {
9830            decoder.debug_check_bounds::<Self>(offset);
9831            // Verify that padding bytes are zero.
9832            fidl::decode!(
9833                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
9834                fidl::encoding::DefaultFuchsiaResourceDialect,
9835                &mut self.iterator,
9836                decoder,
9837                offset + 0,
9838                _depth
9839            )?;
9840            Ok(())
9841        }
9842    }
9843
9844    impl fidl::encoding::ResourceTypeMarker for PackageCacheGetRequest {
9845        type Borrowed<'a> = &'a mut Self;
9846        fn take_or_borrow<'a>(
9847            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9848        ) -> Self::Borrowed<'a> {
9849            value
9850        }
9851    }
9852
9853    unsafe impl fidl::encoding::TypeMarker for PackageCacheGetRequest {
9854        type Owned = Self;
9855
9856        #[inline(always)]
9857        fn inline_align(_context: fidl::encoding::Context) -> usize {
9858            8
9859        }
9860
9861        #[inline(always)]
9862        fn inline_size(_context: fidl::encoding::Context) -> usize {
9863            56
9864        }
9865    }
9866
9867    unsafe impl
9868        fidl::encoding::Encode<
9869            PackageCacheGetRequest,
9870            fidl::encoding::DefaultFuchsiaResourceDialect,
9871        > for &mut PackageCacheGetRequest
9872    {
9873        #[inline]
9874        unsafe fn encode(
9875            self,
9876            encoder: &mut fidl::encoding::Encoder<
9877                '_,
9878                fidl::encoding::DefaultFuchsiaResourceDialect,
9879            >,
9880            offset: usize,
9881            _depth: fidl::encoding::Depth,
9882        ) -> fidl::Result<()> {
9883            encoder.debug_check_bounds::<PackageCacheGetRequest>(offset);
9884            // Delegate to tuple encoding.
9885            fidl::encoding::Encode::<PackageCacheGetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9886                (
9887                    <BlobInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.meta_far_blob),
9888                    <GcProtection as fidl::encoding::ValueTypeMarker>::borrow(&self.gc_protection),
9889                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.needed_blobs),
9890                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dir),
9891                ),
9892                encoder, offset, _depth
9893            )
9894        }
9895    }
9896    unsafe impl<
9897        T0: fidl::encoding::Encode<BlobInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
9898        T1: fidl::encoding::Encode<GcProtection, fidl::encoding::DefaultFuchsiaResourceDialect>,
9899        T2: fidl::encoding::Encode<
9900                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
9901                fidl::encoding::DefaultFuchsiaResourceDialect,
9902            >,
9903        T3: fidl::encoding::Encode<
9904                fidl::encoding::Endpoint<
9905                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9906                >,
9907                fidl::encoding::DefaultFuchsiaResourceDialect,
9908            >,
9909    >
9910        fidl::encoding::Encode<
9911            PackageCacheGetRequest,
9912            fidl::encoding::DefaultFuchsiaResourceDialect,
9913        > for (T0, T1, T2, T3)
9914    {
9915        #[inline]
9916        unsafe fn encode(
9917            self,
9918            encoder: &mut fidl::encoding::Encoder<
9919                '_,
9920                fidl::encoding::DefaultFuchsiaResourceDialect,
9921            >,
9922            offset: usize,
9923            depth: fidl::encoding::Depth,
9924        ) -> fidl::Result<()> {
9925            encoder.debug_check_bounds::<PackageCacheGetRequest>(offset);
9926            // Zero out padding regions. There's no need to apply masks
9927            // because the unmasked parts will be overwritten by fields.
9928            unsafe {
9929                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
9930                (ptr as *mut u64).write_unaligned(0);
9931            }
9932            // Write the fields.
9933            self.0.encode(encoder, offset + 0, depth)?;
9934            self.1.encode(encoder, offset + 40, depth)?;
9935            self.2.encode(encoder, offset + 44, depth)?;
9936            self.3.encode(encoder, offset + 48, depth)?;
9937            Ok(())
9938        }
9939    }
9940
9941    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9942        for PackageCacheGetRequest
9943    {
9944        #[inline(always)]
9945        fn new_empty() -> Self {
9946            Self {
9947                meta_far_blob: fidl::new_empty!(
9948                    BlobInfo,
9949                    fidl::encoding::DefaultFuchsiaResourceDialect
9950                ),
9951                gc_protection: fidl::new_empty!(
9952                    GcProtection,
9953                    fidl::encoding::DefaultFuchsiaResourceDialect
9954                ),
9955                needed_blobs: fidl::new_empty!(
9956                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
9957                    fidl::encoding::DefaultFuchsiaResourceDialect
9958                ),
9959                dir: fidl::new_empty!(
9960                    fidl::encoding::Endpoint<
9961                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9962                    >,
9963                    fidl::encoding::DefaultFuchsiaResourceDialect
9964                ),
9965            }
9966        }
9967
9968        #[inline]
9969        unsafe fn decode(
9970            &mut self,
9971            decoder: &mut fidl::encoding::Decoder<
9972                '_,
9973                fidl::encoding::DefaultFuchsiaResourceDialect,
9974            >,
9975            offset: usize,
9976            _depth: fidl::encoding::Depth,
9977        ) -> fidl::Result<()> {
9978            decoder.debug_check_bounds::<Self>(offset);
9979            // Verify that padding bytes are zero.
9980            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
9981            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9982            let mask = 0xffffffff00000000u64;
9983            let maskedval = padval & mask;
9984            if maskedval != 0 {
9985                return Err(fidl::Error::NonZeroPadding {
9986                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
9987                });
9988            }
9989            fidl::decode!(
9990                BlobInfo,
9991                fidl::encoding::DefaultFuchsiaResourceDialect,
9992                &mut self.meta_far_blob,
9993                decoder,
9994                offset + 0,
9995                _depth
9996            )?;
9997            fidl::decode!(
9998                GcProtection,
9999                fidl::encoding::DefaultFuchsiaResourceDialect,
10000                &mut self.gc_protection,
10001                decoder,
10002                offset + 40,
10003                _depth
10004            )?;
10005            fidl::decode!(
10006                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
10007                fidl::encoding::DefaultFuchsiaResourceDialect,
10008                &mut self.needed_blobs,
10009                decoder,
10010                offset + 44,
10011                _depth
10012            )?;
10013            fidl::decode!(
10014                fidl::encoding::Endpoint<
10015                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10016                >,
10017                fidl::encoding::DefaultFuchsiaResourceDialect,
10018                &mut self.dir,
10019                decoder,
10020                offset + 48,
10021                _depth
10022            )?;
10023            Ok(())
10024        }
10025    }
10026
10027    impl fidl::encoding::ResourceTypeMarker for PackageCacheGetSubpackageRequest {
10028        type Borrowed<'a> = &'a mut Self;
10029        fn take_or_borrow<'a>(
10030            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10031        ) -> Self::Borrowed<'a> {
10032            value
10033        }
10034    }
10035
10036    unsafe impl fidl::encoding::TypeMarker for PackageCacheGetSubpackageRequest {
10037        type Owned = Self;
10038
10039        #[inline(always)]
10040        fn inline_align(_context: fidl::encoding::Context) -> usize {
10041            8
10042        }
10043
10044        #[inline(always)]
10045        fn inline_size(_context: fidl::encoding::Context) -> usize {
10046            56
10047        }
10048    }
10049
10050    unsafe impl
10051        fidl::encoding::Encode<
10052            PackageCacheGetSubpackageRequest,
10053            fidl::encoding::DefaultFuchsiaResourceDialect,
10054        > for &mut PackageCacheGetSubpackageRequest
10055    {
10056        #[inline]
10057        unsafe fn encode(
10058            self,
10059            encoder: &mut fidl::encoding::Encoder<
10060                '_,
10061                fidl::encoding::DefaultFuchsiaResourceDialect,
10062            >,
10063            offset: usize,
10064            _depth: fidl::encoding::Depth,
10065        ) -> fidl::Result<()> {
10066            encoder.debug_check_bounds::<PackageCacheGetSubpackageRequest>(offset);
10067            // Delegate to tuple encoding.
10068            fidl::encoding::Encode::<
10069                PackageCacheGetSubpackageRequest,
10070                fidl::encoding::DefaultFuchsiaResourceDialect,
10071            >::encode(
10072                (
10073                    <BlobId as fidl::encoding::ValueTypeMarker>::borrow(&self.superpackage),
10074                    <PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.subpackage),
10075                    <fidl::encoding::Endpoint<
10076                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10077                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10078                        &mut self.dir
10079                    ),
10080                ),
10081                encoder,
10082                offset,
10083                _depth,
10084            )
10085        }
10086    }
10087    unsafe impl<
10088        T0: fidl::encoding::Encode<BlobId, fidl::encoding::DefaultFuchsiaResourceDialect>,
10089        T1: fidl::encoding::Encode<PackageUrl, fidl::encoding::DefaultFuchsiaResourceDialect>,
10090        T2: fidl::encoding::Encode<
10091                fidl::encoding::Endpoint<
10092                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10093                >,
10094                fidl::encoding::DefaultFuchsiaResourceDialect,
10095            >,
10096    >
10097        fidl::encoding::Encode<
10098            PackageCacheGetSubpackageRequest,
10099            fidl::encoding::DefaultFuchsiaResourceDialect,
10100        > for (T0, T1, T2)
10101    {
10102        #[inline]
10103        unsafe fn encode(
10104            self,
10105            encoder: &mut fidl::encoding::Encoder<
10106                '_,
10107                fidl::encoding::DefaultFuchsiaResourceDialect,
10108            >,
10109            offset: usize,
10110            depth: fidl::encoding::Depth,
10111        ) -> fidl::Result<()> {
10112            encoder.debug_check_bounds::<PackageCacheGetSubpackageRequest>(offset);
10113            // Zero out padding regions. There's no need to apply masks
10114            // because the unmasked parts will be overwritten by fields.
10115            unsafe {
10116                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
10117                (ptr as *mut u64).write_unaligned(0);
10118            }
10119            // Write the fields.
10120            self.0.encode(encoder, offset + 0, depth)?;
10121            self.1.encode(encoder, offset + 32, depth)?;
10122            self.2.encode(encoder, offset + 48, depth)?;
10123            Ok(())
10124        }
10125    }
10126
10127    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10128        for PackageCacheGetSubpackageRequest
10129    {
10130        #[inline(always)]
10131        fn new_empty() -> Self {
10132            Self {
10133                superpackage: fidl::new_empty!(
10134                    BlobId,
10135                    fidl::encoding::DefaultFuchsiaResourceDialect
10136                ),
10137                subpackage: fidl::new_empty!(
10138                    PackageUrl,
10139                    fidl::encoding::DefaultFuchsiaResourceDialect
10140                ),
10141                dir: fidl::new_empty!(
10142                    fidl::encoding::Endpoint<
10143                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10144                    >,
10145                    fidl::encoding::DefaultFuchsiaResourceDialect
10146                ),
10147            }
10148        }
10149
10150        #[inline]
10151        unsafe fn decode(
10152            &mut self,
10153            decoder: &mut fidl::encoding::Decoder<
10154                '_,
10155                fidl::encoding::DefaultFuchsiaResourceDialect,
10156            >,
10157            offset: usize,
10158            _depth: fidl::encoding::Depth,
10159        ) -> fidl::Result<()> {
10160            decoder.debug_check_bounds::<Self>(offset);
10161            // Verify that padding bytes are zero.
10162            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
10163            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10164            let mask = 0xffffffff00000000u64;
10165            let maskedval = padval & mask;
10166            if maskedval != 0 {
10167                return Err(fidl::Error::NonZeroPadding {
10168                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
10169                });
10170            }
10171            fidl::decode!(
10172                BlobId,
10173                fidl::encoding::DefaultFuchsiaResourceDialect,
10174                &mut self.superpackage,
10175                decoder,
10176                offset + 0,
10177                _depth
10178            )?;
10179            fidl::decode!(
10180                PackageUrl,
10181                fidl::encoding::DefaultFuchsiaResourceDialect,
10182                &mut self.subpackage,
10183                decoder,
10184                offset + 32,
10185                _depth
10186            )?;
10187            fidl::decode!(
10188                fidl::encoding::Endpoint<
10189                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10190                >,
10191                fidl::encoding::DefaultFuchsiaResourceDialect,
10192                &mut self.dir,
10193                decoder,
10194                offset + 48,
10195                _depth
10196            )?;
10197            Ok(())
10198        }
10199    }
10200
10201    impl fidl::encoding::ResourceTypeMarker for PackageCacheWriteBlobsRequest {
10202        type Borrowed<'a> = &'a mut Self;
10203        fn take_or_borrow<'a>(
10204            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10205        ) -> Self::Borrowed<'a> {
10206            value
10207        }
10208    }
10209
10210    unsafe impl fidl::encoding::TypeMarker for PackageCacheWriteBlobsRequest {
10211        type Owned = Self;
10212
10213        #[inline(always)]
10214        fn inline_align(_context: fidl::encoding::Context) -> usize {
10215            4
10216        }
10217
10218        #[inline(always)]
10219        fn inline_size(_context: fidl::encoding::Context) -> usize {
10220            4
10221        }
10222    }
10223
10224    unsafe impl
10225        fidl::encoding::Encode<
10226            PackageCacheWriteBlobsRequest,
10227            fidl::encoding::DefaultFuchsiaResourceDialect,
10228        > for &mut PackageCacheWriteBlobsRequest
10229    {
10230        #[inline]
10231        unsafe fn encode(
10232            self,
10233            encoder: &mut fidl::encoding::Encoder<
10234                '_,
10235                fidl::encoding::DefaultFuchsiaResourceDialect,
10236            >,
10237            offset: usize,
10238            _depth: fidl::encoding::Depth,
10239        ) -> fidl::Result<()> {
10240            encoder.debug_check_bounds::<PackageCacheWriteBlobsRequest>(offset);
10241            // Delegate to tuple encoding.
10242            fidl::encoding::Encode::<PackageCacheWriteBlobsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10243                (
10244                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.needed_blobs),
10245                ),
10246                encoder, offset, _depth
10247            )
10248        }
10249    }
10250    unsafe impl<
10251        T0: fidl::encoding::Encode<
10252                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
10253                fidl::encoding::DefaultFuchsiaResourceDialect,
10254            >,
10255    >
10256        fidl::encoding::Encode<
10257            PackageCacheWriteBlobsRequest,
10258            fidl::encoding::DefaultFuchsiaResourceDialect,
10259        > for (T0,)
10260    {
10261        #[inline]
10262        unsafe fn encode(
10263            self,
10264            encoder: &mut fidl::encoding::Encoder<
10265                '_,
10266                fidl::encoding::DefaultFuchsiaResourceDialect,
10267            >,
10268            offset: usize,
10269            depth: fidl::encoding::Depth,
10270        ) -> fidl::Result<()> {
10271            encoder.debug_check_bounds::<PackageCacheWriteBlobsRequest>(offset);
10272            // Zero out padding regions. There's no need to apply masks
10273            // because the unmasked parts will be overwritten by fields.
10274            // Write the fields.
10275            self.0.encode(encoder, offset + 0, depth)?;
10276            Ok(())
10277        }
10278    }
10279
10280    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10281        for PackageCacheWriteBlobsRequest
10282    {
10283        #[inline(always)]
10284        fn new_empty() -> Self {
10285            Self {
10286                needed_blobs: fidl::new_empty!(
10287                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
10288                    fidl::encoding::DefaultFuchsiaResourceDialect
10289                ),
10290            }
10291        }
10292
10293        #[inline]
10294        unsafe fn decode(
10295            &mut self,
10296            decoder: &mut fidl::encoding::Decoder<
10297                '_,
10298                fidl::encoding::DefaultFuchsiaResourceDialect,
10299            >,
10300            offset: usize,
10301            _depth: fidl::encoding::Depth,
10302        ) -> fidl::Result<()> {
10303            decoder.debug_check_bounds::<Self>(offset);
10304            // Verify that padding bytes are zero.
10305            fidl::decode!(
10306                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
10307                fidl::encoding::DefaultFuchsiaResourceDialect,
10308                &mut self.needed_blobs,
10309                decoder,
10310                offset + 0,
10311                _depth
10312            )?;
10313            Ok(())
10314        }
10315    }
10316
10317    impl fidl::encoding::ResourceTypeMarker for PackageResolverResolveRequest {
10318        type Borrowed<'a> = &'a mut Self;
10319        fn take_or_borrow<'a>(
10320            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10321        ) -> Self::Borrowed<'a> {
10322            value
10323        }
10324    }
10325
10326    unsafe impl fidl::encoding::TypeMarker for PackageResolverResolveRequest {
10327        type Owned = Self;
10328
10329        #[inline(always)]
10330        fn inline_align(_context: fidl::encoding::Context) -> usize {
10331            8
10332        }
10333
10334        #[inline(always)]
10335        fn inline_size(_context: fidl::encoding::Context) -> usize {
10336            24
10337        }
10338    }
10339
10340    unsafe impl
10341        fidl::encoding::Encode<
10342            PackageResolverResolveRequest,
10343            fidl::encoding::DefaultFuchsiaResourceDialect,
10344        > for &mut PackageResolverResolveRequest
10345    {
10346        #[inline]
10347        unsafe fn encode(
10348            self,
10349            encoder: &mut fidl::encoding::Encoder<
10350                '_,
10351                fidl::encoding::DefaultFuchsiaResourceDialect,
10352            >,
10353            offset: usize,
10354            _depth: fidl::encoding::Depth,
10355        ) -> fidl::Result<()> {
10356            encoder.debug_check_bounds::<PackageResolverResolveRequest>(offset);
10357            // Delegate to tuple encoding.
10358            fidl::encoding::Encode::<
10359                PackageResolverResolveRequest,
10360                fidl::encoding::DefaultFuchsiaResourceDialect,
10361            >::encode(
10362                (
10363                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
10364                        &self.package_url,
10365                    ),
10366                    <fidl::encoding::Endpoint<
10367                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10368                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10369                        &mut self.dir
10370                    ),
10371                ),
10372                encoder,
10373                offset,
10374                _depth,
10375            )
10376        }
10377    }
10378    unsafe impl<
10379        T0: fidl::encoding::Encode<
10380                fidl::encoding::UnboundedString,
10381                fidl::encoding::DefaultFuchsiaResourceDialect,
10382            >,
10383        T1: fidl::encoding::Encode<
10384                fidl::encoding::Endpoint<
10385                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10386                >,
10387                fidl::encoding::DefaultFuchsiaResourceDialect,
10388            >,
10389    >
10390        fidl::encoding::Encode<
10391            PackageResolverResolveRequest,
10392            fidl::encoding::DefaultFuchsiaResourceDialect,
10393        > for (T0, T1)
10394    {
10395        #[inline]
10396        unsafe fn encode(
10397            self,
10398            encoder: &mut fidl::encoding::Encoder<
10399                '_,
10400                fidl::encoding::DefaultFuchsiaResourceDialect,
10401            >,
10402            offset: usize,
10403            depth: fidl::encoding::Depth,
10404        ) -> fidl::Result<()> {
10405            encoder.debug_check_bounds::<PackageResolverResolveRequest>(offset);
10406            // Zero out padding regions. There's no need to apply masks
10407            // because the unmasked parts will be overwritten by fields.
10408            unsafe {
10409                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10410                (ptr as *mut u64).write_unaligned(0);
10411            }
10412            // Write the fields.
10413            self.0.encode(encoder, offset + 0, depth)?;
10414            self.1.encode(encoder, offset + 16, depth)?;
10415            Ok(())
10416        }
10417    }
10418
10419    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10420        for PackageResolverResolveRequest
10421    {
10422        #[inline(always)]
10423        fn new_empty() -> Self {
10424            Self {
10425                package_url: fidl::new_empty!(
10426                    fidl::encoding::UnboundedString,
10427                    fidl::encoding::DefaultFuchsiaResourceDialect
10428                ),
10429                dir: fidl::new_empty!(
10430                    fidl::encoding::Endpoint<
10431                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10432                    >,
10433                    fidl::encoding::DefaultFuchsiaResourceDialect
10434                ),
10435            }
10436        }
10437
10438        #[inline]
10439        unsafe fn decode(
10440            &mut self,
10441            decoder: &mut fidl::encoding::Decoder<
10442                '_,
10443                fidl::encoding::DefaultFuchsiaResourceDialect,
10444            >,
10445            offset: usize,
10446            _depth: fidl::encoding::Depth,
10447        ) -> fidl::Result<()> {
10448            decoder.debug_check_bounds::<Self>(offset);
10449            // Verify that padding bytes are zero.
10450            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10451            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10452            let mask = 0xffffffff00000000u64;
10453            let maskedval = padval & mask;
10454            if maskedval != 0 {
10455                return Err(fidl::Error::NonZeroPadding {
10456                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10457                });
10458            }
10459            fidl::decode!(
10460                fidl::encoding::UnboundedString,
10461                fidl::encoding::DefaultFuchsiaResourceDialect,
10462                &mut self.package_url,
10463                decoder,
10464                offset + 0,
10465                _depth
10466            )?;
10467            fidl::decode!(
10468                fidl::encoding::Endpoint<
10469                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10470                >,
10471                fidl::encoding::DefaultFuchsiaResourceDialect,
10472                &mut self.dir,
10473                decoder,
10474                offset + 16,
10475                _depth
10476            )?;
10477            Ok(())
10478        }
10479    }
10480
10481    impl fidl::encoding::ResourceTypeMarker for PackageResolverResolveWithContextRequest {
10482        type Borrowed<'a> = &'a mut Self;
10483        fn take_or_borrow<'a>(
10484            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10485        ) -> Self::Borrowed<'a> {
10486            value
10487        }
10488    }
10489
10490    unsafe impl fidl::encoding::TypeMarker for PackageResolverResolveWithContextRequest {
10491        type Owned = Self;
10492
10493        #[inline(always)]
10494        fn inline_align(_context: fidl::encoding::Context) -> usize {
10495            8
10496        }
10497
10498        #[inline(always)]
10499        fn inline_size(_context: fidl::encoding::Context) -> usize {
10500            40
10501        }
10502    }
10503
10504    unsafe impl
10505        fidl::encoding::Encode<
10506            PackageResolverResolveWithContextRequest,
10507            fidl::encoding::DefaultFuchsiaResourceDialect,
10508        > for &mut PackageResolverResolveWithContextRequest
10509    {
10510        #[inline]
10511        unsafe fn encode(
10512            self,
10513            encoder: &mut fidl::encoding::Encoder<
10514                '_,
10515                fidl::encoding::DefaultFuchsiaResourceDialect,
10516            >,
10517            offset: usize,
10518            _depth: fidl::encoding::Depth,
10519        ) -> fidl::Result<()> {
10520            encoder.debug_check_bounds::<PackageResolverResolveWithContextRequest>(offset);
10521            // Delegate to tuple encoding.
10522            fidl::encoding::Encode::<
10523                PackageResolverResolveWithContextRequest,
10524                fidl::encoding::DefaultFuchsiaResourceDialect,
10525            >::encode(
10526                (
10527                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
10528                        &self.package_url,
10529                    ),
10530                    <ResolutionContext as fidl::encoding::ValueTypeMarker>::borrow(&self.context),
10531                    <fidl::encoding::Endpoint<
10532                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10533                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10534                        &mut self.dir
10535                    ),
10536                ),
10537                encoder,
10538                offset,
10539                _depth,
10540            )
10541        }
10542    }
10543    unsafe impl<
10544        T0: fidl::encoding::Encode<
10545                fidl::encoding::UnboundedString,
10546                fidl::encoding::DefaultFuchsiaResourceDialect,
10547            >,
10548        T1: fidl::encoding::Encode<ResolutionContext, fidl::encoding::DefaultFuchsiaResourceDialect>,
10549        T2: fidl::encoding::Encode<
10550                fidl::encoding::Endpoint<
10551                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10552                >,
10553                fidl::encoding::DefaultFuchsiaResourceDialect,
10554            >,
10555    >
10556        fidl::encoding::Encode<
10557            PackageResolverResolveWithContextRequest,
10558            fidl::encoding::DefaultFuchsiaResourceDialect,
10559        > for (T0, T1, T2)
10560    {
10561        #[inline]
10562        unsafe fn encode(
10563            self,
10564            encoder: &mut fidl::encoding::Encoder<
10565                '_,
10566                fidl::encoding::DefaultFuchsiaResourceDialect,
10567            >,
10568            offset: usize,
10569            depth: fidl::encoding::Depth,
10570        ) -> fidl::Result<()> {
10571            encoder.debug_check_bounds::<PackageResolverResolveWithContextRequest>(offset);
10572            // Zero out padding regions. There's no need to apply masks
10573            // because the unmasked parts will be overwritten by fields.
10574            unsafe {
10575                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10576                (ptr as *mut u64).write_unaligned(0);
10577            }
10578            // Write the fields.
10579            self.0.encode(encoder, offset + 0, depth)?;
10580            self.1.encode(encoder, offset + 16, depth)?;
10581            self.2.encode(encoder, offset + 32, depth)?;
10582            Ok(())
10583        }
10584    }
10585
10586    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10587        for PackageResolverResolveWithContextRequest
10588    {
10589        #[inline(always)]
10590        fn new_empty() -> Self {
10591            Self {
10592                package_url: fidl::new_empty!(
10593                    fidl::encoding::UnboundedString,
10594                    fidl::encoding::DefaultFuchsiaResourceDialect
10595                ),
10596                context: fidl::new_empty!(
10597                    ResolutionContext,
10598                    fidl::encoding::DefaultFuchsiaResourceDialect
10599                ),
10600                dir: fidl::new_empty!(
10601                    fidl::encoding::Endpoint<
10602                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10603                    >,
10604                    fidl::encoding::DefaultFuchsiaResourceDialect
10605                ),
10606            }
10607        }
10608
10609        #[inline]
10610        unsafe fn decode(
10611            &mut self,
10612            decoder: &mut fidl::encoding::Decoder<
10613                '_,
10614                fidl::encoding::DefaultFuchsiaResourceDialect,
10615            >,
10616            offset: usize,
10617            _depth: fidl::encoding::Depth,
10618        ) -> fidl::Result<()> {
10619            decoder.debug_check_bounds::<Self>(offset);
10620            // Verify that padding bytes are zero.
10621            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10622            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10623            let mask = 0xffffffff00000000u64;
10624            let maskedval = padval & mask;
10625            if maskedval != 0 {
10626                return Err(fidl::Error::NonZeroPadding {
10627                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10628                });
10629            }
10630            fidl::decode!(
10631                fidl::encoding::UnboundedString,
10632                fidl::encoding::DefaultFuchsiaResourceDialect,
10633                &mut self.package_url,
10634                decoder,
10635                offset + 0,
10636                _depth
10637            )?;
10638            fidl::decode!(
10639                ResolutionContext,
10640                fidl::encoding::DefaultFuchsiaResourceDialect,
10641                &mut self.context,
10642                decoder,
10643                offset + 16,
10644                _depth
10645            )?;
10646            fidl::decode!(
10647                fidl::encoding::Endpoint<
10648                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10649                >,
10650                fidl::encoding::DefaultFuchsiaResourceDialect,
10651                &mut self.dir,
10652                decoder,
10653                offset + 32,
10654                _depth
10655            )?;
10656            Ok(())
10657        }
10658    }
10659
10660    impl fidl::encoding::ResourceTypeMarker for RepositoryManagerListRequest {
10661        type Borrowed<'a> = &'a mut Self;
10662        fn take_or_borrow<'a>(
10663            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10664        ) -> Self::Borrowed<'a> {
10665            value
10666        }
10667    }
10668
10669    unsafe impl fidl::encoding::TypeMarker for RepositoryManagerListRequest {
10670        type Owned = Self;
10671
10672        #[inline(always)]
10673        fn inline_align(_context: fidl::encoding::Context) -> usize {
10674            4
10675        }
10676
10677        #[inline(always)]
10678        fn inline_size(_context: fidl::encoding::Context) -> usize {
10679            4
10680        }
10681    }
10682
10683    unsafe impl
10684        fidl::encoding::Encode<
10685            RepositoryManagerListRequest,
10686            fidl::encoding::DefaultFuchsiaResourceDialect,
10687        > for &mut RepositoryManagerListRequest
10688    {
10689        #[inline]
10690        unsafe fn encode(
10691            self,
10692            encoder: &mut fidl::encoding::Encoder<
10693                '_,
10694                fidl::encoding::DefaultFuchsiaResourceDialect,
10695            >,
10696            offset: usize,
10697            _depth: fidl::encoding::Depth,
10698        ) -> fidl::Result<()> {
10699            encoder.debug_check_bounds::<RepositoryManagerListRequest>(offset);
10700            // Delegate to tuple encoding.
10701            fidl::encoding::Encode::<RepositoryManagerListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10702                (
10703                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
10704                ),
10705                encoder, offset, _depth
10706            )
10707        }
10708    }
10709    unsafe impl<
10710        T0: fidl::encoding::Encode<
10711                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>>,
10712                fidl::encoding::DefaultFuchsiaResourceDialect,
10713            >,
10714    >
10715        fidl::encoding::Encode<
10716            RepositoryManagerListRequest,
10717            fidl::encoding::DefaultFuchsiaResourceDialect,
10718        > for (T0,)
10719    {
10720        #[inline]
10721        unsafe fn encode(
10722            self,
10723            encoder: &mut fidl::encoding::Encoder<
10724                '_,
10725                fidl::encoding::DefaultFuchsiaResourceDialect,
10726            >,
10727            offset: usize,
10728            depth: fidl::encoding::Depth,
10729        ) -> fidl::Result<()> {
10730            encoder.debug_check_bounds::<RepositoryManagerListRequest>(offset);
10731            // Zero out padding regions. There's no need to apply masks
10732            // because the unmasked parts will be overwritten by fields.
10733            // Write the fields.
10734            self.0.encode(encoder, offset + 0, depth)?;
10735            Ok(())
10736        }
10737    }
10738
10739    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10740        for RepositoryManagerListRequest
10741    {
10742        #[inline(always)]
10743        fn new_empty() -> Self {
10744            Self {
10745                iterator: fidl::new_empty!(
10746                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>>,
10747                    fidl::encoding::DefaultFuchsiaResourceDialect
10748                ),
10749            }
10750        }
10751
10752        #[inline]
10753        unsafe fn decode(
10754            &mut self,
10755            decoder: &mut fidl::encoding::Decoder<
10756                '_,
10757                fidl::encoding::DefaultFuchsiaResourceDialect,
10758            >,
10759            offset: usize,
10760            _depth: fidl::encoding::Depth,
10761        ) -> fidl::Result<()> {
10762            decoder.debug_check_bounds::<Self>(offset);
10763            // Verify that padding bytes are zero.
10764            fidl::decode!(
10765                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>>,
10766                fidl::encoding::DefaultFuchsiaResourceDialect,
10767                &mut self.iterator,
10768                decoder,
10769                offset + 0,
10770                _depth
10771            )?;
10772            Ok(())
10773        }
10774    }
10775
10776    impl fidl::encoding::ResourceTypeMarker for RetainedBlobsReplaceRequest {
10777        type Borrowed<'a> = &'a mut Self;
10778        fn take_or_borrow<'a>(
10779            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10780        ) -> Self::Borrowed<'a> {
10781            value
10782        }
10783    }
10784
10785    unsafe impl fidl::encoding::TypeMarker for RetainedBlobsReplaceRequest {
10786        type Owned = Self;
10787
10788        #[inline(always)]
10789        fn inline_align(_context: fidl::encoding::Context) -> usize {
10790            4
10791        }
10792
10793        #[inline(always)]
10794        fn inline_size(_context: fidl::encoding::Context) -> usize {
10795            4
10796        }
10797    }
10798
10799    unsafe impl
10800        fidl::encoding::Encode<
10801            RetainedBlobsReplaceRequest,
10802            fidl::encoding::DefaultFuchsiaResourceDialect,
10803        > for &mut RetainedBlobsReplaceRequest
10804    {
10805        #[inline]
10806        unsafe fn encode(
10807            self,
10808            encoder: &mut fidl::encoding::Encoder<
10809                '_,
10810                fidl::encoding::DefaultFuchsiaResourceDialect,
10811            >,
10812            offset: usize,
10813            _depth: fidl::encoding::Depth,
10814        ) -> fidl::Result<()> {
10815            encoder.debug_check_bounds::<RetainedBlobsReplaceRequest>(offset);
10816            // Delegate to tuple encoding.
10817            fidl::encoding::Encode::<RetainedBlobsReplaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10818                (
10819                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
10820                ),
10821                encoder, offset, _depth
10822            )
10823        }
10824    }
10825    unsafe impl<
10826        T0: fidl::encoding::Encode<
10827                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
10828                fidl::encoding::DefaultFuchsiaResourceDialect,
10829            >,
10830    >
10831        fidl::encoding::Encode<
10832            RetainedBlobsReplaceRequest,
10833            fidl::encoding::DefaultFuchsiaResourceDialect,
10834        > for (T0,)
10835    {
10836        #[inline]
10837        unsafe fn encode(
10838            self,
10839            encoder: &mut fidl::encoding::Encoder<
10840                '_,
10841                fidl::encoding::DefaultFuchsiaResourceDialect,
10842            >,
10843            offset: usize,
10844            depth: fidl::encoding::Depth,
10845        ) -> fidl::Result<()> {
10846            encoder.debug_check_bounds::<RetainedBlobsReplaceRequest>(offset);
10847            // Zero out padding regions. There's no need to apply masks
10848            // because the unmasked parts will be overwritten by fields.
10849            // Write the fields.
10850            self.0.encode(encoder, offset + 0, depth)?;
10851            Ok(())
10852        }
10853    }
10854
10855    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10856        for RetainedBlobsReplaceRequest
10857    {
10858        #[inline(always)]
10859        fn new_empty() -> Self {
10860            Self {
10861                iterator: fidl::new_empty!(
10862                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
10863                    fidl::encoding::DefaultFuchsiaResourceDialect
10864                ),
10865            }
10866        }
10867
10868        #[inline]
10869        unsafe fn decode(
10870            &mut self,
10871            decoder: &mut fidl::encoding::Decoder<
10872                '_,
10873                fidl::encoding::DefaultFuchsiaResourceDialect,
10874            >,
10875            offset: usize,
10876            _depth: fidl::encoding::Depth,
10877        ) -> fidl::Result<()> {
10878            decoder.debug_check_bounds::<Self>(offset);
10879            // Verify that padding bytes are zero.
10880            fidl::decode!(
10881                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
10882                fidl::encoding::DefaultFuchsiaResourceDialect,
10883                &mut self.iterator,
10884                decoder,
10885                offset + 0,
10886                _depth
10887            )?;
10888            Ok(())
10889        }
10890    }
10891
10892    impl fidl::encoding::ResourceTypeMarker for RetainedPackagesReplaceRequest {
10893        type Borrowed<'a> = &'a mut Self;
10894        fn take_or_borrow<'a>(
10895            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10896        ) -> Self::Borrowed<'a> {
10897            value
10898        }
10899    }
10900
10901    unsafe impl fidl::encoding::TypeMarker for RetainedPackagesReplaceRequest {
10902        type Owned = Self;
10903
10904        #[inline(always)]
10905        fn inline_align(_context: fidl::encoding::Context) -> usize {
10906            4
10907        }
10908
10909        #[inline(always)]
10910        fn inline_size(_context: fidl::encoding::Context) -> usize {
10911            4
10912        }
10913    }
10914
10915    unsafe impl
10916        fidl::encoding::Encode<
10917            RetainedPackagesReplaceRequest,
10918            fidl::encoding::DefaultFuchsiaResourceDialect,
10919        > for &mut RetainedPackagesReplaceRequest
10920    {
10921        #[inline]
10922        unsafe fn encode(
10923            self,
10924            encoder: &mut fidl::encoding::Encoder<
10925                '_,
10926                fidl::encoding::DefaultFuchsiaResourceDialect,
10927            >,
10928            offset: usize,
10929            _depth: fidl::encoding::Depth,
10930        ) -> fidl::Result<()> {
10931            encoder.debug_check_bounds::<RetainedPackagesReplaceRequest>(offset);
10932            // Delegate to tuple encoding.
10933            fidl::encoding::Encode::<RetainedPackagesReplaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10934                (
10935                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
10936                ),
10937                encoder, offset, _depth
10938            )
10939        }
10940    }
10941    unsafe impl<
10942        T0: fidl::encoding::Encode<
10943                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
10944                fidl::encoding::DefaultFuchsiaResourceDialect,
10945            >,
10946    >
10947        fidl::encoding::Encode<
10948            RetainedPackagesReplaceRequest,
10949            fidl::encoding::DefaultFuchsiaResourceDialect,
10950        > for (T0,)
10951    {
10952        #[inline]
10953        unsafe fn encode(
10954            self,
10955            encoder: &mut fidl::encoding::Encoder<
10956                '_,
10957                fidl::encoding::DefaultFuchsiaResourceDialect,
10958            >,
10959            offset: usize,
10960            depth: fidl::encoding::Depth,
10961        ) -> fidl::Result<()> {
10962            encoder.debug_check_bounds::<RetainedPackagesReplaceRequest>(offset);
10963            // Zero out padding regions. There's no need to apply masks
10964            // because the unmasked parts will be overwritten by fields.
10965            // Write the fields.
10966            self.0.encode(encoder, offset + 0, depth)?;
10967            Ok(())
10968        }
10969    }
10970
10971    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10972        for RetainedPackagesReplaceRequest
10973    {
10974        #[inline(always)]
10975        fn new_empty() -> Self {
10976            Self {
10977                iterator: fidl::new_empty!(
10978                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
10979                    fidl::encoding::DefaultFuchsiaResourceDialect
10980                ),
10981            }
10982        }
10983
10984        #[inline]
10985        unsafe fn decode(
10986            &mut self,
10987            decoder: &mut fidl::encoding::Decoder<
10988                '_,
10989                fidl::encoding::DefaultFuchsiaResourceDialect,
10990            >,
10991            offset: usize,
10992            _depth: fidl::encoding::Depth,
10993        ) -> fidl::Result<()> {
10994            decoder.debug_check_bounds::<Self>(offset);
10995            // Verify that padding bytes are zero.
10996            fidl::decode!(
10997                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
10998                fidl::encoding::DefaultFuchsiaResourceDialect,
10999                &mut self.iterator,
11000                decoder,
11001                offset + 0,
11002                _depth
11003            )?;
11004            Ok(())
11005        }
11006    }
11007
11008    impl fidl::encoding::ResourceTypeMarker for BlobWriter {
11009        type Borrowed<'a> = &'a mut Self;
11010        fn take_or_borrow<'a>(
11011            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11012        ) -> Self::Borrowed<'a> {
11013            value
11014        }
11015    }
11016
11017    unsafe impl fidl::encoding::TypeMarker for BlobWriter {
11018        type Owned = Self;
11019
11020        #[inline(always)]
11021        fn inline_align(_context: fidl::encoding::Context) -> usize {
11022            8
11023        }
11024
11025        #[inline(always)]
11026        fn inline_size(_context: fidl::encoding::Context) -> usize {
11027            16
11028        }
11029    }
11030
11031    unsafe impl fidl::encoding::Encode<BlobWriter, fidl::encoding::DefaultFuchsiaResourceDialect>
11032        for &mut BlobWriter
11033    {
11034        #[inline]
11035        unsafe fn encode(
11036            self,
11037            encoder: &mut fidl::encoding::Encoder<
11038                '_,
11039                fidl::encoding::DefaultFuchsiaResourceDialect,
11040            >,
11041            offset: usize,
11042            _depth: fidl::encoding::Depth,
11043        ) -> fidl::Result<()> {
11044            encoder.debug_check_bounds::<BlobWriter>(offset);
11045            encoder.write_num::<u64>(self.ordinal(), offset);
11046            match self {
11047                BlobWriter::File(ref mut val) => fidl::encoding::encode_in_envelope::<
11048                    fidl::encoding::Endpoint<
11049                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11050                    >,
11051                    fidl::encoding::DefaultFuchsiaResourceDialect,
11052                >(
11053                    <fidl::encoding::Endpoint<
11054                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11055                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11056                        val
11057                    ),
11058                    encoder,
11059                    offset + 8,
11060                    _depth,
11061                ),
11062                BlobWriter::Writer(ref mut val) => fidl::encoding::encode_in_envelope::<
11063                    fidl::encoding::Endpoint<
11064                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
11065                    >,
11066                    fidl::encoding::DefaultFuchsiaResourceDialect,
11067                >(
11068                    <fidl::encoding::Endpoint<
11069                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
11070                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11071                        val
11072                    ),
11073                    encoder,
11074                    offset + 8,
11075                    _depth,
11076                ),
11077            }
11078        }
11079    }
11080
11081    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlobWriter {
11082        #[inline(always)]
11083        fn new_empty() -> Self {
11084            Self::File(fidl::new_empty!(
11085                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
11086                fidl::encoding::DefaultFuchsiaResourceDialect
11087            ))
11088        }
11089
11090        #[inline]
11091        unsafe fn decode(
11092            &mut self,
11093            decoder: &mut fidl::encoding::Decoder<
11094                '_,
11095                fidl::encoding::DefaultFuchsiaResourceDialect,
11096            >,
11097            offset: usize,
11098            mut depth: fidl::encoding::Depth,
11099        ) -> fidl::Result<()> {
11100            decoder.debug_check_bounds::<Self>(offset);
11101            #[allow(unused_variables)]
11102            let next_out_of_line = decoder.next_out_of_line();
11103            let handles_before = decoder.remaining_handles();
11104            let (ordinal, inlined, num_bytes, num_handles) =
11105                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11106
11107            let member_inline_size = match ordinal {
11108                1 => <fidl::encoding::Endpoint<
11109                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11110                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11111                2 => <fidl::encoding::Endpoint<
11112                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
11113                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11114                _ => return Err(fidl::Error::UnknownUnionTag),
11115            };
11116
11117            if inlined != (member_inline_size <= 4) {
11118                return Err(fidl::Error::InvalidInlineBitInEnvelope);
11119            }
11120            let _inner_offset;
11121            if inlined {
11122                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11123                _inner_offset = offset + 8;
11124            } else {
11125                depth.increment()?;
11126                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11127            }
11128            match ordinal {
11129                1 => {
11130                    #[allow(irrefutable_let_patterns)]
11131                    if let BlobWriter::File(_) = self {
11132                        // Do nothing, read the value into the object
11133                    } else {
11134                        // Initialize `self` to the right variant
11135                        *self = BlobWriter::File(fidl::new_empty!(
11136                            fidl::encoding::Endpoint<
11137                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11138                            >,
11139                            fidl::encoding::DefaultFuchsiaResourceDialect
11140                        ));
11141                    }
11142                    #[allow(irrefutable_let_patterns)]
11143                    if let BlobWriter::File(ref mut val) = self {
11144                        fidl::decode!(
11145                            fidl::encoding::Endpoint<
11146                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
11147                            >,
11148                            fidl::encoding::DefaultFuchsiaResourceDialect,
11149                            val,
11150                            decoder,
11151                            _inner_offset,
11152                            depth
11153                        )?;
11154                    } else {
11155                        unreachable!()
11156                    }
11157                }
11158                2 => {
11159                    #[allow(irrefutable_let_patterns)]
11160                    if let BlobWriter::Writer(_) = self {
11161                        // Do nothing, read the value into the object
11162                    } else {
11163                        // Initialize `self` to the right variant
11164                        *self = BlobWriter::Writer(fidl::new_empty!(
11165                            fidl::encoding::Endpoint<
11166                                fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
11167                            >,
11168                            fidl::encoding::DefaultFuchsiaResourceDialect
11169                        ));
11170                    }
11171                    #[allow(irrefutable_let_patterns)]
11172                    if let BlobWriter::Writer(ref mut val) = self {
11173                        fidl::decode!(
11174                            fidl::encoding::Endpoint<
11175                                fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
11176                            >,
11177                            fidl::encoding::DefaultFuchsiaResourceDialect,
11178                            val,
11179                            decoder,
11180                            _inner_offset,
11181                            depth
11182                        )?;
11183                    } else {
11184                        unreachable!()
11185                    }
11186                }
11187                ordinal => panic!("unexpected ordinal {:?}", ordinal),
11188            }
11189            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11190                return Err(fidl::Error::InvalidNumBytesInEnvelope);
11191            }
11192            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11193                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11194            }
11195            Ok(())
11196        }
11197    }
11198}