Skip to main content

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