Skip to main content

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