fidl_fuchsia_pkg/
fidl_fuchsia_pkg.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// The maximum number of bytes for a `ResolutionContext`.
14///
15/// Note that this value must be less than or equal to
16/// `fuchsia.component.resolution::MAX_RESOLUTION_CONTEXT_SIZE`, since the
17/// component resolver is expected to copy or contain the context provided by
18/// the package resolver.
19pub const MAX_RESOLUTION_CONTEXT_SIZE: u32 = 8192;
20
21/// Error type for [`NeededBlobs.BlobWritten`].
22#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
23#[repr(u32)]
24pub enum BlobWrittenError {
25    /// Client called BlobWritten but blob was not readable in blobfs.
26    NotWritten = 1,
27    /// Client called BlobWritten for a blob it has not yet opened.
28    UnopenedBlob = 2,
29}
30
31impl BlobWrittenError {
32    #[inline]
33    pub fn from_primitive(prim: u32) -> Option<Self> {
34        match prim {
35            1 => Some(Self::NotWritten),
36            2 => Some(Self::UnopenedBlob),
37            _ => None,
38        }
39    }
40
41    #[inline]
42    pub const fn into_primitive(self) -> u32 {
43        self as u32
44    }
45
46    #[deprecated = "Strict enums should not use `is_unknown`"]
47    #[inline]
48    pub fn is_unknown(&self) -> bool {
49        false
50    }
51}
52
53/// How the package served by [`PackageCache.Get`] should be protected from GC.
54#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
55#[repr(u32)]
56pub enum GcProtection {
57    /// Package will be protected from GC as long as there is an open connection to the directory.
58    OpenPackageTracking = 1,
59    /// Package will be protected from GC as long as it is in the Retained index, which is
60    /// controlled by the [`RetainedPackages`] protocol. Client is responsible for ensuring
61    /// the package is in the Retained index.
62    Retained = 2,
63}
64
65impl GcProtection {
66    #[inline]
67    pub fn from_primitive(prim: u32) -> Option<Self> {
68        match prim {
69            1 => Some(Self::OpenPackageTracking),
70            2 => Some(Self::Retained),
71            _ => None,
72        }
73    }
74
75    #[inline]
76    pub const fn into_primitive(self) -> u32 {
77        self as u32
78    }
79
80    #[deprecated = "Strict enums should not use `is_unknown`"]
81    #[inline]
82    pub fn is_unknown(&self) -> bool {
83        false
84    }
85}
86
87#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
88#[repr(u32)]
89pub enum GetInfoError {
90    /// The URL is not a known eager package.
91    UnknownUrl = 1,
92    /// The CUP data associated with the eager package failed verification.
93    Verification = 2,
94    /// The URL is a known eager package, but there are no packages available.
95    NotAvailable = 3,
96}
97
98impl GetInfoError {
99    #[inline]
100    pub fn from_primitive(prim: u32) -> Option<Self> {
101        match prim {
102            1 => Some(Self::UnknownUrl),
103            2 => Some(Self::Verification),
104            3 => Some(Self::NotAvailable),
105            _ => None,
106        }
107    }
108
109    #[inline]
110    pub const fn into_primitive(self) -> u32 {
111        self as u32
112    }
113
114    #[deprecated = "Strict enums should not use `is_unknown`"]
115    #[inline]
116    pub fn is_unknown(&self) -> bool {
117        false
118    }
119}
120
121/// Error type for [`PackageCache.GetSubpackage`].
122#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
123#[repr(u32)]
124pub enum GetSubpackageError {
125    /// The superpackage was not open.
126    SuperpackageClosed = 1,
127    /// The requested subpackage does not exist.
128    DoesNotExist = 2,
129    /// An unspecified error occurred.
130    Internal = 3,
131}
132
133impl GetSubpackageError {
134    #[inline]
135    pub fn from_primitive(prim: u32) -> Option<Self> {
136        match prim {
137            1 => Some(Self::SuperpackageClosed),
138            2 => Some(Self::DoesNotExist),
139            3 => Some(Self::Internal),
140            _ => None,
141        }
142    }
143
144    #[inline]
145    pub const fn into_primitive(self) -> u32 {
146        self as u32
147    }
148
149    #[deprecated = "Strict enums should not use `is_unknown`"]
150    #[inline]
151    pub fn is_unknown(&self) -> bool {
152        false
153    }
154}
155
156/// Error type for [`NeededBlobs.OpenMetaBlob`] and [`NeededBlobs.OpenBlob`].
157#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
158#[repr(u32)]
159pub enum OpenBlobError {
160    /// There is insufficient storage space available to persist this blob.
161    OutOfSpace = 1,
162    /// This blob is already open for write by another cache operation.
163    ConcurrentWrite = 2,
164    /// An unspecified error occurred during underlying I/O.
165    UnspecifiedIo = 3,
166    /// An unspecified error occurred.
167    Internal = 4,
168}
169
170impl OpenBlobError {
171    #[inline]
172    pub fn from_primitive(prim: u32) -> Option<Self> {
173        match prim {
174            1 => Some(Self::OutOfSpace),
175            2 => Some(Self::ConcurrentWrite),
176            3 => Some(Self::UnspecifiedIo),
177            4 => Some(Self::Internal),
178            _ => None,
179        }
180    }
181
182    #[inline]
183    pub const fn into_primitive(self) -> u32 {
184        self as u32
185    }
186
187    #[deprecated = "Strict enums should not use `is_unknown`"]
188    #[inline]
189    pub fn is_unknown(&self) -> bool {
190        false
191    }
192}
193
194/// Where the repository storage is written to.
195#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
196#[repr(u32)]
197pub enum RepositoryStorageType {
198    /// Ephemeral, or in-memory storage. This repository metadata will be lost
199    /// when the process or device is restarted. The default type.
200    Ephemeral = 1,
201    /// Persistent, where the repository metadata is written to mutable storage
202    /// and is available after a reboot.
203    Persistent = 2,
204}
205
206impl RepositoryStorageType {
207    #[inline]
208    pub fn from_primitive(prim: u32) -> Option<Self> {
209        match prim {
210            1 => Some(Self::Ephemeral),
211            2 => Some(Self::Persistent),
212            _ => None,
213        }
214    }
215
216    #[inline]
217    pub const fn into_primitive(self) -> u32 {
218        self as u32
219    }
220
221    #[deprecated = "Strict enums should not use `is_unknown`"]
222    #[inline]
223    pub fn is_unknown(&self) -> bool {
224        false
225    }
226}
227
228/// Error codes for PackageResolver operations.
229#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
230#[repr(i32)]
231pub enum ResolveError {
232    /// The resolver encountered an otherwise unspecified error while handling the request.
233    Internal = 1,
234    /// The resolver does not have permission to fetch a package blob.
235    AccessDenied = 2,
236    /// Some unspecified error during I/O.
237    Io = 3,
238    /// The package blob does not exist.
239    BlobNotFound = 4,
240    /// The package does not exist.
241    PackageNotFound = 5,
242    /// The resolver does not know about the repo.
243    RepoNotFound = 6,
244    /// There is no space available to store the package or metadata.
245    NoSpace = 7,
246    /// The resolver is currently unable to fetch a package blob.
247    UnavailableBlob = 8,
248    /// The resolver is currently unable to fetch a repository's metadata.
249    UnavailableRepoMetadata = 9,
250    /// The `package_url` provided to resolver is invalid.
251    InvalidUrl = 10,
252    /// The `context` provided to resolver is invalid.
253    InvalidContext = 11,
254}
255
256impl ResolveError {
257    #[inline]
258    pub fn from_primitive(prim: i32) -> Option<Self> {
259        match prim {
260            1 => Some(Self::Internal),
261            2 => Some(Self::AccessDenied),
262            3 => Some(Self::Io),
263            4 => Some(Self::BlobNotFound),
264            5 => Some(Self::PackageNotFound),
265            6 => Some(Self::RepoNotFound),
266            7 => Some(Self::NoSpace),
267            8 => Some(Self::UnavailableBlob),
268            9 => Some(Self::UnavailableRepoMetadata),
269            10 => Some(Self::InvalidUrl),
270            11 => Some(Self::InvalidContext),
271            _ => None,
272        }
273    }
274
275    #[inline]
276    pub const fn into_primitive(self) -> i32 {
277        self as i32
278    }
279
280    #[deprecated = "Strict enums should not use `is_unknown`"]
281    #[inline]
282    pub fn is_unknown(&self) -> bool {
283        false
284    }
285}
286
287/// Error type for [`PackageCache.SetUpgradableUrls`].
288#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
289pub enum SetUpgradableUrlsError {
290    /// One or more URLs are not set.
291    ///
292    /// Invalid URLs or base packages are ignored, all the other packages are still set,
293    /// package resolution and GC is unblocked.
294    PartialSet,
295    /// An unspecified error occurred.
296    Internal,
297    #[doc(hidden)]
298    __SourceBreaking { unknown_ordinal: u32 },
299}
300
301/// Pattern that matches an unknown `SetUpgradableUrlsError` member.
302#[macro_export]
303macro_rules! SetUpgradableUrlsErrorUnknown {
304    () => {
305        _
306    };
307}
308
309impl SetUpgradableUrlsError {
310    #[inline]
311    pub fn from_primitive(prim: u32) -> Option<Self> {
312        match prim {
313            1 => Some(Self::PartialSet),
314            2 => Some(Self::Internal),
315            _ => None,
316        }
317    }
318
319    #[inline]
320    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
321        match prim {
322            1 => Self::PartialSet,
323            2 => Self::Internal,
324            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
325        }
326    }
327
328    #[inline]
329    pub fn unknown() -> Self {
330        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
331    }
332
333    #[inline]
334    pub const fn into_primitive(self) -> u32 {
335        match self {
336            Self::PartialSet => 1,
337            Self::Internal => 2,
338            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
339        }
340    }
341
342    #[inline]
343    pub fn is_unknown(&self) -> bool {
344        match self {
345            Self::__SourceBreaking { unknown_ordinal: _ } => true,
346            _ => false,
347        }
348    }
349}
350
351#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
352#[repr(u32)]
353pub enum WriteError {
354    /// The URL is not a known eager package.
355    UnknownUrl = 1,
356    /// The CUP data associated with the eager package failed verification.
357    Verification = 2,
358    /// Downloading the eager package failed.
359    Download = 3,
360    /// Writing the CUP data to storage failed.
361    Storage = 4,
362}
363
364impl WriteError {
365    #[inline]
366    pub fn from_primitive(prim: u32) -> Option<Self> {
367        match prim {
368            1 => Some(Self::UnknownUrl),
369            2 => Some(Self::Verification),
370            3 => Some(Self::Download),
371            4 => Some(Self::Storage),
372            _ => None,
373        }
374    }
375
376    #[inline]
377    pub const fn into_primitive(self) -> u32 {
378        self as u32
379    }
380
381    #[deprecated = "Strict enums should not use `is_unknown`"]
382    #[inline]
383    pub fn is_unknown(&self) -> bool {
384        false
385    }
386}
387
388/// A content-addressed merkle root that describes an artifact that is tracked by the
389/// packaging system.
390#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
391#[repr(C)]
392pub struct BlobId {
393    pub merkle_root: [u8; 32],
394}
395
396impl fidl::Persistable for BlobId {}
397
398#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
399pub struct BlobIdIteratorNextResponse {
400    pub blobs: Vec<BlobId>,
401}
402
403impl fidl::Persistable for BlobIdIteratorNextResponse {}
404
405/// A tuple of the content-addressed merkle root for an artifact, along with that
406/// artifact's length in bytes.
407#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
408#[repr(C)]
409pub struct BlobInfo {
410    pub blob_id: BlobId,
411    pub length: u64,
412}
413
414impl fidl::Persistable for BlobInfo {}
415
416#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
417pub struct BlobInfoIteratorNextResponse {
418    pub blobs: Vec<BlobInfo>,
419}
420
421impl fidl::Persistable for BlobInfoIteratorNextResponse {}
422
423#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
424pub struct CupGetInfoRequest {
425    /// The eager package URL, must be unpinned.
426    pub url: PackageUrl,
427}
428
429impl fidl::Persistable for CupGetInfoRequest {}
430
431#[derive(Clone, Debug, PartialEq)]
432pub struct CupWriteRequest {
433    /// The pinned eager package URL from Omaha, must appear in CUP data.
434    pub url: PackageUrl,
435    /// The CUP data from the update check.
436    pub cup: CupData,
437}
438
439impl fidl::Persistable for CupWriteRequest {}
440
441#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
442pub struct CupGetInfoResponse {
443    pub version: String,
444    pub channel: String,
445}
446
447impl fidl::Persistable for CupGetInfoResponse {}
448
449#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
450pub struct FontResolverResolveRequest {
451    pub package_url: String,
452    pub directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
453}
454
455impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
456    for FontResolverResolveRequest
457{
458}
459
460#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
461#[repr(C)]
462pub struct NeededBlobsBlobWrittenRequest {
463    pub blob_id: BlobId,
464}
465
466impl fidl::Persistable for NeededBlobsBlobWrittenRequest {}
467
468#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
469pub struct NeededBlobsGetMissingBlobsRequest {
470    pub iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
471}
472
473impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
474    for NeededBlobsGetMissingBlobsRequest
475{
476}
477
478#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
479#[repr(C)]
480pub struct NeededBlobsOpenBlobRequest {
481    pub blob_id: BlobId,
482}
483
484impl fidl::Persistable for NeededBlobsOpenBlobRequest {}
485
486#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
487pub struct NeededBlobsOpenBlobResponse {
488    pub writer: Option<Box<BlobWriter>>,
489}
490
491impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
492    for NeededBlobsOpenBlobResponse
493{
494}
495
496#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
497pub struct NeededBlobsOpenMetaBlobResponse {
498    pub writer: Option<Box<BlobWriter>>,
499}
500
501impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
502    for NeededBlobsOpenMetaBlobResponse
503{
504}
505
506#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
507pub struct PackageCacheBasePackageIndexRequest {
508    pub iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
509}
510
511impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
512    for PackageCacheBasePackageIndexRequest
513{
514}
515
516#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
517pub struct PackageCacheCachePackageIndexRequest {
518    pub iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
519}
520
521impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
522    for PackageCacheCachePackageIndexRequest
523{
524}
525
526#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
527pub struct PackageCacheGetRequest {
528    pub meta_far_blob: BlobInfo,
529    pub gc_protection: GcProtection,
530    pub needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
531    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
532}
533
534impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PackageCacheGetRequest {}
535
536#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
537pub struct PackageCacheGetSubpackageRequest {
538    pub superpackage: BlobId,
539    pub subpackage: PackageUrl,
540    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
541}
542
543impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
544    for PackageCacheGetSubpackageRequest
545{
546}
547
548#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
549pub struct PackageCacheSetUpgradableUrlsRequest {
550    pub pinned_urls: Vec<PackageUrl>,
551}
552
553impl fidl::Persistable for PackageCacheSetUpgradableUrlsRequest {}
554
555/// A single entry in the package index.
556#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
557pub struct PackageIndexEntry {
558    pub package_url: PackageUrl,
559    pub meta_far_blob_id: BlobId,
560}
561
562impl fidl::Persistable for PackageIndexEntry {}
563
564#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
565pub struct PackageIndexIteratorNextResponse {
566    pub entries: Vec<PackageIndexEntry>,
567}
568
569impl fidl::Persistable for PackageIndexIteratorNextResponse {}
570
571#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
572pub struct PackageResolverGetHashRequest {
573    pub package_url: PackageUrl,
574}
575
576impl fidl::Persistable for PackageResolverGetHashRequest {}
577
578#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
579pub struct PackageResolverResolveRequest {
580    pub package_url: String,
581    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
582}
583
584impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
585    for PackageResolverResolveRequest
586{
587}
588
589#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
590pub struct PackageResolverResolveWithContextRequest {
591    pub package_url: String,
592    pub context: ResolutionContext,
593    pub dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
594}
595
596impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
597    for PackageResolverResolveWithContextRequest
598{
599}
600
601#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
602#[repr(C)]
603pub struct PackageResolverGetHashResponse {
604    pub meta_far_blob_id: BlobId,
605}
606
607impl fidl::Persistable for PackageResolverGetHashResponse {}
608
609#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
610pub struct PackageResolverResolveWithContextResponse {
611    pub resolved_context: ResolutionContext,
612}
613
614impl fidl::Persistable for PackageResolverResolveWithContextResponse {}
615
616#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
617pub struct PackageResolverResolveResponse {
618    pub resolved_context: ResolutionContext,
619}
620
621impl fidl::Persistable for PackageResolverResolveResponse {}
622
623/// A fuchsia-pkg:// URL indicating a package.
624/// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package_identity
625#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
626pub struct PackageUrl {
627    pub url: String,
628}
629
630impl fidl::Persistable for PackageUrl {}
631
632#[derive(Clone, Debug, PartialEq)]
633pub struct RepositoryIteratorNextResponse {
634    pub repos: Vec<RepositoryConfig>,
635}
636
637impl fidl::Persistable for RepositoryIteratorNextResponse {}
638
639#[derive(Clone, Debug, PartialEq)]
640pub struct RepositoryManagerAddMirrorRequest {
641    pub repo_url: String,
642    pub mirror: MirrorConfig,
643}
644
645impl fidl::Persistable for RepositoryManagerAddMirrorRequest {}
646
647#[derive(Clone, Debug, PartialEq)]
648pub struct RepositoryManagerAddRequest {
649    pub repo: RepositoryConfig,
650}
651
652impl fidl::Persistable for RepositoryManagerAddRequest {}
653
654#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
655pub struct RepositoryManagerListRequest {
656    pub iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
657}
658
659impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
660    for RepositoryManagerListRequest
661{
662}
663
664#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
665pub struct RepositoryManagerRemoveMirrorRequest {
666    pub repo_url: String,
667    pub mirror_url: String,
668}
669
670impl fidl::Persistable for RepositoryManagerRemoveMirrorRequest {}
671
672#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
673pub struct RepositoryManagerRemoveRequest {
674    pub repo_url: String,
675}
676
677impl fidl::Persistable for RepositoryManagerRemoveRequest {}
678
679/// A fuchsia-pkg:// URL indicating a repository.
680/// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#repository_identity
681#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
682pub struct RepositoryUrl {
683    pub url: String,
684}
685
686impl fidl::Persistable for RepositoryUrl {}
687
688/// A package resolution context, used when resolving package URLs relative to
689/// another package.
690#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
691pub struct ResolutionContext {
692    pub bytes: Vec<u8>,
693}
694
695impl fidl::Persistable for ResolutionContext {}
696
697#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
698pub struct RetainedPackagesReplaceRequest {
699    pub iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
700}
701
702impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
703    for RetainedPackagesReplaceRequest
704{
705}
706
707#[derive(Clone, Debug, Default, PartialEq)]
708pub struct CupData {
709    /// Omaha request json
710    pub request: Option<Vec<u8>>,
711    /// The public key id
712    pub key_id: Option<u64>,
713    /// ECDSA nonce.
714    pub nonce: Option<[u8; 32]>,
715    /// Omaha response json
716    pub response: Option<Vec<u8>>,
717    /// DER encoded ECDSA signature
718    pub signature: Option<Vec<u8>>,
719    #[doc(hidden)]
720    pub __source_breaking: fidl::marker::SourceBreaking,
721}
722
723impl fidl::Persistable for CupData {}
724
725/// The configuration necessary to connect to a mirror.
726#[derive(Clone, Debug, Default, PartialEq)]
727pub struct MirrorConfig {
728    /// The base URL of the TUF metadata on this mirror. Required.
729    pub mirror_url: Option<String>,
730    /// Whether or not to automatically monitor the mirror for updates. Required.
731    pub subscribe: Option<bool>,
732    /// The URL where blobs from this mirror should be fetched.  Optional.
733    /// If absent presumed to be `mirror_url + "/blobs"`.
734    pub blob_mirror_url: Option<String>,
735    #[doc(hidden)]
736    pub __source_breaking: fidl::marker::SourceBreaking,
737}
738
739impl fidl::Persistable for MirrorConfig {}
740
741/// The configuration necessary to connect to a repository and its mirrors.
742#[derive(Clone, Debug, Default, PartialEq)]
743pub struct RepositoryConfig {
744    /// A fuchsia-pkg URL identifying the repository. Required.
745    ///
746    /// Example: fuchsia-pkg://example.com/
747    pub repo_url: Option<String>,
748    /// A vector of public keys that have signed the initial trusted root
749    /// metadata. Required.
750    ///
751    /// These keys must match one of the trusted keys known to the system.
752    pub root_keys: Option<Vec<RepositoryKeyConfig>>,
753    /// The repository mirrors that serve the package contents. Required.
754    pub mirrors: Option<Vec<MirrorConfig>>,
755    /// The initial trusted root metadata version. Optional, if absent presumed
756    /// to be 1.
757    ///
758    /// This value describes the initial root metadata version the resolver will
759    /// fetch to initialize trust, once it's signatures has been verified by the
760    /// `root_keys`. It will then walk the chain of N+1, N+2, and etc to the
761    /// latest version before the resolver fetches any targets.
762    ///
763    /// It is recommended that this `root_version` number and `root_keys ` are
764    /// kept reasonably in sync with the most recent published version of the
765    /// root metadata, as that avoids the risk of an old and unused root key
766    /// being used to compromise resolvers during the trust initialization.
767    pub root_version: Option<u32>,
768    /// The number of `root_keys` that need to have signed the root metadata for it
769    /// to be considered trusted. This value must be greater than or equal to 1.
770    /// Optional, if absent presumed to be 1.
771    pub root_threshold: Option<u32>,
772    /// Whether the package resolver should check attached storage for blobs and
773    /// repository metadata. Optional, if absent presumed to be false.
774    pub use_local_mirror: Option<bool>,
775    /// Controls how repository metadata is persisted across reboots. Optional, if absent presumed
776    /// to be EPHEMERAL.
777    pub storage_type: Option<RepositoryStorageType>,
778    #[doc(hidden)]
779    pub __source_breaking: fidl::marker::SourceBreaking,
780}
781
782impl fidl::Persistable for RepositoryConfig {}
783
784/// Used to write a blob to the underlying storage.
785#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
786pub enum BlobWriter {
787    /// To write a blob with `file`:
788    ///   1. If the blob is uncompressed, use `fuchsia.io/File.Resize` to set
789    ///      the blob's uncompressed size.
790    ///   2. Use `fuchsia.io/File.Write` to write the blob's contents from
791    ///      start to finish (seeks are not supported).
792    /// A corrupt blob is indicated by a `Write()` (usually the final write),
793    /// failing with `ZX_ERR_IO_DATA_INTEGRITY`.
794    File(fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>),
795    /// To write a blob with `writer`, follow the instructions on the
796    /// `fuchsia.fxfs.BlobWriter` protocol.
797    Writer(fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>),
798}
799
800impl BlobWriter {
801    #[inline]
802    pub fn ordinal(&self) -> u64 {
803        match *self {
804            Self::File(_) => 1,
805            Self::Writer(_) => 2,
806        }
807    }
808
809    #[deprecated = "Strict unions should not use `is_unknown`"]
810    #[inline]
811    pub fn is_unknown(&self) -> bool {
812        false
813    }
814}
815
816impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlobWriter {}
817
818/// The keys used by the repository to authenticate its packages.
819///
820/// The only supported algorithm at the moment is ed25519.
821#[derive(Clone, Debug)]
822pub enum RepositoryKeyConfig {
823    /// The raw ed25519 public key as binary data.
824    Ed25519Key(Vec<u8>),
825    #[doc(hidden)]
826    __SourceBreaking { unknown_ordinal: u64 },
827}
828
829/// Pattern that matches an unknown `RepositoryKeyConfig` member.
830#[macro_export]
831macro_rules! RepositoryKeyConfigUnknown {
832    () => {
833        _
834    };
835}
836
837// Custom PartialEq so that unknown variants are not equal to themselves.
838impl PartialEq for RepositoryKeyConfig {
839    fn eq(&self, other: &Self) -> bool {
840        match (self, other) {
841            (Self::Ed25519Key(x), Self::Ed25519Key(y)) => *x == *y,
842            _ => false,
843        }
844    }
845}
846
847impl RepositoryKeyConfig {
848    #[inline]
849    pub fn ordinal(&self) -> u64 {
850        match *self {
851            Self::Ed25519Key(_) => 1,
852            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
853        }
854    }
855
856    #[inline]
857    pub fn unknown_variant_for_testing() -> Self {
858        Self::__SourceBreaking { unknown_ordinal: 0 }
859    }
860
861    #[inline]
862    pub fn is_unknown(&self) -> bool {
863        match self {
864            Self::__SourceBreaking { .. } => true,
865            _ => false,
866        }
867    }
868}
869
870impl fidl::Persistable for RepositoryKeyConfig {}
871
872#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
873pub struct BlobIdIteratorMarker;
874
875impl fidl::endpoints::ProtocolMarker for BlobIdIteratorMarker {
876    type Proxy = BlobIdIteratorProxy;
877    type RequestStream = BlobIdIteratorRequestStream;
878    #[cfg(target_os = "fuchsia")]
879    type SynchronousProxy = BlobIdIteratorSynchronousProxy;
880
881    const DEBUG_NAME: &'static str = "(anonymous) BlobIdIterator";
882}
883
884pub trait BlobIdIteratorProxyInterface: Send + Sync {
885    type NextResponseFut: std::future::Future<Output = Result<Vec<BlobId>, fidl::Error>> + Send;
886    fn r#next(&self) -> Self::NextResponseFut;
887}
888#[derive(Debug)]
889#[cfg(target_os = "fuchsia")]
890pub struct BlobIdIteratorSynchronousProxy {
891    client: fidl::client::sync::Client,
892}
893
894#[cfg(target_os = "fuchsia")]
895impl fidl::endpoints::SynchronousProxy for BlobIdIteratorSynchronousProxy {
896    type Proxy = BlobIdIteratorProxy;
897    type Protocol = BlobIdIteratorMarker;
898
899    fn from_channel(inner: fidl::Channel) -> Self {
900        Self::new(inner)
901    }
902
903    fn into_channel(self) -> fidl::Channel {
904        self.client.into_channel()
905    }
906
907    fn as_channel(&self) -> &fidl::Channel {
908        self.client.as_channel()
909    }
910}
911
912#[cfg(target_os = "fuchsia")]
913impl BlobIdIteratorSynchronousProxy {
914    pub fn new(channel: fidl::Channel) -> Self {
915        let protocol_name = <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
916        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
917    }
918
919    pub fn into_channel(self) -> fidl::Channel {
920        self.client.into_channel()
921    }
922
923    /// Waits until an event arrives and returns it. It is safe for other
924    /// threads to make concurrent requests while waiting for an event.
925    pub fn wait_for_event(
926        &self,
927        deadline: zx::MonotonicInstant,
928    ) -> Result<BlobIdIteratorEvent, fidl::Error> {
929        BlobIdIteratorEvent::decode(self.client.wait_for_event(deadline)?)
930    }
931
932    /// Responds with the next chunk of blob IDs. When the iterator is
933    /// exhausted, responds with an empty vector and closes the connection.
934    ///
935    /// - response `blobs` the next chunk of blob IDs.
936    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<BlobId>, fidl::Error> {
937        let _response =
938            self.client.send_query::<fidl::encoding::EmptyPayload, BlobIdIteratorNextResponse>(
939                (),
940                0x5eb0af0daeb8f537,
941                fidl::encoding::DynamicFlags::empty(),
942                ___deadline,
943            )?;
944        Ok(_response.blobs)
945    }
946}
947
948#[derive(Debug, Clone)]
949pub struct BlobIdIteratorProxy {
950    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
951}
952
953impl fidl::endpoints::Proxy for BlobIdIteratorProxy {
954    type Protocol = BlobIdIteratorMarker;
955
956    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
957        Self::new(inner)
958    }
959
960    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
961        self.client.into_channel().map_err(|client| Self { client })
962    }
963
964    fn as_channel(&self) -> &::fidl::AsyncChannel {
965        self.client.as_channel()
966    }
967}
968
969impl BlobIdIteratorProxy {
970    /// Create a new Proxy for fuchsia.pkg/BlobIdIterator.
971    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
972        let protocol_name = <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
973        Self { client: fidl::client::Client::new(channel, protocol_name) }
974    }
975
976    /// Get a Stream of events from the remote end of the protocol.
977    ///
978    /// # Panics
979    ///
980    /// Panics if the event stream was already taken.
981    pub fn take_event_stream(&self) -> BlobIdIteratorEventStream {
982        BlobIdIteratorEventStream { event_receiver: self.client.take_event_receiver() }
983    }
984
985    /// Responds with the next chunk of blob IDs. When the iterator is
986    /// exhausted, responds with an empty vector and closes the connection.
987    ///
988    /// - response `blobs` the next chunk of blob IDs.
989    pub fn r#next(
990        &self,
991    ) -> fidl::client::QueryResponseFut<Vec<BlobId>, fidl::encoding::DefaultFuchsiaResourceDialect>
992    {
993        BlobIdIteratorProxyInterface::r#next(self)
994    }
995}
996
997impl BlobIdIteratorProxyInterface for BlobIdIteratorProxy {
998    type NextResponseFut =
999        fidl::client::QueryResponseFut<Vec<BlobId>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1000    fn r#next(&self) -> Self::NextResponseFut {
1001        fn _decode(
1002            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1003        ) -> Result<Vec<BlobId>, fidl::Error> {
1004            let _response = fidl::client::decode_transaction_body::<
1005                BlobIdIteratorNextResponse,
1006                fidl::encoding::DefaultFuchsiaResourceDialect,
1007                0x5eb0af0daeb8f537,
1008            >(_buf?)?;
1009            Ok(_response.blobs)
1010        }
1011        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<BlobId>>(
1012            (),
1013            0x5eb0af0daeb8f537,
1014            fidl::encoding::DynamicFlags::empty(),
1015            _decode,
1016        )
1017    }
1018}
1019
1020pub struct BlobIdIteratorEventStream {
1021    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1022}
1023
1024impl std::marker::Unpin for BlobIdIteratorEventStream {}
1025
1026impl futures::stream::FusedStream for BlobIdIteratorEventStream {
1027    fn is_terminated(&self) -> bool {
1028        self.event_receiver.is_terminated()
1029    }
1030}
1031
1032impl futures::Stream for BlobIdIteratorEventStream {
1033    type Item = Result<BlobIdIteratorEvent, fidl::Error>;
1034
1035    fn poll_next(
1036        mut self: std::pin::Pin<&mut Self>,
1037        cx: &mut std::task::Context<'_>,
1038    ) -> std::task::Poll<Option<Self::Item>> {
1039        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1040            &mut self.event_receiver,
1041            cx
1042        )?) {
1043            Some(buf) => std::task::Poll::Ready(Some(BlobIdIteratorEvent::decode(buf))),
1044            None => std::task::Poll::Ready(None),
1045        }
1046    }
1047}
1048
1049#[derive(Debug)]
1050pub enum BlobIdIteratorEvent {}
1051
1052impl BlobIdIteratorEvent {
1053    /// Decodes a message buffer as a [`BlobIdIteratorEvent`].
1054    fn decode(
1055        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1056    ) -> Result<BlobIdIteratorEvent, fidl::Error> {
1057        let (bytes, _handles) = buf.split_mut();
1058        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1059        debug_assert_eq!(tx_header.tx_id, 0);
1060        match tx_header.ordinal {
1061            _ => Err(fidl::Error::UnknownOrdinal {
1062                ordinal: tx_header.ordinal,
1063                protocol_name:
1064                    <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1065            }),
1066        }
1067    }
1068}
1069
1070/// A Stream of incoming requests for fuchsia.pkg/BlobIdIterator.
1071pub struct BlobIdIteratorRequestStream {
1072    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1073    is_terminated: bool,
1074}
1075
1076impl std::marker::Unpin for BlobIdIteratorRequestStream {}
1077
1078impl futures::stream::FusedStream for BlobIdIteratorRequestStream {
1079    fn is_terminated(&self) -> bool {
1080        self.is_terminated
1081    }
1082}
1083
1084impl fidl::endpoints::RequestStream for BlobIdIteratorRequestStream {
1085    type Protocol = BlobIdIteratorMarker;
1086    type ControlHandle = BlobIdIteratorControlHandle;
1087
1088    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1089        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1090    }
1091
1092    fn control_handle(&self) -> Self::ControlHandle {
1093        BlobIdIteratorControlHandle { inner: self.inner.clone() }
1094    }
1095
1096    fn into_inner(
1097        self,
1098    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1099    {
1100        (self.inner, self.is_terminated)
1101    }
1102
1103    fn from_inner(
1104        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1105        is_terminated: bool,
1106    ) -> Self {
1107        Self { inner, is_terminated }
1108    }
1109}
1110
1111impl futures::Stream for BlobIdIteratorRequestStream {
1112    type Item = Result<BlobIdIteratorRequest, fidl::Error>;
1113
1114    fn poll_next(
1115        mut self: std::pin::Pin<&mut Self>,
1116        cx: &mut std::task::Context<'_>,
1117    ) -> std::task::Poll<Option<Self::Item>> {
1118        let this = &mut *self;
1119        if this.inner.check_shutdown(cx) {
1120            this.is_terminated = true;
1121            return std::task::Poll::Ready(None);
1122        }
1123        if this.is_terminated {
1124            panic!("polled BlobIdIteratorRequestStream after completion");
1125        }
1126        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1127            |bytes, handles| {
1128                match this.inner.channel().read_etc(cx, bytes, handles) {
1129                    std::task::Poll::Ready(Ok(())) => {}
1130                    std::task::Poll::Pending => return std::task::Poll::Pending,
1131                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1132                        this.is_terminated = true;
1133                        return std::task::Poll::Ready(None);
1134                    }
1135                    std::task::Poll::Ready(Err(e)) => {
1136                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1137                            e.into(),
1138                        ))))
1139                    }
1140                }
1141
1142                // A message has been received from the channel
1143                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1144
1145                std::task::Poll::Ready(Some(match header.ordinal {
1146                    0x5eb0af0daeb8f537 => {
1147                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1148                        let mut req = fidl::new_empty!(
1149                            fidl::encoding::EmptyPayload,
1150                            fidl::encoding::DefaultFuchsiaResourceDialect
1151                        );
1152                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1153                        let control_handle =
1154                            BlobIdIteratorControlHandle { inner: this.inner.clone() };
1155                        Ok(BlobIdIteratorRequest::Next {
1156                            responder: BlobIdIteratorNextResponder {
1157                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1158                                tx_id: header.tx_id,
1159                            },
1160                        })
1161                    }
1162                    _ => Err(fidl::Error::UnknownOrdinal {
1163                        ordinal: header.ordinal,
1164                        protocol_name:
1165                            <BlobIdIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1166                    }),
1167                }))
1168            },
1169        )
1170    }
1171}
1172
1173/// A chunked iterator of blob IDs, allowing transfer of more blob IDs that can
1174/// fit in a single FIDL message.
1175#[derive(Debug)]
1176pub enum BlobIdIteratorRequest {
1177    /// Responds with the next chunk of blob IDs. When the iterator is
1178    /// exhausted, responds with an empty vector and closes the connection.
1179    ///
1180    /// - response `blobs` the next chunk of blob IDs.
1181    Next { responder: BlobIdIteratorNextResponder },
1182}
1183
1184impl BlobIdIteratorRequest {
1185    #[allow(irrefutable_let_patterns)]
1186    pub fn into_next(self) -> Option<(BlobIdIteratorNextResponder)> {
1187        if let BlobIdIteratorRequest::Next { responder } = self {
1188            Some((responder))
1189        } else {
1190            None
1191        }
1192    }
1193
1194    /// Name of the method defined in FIDL
1195    pub fn method_name(&self) -> &'static str {
1196        match *self {
1197            BlobIdIteratorRequest::Next { .. } => "next",
1198        }
1199    }
1200}
1201
1202#[derive(Debug, Clone)]
1203pub struct BlobIdIteratorControlHandle {
1204    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1205}
1206
1207impl fidl::endpoints::ControlHandle for BlobIdIteratorControlHandle {
1208    fn shutdown(&self) {
1209        self.inner.shutdown()
1210    }
1211    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1212        self.inner.shutdown_with_epitaph(status)
1213    }
1214
1215    fn is_closed(&self) -> bool {
1216        self.inner.channel().is_closed()
1217    }
1218    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1219        self.inner.channel().on_closed()
1220    }
1221
1222    #[cfg(target_os = "fuchsia")]
1223    fn signal_peer(
1224        &self,
1225        clear_mask: zx::Signals,
1226        set_mask: zx::Signals,
1227    ) -> Result<(), zx_status::Status> {
1228        use fidl::Peered;
1229        self.inner.channel().signal_peer(clear_mask, set_mask)
1230    }
1231}
1232
1233impl BlobIdIteratorControlHandle {}
1234
1235#[must_use = "FIDL methods require a response to be sent"]
1236#[derive(Debug)]
1237pub struct BlobIdIteratorNextResponder {
1238    control_handle: std::mem::ManuallyDrop<BlobIdIteratorControlHandle>,
1239    tx_id: u32,
1240}
1241
1242/// Set the the channel to be shutdown (see [`BlobIdIteratorControlHandle::shutdown`])
1243/// if the responder is dropped without sending a response, so that the client
1244/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1245impl std::ops::Drop for BlobIdIteratorNextResponder {
1246    fn drop(&mut self) {
1247        self.control_handle.shutdown();
1248        // Safety: drops once, never accessed again
1249        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1250    }
1251}
1252
1253impl fidl::endpoints::Responder for BlobIdIteratorNextResponder {
1254    type ControlHandle = BlobIdIteratorControlHandle;
1255
1256    fn control_handle(&self) -> &BlobIdIteratorControlHandle {
1257        &self.control_handle
1258    }
1259
1260    fn drop_without_shutdown(mut self) {
1261        // Safety: drops once, never accessed again due to mem::forget
1262        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1263        // Prevent Drop from running (which would shut down the channel)
1264        std::mem::forget(self);
1265    }
1266}
1267
1268impl BlobIdIteratorNextResponder {
1269    /// Sends a response to the FIDL transaction.
1270    ///
1271    /// Sets the channel to shutdown if an error occurs.
1272    pub fn send(self, mut blobs: &[BlobId]) -> Result<(), fidl::Error> {
1273        let _result = self.send_raw(blobs);
1274        if _result.is_err() {
1275            self.control_handle.shutdown();
1276        }
1277        self.drop_without_shutdown();
1278        _result
1279    }
1280
1281    /// Similar to "send" but does not shutdown the channel if an error occurs.
1282    pub fn send_no_shutdown_on_err(self, mut blobs: &[BlobId]) -> Result<(), fidl::Error> {
1283        let _result = self.send_raw(blobs);
1284        self.drop_without_shutdown();
1285        _result
1286    }
1287
1288    fn send_raw(&self, mut blobs: &[BlobId]) -> Result<(), fidl::Error> {
1289        self.control_handle.inner.send::<BlobIdIteratorNextResponse>(
1290            (blobs,),
1291            self.tx_id,
1292            0x5eb0af0daeb8f537,
1293            fidl::encoding::DynamicFlags::empty(),
1294        )
1295    }
1296}
1297
1298#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1299pub struct BlobInfoIteratorMarker;
1300
1301impl fidl::endpoints::ProtocolMarker for BlobInfoIteratorMarker {
1302    type Proxy = BlobInfoIteratorProxy;
1303    type RequestStream = BlobInfoIteratorRequestStream;
1304    #[cfg(target_os = "fuchsia")]
1305    type SynchronousProxy = BlobInfoIteratorSynchronousProxy;
1306
1307    const DEBUG_NAME: &'static str = "(anonymous) BlobInfoIterator";
1308}
1309
1310pub trait BlobInfoIteratorProxyInterface: Send + Sync {
1311    type NextResponseFut: std::future::Future<Output = Result<Vec<BlobInfo>, fidl::Error>> + Send;
1312    fn r#next(&self) -> Self::NextResponseFut;
1313}
1314#[derive(Debug)]
1315#[cfg(target_os = "fuchsia")]
1316pub struct BlobInfoIteratorSynchronousProxy {
1317    client: fidl::client::sync::Client,
1318}
1319
1320#[cfg(target_os = "fuchsia")]
1321impl fidl::endpoints::SynchronousProxy for BlobInfoIteratorSynchronousProxy {
1322    type Proxy = BlobInfoIteratorProxy;
1323    type Protocol = BlobInfoIteratorMarker;
1324
1325    fn from_channel(inner: fidl::Channel) -> Self {
1326        Self::new(inner)
1327    }
1328
1329    fn into_channel(self) -> fidl::Channel {
1330        self.client.into_channel()
1331    }
1332
1333    fn as_channel(&self) -> &fidl::Channel {
1334        self.client.as_channel()
1335    }
1336}
1337
1338#[cfg(target_os = "fuchsia")]
1339impl BlobInfoIteratorSynchronousProxy {
1340    pub fn new(channel: fidl::Channel) -> Self {
1341        let protocol_name = <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1342        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1343    }
1344
1345    pub fn into_channel(self) -> fidl::Channel {
1346        self.client.into_channel()
1347    }
1348
1349    /// Waits until an event arrives and returns it. It is safe for other
1350    /// threads to make concurrent requests while waiting for an event.
1351    pub fn wait_for_event(
1352        &self,
1353        deadline: zx::MonotonicInstant,
1354    ) -> Result<BlobInfoIteratorEvent, fidl::Error> {
1355        BlobInfoIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1356    }
1357
1358    /// Responds with the next chunk of [`BlobInfo`]s. When the iterator is
1359    /// exhausted, responds with an empty vector and closes the connection.
1360    ///
1361    /// - response `blobs` the next chunk of [`BlobInfo`]s.
1362    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<BlobInfo>, fidl::Error> {
1363        let _response =
1364            self.client.send_query::<fidl::encoding::EmptyPayload, BlobInfoIteratorNextResponse>(
1365                (),
1366                0x2b889489a59b6970,
1367                fidl::encoding::DynamicFlags::empty(),
1368                ___deadline,
1369            )?;
1370        Ok(_response.blobs)
1371    }
1372}
1373
1374#[derive(Debug, Clone)]
1375pub struct BlobInfoIteratorProxy {
1376    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1377}
1378
1379impl fidl::endpoints::Proxy for BlobInfoIteratorProxy {
1380    type Protocol = BlobInfoIteratorMarker;
1381
1382    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1383        Self::new(inner)
1384    }
1385
1386    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1387        self.client.into_channel().map_err(|client| Self { client })
1388    }
1389
1390    fn as_channel(&self) -> &::fidl::AsyncChannel {
1391        self.client.as_channel()
1392    }
1393}
1394
1395impl BlobInfoIteratorProxy {
1396    /// Create a new Proxy for fuchsia.pkg/BlobInfoIterator.
1397    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1398        let protocol_name = <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1399        Self { client: fidl::client::Client::new(channel, protocol_name) }
1400    }
1401
1402    /// Get a Stream of events from the remote end of the protocol.
1403    ///
1404    /// # Panics
1405    ///
1406    /// Panics if the event stream was already taken.
1407    pub fn take_event_stream(&self) -> BlobInfoIteratorEventStream {
1408        BlobInfoIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1409    }
1410
1411    /// Responds with the next chunk of [`BlobInfo`]s. When the iterator is
1412    /// exhausted, responds with an empty vector and closes the connection.
1413    ///
1414    /// - response `blobs` the next chunk of [`BlobInfo`]s.
1415    pub fn r#next(
1416        &self,
1417    ) -> fidl::client::QueryResponseFut<Vec<BlobInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
1418    {
1419        BlobInfoIteratorProxyInterface::r#next(self)
1420    }
1421}
1422
1423impl BlobInfoIteratorProxyInterface for BlobInfoIteratorProxy {
1424    type NextResponseFut = fidl::client::QueryResponseFut<
1425        Vec<BlobInfo>,
1426        fidl::encoding::DefaultFuchsiaResourceDialect,
1427    >;
1428    fn r#next(&self) -> Self::NextResponseFut {
1429        fn _decode(
1430            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1431        ) -> Result<Vec<BlobInfo>, fidl::Error> {
1432            let _response = fidl::client::decode_transaction_body::<
1433                BlobInfoIteratorNextResponse,
1434                fidl::encoding::DefaultFuchsiaResourceDialect,
1435                0x2b889489a59b6970,
1436            >(_buf?)?;
1437            Ok(_response.blobs)
1438        }
1439        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<BlobInfo>>(
1440            (),
1441            0x2b889489a59b6970,
1442            fidl::encoding::DynamicFlags::empty(),
1443            _decode,
1444        )
1445    }
1446}
1447
1448pub struct BlobInfoIteratorEventStream {
1449    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1450}
1451
1452impl std::marker::Unpin for BlobInfoIteratorEventStream {}
1453
1454impl futures::stream::FusedStream for BlobInfoIteratorEventStream {
1455    fn is_terminated(&self) -> bool {
1456        self.event_receiver.is_terminated()
1457    }
1458}
1459
1460impl futures::Stream for BlobInfoIteratorEventStream {
1461    type Item = Result<BlobInfoIteratorEvent, fidl::Error>;
1462
1463    fn poll_next(
1464        mut self: std::pin::Pin<&mut Self>,
1465        cx: &mut std::task::Context<'_>,
1466    ) -> std::task::Poll<Option<Self::Item>> {
1467        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1468            &mut self.event_receiver,
1469            cx
1470        )?) {
1471            Some(buf) => std::task::Poll::Ready(Some(BlobInfoIteratorEvent::decode(buf))),
1472            None => std::task::Poll::Ready(None),
1473        }
1474    }
1475}
1476
1477#[derive(Debug)]
1478pub enum BlobInfoIteratorEvent {}
1479
1480impl BlobInfoIteratorEvent {
1481    /// Decodes a message buffer as a [`BlobInfoIteratorEvent`].
1482    fn decode(
1483        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1484    ) -> Result<BlobInfoIteratorEvent, fidl::Error> {
1485        let (bytes, _handles) = buf.split_mut();
1486        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1487        debug_assert_eq!(tx_header.tx_id, 0);
1488        match tx_header.ordinal {
1489            _ => Err(fidl::Error::UnknownOrdinal {
1490                ordinal: tx_header.ordinal,
1491                protocol_name:
1492                    <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1493            }),
1494        }
1495    }
1496}
1497
1498/// A Stream of incoming requests for fuchsia.pkg/BlobInfoIterator.
1499pub struct BlobInfoIteratorRequestStream {
1500    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1501    is_terminated: bool,
1502}
1503
1504impl std::marker::Unpin for BlobInfoIteratorRequestStream {}
1505
1506impl futures::stream::FusedStream for BlobInfoIteratorRequestStream {
1507    fn is_terminated(&self) -> bool {
1508        self.is_terminated
1509    }
1510}
1511
1512impl fidl::endpoints::RequestStream for BlobInfoIteratorRequestStream {
1513    type Protocol = BlobInfoIteratorMarker;
1514    type ControlHandle = BlobInfoIteratorControlHandle;
1515
1516    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1517        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1518    }
1519
1520    fn control_handle(&self) -> Self::ControlHandle {
1521        BlobInfoIteratorControlHandle { inner: self.inner.clone() }
1522    }
1523
1524    fn into_inner(
1525        self,
1526    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1527    {
1528        (self.inner, self.is_terminated)
1529    }
1530
1531    fn from_inner(
1532        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1533        is_terminated: bool,
1534    ) -> Self {
1535        Self { inner, is_terminated }
1536    }
1537}
1538
1539impl futures::Stream for BlobInfoIteratorRequestStream {
1540    type Item = Result<BlobInfoIteratorRequest, fidl::Error>;
1541
1542    fn poll_next(
1543        mut self: std::pin::Pin<&mut Self>,
1544        cx: &mut std::task::Context<'_>,
1545    ) -> std::task::Poll<Option<Self::Item>> {
1546        let this = &mut *self;
1547        if this.inner.check_shutdown(cx) {
1548            this.is_terminated = true;
1549            return std::task::Poll::Ready(None);
1550        }
1551        if this.is_terminated {
1552            panic!("polled BlobInfoIteratorRequestStream after completion");
1553        }
1554        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1555            |bytes, handles| {
1556                match this.inner.channel().read_etc(cx, bytes, handles) {
1557                    std::task::Poll::Ready(Ok(())) => {}
1558                    std::task::Poll::Pending => return std::task::Poll::Pending,
1559                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1560                        this.is_terminated = true;
1561                        return std::task::Poll::Ready(None);
1562                    }
1563                    std::task::Poll::Ready(Err(e)) => {
1564                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1565                            e.into(),
1566                        ))))
1567                    }
1568                }
1569
1570                // A message has been received from the channel
1571                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1572
1573                std::task::Poll::Ready(Some(match header.ordinal {
1574                    0x2b889489a59b6970 => {
1575                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1576                        let mut req = fidl::new_empty!(
1577                            fidl::encoding::EmptyPayload,
1578                            fidl::encoding::DefaultFuchsiaResourceDialect
1579                        );
1580                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1581                        let control_handle =
1582                            BlobInfoIteratorControlHandle { inner: this.inner.clone() };
1583                        Ok(BlobInfoIteratorRequest::Next {
1584                            responder: BlobInfoIteratorNextResponder {
1585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1586                                tx_id: header.tx_id,
1587                            },
1588                        })
1589                    }
1590                    _ => Err(fidl::Error::UnknownOrdinal {
1591                        ordinal: header.ordinal,
1592                        protocol_name:
1593                            <BlobInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1594                    }),
1595                }))
1596            },
1597        )
1598    }
1599}
1600
1601/// A chunked iterator of [`BlobInfo`], allowing transfer of more [`BlobInfo`]s
1602/// that can fit in a single FIDL message.
1603#[derive(Debug)]
1604pub enum BlobInfoIteratorRequest {
1605    /// Responds with the next chunk of [`BlobInfo`]s. When the iterator is
1606    /// exhausted, responds with an empty vector and closes the connection.
1607    ///
1608    /// - response `blobs` the next chunk of [`BlobInfo`]s.
1609    Next { responder: BlobInfoIteratorNextResponder },
1610}
1611
1612impl BlobInfoIteratorRequest {
1613    #[allow(irrefutable_let_patterns)]
1614    pub fn into_next(self) -> Option<(BlobInfoIteratorNextResponder)> {
1615        if let BlobInfoIteratorRequest::Next { responder } = self {
1616            Some((responder))
1617        } else {
1618            None
1619        }
1620    }
1621
1622    /// Name of the method defined in FIDL
1623    pub fn method_name(&self) -> &'static str {
1624        match *self {
1625            BlobInfoIteratorRequest::Next { .. } => "next",
1626        }
1627    }
1628}
1629
1630#[derive(Debug, Clone)]
1631pub struct BlobInfoIteratorControlHandle {
1632    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1633}
1634
1635impl fidl::endpoints::ControlHandle for BlobInfoIteratorControlHandle {
1636    fn shutdown(&self) {
1637        self.inner.shutdown()
1638    }
1639    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1640        self.inner.shutdown_with_epitaph(status)
1641    }
1642
1643    fn is_closed(&self) -> bool {
1644        self.inner.channel().is_closed()
1645    }
1646    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1647        self.inner.channel().on_closed()
1648    }
1649
1650    #[cfg(target_os = "fuchsia")]
1651    fn signal_peer(
1652        &self,
1653        clear_mask: zx::Signals,
1654        set_mask: zx::Signals,
1655    ) -> Result<(), zx_status::Status> {
1656        use fidl::Peered;
1657        self.inner.channel().signal_peer(clear_mask, set_mask)
1658    }
1659}
1660
1661impl BlobInfoIteratorControlHandle {}
1662
1663#[must_use = "FIDL methods require a response to be sent"]
1664#[derive(Debug)]
1665pub struct BlobInfoIteratorNextResponder {
1666    control_handle: std::mem::ManuallyDrop<BlobInfoIteratorControlHandle>,
1667    tx_id: u32,
1668}
1669
1670/// Set the the channel to be shutdown (see [`BlobInfoIteratorControlHandle::shutdown`])
1671/// if the responder is dropped without sending a response, so that the client
1672/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1673impl std::ops::Drop for BlobInfoIteratorNextResponder {
1674    fn drop(&mut self) {
1675        self.control_handle.shutdown();
1676        // Safety: drops once, never accessed again
1677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1678    }
1679}
1680
1681impl fidl::endpoints::Responder for BlobInfoIteratorNextResponder {
1682    type ControlHandle = BlobInfoIteratorControlHandle;
1683
1684    fn control_handle(&self) -> &BlobInfoIteratorControlHandle {
1685        &self.control_handle
1686    }
1687
1688    fn drop_without_shutdown(mut self) {
1689        // Safety: drops once, never accessed again due to mem::forget
1690        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1691        // Prevent Drop from running (which would shut down the channel)
1692        std::mem::forget(self);
1693    }
1694}
1695
1696impl BlobInfoIteratorNextResponder {
1697    /// Sends a response to the FIDL transaction.
1698    ///
1699    /// Sets the channel to shutdown if an error occurs.
1700    pub fn send(self, mut blobs: &[BlobInfo]) -> Result<(), fidl::Error> {
1701        let _result = self.send_raw(blobs);
1702        if _result.is_err() {
1703            self.control_handle.shutdown();
1704        }
1705        self.drop_without_shutdown();
1706        _result
1707    }
1708
1709    /// Similar to "send" but does not shutdown the channel if an error occurs.
1710    pub fn send_no_shutdown_on_err(self, mut blobs: &[BlobInfo]) -> Result<(), fidl::Error> {
1711        let _result = self.send_raw(blobs);
1712        self.drop_without_shutdown();
1713        _result
1714    }
1715
1716    fn send_raw(&self, mut blobs: &[BlobInfo]) -> Result<(), fidl::Error> {
1717        self.control_handle.inner.send::<BlobInfoIteratorNextResponse>(
1718            (blobs,),
1719            self.tx_id,
1720            0x2b889489a59b6970,
1721            fidl::encoding::DynamicFlags::empty(),
1722        )
1723    }
1724}
1725
1726#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1727pub struct CupMarker;
1728
1729impl fidl::endpoints::ProtocolMarker for CupMarker {
1730    type Proxy = CupProxy;
1731    type RequestStream = CupRequestStream;
1732    #[cfg(target_os = "fuchsia")]
1733    type SynchronousProxy = CupSynchronousProxy;
1734
1735    const DEBUG_NAME: &'static str = "fuchsia.pkg.Cup";
1736}
1737impl fidl::endpoints::DiscoverableProtocolMarker for CupMarker {}
1738pub type CupWriteResult = Result<(), WriteError>;
1739pub type CupGetInfoResult = Result<(String, String), GetInfoError>;
1740
1741pub trait CupProxyInterface: Send + Sync {
1742    type WriteResponseFut: std::future::Future<Output = Result<CupWriteResult, fidl::Error>> + Send;
1743    fn r#write(&self, url: &PackageUrl, cup: &CupData) -> Self::WriteResponseFut;
1744    type GetInfoResponseFut: std::future::Future<Output = Result<CupGetInfoResult, fidl::Error>>
1745        + Send;
1746    fn r#get_info(&self, url: &PackageUrl) -> Self::GetInfoResponseFut;
1747}
1748#[derive(Debug)]
1749#[cfg(target_os = "fuchsia")]
1750pub struct CupSynchronousProxy {
1751    client: fidl::client::sync::Client,
1752}
1753
1754#[cfg(target_os = "fuchsia")]
1755impl fidl::endpoints::SynchronousProxy for CupSynchronousProxy {
1756    type Proxy = CupProxy;
1757    type Protocol = CupMarker;
1758
1759    fn from_channel(inner: fidl::Channel) -> Self {
1760        Self::new(inner)
1761    }
1762
1763    fn into_channel(self) -> fidl::Channel {
1764        self.client.into_channel()
1765    }
1766
1767    fn as_channel(&self) -> &fidl::Channel {
1768        self.client.as_channel()
1769    }
1770}
1771
1772#[cfg(target_os = "fuchsia")]
1773impl CupSynchronousProxy {
1774    pub fn new(channel: fidl::Channel) -> Self {
1775        let protocol_name = <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1776        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1777    }
1778
1779    pub fn into_channel(self) -> fidl::Channel {
1780        self.client.into_channel()
1781    }
1782
1783    /// Waits until an event arrives and returns it. It is safe for other
1784    /// threads to make concurrent requests while waiting for an event.
1785    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<CupEvent, fidl::Error> {
1786        CupEvent::decode(self.client.wait_for_event(deadline)?)
1787    }
1788
1789    /// Resolve the eager package given by the pinned package URL, and write the
1790    /// CUP data to storage.
1791    pub fn r#write(
1792        &self,
1793        mut url: &PackageUrl,
1794        mut cup: &CupData,
1795        ___deadline: zx::MonotonicInstant,
1796    ) -> Result<CupWriteResult, fidl::Error> {
1797        let _response = self.client.send_query::<CupWriteRequest, fidl::encoding::ResultType<
1798            fidl::encoding::EmptyStruct,
1799            WriteError,
1800        >>(
1801            (url, cup),
1802            0x29f30e83bda39c37,
1803            fidl::encoding::DynamicFlags::empty(),
1804            ___deadline,
1805        )?;
1806        Ok(_response.map(|x| x))
1807    }
1808
1809    /// Returns the eager package version and channel of the given package URL.
1810    pub fn r#get_info(
1811        &self,
1812        mut url: &PackageUrl,
1813        ___deadline: zx::MonotonicInstant,
1814    ) -> Result<CupGetInfoResult, fidl::Error> {
1815        let _response = self.client.send_query::<
1816            CupGetInfoRequest,
1817            fidl::encoding::ResultType<CupGetInfoResponse, GetInfoError>,
1818        >(
1819            (url,),
1820            0x5b2cedd887209b9c,
1821            fidl::encoding::DynamicFlags::empty(),
1822            ___deadline,
1823        )?;
1824        Ok(_response.map(|x| (x.version, x.channel)))
1825    }
1826}
1827
1828#[derive(Debug, Clone)]
1829pub struct CupProxy {
1830    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1831}
1832
1833impl fidl::endpoints::Proxy for CupProxy {
1834    type Protocol = CupMarker;
1835
1836    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1837        Self::new(inner)
1838    }
1839
1840    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1841        self.client.into_channel().map_err(|client| Self { client })
1842    }
1843
1844    fn as_channel(&self) -> &::fidl::AsyncChannel {
1845        self.client.as_channel()
1846    }
1847}
1848
1849impl CupProxy {
1850    /// Create a new Proxy for fuchsia.pkg/Cup.
1851    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1852        let protocol_name = <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1853        Self { client: fidl::client::Client::new(channel, protocol_name) }
1854    }
1855
1856    /// Get a Stream of events from the remote end of the protocol.
1857    ///
1858    /// # Panics
1859    ///
1860    /// Panics if the event stream was already taken.
1861    pub fn take_event_stream(&self) -> CupEventStream {
1862        CupEventStream { event_receiver: self.client.take_event_receiver() }
1863    }
1864
1865    /// Resolve the eager package given by the pinned package URL, and write the
1866    /// CUP data to storage.
1867    pub fn r#write(
1868        &self,
1869        mut url: &PackageUrl,
1870        mut cup: &CupData,
1871    ) -> fidl::client::QueryResponseFut<CupWriteResult, fidl::encoding::DefaultFuchsiaResourceDialect>
1872    {
1873        CupProxyInterface::r#write(self, url, cup)
1874    }
1875
1876    /// Returns the eager package version and channel of the given package URL.
1877    pub fn r#get_info(
1878        &self,
1879        mut url: &PackageUrl,
1880    ) -> fidl::client::QueryResponseFut<
1881        CupGetInfoResult,
1882        fidl::encoding::DefaultFuchsiaResourceDialect,
1883    > {
1884        CupProxyInterface::r#get_info(self, url)
1885    }
1886}
1887
1888impl CupProxyInterface for CupProxy {
1889    type WriteResponseFut = fidl::client::QueryResponseFut<
1890        CupWriteResult,
1891        fidl::encoding::DefaultFuchsiaResourceDialect,
1892    >;
1893    fn r#write(&self, mut url: &PackageUrl, mut cup: &CupData) -> Self::WriteResponseFut {
1894        fn _decode(
1895            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1896        ) -> Result<CupWriteResult, fidl::Error> {
1897            let _response = fidl::client::decode_transaction_body::<
1898                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, WriteError>,
1899                fidl::encoding::DefaultFuchsiaResourceDialect,
1900                0x29f30e83bda39c37,
1901            >(_buf?)?;
1902            Ok(_response.map(|x| x))
1903        }
1904        self.client.send_query_and_decode::<CupWriteRequest, CupWriteResult>(
1905            (url, cup),
1906            0x29f30e83bda39c37,
1907            fidl::encoding::DynamicFlags::empty(),
1908            _decode,
1909        )
1910    }
1911
1912    type GetInfoResponseFut = fidl::client::QueryResponseFut<
1913        CupGetInfoResult,
1914        fidl::encoding::DefaultFuchsiaResourceDialect,
1915    >;
1916    fn r#get_info(&self, mut url: &PackageUrl) -> Self::GetInfoResponseFut {
1917        fn _decode(
1918            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1919        ) -> Result<CupGetInfoResult, fidl::Error> {
1920            let _response = fidl::client::decode_transaction_body::<
1921                fidl::encoding::ResultType<CupGetInfoResponse, GetInfoError>,
1922                fidl::encoding::DefaultFuchsiaResourceDialect,
1923                0x5b2cedd887209b9c,
1924            >(_buf?)?;
1925            Ok(_response.map(|x| (x.version, x.channel)))
1926        }
1927        self.client.send_query_and_decode::<CupGetInfoRequest, CupGetInfoResult>(
1928            (url,),
1929            0x5b2cedd887209b9c,
1930            fidl::encoding::DynamicFlags::empty(),
1931            _decode,
1932        )
1933    }
1934}
1935
1936pub struct CupEventStream {
1937    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1938}
1939
1940impl std::marker::Unpin for CupEventStream {}
1941
1942impl futures::stream::FusedStream for CupEventStream {
1943    fn is_terminated(&self) -> bool {
1944        self.event_receiver.is_terminated()
1945    }
1946}
1947
1948impl futures::Stream for CupEventStream {
1949    type Item = Result<CupEvent, fidl::Error>;
1950
1951    fn poll_next(
1952        mut self: std::pin::Pin<&mut Self>,
1953        cx: &mut std::task::Context<'_>,
1954    ) -> std::task::Poll<Option<Self::Item>> {
1955        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1956            &mut self.event_receiver,
1957            cx
1958        )?) {
1959            Some(buf) => std::task::Poll::Ready(Some(CupEvent::decode(buf))),
1960            None => std::task::Poll::Ready(None),
1961        }
1962    }
1963}
1964
1965#[derive(Debug)]
1966pub enum CupEvent {}
1967
1968impl CupEvent {
1969    /// Decodes a message buffer as a [`CupEvent`].
1970    fn decode(
1971        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1972    ) -> Result<CupEvent, fidl::Error> {
1973        let (bytes, _handles) = buf.split_mut();
1974        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1975        debug_assert_eq!(tx_header.tx_id, 0);
1976        match tx_header.ordinal {
1977            _ => Err(fidl::Error::UnknownOrdinal {
1978                ordinal: tx_header.ordinal,
1979                protocol_name: <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1980            }),
1981        }
1982    }
1983}
1984
1985/// A Stream of incoming requests for fuchsia.pkg/Cup.
1986pub struct CupRequestStream {
1987    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1988    is_terminated: bool,
1989}
1990
1991impl std::marker::Unpin for CupRequestStream {}
1992
1993impl futures::stream::FusedStream for CupRequestStream {
1994    fn is_terminated(&self) -> bool {
1995        self.is_terminated
1996    }
1997}
1998
1999impl fidl::endpoints::RequestStream for CupRequestStream {
2000    type Protocol = CupMarker;
2001    type ControlHandle = CupControlHandle;
2002
2003    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2004        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2005    }
2006
2007    fn control_handle(&self) -> Self::ControlHandle {
2008        CupControlHandle { inner: self.inner.clone() }
2009    }
2010
2011    fn into_inner(
2012        self,
2013    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2014    {
2015        (self.inner, self.is_terminated)
2016    }
2017
2018    fn from_inner(
2019        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2020        is_terminated: bool,
2021    ) -> Self {
2022        Self { inner, is_terminated }
2023    }
2024}
2025
2026impl futures::Stream for CupRequestStream {
2027    type Item = Result<CupRequest, fidl::Error>;
2028
2029    fn poll_next(
2030        mut self: std::pin::Pin<&mut Self>,
2031        cx: &mut std::task::Context<'_>,
2032    ) -> std::task::Poll<Option<Self::Item>> {
2033        let this = &mut *self;
2034        if this.inner.check_shutdown(cx) {
2035            this.is_terminated = true;
2036            return std::task::Poll::Ready(None);
2037        }
2038        if this.is_terminated {
2039            panic!("polled CupRequestStream after completion");
2040        }
2041        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2042            |bytes, handles| {
2043                match this.inner.channel().read_etc(cx, bytes, handles) {
2044                    std::task::Poll::Ready(Ok(())) => {}
2045                    std::task::Poll::Pending => return std::task::Poll::Pending,
2046                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2047                        this.is_terminated = true;
2048                        return std::task::Poll::Ready(None);
2049                    }
2050                    std::task::Poll::Ready(Err(e)) => {
2051                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2052                            e.into(),
2053                        ))))
2054                    }
2055                }
2056
2057                // A message has been received from the channel
2058                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2059
2060                std::task::Poll::Ready(Some(match header.ordinal {
2061                    0x29f30e83bda39c37 => {
2062                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2063                        let mut req = fidl::new_empty!(
2064                            CupWriteRequest,
2065                            fidl::encoding::DefaultFuchsiaResourceDialect
2066                        );
2067                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CupWriteRequest>(&header, _body_bytes, handles, &mut req)?;
2068                        let control_handle = CupControlHandle { inner: this.inner.clone() };
2069                        Ok(CupRequest::Write {
2070                            url: req.url,
2071                            cup: req.cup,
2072
2073                            responder: CupWriteResponder {
2074                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2075                                tx_id: header.tx_id,
2076                            },
2077                        })
2078                    }
2079                    0x5b2cedd887209b9c => {
2080                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2081                        let mut req = fidl::new_empty!(
2082                            CupGetInfoRequest,
2083                            fidl::encoding::DefaultFuchsiaResourceDialect
2084                        );
2085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CupGetInfoRequest>(&header, _body_bytes, handles, &mut req)?;
2086                        let control_handle = CupControlHandle { inner: this.inner.clone() };
2087                        Ok(CupRequest::GetInfo {
2088                            url: req.url,
2089
2090                            responder: CupGetInfoResponder {
2091                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2092                                tx_id: header.tx_id,
2093                            },
2094                        })
2095                    }
2096                    _ => Err(fidl::Error::UnknownOrdinal {
2097                        ordinal: header.ordinal,
2098                        protocol_name: <CupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2099                    }),
2100                }))
2101            },
2102        )
2103    }
2104}
2105
2106/// This protocol gives access to persisted CUP data for eager packages in
2107/// pkg-resolver.
2108#[derive(Debug)]
2109pub enum CupRequest {
2110    /// Resolve the eager package given by the pinned package URL, and write the
2111    /// CUP data to storage.
2112    Write { url: PackageUrl, cup: CupData, responder: CupWriteResponder },
2113    /// Returns the eager package version and channel of the given package URL.
2114    GetInfo { url: PackageUrl, responder: CupGetInfoResponder },
2115}
2116
2117impl CupRequest {
2118    #[allow(irrefutable_let_patterns)]
2119    pub fn into_write(self) -> Option<(PackageUrl, CupData, CupWriteResponder)> {
2120        if let CupRequest::Write { url, cup, responder } = self {
2121            Some((url, cup, responder))
2122        } else {
2123            None
2124        }
2125    }
2126
2127    #[allow(irrefutable_let_patterns)]
2128    pub fn into_get_info(self) -> Option<(PackageUrl, CupGetInfoResponder)> {
2129        if let CupRequest::GetInfo { url, responder } = self {
2130            Some((url, responder))
2131        } else {
2132            None
2133        }
2134    }
2135
2136    /// Name of the method defined in FIDL
2137    pub fn method_name(&self) -> &'static str {
2138        match *self {
2139            CupRequest::Write { .. } => "write",
2140            CupRequest::GetInfo { .. } => "get_info",
2141        }
2142    }
2143}
2144
2145#[derive(Debug, Clone)]
2146pub struct CupControlHandle {
2147    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2148}
2149
2150impl fidl::endpoints::ControlHandle for CupControlHandle {
2151    fn shutdown(&self) {
2152        self.inner.shutdown()
2153    }
2154    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2155        self.inner.shutdown_with_epitaph(status)
2156    }
2157
2158    fn is_closed(&self) -> bool {
2159        self.inner.channel().is_closed()
2160    }
2161    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2162        self.inner.channel().on_closed()
2163    }
2164
2165    #[cfg(target_os = "fuchsia")]
2166    fn signal_peer(
2167        &self,
2168        clear_mask: zx::Signals,
2169        set_mask: zx::Signals,
2170    ) -> Result<(), zx_status::Status> {
2171        use fidl::Peered;
2172        self.inner.channel().signal_peer(clear_mask, set_mask)
2173    }
2174}
2175
2176impl CupControlHandle {}
2177
2178#[must_use = "FIDL methods require a response to be sent"]
2179#[derive(Debug)]
2180pub struct CupWriteResponder {
2181    control_handle: std::mem::ManuallyDrop<CupControlHandle>,
2182    tx_id: u32,
2183}
2184
2185/// Set the the channel to be shutdown (see [`CupControlHandle::shutdown`])
2186/// if the responder is dropped without sending a response, so that the client
2187/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2188impl std::ops::Drop for CupWriteResponder {
2189    fn drop(&mut self) {
2190        self.control_handle.shutdown();
2191        // Safety: drops once, never accessed again
2192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2193    }
2194}
2195
2196impl fidl::endpoints::Responder for CupWriteResponder {
2197    type ControlHandle = CupControlHandle;
2198
2199    fn control_handle(&self) -> &CupControlHandle {
2200        &self.control_handle
2201    }
2202
2203    fn drop_without_shutdown(mut self) {
2204        // Safety: drops once, never accessed again due to mem::forget
2205        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2206        // Prevent Drop from running (which would shut down the channel)
2207        std::mem::forget(self);
2208    }
2209}
2210
2211impl CupWriteResponder {
2212    /// Sends a response to the FIDL transaction.
2213    ///
2214    /// Sets the channel to shutdown if an error occurs.
2215    pub fn send(self, mut result: Result<(), WriteError>) -> Result<(), fidl::Error> {
2216        let _result = self.send_raw(result);
2217        if _result.is_err() {
2218            self.control_handle.shutdown();
2219        }
2220        self.drop_without_shutdown();
2221        _result
2222    }
2223
2224    /// Similar to "send" but does not shutdown the channel if an error occurs.
2225    pub fn send_no_shutdown_on_err(
2226        self,
2227        mut result: Result<(), WriteError>,
2228    ) -> Result<(), fidl::Error> {
2229        let _result = self.send_raw(result);
2230        self.drop_without_shutdown();
2231        _result
2232    }
2233
2234    fn send_raw(&self, mut result: Result<(), WriteError>) -> Result<(), fidl::Error> {
2235        self.control_handle
2236            .inner
2237            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, WriteError>>(
2238                result,
2239                self.tx_id,
2240                0x29f30e83bda39c37,
2241                fidl::encoding::DynamicFlags::empty(),
2242            )
2243    }
2244}
2245
2246#[must_use = "FIDL methods require a response to be sent"]
2247#[derive(Debug)]
2248pub struct CupGetInfoResponder {
2249    control_handle: std::mem::ManuallyDrop<CupControlHandle>,
2250    tx_id: u32,
2251}
2252
2253/// Set the the channel to be shutdown (see [`CupControlHandle::shutdown`])
2254/// if the responder is dropped without sending a response, so that the client
2255/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2256impl std::ops::Drop for CupGetInfoResponder {
2257    fn drop(&mut self) {
2258        self.control_handle.shutdown();
2259        // Safety: drops once, never accessed again
2260        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2261    }
2262}
2263
2264impl fidl::endpoints::Responder for CupGetInfoResponder {
2265    type ControlHandle = CupControlHandle;
2266
2267    fn control_handle(&self) -> &CupControlHandle {
2268        &self.control_handle
2269    }
2270
2271    fn drop_without_shutdown(mut self) {
2272        // Safety: drops once, never accessed again due to mem::forget
2273        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2274        // Prevent Drop from running (which would shut down the channel)
2275        std::mem::forget(self);
2276    }
2277}
2278
2279impl CupGetInfoResponder {
2280    /// Sends a response to the FIDL transaction.
2281    ///
2282    /// Sets the channel to shutdown if an error occurs.
2283    pub fn send(self, mut result: Result<(&str, &str), GetInfoError>) -> Result<(), fidl::Error> {
2284        let _result = self.send_raw(result);
2285        if _result.is_err() {
2286            self.control_handle.shutdown();
2287        }
2288        self.drop_without_shutdown();
2289        _result
2290    }
2291
2292    /// Similar to "send" but does not shutdown the channel if an error occurs.
2293    pub fn send_no_shutdown_on_err(
2294        self,
2295        mut result: Result<(&str, &str), GetInfoError>,
2296    ) -> Result<(), fidl::Error> {
2297        let _result = self.send_raw(result);
2298        self.drop_without_shutdown();
2299        _result
2300    }
2301
2302    fn send_raw(&self, mut result: Result<(&str, &str), GetInfoError>) -> Result<(), fidl::Error> {
2303        self.control_handle
2304            .inner
2305            .send::<fidl::encoding::ResultType<CupGetInfoResponse, GetInfoError>>(
2306                result,
2307                self.tx_id,
2308                0x5b2cedd887209b9c,
2309                fidl::encoding::DynamicFlags::empty(),
2310            )
2311    }
2312}
2313
2314#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2315pub struct FontResolverMarker;
2316
2317impl fidl::endpoints::ProtocolMarker for FontResolverMarker {
2318    type Proxy = FontResolverProxy;
2319    type RequestStream = FontResolverRequestStream;
2320    #[cfg(target_os = "fuchsia")]
2321    type SynchronousProxy = FontResolverSynchronousProxy;
2322
2323    const DEBUG_NAME: &'static str = "fuchsia.pkg.FontResolver";
2324}
2325impl fidl::endpoints::DiscoverableProtocolMarker for FontResolverMarker {}
2326pub type FontResolverResolveResult = Result<(), i32>;
2327
2328pub trait FontResolverProxyInterface: Send + Sync {
2329    type ResolveResponseFut: std::future::Future<Output = Result<FontResolverResolveResult, fidl::Error>>
2330        + Send;
2331    fn r#resolve(
2332        &self,
2333        package_url: &str,
2334        directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2335    ) -> Self::ResolveResponseFut;
2336}
2337#[derive(Debug)]
2338#[cfg(target_os = "fuchsia")]
2339pub struct FontResolverSynchronousProxy {
2340    client: fidl::client::sync::Client,
2341}
2342
2343#[cfg(target_os = "fuchsia")]
2344impl fidl::endpoints::SynchronousProxy for FontResolverSynchronousProxy {
2345    type Proxy = FontResolverProxy;
2346    type Protocol = FontResolverMarker;
2347
2348    fn from_channel(inner: fidl::Channel) -> Self {
2349        Self::new(inner)
2350    }
2351
2352    fn into_channel(self) -> fidl::Channel {
2353        self.client.into_channel()
2354    }
2355
2356    fn as_channel(&self) -> &fidl::Channel {
2357        self.client.as_channel()
2358    }
2359}
2360
2361#[cfg(target_os = "fuchsia")]
2362impl FontResolverSynchronousProxy {
2363    pub fn new(channel: fidl::Channel) -> Self {
2364        let protocol_name = <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2365        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2366    }
2367
2368    pub fn into_channel(self) -> fidl::Channel {
2369        self.client.into_channel()
2370    }
2371
2372    /// Waits until an event arrives and returns it. It is safe for other
2373    /// threads to make concurrent requests while waiting for an event.
2374    pub fn wait_for_event(
2375        &self,
2376        deadline: zx::MonotonicInstant,
2377    ) -> Result<FontResolverEvent, fidl::Error> {
2378        FontResolverEvent::decode(self.client.wait_for_event(deadline)?)
2379    }
2380
2381    /// Populates or updates the cache of a font package, fetching it if it is not present on the
2382    /// local system.
2383    ///
2384    /// + request `package_url` the package URL of a font package.
2385    /// + request `directory_request` a request for a directory that will be resolved when the
2386    ///   package has been successfully cached. The directory should contain a single file,
2387    ///   corresponding to the asset filename. The client should retain the directory handle
2388    ///   for as long as needed to prevent the package from being evicted from cache.
2389    /// * error a zx_status value indicating failure. One of the following:
2390    ///     * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a
2391    ///       package blob.
2392    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
2393    ///     * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is
2394    ///       not known to be a font package.
2395    ///     * `ZX_ERR_NO_SPACE` if there is no space available to store the package.
2396    ///     * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob.
2397    pub fn r#resolve(
2398        &self,
2399        mut package_url: &str,
2400        mut directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2401        ___deadline: zx::MonotonicInstant,
2402    ) -> Result<FontResolverResolveResult, fidl::Error> {
2403        let _response = self.client.send_query::<
2404            FontResolverResolveRequest,
2405            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2406        >(
2407            (package_url, directory_request,),
2408            0x159f60cc5ba432da,
2409            fidl::encoding::DynamicFlags::empty(),
2410            ___deadline,
2411        )?;
2412        Ok(_response.map(|x| x))
2413    }
2414}
2415
2416#[derive(Debug, Clone)]
2417pub struct FontResolverProxy {
2418    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2419}
2420
2421impl fidl::endpoints::Proxy for FontResolverProxy {
2422    type Protocol = FontResolverMarker;
2423
2424    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2425        Self::new(inner)
2426    }
2427
2428    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2429        self.client.into_channel().map_err(|client| Self { client })
2430    }
2431
2432    fn as_channel(&self) -> &::fidl::AsyncChannel {
2433        self.client.as_channel()
2434    }
2435}
2436
2437impl FontResolverProxy {
2438    /// Create a new Proxy for fuchsia.pkg/FontResolver.
2439    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2440        let protocol_name = <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2441        Self { client: fidl::client::Client::new(channel, protocol_name) }
2442    }
2443
2444    /// Get a Stream of events from the remote end of the protocol.
2445    ///
2446    /// # Panics
2447    ///
2448    /// Panics if the event stream was already taken.
2449    pub fn take_event_stream(&self) -> FontResolverEventStream {
2450        FontResolverEventStream { event_receiver: self.client.take_event_receiver() }
2451    }
2452
2453    /// Populates or updates the cache of a font package, fetching it if it is not present on the
2454    /// local system.
2455    ///
2456    /// + request `package_url` the package URL of a font package.
2457    /// + request `directory_request` a request for a directory that will be resolved when the
2458    ///   package has been successfully cached. The directory should contain a single file,
2459    ///   corresponding to the asset filename. The client should retain the directory handle
2460    ///   for as long as needed to prevent the package from being evicted from cache.
2461    /// * error a zx_status value indicating failure. One of the following:
2462    ///     * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a
2463    ///       package blob.
2464    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
2465    ///     * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is
2466    ///       not known to be a font package.
2467    ///     * `ZX_ERR_NO_SPACE` if there is no space available to store the package.
2468    ///     * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob.
2469    pub fn r#resolve(
2470        &self,
2471        mut package_url: &str,
2472        mut directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2473    ) -> fidl::client::QueryResponseFut<
2474        FontResolverResolveResult,
2475        fidl::encoding::DefaultFuchsiaResourceDialect,
2476    > {
2477        FontResolverProxyInterface::r#resolve(self, package_url, directory_request)
2478    }
2479}
2480
2481impl FontResolverProxyInterface for FontResolverProxy {
2482    type ResolveResponseFut = fidl::client::QueryResponseFut<
2483        FontResolverResolveResult,
2484        fidl::encoding::DefaultFuchsiaResourceDialect,
2485    >;
2486    fn r#resolve(
2487        &self,
2488        mut package_url: &str,
2489        mut directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2490    ) -> Self::ResolveResponseFut {
2491        fn _decode(
2492            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2493        ) -> Result<FontResolverResolveResult, fidl::Error> {
2494            let _response = fidl::client::decode_transaction_body::<
2495                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2496                fidl::encoding::DefaultFuchsiaResourceDialect,
2497                0x159f60cc5ba432da,
2498            >(_buf?)?;
2499            Ok(_response.map(|x| x))
2500        }
2501        self.client.send_query_and_decode::<FontResolverResolveRequest, FontResolverResolveResult>(
2502            (package_url, directory_request),
2503            0x159f60cc5ba432da,
2504            fidl::encoding::DynamicFlags::empty(),
2505            _decode,
2506        )
2507    }
2508}
2509
2510pub struct FontResolverEventStream {
2511    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2512}
2513
2514impl std::marker::Unpin for FontResolverEventStream {}
2515
2516impl futures::stream::FusedStream for FontResolverEventStream {
2517    fn is_terminated(&self) -> bool {
2518        self.event_receiver.is_terminated()
2519    }
2520}
2521
2522impl futures::Stream for FontResolverEventStream {
2523    type Item = Result<FontResolverEvent, fidl::Error>;
2524
2525    fn poll_next(
2526        mut self: std::pin::Pin<&mut Self>,
2527        cx: &mut std::task::Context<'_>,
2528    ) -> std::task::Poll<Option<Self::Item>> {
2529        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2530            &mut self.event_receiver,
2531            cx
2532        )?) {
2533            Some(buf) => std::task::Poll::Ready(Some(FontResolverEvent::decode(buf))),
2534            None => std::task::Poll::Ready(None),
2535        }
2536    }
2537}
2538
2539#[derive(Debug)]
2540pub enum FontResolverEvent {}
2541
2542impl FontResolverEvent {
2543    /// Decodes a message buffer as a [`FontResolverEvent`].
2544    fn decode(
2545        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2546    ) -> Result<FontResolverEvent, fidl::Error> {
2547        let (bytes, _handles) = buf.split_mut();
2548        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2549        debug_assert_eq!(tx_header.tx_id, 0);
2550        match tx_header.ordinal {
2551            _ => Err(fidl::Error::UnknownOrdinal {
2552                ordinal: tx_header.ordinal,
2553                protocol_name: <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2554            }),
2555        }
2556    }
2557}
2558
2559/// A Stream of incoming requests for fuchsia.pkg/FontResolver.
2560pub struct FontResolverRequestStream {
2561    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2562    is_terminated: bool,
2563}
2564
2565impl std::marker::Unpin for FontResolverRequestStream {}
2566
2567impl futures::stream::FusedStream for FontResolverRequestStream {
2568    fn is_terminated(&self) -> bool {
2569        self.is_terminated
2570    }
2571}
2572
2573impl fidl::endpoints::RequestStream for FontResolverRequestStream {
2574    type Protocol = FontResolverMarker;
2575    type ControlHandle = FontResolverControlHandle;
2576
2577    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2578        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2579    }
2580
2581    fn control_handle(&self) -> Self::ControlHandle {
2582        FontResolverControlHandle { inner: self.inner.clone() }
2583    }
2584
2585    fn into_inner(
2586        self,
2587    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2588    {
2589        (self.inner, self.is_terminated)
2590    }
2591
2592    fn from_inner(
2593        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2594        is_terminated: bool,
2595    ) -> Self {
2596        Self { inner, is_terminated }
2597    }
2598}
2599
2600impl futures::Stream for FontResolverRequestStream {
2601    type Item = Result<FontResolverRequest, fidl::Error>;
2602
2603    fn poll_next(
2604        mut self: std::pin::Pin<&mut Self>,
2605        cx: &mut std::task::Context<'_>,
2606    ) -> std::task::Poll<Option<Self::Item>> {
2607        let this = &mut *self;
2608        if this.inner.check_shutdown(cx) {
2609            this.is_terminated = true;
2610            return std::task::Poll::Ready(None);
2611        }
2612        if this.is_terminated {
2613            panic!("polled FontResolverRequestStream after completion");
2614        }
2615        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2616            |bytes, handles| {
2617                match this.inner.channel().read_etc(cx, bytes, handles) {
2618                    std::task::Poll::Ready(Ok(())) => {}
2619                    std::task::Poll::Pending => return std::task::Poll::Pending,
2620                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2621                        this.is_terminated = true;
2622                        return std::task::Poll::Ready(None);
2623                    }
2624                    std::task::Poll::Ready(Err(e)) => {
2625                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2626                            e.into(),
2627                        ))))
2628                    }
2629                }
2630
2631                // A message has been received from the channel
2632                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2633
2634                std::task::Poll::Ready(Some(match header.ordinal {
2635                    0x159f60cc5ba432da => {
2636                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2637                        let mut req = fidl::new_empty!(
2638                            FontResolverResolveRequest,
2639                            fidl::encoding::DefaultFuchsiaResourceDialect
2640                        );
2641                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FontResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
2642                        let control_handle =
2643                            FontResolverControlHandle { inner: this.inner.clone() };
2644                        Ok(FontResolverRequest::Resolve {
2645                            package_url: req.package_url,
2646                            directory_request: req.directory_request,
2647
2648                            responder: FontResolverResolveResponder {
2649                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2650                                tx_id: header.tx_id,
2651                            },
2652                        })
2653                    }
2654                    _ => Err(fidl::Error::UnknownOrdinal {
2655                        ordinal: header.ordinal,
2656                        protocol_name:
2657                            <FontResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2658                    }),
2659                }))
2660            },
2661        )
2662    }
2663}
2664
2665/// This resolves font packages from a registry.
2666///
2667/// This is intended to be implemented by package resolver components, and used
2668/// exclusively by fuchsia.fonts.Provider.
2669///
2670/// DEPRECATED. This is an interim solution, and will be revisited when Component Framework v2
2671/// becomes available and allows non-component packages and easier directory routing.
2672#[derive(Debug)]
2673pub enum FontResolverRequest {
2674    /// Populates or updates the cache of a font package, fetching it if it is not present on the
2675    /// local system.
2676    ///
2677    /// + request `package_url` the package URL of a font package.
2678    /// + request `directory_request` a request for a directory that will be resolved when the
2679    ///   package has been successfully cached. The directory should contain a single file,
2680    ///   corresponding to the asset filename. The client should retain the directory handle
2681    ///   for as long as needed to prevent the package from being evicted from cache.
2682    /// * error a zx_status value indicating failure. One of the following:
2683    ///     * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a
2684    ///       package blob.
2685    ///     * `ZX_ERR_IO` if there is some other unspecified error during I/O.
2686    ///     * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is
2687    ///       not known to be a font package.
2688    ///     * `ZX_ERR_NO_SPACE` if there is no space available to store the package.
2689    ///     * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob.
2690    Resolve {
2691        package_url: String,
2692        directory_request: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2693        responder: FontResolverResolveResponder,
2694    },
2695}
2696
2697impl FontResolverRequest {
2698    #[allow(irrefutable_let_patterns)]
2699    pub fn into_resolve(
2700        self,
2701    ) -> Option<(
2702        String,
2703        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2704        FontResolverResolveResponder,
2705    )> {
2706        if let FontResolverRequest::Resolve { package_url, directory_request, responder } = self {
2707            Some((package_url, directory_request, responder))
2708        } else {
2709            None
2710        }
2711    }
2712
2713    /// Name of the method defined in FIDL
2714    pub fn method_name(&self) -> &'static str {
2715        match *self {
2716            FontResolverRequest::Resolve { .. } => "resolve",
2717        }
2718    }
2719}
2720
2721#[derive(Debug, Clone)]
2722pub struct FontResolverControlHandle {
2723    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2724}
2725
2726impl fidl::endpoints::ControlHandle for FontResolverControlHandle {
2727    fn shutdown(&self) {
2728        self.inner.shutdown()
2729    }
2730    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2731        self.inner.shutdown_with_epitaph(status)
2732    }
2733
2734    fn is_closed(&self) -> bool {
2735        self.inner.channel().is_closed()
2736    }
2737    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2738        self.inner.channel().on_closed()
2739    }
2740
2741    #[cfg(target_os = "fuchsia")]
2742    fn signal_peer(
2743        &self,
2744        clear_mask: zx::Signals,
2745        set_mask: zx::Signals,
2746    ) -> Result<(), zx_status::Status> {
2747        use fidl::Peered;
2748        self.inner.channel().signal_peer(clear_mask, set_mask)
2749    }
2750}
2751
2752impl FontResolverControlHandle {}
2753
2754#[must_use = "FIDL methods require a response to be sent"]
2755#[derive(Debug)]
2756pub struct FontResolverResolveResponder {
2757    control_handle: std::mem::ManuallyDrop<FontResolverControlHandle>,
2758    tx_id: u32,
2759}
2760
2761/// Set the the channel to be shutdown (see [`FontResolverControlHandle::shutdown`])
2762/// if the responder is dropped without sending a response, so that the client
2763/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2764impl std::ops::Drop for FontResolverResolveResponder {
2765    fn drop(&mut self) {
2766        self.control_handle.shutdown();
2767        // Safety: drops once, never accessed again
2768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2769    }
2770}
2771
2772impl fidl::endpoints::Responder for FontResolverResolveResponder {
2773    type ControlHandle = FontResolverControlHandle;
2774
2775    fn control_handle(&self) -> &FontResolverControlHandle {
2776        &self.control_handle
2777    }
2778
2779    fn drop_without_shutdown(mut self) {
2780        // Safety: drops once, never accessed again due to mem::forget
2781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2782        // Prevent Drop from running (which would shut down the channel)
2783        std::mem::forget(self);
2784    }
2785}
2786
2787impl FontResolverResolveResponder {
2788    /// Sends a response to the FIDL transaction.
2789    ///
2790    /// Sets the channel to shutdown if an error occurs.
2791    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2792        let _result = self.send_raw(result);
2793        if _result.is_err() {
2794            self.control_handle.shutdown();
2795        }
2796        self.drop_without_shutdown();
2797        _result
2798    }
2799
2800    /// Similar to "send" but does not shutdown the channel if an error occurs.
2801    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2802        let _result = self.send_raw(result);
2803        self.drop_without_shutdown();
2804        _result
2805    }
2806
2807    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2808        self.control_handle
2809            .inner
2810            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2811                result,
2812                self.tx_id,
2813                0x159f60cc5ba432da,
2814                fidl::encoding::DynamicFlags::empty(),
2815            )
2816    }
2817}
2818
2819#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2820pub struct NeededBlobsMarker;
2821
2822impl fidl::endpoints::ProtocolMarker for NeededBlobsMarker {
2823    type Proxy = NeededBlobsProxy;
2824    type RequestStream = NeededBlobsRequestStream;
2825    #[cfg(target_os = "fuchsia")]
2826    type SynchronousProxy = NeededBlobsSynchronousProxy;
2827
2828    const DEBUG_NAME: &'static str = "(anonymous) NeededBlobs";
2829}
2830pub type NeededBlobsOpenMetaBlobResult = Result<Option<Box<BlobWriter>>, OpenBlobError>;
2831pub type NeededBlobsOpenBlobResult = Result<Option<Box<BlobWriter>>, OpenBlobError>;
2832pub type NeededBlobsBlobWrittenResult = Result<(), BlobWrittenError>;
2833
2834pub trait NeededBlobsProxyInterface: Send + Sync {
2835    type OpenMetaBlobResponseFut: std::future::Future<Output = Result<NeededBlobsOpenMetaBlobResult, fidl::Error>>
2836        + Send;
2837    fn r#open_meta_blob(&self) -> Self::OpenMetaBlobResponseFut;
2838    fn r#get_missing_blobs(
2839        &self,
2840        iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2841    ) -> Result<(), fidl::Error>;
2842    type OpenBlobResponseFut: std::future::Future<Output = Result<NeededBlobsOpenBlobResult, fidl::Error>>
2843        + Send;
2844    fn r#open_blob(&self, blob_id: &BlobId) -> Self::OpenBlobResponseFut;
2845    type BlobWrittenResponseFut: std::future::Future<Output = Result<NeededBlobsBlobWrittenResult, fidl::Error>>
2846        + Send;
2847    fn r#blob_written(&self, blob_id: &BlobId) -> Self::BlobWrittenResponseFut;
2848    type AbortResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2849    fn r#abort(&self) -> Self::AbortResponseFut;
2850}
2851#[derive(Debug)]
2852#[cfg(target_os = "fuchsia")]
2853pub struct NeededBlobsSynchronousProxy {
2854    client: fidl::client::sync::Client,
2855}
2856
2857#[cfg(target_os = "fuchsia")]
2858impl fidl::endpoints::SynchronousProxy for NeededBlobsSynchronousProxy {
2859    type Proxy = NeededBlobsProxy;
2860    type Protocol = NeededBlobsMarker;
2861
2862    fn from_channel(inner: fidl::Channel) -> Self {
2863        Self::new(inner)
2864    }
2865
2866    fn into_channel(self) -> fidl::Channel {
2867        self.client.into_channel()
2868    }
2869
2870    fn as_channel(&self) -> &fidl::Channel {
2871        self.client.as_channel()
2872    }
2873}
2874
2875#[cfg(target_os = "fuchsia")]
2876impl NeededBlobsSynchronousProxy {
2877    pub fn new(channel: fidl::Channel) -> Self {
2878        let protocol_name = <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2879        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2880    }
2881
2882    pub fn into_channel(self) -> fidl::Channel {
2883        self.client.into_channel()
2884    }
2885
2886    /// Waits until an event arrives and returns it. It is safe for other
2887    /// threads to make concurrent requests while waiting for an event.
2888    pub fn wait_for_event(
2889        &self,
2890        deadline: zx::MonotonicInstant,
2891    ) -> Result<NeededBlobsEvent, fidl::Error> {
2892        NeededBlobsEvent::decode(self.client.wait_for_event(deadline)?)
2893    }
2894
2895    /// Opens the package's metadata blob for writing. `GetMissingBlobs()`
2896    /// should not be called until writing the meta blob or this request
2897    /// responds with `false`.
2898    ///
2899    /// If the package was already cached, server will close the channel with a
2900    /// `ZX_OK` epitaph.
2901    ///
2902    /// - response `writer` is used to write the blob. If `writer` is absent,
2903    ///   the blob is already cached and so does not need to be written.
2904    /// * error an OpenBlobError indicating failure. Clients may retry this
2905    ///   request, though the server end may abort this cache operation on
2906    ///   errors it considers to be fatal.
2907    pub fn r#open_meta_blob(
2908        &self,
2909        ___deadline: zx::MonotonicInstant,
2910    ) -> Result<NeededBlobsOpenMetaBlobResult, fidl::Error> {
2911        let _response =
2912            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
2913                NeededBlobsOpenMetaBlobResponse,
2914                OpenBlobError,
2915            >>(
2916                (),
2917                0x42f385a58180f5fb,
2918                fidl::encoding::DynamicFlags::empty(),
2919                ___deadline,
2920            )?;
2921        Ok(_response.map(|x| x.writer))
2922    }
2923
2924    /// Returns an iterator of blobs that are not present on the system that
2925    /// must be written using the `OpenBlob` request before the package will be
2926    /// fully cached.
2927    ///
2928    /// Client should call `OpenMetaBlob`, and write it if needed, before
2929    /// calling `GetMissingBlobs`.
2930    ///
2931    /// A client should make this request no more than once per `NeededBlobs`
2932    /// connection. Once all blobs yielded by this iterator are written, the
2933    /// package open request will complete.
2934    ///
2935    /// New items may be added to the obtained `BlobInfoIterator` as the client
2936    /// calls `OpenBlob`, so, to guaranatee termination of the iterator, clients
2937    /// should call `OpenBlob` concurrently with reading the iterator.
2938    ///
2939    /// + request `iterator` a request for an iterator of [`BlobInfo`] of blobs
2940    ///   that the client should try to write.
2941    pub fn r#get_missing_blobs(
2942        &self,
2943        mut iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
2944    ) -> Result<(), fidl::Error> {
2945        self.client.send::<NeededBlobsGetMissingBlobsRequest>(
2946            (iterator,),
2947            0x44eaf14fd56e7ae1,
2948            fidl::encoding::DynamicFlags::empty(),
2949        )
2950    }
2951
2952    /// Opens a blob for writing.
2953    ///
2954    /// + request `blob_id` the blob id describing this blob.
2955    /// - response `writer` is used to write the blob. If `writer` is absent,
2956    ///   the blob is already cached and so does not need to be written.
2957    /// * error an OpenBlobError indicating failure. Clients may retry this
2958    ///   request, though the server end may abort this cache operation on
2959    ///   errors it considers to be fatal.
2960    pub fn r#open_blob(
2961        &self,
2962        mut blob_id: &BlobId,
2963        ___deadline: zx::MonotonicInstant,
2964    ) -> Result<NeededBlobsOpenBlobResult, fidl::Error> {
2965        let _response = self.client.send_query::<
2966            NeededBlobsOpenBlobRequest,
2967            fidl::encoding::ResultType<NeededBlobsOpenBlobResponse, OpenBlobError>,
2968        >(
2969            (blob_id,),
2970            0x67cd4c4cd10ea9e0,
2971            fidl::encoding::DynamicFlags::empty(),
2972            ___deadline,
2973        )?;
2974        Ok(_response.map(|x| x.writer))
2975    }
2976
2977    /// Indicates that a blob opened by `Open[Meta]Blob` has been successfully
2978    /// written.
2979    ///
2980    /// A client should call this once the blob has been fully written using
2981    /// the `writer` returned by `Open[Meta]Blob`.
2982    ///
2983    /// + request `blob_id` the blob id describing this blob.
2984    /// * error a BlobWrittenError indicating failure. Clients may retry the
2985    ///   `Open[Meta]Blob` request that prompted this call, though the server
2986    ///   end may abort this cache operation on errors it considers to be fatal.
2987    pub fn r#blob_written(
2988        &self,
2989        mut blob_id: &BlobId,
2990        ___deadline: zx::MonotonicInstant,
2991    ) -> Result<NeededBlobsBlobWrittenResult, fidl::Error> {
2992        let _response = self.client.send_query::<
2993            NeededBlobsBlobWrittenRequest,
2994            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BlobWrittenError>,
2995        >(
2996            (blob_id,),
2997            0x222f80ec77433f44,
2998            fidl::encoding::DynamicFlags::empty(),
2999            ___deadline,
3000        )?;
3001        Ok(_response.map(|x| x))
3002    }
3003
3004    /// Aborts this caching operation for the package.
3005    ///
3006    /// Any open blobs and any missing blobs iterator will be closed. Any `dir`
3007    /// provided to the associated [`PackageCache.Get`] request will also be
3008    /// closed. Once this request is acknowledged, this channel will be closed.
3009    ///
3010    /// Note, dropping this NeededBlobs channel without writing all needed blobs
3011    /// will also abort the package cache operation. However, this API provides
3012    /// the ability to wait for the operation to be torn down.
3013    pub fn r#abort(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
3014        let _response =
3015            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
3016                (),
3017                0x6fda8d5ebea74cbb,
3018                fidl::encoding::DynamicFlags::empty(),
3019                ___deadline,
3020            )?;
3021        Ok(_response)
3022    }
3023}
3024
3025#[derive(Debug, Clone)]
3026pub struct NeededBlobsProxy {
3027    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3028}
3029
3030impl fidl::endpoints::Proxy for NeededBlobsProxy {
3031    type Protocol = NeededBlobsMarker;
3032
3033    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3034        Self::new(inner)
3035    }
3036
3037    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3038        self.client.into_channel().map_err(|client| Self { client })
3039    }
3040
3041    fn as_channel(&self) -> &::fidl::AsyncChannel {
3042        self.client.as_channel()
3043    }
3044}
3045
3046impl NeededBlobsProxy {
3047    /// Create a new Proxy for fuchsia.pkg/NeededBlobs.
3048    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3049        let protocol_name = <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3050        Self { client: fidl::client::Client::new(channel, protocol_name) }
3051    }
3052
3053    /// Get a Stream of events from the remote end of the protocol.
3054    ///
3055    /// # Panics
3056    ///
3057    /// Panics if the event stream was already taken.
3058    pub fn take_event_stream(&self) -> NeededBlobsEventStream {
3059        NeededBlobsEventStream { event_receiver: self.client.take_event_receiver() }
3060    }
3061
3062    /// Opens the package's metadata blob for writing. `GetMissingBlobs()`
3063    /// should not be called until writing the meta blob or this request
3064    /// responds with `false`.
3065    ///
3066    /// If the package was already cached, server will close the channel with a
3067    /// `ZX_OK` epitaph.
3068    ///
3069    /// - response `writer` is used to write the blob. If `writer` is absent,
3070    ///   the blob is already cached and so does not need to be written.
3071    /// * error an OpenBlobError indicating failure. Clients may retry this
3072    ///   request, though the server end may abort this cache operation on
3073    ///   errors it considers to be fatal.
3074    pub fn r#open_meta_blob(
3075        &self,
3076    ) -> fidl::client::QueryResponseFut<
3077        NeededBlobsOpenMetaBlobResult,
3078        fidl::encoding::DefaultFuchsiaResourceDialect,
3079    > {
3080        NeededBlobsProxyInterface::r#open_meta_blob(self)
3081    }
3082
3083    /// Returns an iterator of blobs that are not present on the system that
3084    /// must be written using the `OpenBlob` request before the package will be
3085    /// fully cached.
3086    ///
3087    /// Client should call `OpenMetaBlob`, and write it if needed, before
3088    /// calling `GetMissingBlobs`.
3089    ///
3090    /// A client should make this request no more than once per `NeededBlobs`
3091    /// connection. Once all blobs yielded by this iterator are written, the
3092    /// package open request will complete.
3093    ///
3094    /// New items may be added to the obtained `BlobInfoIterator` as the client
3095    /// calls `OpenBlob`, so, to guaranatee termination of the iterator, clients
3096    /// should call `OpenBlob` concurrently with reading the iterator.
3097    ///
3098    /// + request `iterator` a request for an iterator of [`BlobInfo`] of blobs
3099    ///   that the client should try to write.
3100    pub fn r#get_missing_blobs(
3101        &self,
3102        mut iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
3103    ) -> Result<(), fidl::Error> {
3104        NeededBlobsProxyInterface::r#get_missing_blobs(self, iterator)
3105    }
3106
3107    /// Opens a blob for writing.
3108    ///
3109    /// + request `blob_id` the blob id describing this blob.
3110    /// - response `writer` is used to write the blob. If `writer` is absent,
3111    ///   the blob is already cached and so does not need to be written.
3112    /// * error an OpenBlobError indicating failure. Clients may retry this
3113    ///   request, though the server end may abort this cache operation on
3114    ///   errors it considers to be fatal.
3115    pub fn r#open_blob(
3116        &self,
3117        mut blob_id: &BlobId,
3118    ) -> fidl::client::QueryResponseFut<
3119        NeededBlobsOpenBlobResult,
3120        fidl::encoding::DefaultFuchsiaResourceDialect,
3121    > {
3122        NeededBlobsProxyInterface::r#open_blob(self, blob_id)
3123    }
3124
3125    /// Indicates that a blob opened by `Open[Meta]Blob` has been successfully
3126    /// written.
3127    ///
3128    /// A client should call this once the blob has been fully written using
3129    /// the `writer` returned by `Open[Meta]Blob`.
3130    ///
3131    /// + request `blob_id` the blob id describing this blob.
3132    /// * error a BlobWrittenError indicating failure. Clients may retry the
3133    ///   `Open[Meta]Blob` request that prompted this call, though the server
3134    ///   end may abort this cache operation on errors it considers to be fatal.
3135    pub fn r#blob_written(
3136        &self,
3137        mut blob_id: &BlobId,
3138    ) -> fidl::client::QueryResponseFut<
3139        NeededBlobsBlobWrittenResult,
3140        fidl::encoding::DefaultFuchsiaResourceDialect,
3141    > {
3142        NeededBlobsProxyInterface::r#blob_written(self, blob_id)
3143    }
3144
3145    /// Aborts this caching operation for the package.
3146    ///
3147    /// Any open blobs and any missing blobs iterator will be closed. Any `dir`
3148    /// provided to the associated [`PackageCache.Get`] request will also be
3149    /// closed. Once this request is acknowledged, this channel will be closed.
3150    ///
3151    /// Note, dropping this NeededBlobs channel without writing all needed blobs
3152    /// will also abort the package cache operation. However, this API provides
3153    /// the ability to wait for the operation to be torn down.
3154    pub fn r#abort(
3155        &self,
3156    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3157        NeededBlobsProxyInterface::r#abort(self)
3158    }
3159}
3160
3161impl NeededBlobsProxyInterface for NeededBlobsProxy {
3162    type OpenMetaBlobResponseFut = fidl::client::QueryResponseFut<
3163        NeededBlobsOpenMetaBlobResult,
3164        fidl::encoding::DefaultFuchsiaResourceDialect,
3165    >;
3166    fn r#open_meta_blob(&self) -> Self::OpenMetaBlobResponseFut {
3167        fn _decode(
3168            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3169        ) -> Result<NeededBlobsOpenMetaBlobResult, fidl::Error> {
3170            let _response = fidl::client::decode_transaction_body::<
3171                fidl::encoding::ResultType<NeededBlobsOpenMetaBlobResponse, OpenBlobError>,
3172                fidl::encoding::DefaultFuchsiaResourceDialect,
3173                0x42f385a58180f5fb,
3174            >(_buf?)?;
3175            Ok(_response.map(|x| x.writer))
3176        }
3177        self.client
3178            .send_query_and_decode::<fidl::encoding::EmptyPayload, NeededBlobsOpenMetaBlobResult>(
3179                (),
3180                0x42f385a58180f5fb,
3181                fidl::encoding::DynamicFlags::empty(),
3182                _decode,
3183            )
3184    }
3185
3186    fn r#get_missing_blobs(
3187        &self,
3188        mut iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
3189    ) -> Result<(), fidl::Error> {
3190        self.client.send::<NeededBlobsGetMissingBlobsRequest>(
3191            (iterator,),
3192            0x44eaf14fd56e7ae1,
3193            fidl::encoding::DynamicFlags::empty(),
3194        )
3195    }
3196
3197    type OpenBlobResponseFut = fidl::client::QueryResponseFut<
3198        NeededBlobsOpenBlobResult,
3199        fidl::encoding::DefaultFuchsiaResourceDialect,
3200    >;
3201    fn r#open_blob(&self, mut blob_id: &BlobId) -> Self::OpenBlobResponseFut {
3202        fn _decode(
3203            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3204        ) -> Result<NeededBlobsOpenBlobResult, fidl::Error> {
3205            let _response = fidl::client::decode_transaction_body::<
3206                fidl::encoding::ResultType<NeededBlobsOpenBlobResponse, OpenBlobError>,
3207                fidl::encoding::DefaultFuchsiaResourceDialect,
3208                0x67cd4c4cd10ea9e0,
3209            >(_buf?)?;
3210            Ok(_response.map(|x| x.writer))
3211        }
3212        self.client.send_query_and_decode::<NeededBlobsOpenBlobRequest, NeededBlobsOpenBlobResult>(
3213            (blob_id,),
3214            0x67cd4c4cd10ea9e0,
3215            fidl::encoding::DynamicFlags::empty(),
3216            _decode,
3217        )
3218    }
3219
3220    type BlobWrittenResponseFut = fidl::client::QueryResponseFut<
3221        NeededBlobsBlobWrittenResult,
3222        fidl::encoding::DefaultFuchsiaResourceDialect,
3223    >;
3224    fn r#blob_written(&self, mut blob_id: &BlobId) -> Self::BlobWrittenResponseFut {
3225        fn _decode(
3226            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3227        ) -> Result<NeededBlobsBlobWrittenResult, fidl::Error> {
3228            let _response = fidl::client::decode_transaction_body::<
3229                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BlobWrittenError>,
3230                fidl::encoding::DefaultFuchsiaResourceDialect,
3231                0x222f80ec77433f44,
3232            >(_buf?)?;
3233            Ok(_response.map(|x| x))
3234        }
3235        self.client
3236            .send_query_and_decode::<NeededBlobsBlobWrittenRequest, NeededBlobsBlobWrittenResult>(
3237                (blob_id,),
3238                0x222f80ec77433f44,
3239                fidl::encoding::DynamicFlags::empty(),
3240                _decode,
3241            )
3242    }
3243
3244    type AbortResponseFut =
3245        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3246    fn r#abort(&self) -> Self::AbortResponseFut {
3247        fn _decode(
3248            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3249        ) -> Result<(), fidl::Error> {
3250            let _response = fidl::client::decode_transaction_body::<
3251                fidl::encoding::EmptyPayload,
3252                fidl::encoding::DefaultFuchsiaResourceDialect,
3253                0x6fda8d5ebea74cbb,
3254            >(_buf?)?;
3255            Ok(_response)
3256        }
3257        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3258            (),
3259            0x6fda8d5ebea74cbb,
3260            fidl::encoding::DynamicFlags::empty(),
3261            _decode,
3262        )
3263    }
3264}
3265
3266pub struct NeededBlobsEventStream {
3267    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3268}
3269
3270impl std::marker::Unpin for NeededBlobsEventStream {}
3271
3272impl futures::stream::FusedStream for NeededBlobsEventStream {
3273    fn is_terminated(&self) -> bool {
3274        self.event_receiver.is_terminated()
3275    }
3276}
3277
3278impl futures::Stream for NeededBlobsEventStream {
3279    type Item = Result<NeededBlobsEvent, fidl::Error>;
3280
3281    fn poll_next(
3282        mut self: std::pin::Pin<&mut Self>,
3283        cx: &mut std::task::Context<'_>,
3284    ) -> std::task::Poll<Option<Self::Item>> {
3285        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3286            &mut self.event_receiver,
3287            cx
3288        )?) {
3289            Some(buf) => std::task::Poll::Ready(Some(NeededBlobsEvent::decode(buf))),
3290            None => std::task::Poll::Ready(None),
3291        }
3292    }
3293}
3294
3295#[derive(Debug)]
3296pub enum NeededBlobsEvent {}
3297
3298impl NeededBlobsEvent {
3299    /// Decodes a message buffer as a [`NeededBlobsEvent`].
3300    fn decode(
3301        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3302    ) -> Result<NeededBlobsEvent, fidl::Error> {
3303        let (bytes, _handles) = buf.split_mut();
3304        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3305        debug_assert_eq!(tx_header.tx_id, 0);
3306        match tx_header.ordinal {
3307            _ => Err(fidl::Error::UnknownOrdinal {
3308                ordinal: tx_header.ordinal,
3309                protocol_name: <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3310            }),
3311        }
3312    }
3313}
3314
3315/// A Stream of incoming requests for fuchsia.pkg/NeededBlobs.
3316pub struct NeededBlobsRequestStream {
3317    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3318    is_terminated: bool,
3319}
3320
3321impl std::marker::Unpin for NeededBlobsRequestStream {}
3322
3323impl futures::stream::FusedStream for NeededBlobsRequestStream {
3324    fn is_terminated(&self) -> bool {
3325        self.is_terminated
3326    }
3327}
3328
3329impl fidl::endpoints::RequestStream for NeededBlobsRequestStream {
3330    type Protocol = NeededBlobsMarker;
3331    type ControlHandle = NeededBlobsControlHandle;
3332
3333    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3334        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3335    }
3336
3337    fn control_handle(&self) -> Self::ControlHandle {
3338        NeededBlobsControlHandle { inner: self.inner.clone() }
3339    }
3340
3341    fn into_inner(
3342        self,
3343    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3344    {
3345        (self.inner, self.is_terminated)
3346    }
3347
3348    fn from_inner(
3349        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3350        is_terminated: bool,
3351    ) -> Self {
3352        Self { inner, is_terminated }
3353    }
3354}
3355
3356impl futures::Stream for NeededBlobsRequestStream {
3357    type Item = Result<NeededBlobsRequest, fidl::Error>;
3358
3359    fn poll_next(
3360        mut self: std::pin::Pin<&mut Self>,
3361        cx: &mut std::task::Context<'_>,
3362    ) -> std::task::Poll<Option<Self::Item>> {
3363        let this = &mut *self;
3364        if this.inner.check_shutdown(cx) {
3365            this.is_terminated = true;
3366            return std::task::Poll::Ready(None);
3367        }
3368        if this.is_terminated {
3369            panic!("polled NeededBlobsRequestStream after completion");
3370        }
3371        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3372            |bytes, handles| {
3373                match this.inner.channel().read_etc(cx, bytes, handles) {
3374                    std::task::Poll::Ready(Ok(())) => {}
3375                    std::task::Poll::Pending => return std::task::Poll::Pending,
3376                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3377                        this.is_terminated = true;
3378                        return std::task::Poll::Ready(None);
3379                    }
3380                    std::task::Poll::Ready(Err(e)) => {
3381                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3382                            e.into(),
3383                        ))))
3384                    }
3385                }
3386
3387                // A message has been received from the channel
3388                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3389
3390                std::task::Poll::Ready(Some(match header.ordinal {
3391                    0x42f385a58180f5fb => {
3392                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3393                        let mut req = fidl::new_empty!(
3394                            fidl::encoding::EmptyPayload,
3395                            fidl::encoding::DefaultFuchsiaResourceDialect
3396                        );
3397                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3398                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
3399                        Ok(NeededBlobsRequest::OpenMetaBlob {
3400                            responder: NeededBlobsOpenMetaBlobResponder {
3401                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3402                                tx_id: header.tx_id,
3403                            },
3404                        })
3405                    }
3406                    0x44eaf14fd56e7ae1 => {
3407                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3408                        let mut req = fidl::new_empty!(
3409                            NeededBlobsGetMissingBlobsRequest,
3410                            fidl::encoding::DefaultFuchsiaResourceDialect
3411                        );
3412                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NeededBlobsGetMissingBlobsRequest>(&header, _body_bytes, handles, &mut req)?;
3413                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
3414                        Ok(NeededBlobsRequest::GetMissingBlobs {
3415                            iterator: req.iterator,
3416
3417                            control_handle,
3418                        })
3419                    }
3420                    0x67cd4c4cd10ea9e0 => {
3421                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3422                        let mut req = fidl::new_empty!(
3423                            NeededBlobsOpenBlobRequest,
3424                            fidl::encoding::DefaultFuchsiaResourceDialect
3425                        );
3426                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NeededBlobsOpenBlobRequest>(&header, _body_bytes, handles, &mut req)?;
3427                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
3428                        Ok(NeededBlobsRequest::OpenBlob {
3429                            blob_id: req.blob_id,
3430
3431                            responder: NeededBlobsOpenBlobResponder {
3432                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3433                                tx_id: header.tx_id,
3434                            },
3435                        })
3436                    }
3437                    0x222f80ec77433f44 => {
3438                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3439                        let mut req = fidl::new_empty!(
3440                            NeededBlobsBlobWrittenRequest,
3441                            fidl::encoding::DefaultFuchsiaResourceDialect
3442                        );
3443                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NeededBlobsBlobWrittenRequest>(&header, _body_bytes, handles, &mut req)?;
3444                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
3445                        Ok(NeededBlobsRequest::BlobWritten {
3446                            blob_id: req.blob_id,
3447
3448                            responder: NeededBlobsBlobWrittenResponder {
3449                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3450                                tx_id: header.tx_id,
3451                            },
3452                        })
3453                    }
3454                    0x6fda8d5ebea74cbb => {
3455                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3456                        let mut req = fidl::new_empty!(
3457                            fidl::encoding::EmptyPayload,
3458                            fidl::encoding::DefaultFuchsiaResourceDialect
3459                        );
3460                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3461                        let control_handle = NeededBlobsControlHandle { inner: this.inner.clone() };
3462                        Ok(NeededBlobsRequest::Abort {
3463                            responder: NeededBlobsAbortResponder {
3464                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3465                                tx_id: header.tx_id,
3466                            },
3467                        })
3468                    }
3469                    _ => Err(fidl::Error::UnknownOrdinal {
3470                        ordinal: header.ordinal,
3471                        protocol_name:
3472                            <NeededBlobsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3473                    }),
3474                }))
3475            },
3476        )
3477    }
3478}
3479
3480/// Represents the transaction for caching a particular package.
3481///
3482/// Server expects client to follow the normal operation sequence defined below.
3483/// Violating the protocol (e.g. calling wrong methods at the wrong time) will result
3484/// in the channel being closed by the package cache with a `ZX_ERR_BAD_STATE` epitaph
3485/// and aborting the package cache operation.
3486/// If a fatal error occurs at any step, server will close the channel, and client
3487/// should not proceed with the sequence.
3488/// Non-fatal errors could be retried, as long as the channel remains open.
3489///
3490/// Normal operation sequence:
3491/// 1. Clients should start by requesting to `OpenMetaBlob()`, and fetch and write
3492/// the metadata blob if needed, calling `BlobWritten()` when done to indicate the
3493/// write is complete.
3494/// 2. `GetMissingBlobs()` should be used to determine which blobs need to be
3495/// fetched and written.
3496/// 3. Each of the missing blobs needs to be written using `OpenBlob()` and
3497/// `BlobWritten()` should be called after each blob is written.
3498///
3499/// Clients are responsible for avoiding concurrent creation of the same blob if the underlying
3500/// blobstore does not support it.
3501/// This manifests as the following constraints (applied per `BlobId`):
3502/// 1. If the `BlobWriter` returned by calls to `Open[Meta]Blob` is the `file` variant, once Clients
3503///    call Resize on a file, they must close *all* file connections obtained from `Open[Meta]Blob`
3504///    before calling `Open[Meta]Blob` again.
3505/// 2. If the `BlobWriter` returned by calls to `Open[Meta]Blob` is the `writer` variant, Clients
3506///    must not write all the bytes to more than one of the `writer`s.
3507/// This applies per `BlobId` to all `BlobWriter`s returned by all calls to `Open[Meta]Blob` across
3508/// all `NeededBlobs` connections across all `PackageCache` connections.
3509/// Once c++blobfs support is removed and fxblob is changed to support duplicate concurrent creation
3510/// requests (https://fxbug.dev/335870456#comment9), this requirement can be dropped.
3511///
3512/// Once all needed blobs are written by the client, the package cache will
3513/// complete the pending [`PackageCache.Get`] request and close this channel
3514/// with a `ZX_OK` epitaph.
3515#[derive(Debug)]
3516pub enum NeededBlobsRequest {
3517    /// Opens the package's metadata blob for writing. `GetMissingBlobs()`
3518    /// should not be called until writing the meta blob or this request
3519    /// responds with `false`.
3520    ///
3521    /// If the package was already cached, server will close the channel with a
3522    /// `ZX_OK` epitaph.
3523    ///
3524    /// - response `writer` is used to write the blob. If `writer` is absent,
3525    ///   the blob is already cached and so does not need to be written.
3526    /// * error an OpenBlobError indicating failure. Clients may retry this
3527    ///   request, though the server end may abort this cache operation on
3528    ///   errors it considers to be fatal.
3529    OpenMetaBlob { responder: NeededBlobsOpenMetaBlobResponder },
3530    /// Returns an iterator of blobs that are not present on the system that
3531    /// must be written using the `OpenBlob` request before the package will be
3532    /// fully cached.
3533    ///
3534    /// Client should call `OpenMetaBlob`, and write it if needed, before
3535    /// calling `GetMissingBlobs`.
3536    ///
3537    /// A client should make this request no more than once per `NeededBlobs`
3538    /// connection. Once all blobs yielded by this iterator are written, the
3539    /// package open request will complete.
3540    ///
3541    /// New items may be added to the obtained `BlobInfoIterator` as the client
3542    /// calls `OpenBlob`, so, to guaranatee termination of the iterator, clients
3543    /// should call `OpenBlob` concurrently with reading the iterator.
3544    ///
3545    /// + request `iterator` a request for an iterator of [`BlobInfo`] of blobs
3546    ///   that the client should try to write.
3547    GetMissingBlobs {
3548        iterator: fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>,
3549        control_handle: NeededBlobsControlHandle,
3550    },
3551    /// Opens a blob for writing.
3552    ///
3553    /// + request `blob_id` the blob id describing this blob.
3554    /// - response `writer` is used to write the blob. If `writer` is absent,
3555    ///   the blob is already cached and so does not need to be written.
3556    /// * error an OpenBlobError indicating failure. Clients may retry this
3557    ///   request, though the server end may abort this cache operation on
3558    ///   errors it considers to be fatal.
3559    OpenBlob { blob_id: BlobId, responder: NeededBlobsOpenBlobResponder },
3560    /// Indicates that a blob opened by `Open[Meta]Blob` has been successfully
3561    /// written.
3562    ///
3563    /// A client should call this once the blob has been fully written using
3564    /// the `writer` returned by `Open[Meta]Blob`.
3565    ///
3566    /// + request `blob_id` the blob id describing this blob.
3567    /// * error a BlobWrittenError indicating failure. Clients may retry the
3568    ///   `Open[Meta]Blob` request that prompted this call, though the server
3569    ///   end may abort this cache operation on errors it considers to be fatal.
3570    BlobWritten { blob_id: BlobId, responder: NeededBlobsBlobWrittenResponder },
3571    /// Aborts this caching operation for the package.
3572    ///
3573    /// Any open blobs and any missing blobs iterator will be closed. Any `dir`
3574    /// provided to the associated [`PackageCache.Get`] request will also be
3575    /// closed. Once this request is acknowledged, this channel will be closed.
3576    ///
3577    /// Note, dropping this NeededBlobs channel without writing all needed blobs
3578    /// will also abort the package cache operation. However, this API provides
3579    /// the ability to wait for the operation to be torn down.
3580    Abort { responder: NeededBlobsAbortResponder },
3581}
3582
3583impl NeededBlobsRequest {
3584    #[allow(irrefutable_let_patterns)]
3585    pub fn into_open_meta_blob(self) -> Option<(NeededBlobsOpenMetaBlobResponder)> {
3586        if let NeededBlobsRequest::OpenMetaBlob { responder } = self {
3587            Some((responder))
3588        } else {
3589            None
3590        }
3591    }
3592
3593    #[allow(irrefutable_let_patterns)]
3594    pub fn into_get_missing_blobs(
3595        self,
3596    ) -> Option<(fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>, NeededBlobsControlHandle)>
3597    {
3598        if let NeededBlobsRequest::GetMissingBlobs { iterator, control_handle } = self {
3599            Some((iterator, control_handle))
3600        } else {
3601            None
3602        }
3603    }
3604
3605    #[allow(irrefutable_let_patterns)]
3606    pub fn into_open_blob(self) -> Option<(BlobId, NeededBlobsOpenBlobResponder)> {
3607        if let NeededBlobsRequest::OpenBlob { blob_id, responder } = self {
3608            Some((blob_id, responder))
3609        } else {
3610            None
3611        }
3612    }
3613
3614    #[allow(irrefutable_let_patterns)]
3615    pub fn into_blob_written(self) -> Option<(BlobId, NeededBlobsBlobWrittenResponder)> {
3616        if let NeededBlobsRequest::BlobWritten { blob_id, responder } = self {
3617            Some((blob_id, responder))
3618        } else {
3619            None
3620        }
3621    }
3622
3623    #[allow(irrefutable_let_patterns)]
3624    pub fn into_abort(self) -> Option<(NeededBlobsAbortResponder)> {
3625        if let NeededBlobsRequest::Abort { responder } = self {
3626            Some((responder))
3627        } else {
3628            None
3629        }
3630    }
3631
3632    /// Name of the method defined in FIDL
3633    pub fn method_name(&self) -> &'static str {
3634        match *self {
3635            NeededBlobsRequest::OpenMetaBlob { .. } => "open_meta_blob",
3636            NeededBlobsRequest::GetMissingBlobs { .. } => "get_missing_blobs",
3637            NeededBlobsRequest::OpenBlob { .. } => "open_blob",
3638            NeededBlobsRequest::BlobWritten { .. } => "blob_written",
3639            NeededBlobsRequest::Abort { .. } => "abort",
3640        }
3641    }
3642}
3643
3644#[derive(Debug, Clone)]
3645pub struct NeededBlobsControlHandle {
3646    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3647}
3648
3649impl fidl::endpoints::ControlHandle for NeededBlobsControlHandle {
3650    fn shutdown(&self) {
3651        self.inner.shutdown()
3652    }
3653    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3654        self.inner.shutdown_with_epitaph(status)
3655    }
3656
3657    fn is_closed(&self) -> bool {
3658        self.inner.channel().is_closed()
3659    }
3660    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3661        self.inner.channel().on_closed()
3662    }
3663
3664    #[cfg(target_os = "fuchsia")]
3665    fn signal_peer(
3666        &self,
3667        clear_mask: zx::Signals,
3668        set_mask: zx::Signals,
3669    ) -> Result<(), zx_status::Status> {
3670        use fidl::Peered;
3671        self.inner.channel().signal_peer(clear_mask, set_mask)
3672    }
3673}
3674
3675impl NeededBlobsControlHandle {}
3676
3677#[must_use = "FIDL methods require a response to be sent"]
3678#[derive(Debug)]
3679pub struct NeededBlobsOpenMetaBlobResponder {
3680    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3681    tx_id: u32,
3682}
3683
3684/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3685/// if the responder is dropped without sending a response, so that the client
3686/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3687impl std::ops::Drop for NeededBlobsOpenMetaBlobResponder {
3688    fn drop(&mut self) {
3689        self.control_handle.shutdown();
3690        // Safety: drops once, never accessed again
3691        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3692    }
3693}
3694
3695impl fidl::endpoints::Responder for NeededBlobsOpenMetaBlobResponder {
3696    type ControlHandle = NeededBlobsControlHandle;
3697
3698    fn control_handle(&self) -> &NeededBlobsControlHandle {
3699        &self.control_handle
3700    }
3701
3702    fn drop_without_shutdown(mut self) {
3703        // Safety: drops once, never accessed again due to mem::forget
3704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3705        // Prevent Drop from running (which would shut down the channel)
3706        std::mem::forget(self);
3707    }
3708}
3709
3710impl NeededBlobsOpenMetaBlobResponder {
3711    /// Sends a response to the FIDL transaction.
3712    ///
3713    /// Sets the channel to shutdown if an error occurs.
3714    pub fn send(
3715        self,
3716        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3717    ) -> Result<(), fidl::Error> {
3718        let _result = self.send_raw(result);
3719        if _result.is_err() {
3720            self.control_handle.shutdown();
3721        }
3722        self.drop_without_shutdown();
3723        _result
3724    }
3725
3726    /// Similar to "send" but does not shutdown the channel if an error occurs.
3727    pub fn send_no_shutdown_on_err(
3728        self,
3729        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3730    ) -> Result<(), fidl::Error> {
3731        let _result = self.send_raw(result);
3732        self.drop_without_shutdown();
3733        _result
3734    }
3735
3736    fn send_raw(
3737        &self,
3738        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3739    ) -> Result<(), fidl::Error> {
3740        self.control_handle.inner.send::<fidl::encoding::ResultType<
3741            NeededBlobsOpenMetaBlobResponse,
3742            OpenBlobError,
3743        >>(
3744            result.as_mut().map_err(|e| *e).map(|writer| (writer.as_mut(),)),
3745            self.tx_id,
3746            0x42f385a58180f5fb,
3747            fidl::encoding::DynamicFlags::empty(),
3748        )
3749    }
3750}
3751
3752#[must_use = "FIDL methods require a response to be sent"]
3753#[derive(Debug)]
3754pub struct NeededBlobsOpenBlobResponder {
3755    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3756    tx_id: u32,
3757}
3758
3759/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3760/// if the responder is dropped without sending a response, so that the client
3761/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3762impl std::ops::Drop for NeededBlobsOpenBlobResponder {
3763    fn drop(&mut self) {
3764        self.control_handle.shutdown();
3765        // Safety: drops once, never accessed again
3766        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3767    }
3768}
3769
3770impl fidl::endpoints::Responder for NeededBlobsOpenBlobResponder {
3771    type ControlHandle = NeededBlobsControlHandle;
3772
3773    fn control_handle(&self) -> &NeededBlobsControlHandle {
3774        &self.control_handle
3775    }
3776
3777    fn drop_without_shutdown(mut self) {
3778        // Safety: drops once, never accessed again due to mem::forget
3779        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3780        // Prevent Drop from running (which would shut down the channel)
3781        std::mem::forget(self);
3782    }
3783}
3784
3785impl NeededBlobsOpenBlobResponder {
3786    /// Sends a response to the FIDL transaction.
3787    ///
3788    /// Sets the channel to shutdown if an error occurs.
3789    pub fn send(
3790        self,
3791        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3792    ) -> Result<(), fidl::Error> {
3793        let _result = self.send_raw(result);
3794        if _result.is_err() {
3795            self.control_handle.shutdown();
3796        }
3797        self.drop_without_shutdown();
3798        _result
3799    }
3800
3801    /// Similar to "send" but does not shutdown the channel if an error occurs.
3802    pub fn send_no_shutdown_on_err(
3803        self,
3804        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3805    ) -> Result<(), fidl::Error> {
3806        let _result = self.send_raw(result);
3807        self.drop_without_shutdown();
3808        _result
3809    }
3810
3811    fn send_raw(
3812        &self,
3813        mut result: Result<Option<BlobWriter>, OpenBlobError>,
3814    ) -> Result<(), fidl::Error> {
3815        self.control_handle.inner.send::<fidl::encoding::ResultType<
3816            NeededBlobsOpenBlobResponse,
3817            OpenBlobError,
3818        >>(
3819            result.as_mut().map_err(|e| *e).map(|writer| (writer.as_mut(),)),
3820            self.tx_id,
3821            0x67cd4c4cd10ea9e0,
3822            fidl::encoding::DynamicFlags::empty(),
3823        )
3824    }
3825}
3826
3827#[must_use = "FIDL methods require a response to be sent"]
3828#[derive(Debug)]
3829pub struct NeededBlobsBlobWrittenResponder {
3830    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3831    tx_id: u32,
3832}
3833
3834/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3835/// if the responder is dropped without sending a response, so that the client
3836/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3837impl std::ops::Drop for NeededBlobsBlobWrittenResponder {
3838    fn drop(&mut self) {
3839        self.control_handle.shutdown();
3840        // Safety: drops once, never accessed again
3841        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3842    }
3843}
3844
3845impl fidl::endpoints::Responder for NeededBlobsBlobWrittenResponder {
3846    type ControlHandle = NeededBlobsControlHandle;
3847
3848    fn control_handle(&self) -> &NeededBlobsControlHandle {
3849        &self.control_handle
3850    }
3851
3852    fn drop_without_shutdown(mut self) {
3853        // Safety: drops once, never accessed again due to mem::forget
3854        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3855        // Prevent Drop from running (which would shut down the channel)
3856        std::mem::forget(self);
3857    }
3858}
3859
3860impl NeededBlobsBlobWrittenResponder {
3861    /// Sends a response to the FIDL transaction.
3862    ///
3863    /// Sets the channel to shutdown if an error occurs.
3864    pub fn send(self, mut result: Result<(), BlobWrittenError>) -> Result<(), fidl::Error> {
3865        let _result = self.send_raw(result);
3866        if _result.is_err() {
3867            self.control_handle.shutdown();
3868        }
3869        self.drop_without_shutdown();
3870        _result
3871    }
3872
3873    /// Similar to "send" but does not shutdown the channel if an error occurs.
3874    pub fn send_no_shutdown_on_err(
3875        self,
3876        mut result: Result<(), BlobWrittenError>,
3877    ) -> Result<(), fidl::Error> {
3878        let _result = self.send_raw(result);
3879        self.drop_without_shutdown();
3880        _result
3881    }
3882
3883    fn send_raw(&self, mut result: Result<(), BlobWrittenError>) -> Result<(), fidl::Error> {
3884        self.control_handle.inner.send::<fidl::encoding::ResultType<
3885            fidl::encoding::EmptyStruct,
3886            BlobWrittenError,
3887        >>(
3888            result,
3889            self.tx_id,
3890            0x222f80ec77433f44,
3891            fidl::encoding::DynamicFlags::empty(),
3892        )
3893    }
3894}
3895
3896#[must_use = "FIDL methods require a response to be sent"]
3897#[derive(Debug)]
3898pub struct NeededBlobsAbortResponder {
3899    control_handle: std::mem::ManuallyDrop<NeededBlobsControlHandle>,
3900    tx_id: u32,
3901}
3902
3903/// Set the the channel to be shutdown (see [`NeededBlobsControlHandle::shutdown`])
3904/// if the responder is dropped without sending a response, so that the client
3905/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3906impl std::ops::Drop for NeededBlobsAbortResponder {
3907    fn drop(&mut self) {
3908        self.control_handle.shutdown();
3909        // Safety: drops once, never accessed again
3910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3911    }
3912}
3913
3914impl fidl::endpoints::Responder for NeededBlobsAbortResponder {
3915    type ControlHandle = NeededBlobsControlHandle;
3916
3917    fn control_handle(&self) -> &NeededBlobsControlHandle {
3918        &self.control_handle
3919    }
3920
3921    fn drop_without_shutdown(mut self) {
3922        // Safety: drops once, never accessed again due to mem::forget
3923        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3924        // Prevent Drop from running (which would shut down the channel)
3925        std::mem::forget(self);
3926    }
3927}
3928
3929impl NeededBlobsAbortResponder {
3930    /// Sends a response to the FIDL transaction.
3931    ///
3932    /// Sets the channel to shutdown if an error occurs.
3933    pub fn send(self) -> Result<(), fidl::Error> {
3934        let _result = self.send_raw();
3935        if _result.is_err() {
3936            self.control_handle.shutdown();
3937        }
3938        self.drop_without_shutdown();
3939        _result
3940    }
3941
3942    /// Similar to "send" but does not shutdown the channel if an error occurs.
3943    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3944        let _result = self.send_raw();
3945        self.drop_without_shutdown();
3946        _result
3947    }
3948
3949    fn send_raw(&self) -> Result<(), fidl::Error> {
3950        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3951            (),
3952            self.tx_id,
3953            0x6fda8d5ebea74cbb,
3954            fidl::encoding::DynamicFlags::empty(),
3955        )
3956    }
3957}
3958
3959#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3960pub struct PackageCacheMarker;
3961
3962impl fidl::endpoints::ProtocolMarker for PackageCacheMarker {
3963    type Proxy = PackageCacheProxy;
3964    type RequestStream = PackageCacheRequestStream;
3965    #[cfg(target_os = "fuchsia")]
3966    type SynchronousProxy = PackageCacheSynchronousProxy;
3967
3968    const DEBUG_NAME: &'static str = "fuchsia.pkg.PackageCache";
3969}
3970impl fidl::endpoints::DiscoverableProtocolMarker for PackageCacheMarker {}
3971pub type PackageCacheGetResult = Result<(), i32>;
3972pub type PackageCacheGetSubpackageResult = Result<(), GetSubpackageError>;
3973pub type PackageCacheSyncResult = Result<(), i32>;
3974pub type PackageCacheSetUpgradableUrlsResult = Result<(), SetUpgradableUrlsError>;
3975
3976pub trait PackageCacheProxyInterface: Send + Sync {
3977    type GetResponseFut: std::future::Future<Output = Result<PackageCacheGetResult, fidl::Error>>
3978        + Send;
3979    fn r#get(
3980        &self,
3981        meta_far_blob: &BlobInfo,
3982        gc_protection: GcProtection,
3983        needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
3984        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3985    ) -> Self::GetResponseFut;
3986    type GetSubpackageResponseFut: std::future::Future<Output = Result<PackageCacheGetSubpackageResult, fidl::Error>>
3987        + Send;
3988    fn r#get_subpackage(
3989        &self,
3990        superpackage: &BlobId,
3991        subpackage: &PackageUrl,
3992        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3993    ) -> Self::GetSubpackageResponseFut;
3994    fn r#base_package_index(
3995        &self,
3996        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
3997    ) -> Result<(), fidl::Error>;
3998    fn r#cache_package_index(
3999        &self,
4000        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4001    ) -> Result<(), fidl::Error>;
4002    type SyncResponseFut: std::future::Future<Output = Result<PackageCacheSyncResult, fidl::Error>>
4003        + Send;
4004    fn r#sync(&self) -> Self::SyncResponseFut;
4005    type SetUpgradableUrlsResponseFut: std::future::Future<Output = Result<PackageCacheSetUpgradableUrlsResult, fidl::Error>>
4006        + Send;
4007    fn r#set_upgradable_urls(
4008        &self,
4009        pinned_urls: &[PackageUrl],
4010    ) -> Self::SetUpgradableUrlsResponseFut;
4011}
4012#[derive(Debug)]
4013#[cfg(target_os = "fuchsia")]
4014pub struct PackageCacheSynchronousProxy {
4015    client: fidl::client::sync::Client,
4016}
4017
4018#[cfg(target_os = "fuchsia")]
4019impl fidl::endpoints::SynchronousProxy for PackageCacheSynchronousProxy {
4020    type Proxy = PackageCacheProxy;
4021    type Protocol = PackageCacheMarker;
4022
4023    fn from_channel(inner: fidl::Channel) -> Self {
4024        Self::new(inner)
4025    }
4026
4027    fn into_channel(self) -> fidl::Channel {
4028        self.client.into_channel()
4029    }
4030
4031    fn as_channel(&self) -> &fidl::Channel {
4032        self.client.as_channel()
4033    }
4034}
4035
4036#[cfg(target_os = "fuchsia")]
4037impl PackageCacheSynchronousProxy {
4038    pub fn new(channel: fidl::Channel) -> Self {
4039        let protocol_name = <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4040        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4041    }
4042
4043    pub fn into_channel(self) -> fidl::Channel {
4044        self.client.into_channel()
4045    }
4046
4047    /// Waits until an event arrives and returns it. It is safe for other
4048    /// threads to make concurrent requests while waiting for an event.
4049    pub fn wait_for_event(
4050        &self,
4051        deadline: zx::MonotonicInstant,
4052    ) -> Result<PackageCacheEvent, fidl::Error> {
4053        PackageCacheEvent::decode(self.client.wait_for_event(deadline)?)
4054    }
4055
4056    /// Gets the package directory if it is present on the local system. If it is not, the
4057    /// `missing_blobs` iterator will provide all the blobs in the package that are missing from
4058    /// the system, and the ability to write those blobs to blobfs. If all the missing blobs are
4059    /// downloaded and written to by the client, the `dir` directory will be resolved. This method
4060    /// will return successfully when the package has been fully resolved, or return an error if
4061    /// the client closes `needed_blobs` or `dir` handle before the package has been resolved.
4062    ///
4063    /// This method does not guarantee the missing blobs have been persisted. In order to guarantee
4064    /// missing blobs are persisted, clients should call ['Sync'].
4065    ///
4066    /// Clients must not make concurrent `Get()` calls for the same `meta_far_blob`, even across
4067    /// different `PackageCache` connections, *unless* the `meta_far_blob` is in base or already
4068    /// active in the dynamic index. Violating this may result in `Get()` errors.
4069    ///
4070    /// + request `meta_far_blob` the blob info for the package's meta.far.
4071    /// + request `needed_blobs` an iterator over all the blobs in the package that
4072    ///   are not present on the system.
4073    /// + request `dir` the channel on which the package directory will be served.
4074    /// * error a zx_status value indicating failure. One of the following:
4075    ///     * `ZX_ERR_UNAVAILABLE` if the client closed `needed_blobs` handles before
4076    ///       all the missing blobs were downloaded to the system.
4077    pub fn r#get(
4078        &self,
4079        mut meta_far_blob: &BlobInfo,
4080        mut gc_protection: GcProtection,
4081        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4082        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4083        ___deadline: zx::MonotonicInstant,
4084    ) -> Result<PackageCacheGetResult, fidl::Error> {
4085        let _response = self.client.send_query::<
4086            PackageCacheGetRequest,
4087            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4088        >(
4089            (meta_far_blob, gc_protection, needed_blobs, dir,),
4090            0x15e1963f4bf123b5,
4091            fidl::encoding::DynamicFlags::empty(),
4092            ___deadline,
4093        )?;
4094        Ok(_response.map(|x| x))
4095    }
4096
4097    /// Gets the package directory for a subpackage.
4098    /// The connection to the superpackage's package directory must still be open when this is
4099    /// called.
4100    /// The returned package will be protected by open package tracking.
4101    ///
4102    /// + request `superpackage` the hash of the superpackage's meta.far.
4103    /// + request `subpackage` the relative package URL of the subpackage.
4104    /// + request `dir` the channel on which the package directory will be served.
4105    /// * error a GetSubpackageError value indicating failure.
4106    pub fn r#get_subpackage(
4107        &self,
4108        mut superpackage: &BlobId,
4109        mut subpackage: &PackageUrl,
4110        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4111        ___deadline: zx::MonotonicInstant,
4112    ) -> Result<PackageCacheGetSubpackageResult, fidl::Error> {
4113        let _response =
4114            self.client.send_query::<PackageCacheGetSubpackageRequest, fidl::encoding::ResultType<
4115                fidl::encoding::EmptyStruct,
4116                GetSubpackageError,
4117            >>(
4118                (superpackage, subpackage, dir),
4119                0x29478df87c29ffa3,
4120                fidl::encoding::DynamicFlags::empty(),
4121                ___deadline,
4122            )?;
4123        Ok(_response.map(|x| x))
4124    }
4125
4126    /// Retrieves a chunk iterator to the base package index.
4127    ///
4128    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4129    ///   `PackageIndexEntry` objects until all packages in the base index have been iterated.
4130    pub fn r#base_package_index(
4131        &self,
4132        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4133    ) -> Result<(), fidl::Error> {
4134        self.client.send::<PackageCacheBasePackageIndexRequest>(
4135            (iterator,),
4136            0x46af9e595f8eced4,
4137            fidl::encoding::DynamicFlags::empty(),
4138        )
4139    }
4140
4141    /// Retrieves a chunk iterator to the cache package index.
4142    ///
4143    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4144    ///   `PackageIndexEntry` objects until all packages in the cache index have been iterated.
4145    pub fn r#cache_package_index(
4146        &self,
4147        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4148    ) -> Result<(), fidl::Error> {
4149        self.client.send::<PackageCacheCachePackageIndexRequest>(
4150            (iterator,),
4151            0x14a48fdb8f26ed26,
4152            fidl::encoding::DynamicFlags::empty(),
4153        )
4154    }
4155
4156    /// Synchronizes updates to the cached packages to the underlying persistent storage.
4157    ///
4158    /// * error a zx_status value indicating failure. One of the following:
4159    ///     * `ZX_ERR_INTERNAL` if the sync fails.
4160    pub fn r#sync(
4161        &self,
4162        ___deadline: zx::MonotonicInstant,
4163    ) -> Result<PackageCacheSyncResult, fidl::Error> {
4164        let _response = self.client.send_query::<
4165            fidl::encoding::EmptyPayload,
4166            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4167        >(
4168            (),
4169            0x5c10a84094535a74,
4170            fidl::encoding::DynamicFlags::empty(),
4171            ___deadline,
4172        )?;
4173        Ok(_response.map(|x| x))
4174    }
4175
4176    /// Sets which package URLs correspond to upgradable packages and the hash they should resolve
4177    /// to.
4178    ///
4179    /// If upgradable packages are enabled in pkg-cache, this method must be called once on start up
4180    /// to set the hashes for persisted upgradable packages. All such packages must not be base
4181    /// packages. If none of the upgradable packages are persisted, a call with an empty vector
4182    /// still needs to be made. Package resolution of non base packages and GC (and therefore OTA)
4183    /// will block until this is done.
4184    ///
4185    /// Subsequent calls can be made to set new upgradable packages or change the hashes associated
4186    /// with upgradable packages.
4187    ///
4188    /// The hash most recently associated with an upgradable package URL will be protected from GC.
4189    ///
4190    /// + request `pinned_urls` packages URLs pinned to the new hash.
4191    pub fn r#set_upgradable_urls(
4192        &self,
4193        mut pinned_urls: &[PackageUrl],
4194        ___deadline: zx::MonotonicInstant,
4195    ) -> Result<PackageCacheSetUpgradableUrlsResult, fidl::Error> {
4196        let _response = self.client.send_query::<
4197            PackageCacheSetUpgradableUrlsRequest,
4198            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, SetUpgradableUrlsError>,
4199        >(
4200            (pinned_urls,),
4201            0x2c235f7efdb5e2d1,
4202            fidl::encoding::DynamicFlags::FLEXIBLE,
4203            ___deadline,
4204        )?
4205        .into_result::<PackageCacheMarker>("set_upgradable_urls")?;
4206        Ok(_response.map(|x| x))
4207    }
4208}
4209
4210#[derive(Debug, Clone)]
4211pub struct PackageCacheProxy {
4212    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4213}
4214
4215impl fidl::endpoints::Proxy for PackageCacheProxy {
4216    type Protocol = PackageCacheMarker;
4217
4218    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4219        Self::new(inner)
4220    }
4221
4222    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4223        self.client.into_channel().map_err(|client| Self { client })
4224    }
4225
4226    fn as_channel(&self) -> &::fidl::AsyncChannel {
4227        self.client.as_channel()
4228    }
4229}
4230
4231impl PackageCacheProxy {
4232    /// Create a new Proxy for fuchsia.pkg/PackageCache.
4233    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4234        let protocol_name = <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4235        Self { client: fidl::client::Client::new(channel, protocol_name) }
4236    }
4237
4238    /// Get a Stream of events from the remote end of the protocol.
4239    ///
4240    /// # Panics
4241    ///
4242    /// Panics if the event stream was already taken.
4243    pub fn take_event_stream(&self) -> PackageCacheEventStream {
4244        PackageCacheEventStream { event_receiver: self.client.take_event_receiver() }
4245    }
4246
4247    /// Gets the package directory if it is present on the local system. If it is not, the
4248    /// `missing_blobs` iterator will provide all the blobs in the package that are missing from
4249    /// the system, and the ability to write those blobs to blobfs. If all the missing blobs are
4250    /// downloaded and written to by the client, the `dir` directory will be resolved. This method
4251    /// will return successfully when the package has been fully resolved, or return an error if
4252    /// the client closes `needed_blobs` or `dir` handle before the package has been resolved.
4253    ///
4254    /// This method does not guarantee the missing blobs have been persisted. In order to guarantee
4255    /// missing blobs are persisted, clients should call ['Sync'].
4256    ///
4257    /// Clients must not make concurrent `Get()` calls for the same `meta_far_blob`, even across
4258    /// different `PackageCache` connections, *unless* the `meta_far_blob` is in base or already
4259    /// active in the dynamic index. Violating this may result in `Get()` errors.
4260    ///
4261    /// + request `meta_far_blob` the blob info for the package's meta.far.
4262    /// + request `needed_blobs` an iterator over all the blobs in the package that
4263    ///   are not present on the system.
4264    /// + request `dir` the channel on which the package directory will be served.
4265    /// * error a zx_status value indicating failure. One of the following:
4266    ///     * `ZX_ERR_UNAVAILABLE` if the client closed `needed_blobs` handles before
4267    ///       all the missing blobs were downloaded to the system.
4268    pub fn r#get(
4269        &self,
4270        mut meta_far_blob: &BlobInfo,
4271        mut gc_protection: GcProtection,
4272        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4273        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4274    ) -> fidl::client::QueryResponseFut<
4275        PackageCacheGetResult,
4276        fidl::encoding::DefaultFuchsiaResourceDialect,
4277    > {
4278        PackageCacheProxyInterface::r#get(self, meta_far_blob, gc_protection, needed_blobs, dir)
4279    }
4280
4281    /// Gets the package directory for a subpackage.
4282    /// The connection to the superpackage's package directory must still be open when this is
4283    /// called.
4284    /// The returned package will be protected by open package tracking.
4285    ///
4286    /// + request `superpackage` the hash of the superpackage's meta.far.
4287    /// + request `subpackage` the relative package URL of the subpackage.
4288    /// + request `dir` the channel on which the package directory will be served.
4289    /// * error a GetSubpackageError value indicating failure.
4290    pub fn r#get_subpackage(
4291        &self,
4292        mut superpackage: &BlobId,
4293        mut subpackage: &PackageUrl,
4294        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4295    ) -> fidl::client::QueryResponseFut<
4296        PackageCacheGetSubpackageResult,
4297        fidl::encoding::DefaultFuchsiaResourceDialect,
4298    > {
4299        PackageCacheProxyInterface::r#get_subpackage(self, superpackage, subpackage, dir)
4300    }
4301
4302    /// Retrieves a chunk iterator to the base package index.
4303    ///
4304    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4305    ///   `PackageIndexEntry` objects until all packages in the base index have been iterated.
4306    pub fn r#base_package_index(
4307        &self,
4308        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4309    ) -> Result<(), fidl::Error> {
4310        PackageCacheProxyInterface::r#base_package_index(self, iterator)
4311    }
4312
4313    /// Retrieves a chunk iterator to the cache package index.
4314    ///
4315    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4316    ///   `PackageIndexEntry` objects until all packages in the cache index have been iterated.
4317    pub fn r#cache_package_index(
4318        &self,
4319        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4320    ) -> Result<(), fidl::Error> {
4321        PackageCacheProxyInterface::r#cache_package_index(self, iterator)
4322    }
4323
4324    /// Synchronizes updates to the cached packages to the underlying persistent storage.
4325    ///
4326    /// * error a zx_status value indicating failure. One of the following:
4327    ///     * `ZX_ERR_INTERNAL` if the sync fails.
4328    pub fn r#sync(
4329        &self,
4330    ) -> fidl::client::QueryResponseFut<
4331        PackageCacheSyncResult,
4332        fidl::encoding::DefaultFuchsiaResourceDialect,
4333    > {
4334        PackageCacheProxyInterface::r#sync(self)
4335    }
4336
4337    /// Sets which package URLs correspond to upgradable packages and the hash they should resolve
4338    /// to.
4339    ///
4340    /// If upgradable packages are enabled in pkg-cache, this method must be called once on start up
4341    /// to set the hashes for persisted upgradable packages. All such packages must not be base
4342    /// packages. If none of the upgradable packages are persisted, a call with an empty vector
4343    /// still needs to be made. Package resolution of non base packages and GC (and therefore OTA)
4344    /// will block until this is done.
4345    ///
4346    /// Subsequent calls can be made to set new upgradable packages or change the hashes associated
4347    /// with upgradable packages.
4348    ///
4349    /// The hash most recently associated with an upgradable package URL will be protected from GC.
4350    ///
4351    /// + request `pinned_urls` packages URLs pinned to the new hash.
4352    pub fn r#set_upgradable_urls(
4353        &self,
4354        mut pinned_urls: &[PackageUrl],
4355    ) -> fidl::client::QueryResponseFut<
4356        PackageCacheSetUpgradableUrlsResult,
4357        fidl::encoding::DefaultFuchsiaResourceDialect,
4358    > {
4359        PackageCacheProxyInterface::r#set_upgradable_urls(self, pinned_urls)
4360    }
4361}
4362
4363impl PackageCacheProxyInterface for PackageCacheProxy {
4364    type GetResponseFut = fidl::client::QueryResponseFut<
4365        PackageCacheGetResult,
4366        fidl::encoding::DefaultFuchsiaResourceDialect,
4367    >;
4368    fn r#get(
4369        &self,
4370        mut meta_far_blob: &BlobInfo,
4371        mut gc_protection: GcProtection,
4372        mut needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4373        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4374    ) -> Self::GetResponseFut {
4375        fn _decode(
4376            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4377        ) -> Result<PackageCacheGetResult, fidl::Error> {
4378            let _response = fidl::client::decode_transaction_body::<
4379                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4380                fidl::encoding::DefaultFuchsiaResourceDialect,
4381                0x15e1963f4bf123b5,
4382            >(_buf?)?;
4383            Ok(_response.map(|x| x))
4384        }
4385        self.client.send_query_and_decode::<PackageCacheGetRequest, PackageCacheGetResult>(
4386            (meta_far_blob, gc_protection, needed_blobs, dir),
4387            0x15e1963f4bf123b5,
4388            fidl::encoding::DynamicFlags::empty(),
4389            _decode,
4390        )
4391    }
4392
4393    type GetSubpackageResponseFut = fidl::client::QueryResponseFut<
4394        PackageCacheGetSubpackageResult,
4395        fidl::encoding::DefaultFuchsiaResourceDialect,
4396    >;
4397    fn r#get_subpackage(
4398        &self,
4399        mut superpackage: &BlobId,
4400        mut subpackage: &PackageUrl,
4401        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4402    ) -> Self::GetSubpackageResponseFut {
4403        fn _decode(
4404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4405        ) -> Result<PackageCacheGetSubpackageResult, fidl::Error> {
4406            let _response = fidl::client::decode_transaction_body::<
4407                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GetSubpackageError>,
4408                fidl::encoding::DefaultFuchsiaResourceDialect,
4409                0x29478df87c29ffa3,
4410            >(_buf?)?;
4411            Ok(_response.map(|x| x))
4412        }
4413        self.client.send_query_and_decode::<
4414            PackageCacheGetSubpackageRequest,
4415            PackageCacheGetSubpackageResult,
4416        >(
4417            (superpackage, subpackage, dir,),
4418            0x29478df87c29ffa3,
4419            fidl::encoding::DynamicFlags::empty(),
4420            _decode,
4421        )
4422    }
4423
4424    fn r#base_package_index(
4425        &self,
4426        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4427    ) -> Result<(), fidl::Error> {
4428        self.client.send::<PackageCacheBasePackageIndexRequest>(
4429            (iterator,),
4430            0x46af9e595f8eced4,
4431            fidl::encoding::DynamicFlags::empty(),
4432        )
4433    }
4434
4435    fn r#cache_package_index(
4436        &self,
4437        mut iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4438    ) -> Result<(), fidl::Error> {
4439        self.client.send::<PackageCacheCachePackageIndexRequest>(
4440            (iterator,),
4441            0x14a48fdb8f26ed26,
4442            fidl::encoding::DynamicFlags::empty(),
4443        )
4444    }
4445
4446    type SyncResponseFut = fidl::client::QueryResponseFut<
4447        PackageCacheSyncResult,
4448        fidl::encoding::DefaultFuchsiaResourceDialect,
4449    >;
4450    fn r#sync(&self) -> Self::SyncResponseFut {
4451        fn _decode(
4452            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4453        ) -> Result<PackageCacheSyncResult, fidl::Error> {
4454            let _response = fidl::client::decode_transaction_body::<
4455                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4456                fidl::encoding::DefaultFuchsiaResourceDialect,
4457                0x5c10a84094535a74,
4458            >(_buf?)?;
4459            Ok(_response.map(|x| x))
4460        }
4461        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PackageCacheSyncResult>(
4462            (),
4463            0x5c10a84094535a74,
4464            fidl::encoding::DynamicFlags::empty(),
4465            _decode,
4466        )
4467    }
4468
4469    type SetUpgradableUrlsResponseFut = fidl::client::QueryResponseFut<
4470        PackageCacheSetUpgradableUrlsResult,
4471        fidl::encoding::DefaultFuchsiaResourceDialect,
4472    >;
4473    fn r#set_upgradable_urls(
4474        &self,
4475        mut pinned_urls: &[PackageUrl],
4476    ) -> Self::SetUpgradableUrlsResponseFut {
4477        fn _decode(
4478            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4479        ) -> Result<PackageCacheSetUpgradableUrlsResult, fidl::Error> {
4480            let _response = fidl::client::decode_transaction_body::<
4481                fidl::encoding::FlexibleResultType<
4482                    fidl::encoding::EmptyStruct,
4483                    SetUpgradableUrlsError,
4484                >,
4485                fidl::encoding::DefaultFuchsiaResourceDialect,
4486                0x2c235f7efdb5e2d1,
4487            >(_buf?)?
4488            .into_result::<PackageCacheMarker>("set_upgradable_urls")?;
4489            Ok(_response.map(|x| x))
4490        }
4491        self.client.send_query_and_decode::<
4492            PackageCacheSetUpgradableUrlsRequest,
4493            PackageCacheSetUpgradableUrlsResult,
4494        >(
4495            (pinned_urls,),
4496            0x2c235f7efdb5e2d1,
4497            fidl::encoding::DynamicFlags::FLEXIBLE,
4498            _decode,
4499        )
4500    }
4501}
4502
4503pub struct PackageCacheEventStream {
4504    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4505}
4506
4507impl std::marker::Unpin for PackageCacheEventStream {}
4508
4509impl futures::stream::FusedStream for PackageCacheEventStream {
4510    fn is_terminated(&self) -> bool {
4511        self.event_receiver.is_terminated()
4512    }
4513}
4514
4515impl futures::Stream for PackageCacheEventStream {
4516    type Item = Result<PackageCacheEvent, fidl::Error>;
4517
4518    fn poll_next(
4519        mut self: std::pin::Pin<&mut Self>,
4520        cx: &mut std::task::Context<'_>,
4521    ) -> std::task::Poll<Option<Self::Item>> {
4522        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4523            &mut self.event_receiver,
4524            cx
4525        )?) {
4526            Some(buf) => std::task::Poll::Ready(Some(PackageCacheEvent::decode(buf))),
4527            None => std::task::Poll::Ready(None),
4528        }
4529    }
4530}
4531
4532#[derive(Debug)]
4533pub enum PackageCacheEvent {
4534    #[non_exhaustive]
4535    _UnknownEvent {
4536        /// Ordinal of the event that was sent.
4537        ordinal: u64,
4538    },
4539}
4540
4541impl PackageCacheEvent {
4542    /// Decodes a message buffer as a [`PackageCacheEvent`].
4543    fn decode(
4544        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4545    ) -> Result<PackageCacheEvent, fidl::Error> {
4546        let (bytes, _handles) = buf.split_mut();
4547        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4548        debug_assert_eq!(tx_header.tx_id, 0);
4549        match tx_header.ordinal {
4550            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4551                Ok(PackageCacheEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4552            }
4553            _ => Err(fidl::Error::UnknownOrdinal {
4554                ordinal: tx_header.ordinal,
4555                protocol_name: <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4556            }),
4557        }
4558    }
4559}
4560
4561/// A Stream of incoming requests for fuchsia.pkg/PackageCache.
4562pub struct PackageCacheRequestStream {
4563    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4564    is_terminated: bool,
4565}
4566
4567impl std::marker::Unpin for PackageCacheRequestStream {}
4568
4569impl futures::stream::FusedStream for PackageCacheRequestStream {
4570    fn is_terminated(&self) -> bool {
4571        self.is_terminated
4572    }
4573}
4574
4575impl fidl::endpoints::RequestStream for PackageCacheRequestStream {
4576    type Protocol = PackageCacheMarker;
4577    type ControlHandle = PackageCacheControlHandle;
4578
4579    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4580        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4581    }
4582
4583    fn control_handle(&self) -> Self::ControlHandle {
4584        PackageCacheControlHandle { inner: self.inner.clone() }
4585    }
4586
4587    fn into_inner(
4588        self,
4589    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4590    {
4591        (self.inner, self.is_terminated)
4592    }
4593
4594    fn from_inner(
4595        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4596        is_terminated: bool,
4597    ) -> Self {
4598        Self { inner, is_terminated }
4599    }
4600}
4601
4602impl futures::Stream for PackageCacheRequestStream {
4603    type Item = Result<PackageCacheRequest, fidl::Error>;
4604
4605    fn poll_next(
4606        mut self: std::pin::Pin<&mut Self>,
4607        cx: &mut std::task::Context<'_>,
4608    ) -> std::task::Poll<Option<Self::Item>> {
4609        let this = &mut *self;
4610        if this.inner.check_shutdown(cx) {
4611            this.is_terminated = true;
4612            return std::task::Poll::Ready(None);
4613        }
4614        if this.is_terminated {
4615            panic!("polled PackageCacheRequestStream after completion");
4616        }
4617        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4618            |bytes, handles| {
4619                match this.inner.channel().read_etc(cx, bytes, handles) {
4620                    std::task::Poll::Ready(Ok(())) => {}
4621                    std::task::Poll::Pending => return std::task::Poll::Pending,
4622                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4623                        this.is_terminated = true;
4624                        return std::task::Poll::Ready(None);
4625                    }
4626                    std::task::Poll::Ready(Err(e)) => {
4627                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4628                            e.into(),
4629                        ))))
4630                    }
4631                }
4632
4633                // A message has been received from the channel
4634                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4635
4636                std::task::Poll::Ready(Some(match header.ordinal {
4637                    0x15e1963f4bf123b5 => {
4638                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4639                        let mut req = fidl::new_empty!(
4640                            PackageCacheGetRequest,
4641                            fidl::encoding::DefaultFuchsiaResourceDialect
4642                        );
4643                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheGetRequest>(&header, _body_bytes, handles, &mut req)?;
4644                        let control_handle =
4645                            PackageCacheControlHandle { inner: this.inner.clone() };
4646                        Ok(PackageCacheRequest::Get {
4647                            meta_far_blob: req.meta_far_blob,
4648                            gc_protection: req.gc_protection,
4649                            needed_blobs: req.needed_blobs,
4650                            dir: req.dir,
4651
4652                            responder: PackageCacheGetResponder {
4653                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4654                                tx_id: header.tx_id,
4655                            },
4656                        })
4657                    }
4658                    0x29478df87c29ffa3 => {
4659                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4660                        let mut req = fidl::new_empty!(
4661                            PackageCacheGetSubpackageRequest,
4662                            fidl::encoding::DefaultFuchsiaResourceDialect
4663                        );
4664                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheGetSubpackageRequest>(&header, _body_bytes, handles, &mut req)?;
4665                        let control_handle =
4666                            PackageCacheControlHandle { inner: this.inner.clone() };
4667                        Ok(PackageCacheRequest::GetSubpackage {
4668                            superpackage: req.superpackage,
4669                            subpackage: req.subpackage,
4670                            dir: req.dir,
4671
4672                            responder: PackageCacheGetSubpackageResponder {
4673                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4674                                tx_id: header.tx_id,
4675                            },
4676                        })
4677                    }
4678                    0x46af9e595f8eced4 => {
4679                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4680                        let mut req = fidl::new_empty!(
4681                            PackageCacheBasePackageIndexRequest,
4682                            fidl::encoding::DefaultFuchsiaResourceDialect
4683                        );
4684                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheBasePackageIndexRequest>(&header, _body_bytes, handles, &mut req)?;
4685                        let control_handle =
4686                            PackageCacheControlHandle { inner: this.inner.clone() };
4687                        Ok(PackageCacheRequest::BasePackageIndex {
4688                            iterator: req.iterator,
4689
4690                            control_handle,
4691                        })
4692                    }
4693                    0x14a48fdb8f26ed26 => {
4694                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4695                        let mut req = fidl::new_empty!(
4696                            PackageCacheCachePackageIndexRequest,
4697                            fidl::encoding::DefaultFuchsiaResourceDialect
4698                        );
4699                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheCachePackageIndexRequest>(&header, _body_bytes, handles, &mut req)?;
4700                        let control_handle =
4701                            PackageCacheControlHandle { inner: this.inner.clone() };
4702                        Ok(PackageCacheRequest::CachePackageIndex {
4703                            iterator: req.iterator,
4704
4705                            control_handle,
4706                        })
4707                    }
4708                    0x5c10a84094535a74 => {
4709                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4710                        let mut req = fidl::new_empty!(
4711                            fidl::encoding::EmptyPayload,
4712                            fidl::encoding::DefaultFuchsiaResourceDialect
4713                        );
4714                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4715                        let control_handle =
4716                            PackageCacheControlHandle { inner: this.inner.clone() };
4717                        Ok(PackageCacheRequest::Sync {
4718                            responder: PackageCacheSyncResponder {
4719                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4720                                tx_id: header.tx_id,
4721                            },
4722                        })
4723                    }
4724                    0x2c235f7efdb5e2d1 => {
4725                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4726                        let mut req = fidl::new_empty!(
4727                            PackageCacheSetUpgradableUrlsRequest,
4728                            fidl::encoding::DefaultFuchsiaResourceDialect
4729                        );
4730                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageCacheSetUpgradableUrlsRequest>(&header, _body_bytes, handles, &mut req)?;
4731                        let control_handle =
4732                            PackageCacheControlHandle { inner: this.inner.clone() };
4733                        Ok(PackageCacheRequest::SetUpgradableUrls {
4734                            pinned_urls: req.pinned_urls,
4735
4736                            responder: PackageCacheSetUpgradableUrlsResponder {
4737                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4738                                tx_id: header.tx_id,
4739                            },
4740                        })
4741                    }
4742                    _ if header.tx_id == 0
4743                        && header
4744                            .dynamic_flags()
4745                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4746                    {
4747                        Ok(PackageCacheRequest::_UnknownMethod {
4748                            ordinal: header.ordinal,
4749                            control_handle: PackageCacheControlHandle { inner: this.inner.clone() },
4750                            method_type: fidl::MethodType::OneWay,
4751                        })
4752                    }
4753                    _ if header
4754                        .dynamic_flags()
4755                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4756                    {
4757                        this.inner.send_framework_err(
4758                            fidl::encoding::FrameworkErr::UnknownMethod,
4759                            header.tx_id,
4760                            header.ordinal,
4761                            header.dynamic_flags(),
4762                            (bytes, handles),
4763                        )?;
4764                        Ok(PackageCacheRequest::_UnknownMethod {
4765                            ordinal: header.ordinal,
4766                            control_handle: PackageCacheControlHandle { inner: this.inner.clone() },
4767                            method_type: fidl::MethodType::TwoWay,
4768                        })
4769                    }
4770                    _ => Err(fidl::Error::UnknownOrdinal {
4771                        ordinal: header.ordinal,
4772                        protocol_name:
4773                            <PackageCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4774                    }),
4775                }))
4776            },
4777        )
4778    }
4779}
4780
4781/// This manages the system package cache.
4782///
4783/// This is intended to be implemented by the package manager component and used by
4784/// package resolver components.
4785#[derive(Debug)]
4786pub enum PackageCacheRequest {
4787    /// Gets the package directory if it is present on the local system. If it is not, the
4788    /// `missing_blobs` iterator will provide all the blobs in the package that are missing from
4789    /// the system, and the ability to write those blobs to blobfs. If all the missing blobs are
4790    /// downloaded and written to by the client, the `dir` directory will be resolved. This method
4791    /// will return successfully when the package has been fully resolved, or return an error if
4792    /// the client closes `needed_blobs` or `dir` handle before the package has been resolved.
4793    ///
4794    /// This method does not guarantee the missing blobs have been persisted. In order to guarantee
4795    /// missing blobs are persisted, clients should call ['Sync'].
4796    ///
4797    /// Clients must not make concurrent `Get()` calls for the same `meta_far_blob`, even across
4798    /// different `PackageCache` connections, *unless* the `meta_far_blob` is in base or already
4799    /// active in the dynamic index. Violating this may result in `Get()` errors.
4800    ///
4801    /// + request `meta_far_blob` the blob info for the package's meta.far.
4802    /// + request `needed_blobs` an iterator over all the blobs in the package that
4803    ///   are not present on the system.
4804    /// + request `dir` the channel on which the package directory will be served.
4805    /// * error a zx_status value indicating failure. One of the following:
4806    ///     * `ZX_ERR_UNAVAILABLE` if the client closed `needed_blobs` handles before
4807    ///       all the missing blobs were downloaded to the system.
4808    Get {
4809        meta_far_blob: BlobInfo,
4810        gc_protection: GcProtection,
4811        needed_blobs: fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4812        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4813        responder: PackageCacheGetResponder,
4814    },
4815    /// Gets the package directory for a subpackage.
4816    /// The connection to the superpackage's package directory must still be open when this is
4817    /// called.
4818    /// The returned package will be protected by open package tracking.
4819    ///
4820    /// + request `superpackage` the hash of the superpackage's meta.far.
4821    /// + request `subpackage` the relative package URL of the subpackage.
4822    /// + request `dir` the channel on which the package directory will be served.
4823    /// * error a GetSubpackageError value indicating failure.
4824    GetSubpackage {
4825        superpackage: BlobId,
4826        subpackage: PackageUrl,
4827        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4828        responder: PackageCacheGetSubpackageResponder,
4829    },
4830    /// Retrieves a chunk iterator to the base package index.
4831    ///
4832    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4833    ///   `PackageIndexEntry` objects until all packages in the base index have been iterated.
4834    BasePackageIndex {
4835        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4836        control_handle: PackageCacheControlHandle,
4837    },
4838    /// Retrieves a chunk iterator to the cache package index.
4839    ///
4840    /// + request `iterator` a request for the `PackageIndexIterator` that will return sets of
4841    ///   `PackageIndexEntry` objects until all packages in the cache index have been iterated.
4842    CachePackageIndex {
4843        iterator: fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
4844        control_handle: PackageCacheControlHandle,
4845    },
4846    /// Synchronizes updates to the cached packages to the underlying persistent storage.
4847    ///
4848    /// * error a zx_status value indicating failure. One of the following:
4849    ///     * `ZX_ERR_INTERNAL` if the sync fails.
4850    Sync { responder: PackageCacheSyncResponder },
4851    /// Sets which package URLs correspond to upgradable packages and the hash they should resolve
4852    /// to.
4853    ///
4854    /// If upgradable packages are enabled in pkg-cache, this method must be called once on start up
4855    /// to set the hashes for persisted upgradable packages. All such packages must not be base
4856    /// packages. If none of the upgradable packages are persisted, a call with an empty vector
4857    /// still needs to be made. Package resolution of non base packages and GC (and therefore OTA)
4858    /// will block until this is done.
4859    ///
4860    /// Subsequent calls can be made to set new upgradable packages or change the hashes associated
4861    /// with upgradable packages.
4862    ///
4863    /// The hash most recently associated with an upgradable package URL will be protected from GC.
4864    ///
4865    /// + request `pinned_urls` packages URLs pinned to the new hash.
4866    SetUpgradableUrls {
4867        pinned_urls: Vec<PackageUrl>,
4868        responder: PackageCacheSetUpgradableUrlsResponder,
4869    },
4870    /// An interaction was received which does not match any known method.
4871    #[non_exhaustive]
4872    _UnknownMethod {
4873        /// Ordinal of the method that was called.
4874        ordinal: u64,
4875        control_handle: PackageCacheControlHandle,
4876        method_type: fidl::MethodType,
4877    },
4878}
4879
4880impl PackageCacheRequest {
4881    #[allow(irrefutable_let_patterns)]
4882    pub fn into_get(
4883        self,
4884    ) -> Option<(
4885        BlobInfo,
4886        GcProtection,
4887        fidl::endpoints::ServerEnd<NeededBlobsMarker>,
4888        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4889        PackageCacheGetResponder,
4890    )> {
4891        if let PackageCacheRequest::Get {
4892            meta_far_blob,
4893            gc_protection,
4894            needed_blobs,
4895            dir,
4896            responder,
4897        } = self
4898        {
4899            Some((meta_far_blob, gc_protection, needed_blobs, dir, responder))
4900        } else {
4901            None
4902        }
4903    }
4904
4905    #[allow(irrefutable_let_patterns)]
4906    pub fn into_get_subpackage(
4907        self,
4908    ) -> Option<(
4909        BlobId,
4910        PackageUrl,
4911        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4912        PackageCacheGetSubpackageResponder,
4913    )> {
4914        if let PackageCacheRequest::GetSubpackage { superpackage, subpackage, dir, responder } =
4915            self
4916        {
4917            Some((superpackage, subpackage, dir, responder))
4918        } else {
4919            None
4920        }
4921    }
4922
4923    #[allow(irrefutable_let_patterns)]
4924    pub fn into_base_package_index(
4925        self,
4926    ) -> Option<(fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>, PackageCacheControlHandle)>
4927    {
4928        if let PackageCacheRequest::BasePackageIndex { iterator, control_handle } = self {
4929            Some((iterator, control_handle))
4930        } else {
4931            None
4932        }
4933    }
4934
4935    #[allow(irrefutable_let_patterns)]
4936    pub fn into_cache_package_index(
4937        self,
4938    ) -> Option<(fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>, PackageCacheControlHandle)>
4939    {
4940        if let PackageCacheRequest::CachePackageIndex { iterator, control_handle } = self {
4941            Some((iterator, control_handle))
4942        } else {
4943            None
4944        }
4945    }
4946
4947    #[allow(irrefutable_let_patterns)]
4948    pub fn into_sync(self) -> Option<(PackageCacheSyncResponder)> {
4949        if let PackageCacheRequest::Sync { responder } = self {
4950            Some((responder))
4951        } else {
4952            None
4953        }
4954    }
4955
4956    #[allow(irrefutable_let_patterns)]
4957    pub fn into_set_upgradable_urls(
4958        self,
4959    ) -> Option<(Vec<PackageUrl>, PackageCacheSetUpgradableUrlsResponder)> {
4960        if let PackageCacheRequest::SetUpgradableUrls { pinned_urls, responder } = self {
4961            Some((pinned_urls, responder))
4962        } else {
4963            None
4964        }
4965    }
4966
4967    /// Name of the method defined in FIDL
4968    pub fn method_name(&self) -> &'static str {
4969        match *self {
4970            PackageCacheRequest::Get { .. } => "get",
4971            PackageCacheRequest::GetSubpackage { .. } => "get_subpackage",
4972            PackageCacheRequest::BasePackageIndex { .. } => "base_package_index",
4973            PackageCacheRequest::CachePackageIndex { .. } => "cache_package_index",
4974            PackageCacheRequest::Sync { .. } => "sync",
4975            PackageCacheRequest::SetUpgradableUrls { .. } => "set_upgradable_urls",
4976            PackageCacheRequest::_UnknownMethod {
4977                method_type: fidl::MethodType::OneWay, ..
4978            } => "unknown one-way method",
4979            PackageCacheRequest::_UnknownMethod {
4980                method_type: fidl::MethodType::TwoWay, ..
4981            } => "unknown two-way method",
4982        }
4983    }
4984}
4985
4986#[derive(Debug, Clone)]
4987pub struct PackageCacheControlHandle {
4988    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4989}
4990
4991impl fidl::endpoints::ControlHandle for PackageCacheControlHandle {
4992    fn shutdown(&self) {
4993        self.inner.shutdown()
4994    }
4995    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4996        self.inner.shutdown_with_epitaph(status)
4997    }
4998
4999    fn is_closed(&self) -> bool {
5000        self.inner.channel().is_closed()
5001    }
5002    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5003        self.inner.channel().on_closed()
5004    }
5005
5006    #[cfg(target_os = "fuchsia")]
5007    fn signal_peer(
5008        &self,
5009        clear_mask: zx::Signals,
5010        set_mask: zx::Signals,
5011    ) -> Result<(), zx_status::Status> {
5012        use fidl::Peered;
5013        self.inner.channel().signal_peer(clear_mask, set_mask)
5014    }
5015}
5016
5017impl PackageCacheControlHandle {}
5018
5019#[must_use = "FIDL methods require a response to be sent"]
5020#[derive(Debug)]
5021pub struct PackageCacheGetResponder {
5022    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
5023    tx_id: u32,
5024}
5025
5026/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
5027/// if the responder is dropped without sending a response, so that the client
5028/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5029impl std::ops::Drop for PackageCacheGetResponder {
5030    fn drop(&mut self) {
5031        self.control_handle.shutdown();
5032        // Safety: drops once, never accessed again
5033        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5034    }
5035}
5036
5037impl fidl::endpoints::Responder for PackageCacheGetResponder {
5038    type ControlHandle = PackageCacheControlHandle;
5039
5040    fn control_handle(&self) -> &PackageCacheControlHandle {
5041        &self.control_handle
5042    }
5043
5044    fn drop_without_shutdown(mut self) {
5045        // Safety: drops once, never accessed again due to mem::forget
5046        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5047        // Prevent Drop from running (which would shut down the channel)
5048        std::mem::forget(self);
5049    }
5050}
5051
5052impl PackageCacheGetResponder {
5053    /// Sends a response to the FIDL transaction.
5054    ///
5055    /// Sets the channel to shutdown if an error occurs.
5056    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5057        let _result = self.send_raw(result);
5058        if _result.is_err() {
5059            self.control_handle.shutdown();
5060        }
5061        self.drop_without_shutdown();
5062        _result
5063    }
5064
5065    /// Similar to "send" but does not shutdown the channel if an error occurs.
5066    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5067        let _result = self.send_raw(result);
5068        self.drop_without_shutdown();
5069        _result
5070    }
5071
5072    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5073        self.control_handle
5074            .inner
5075            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5076                result,
5077                self.tx_id,
5078                0x15e1963f4bf123b5,
5079                fidl::encoding::DynamicFlags::empty(),
5080            )
5081    }
5082}
5083
5084#[must_use = "FIDL methods require a response to be sent"]
5085#[derive(Debug)]
5086pub struct PackageCacheGetSubpackageResponder {
5087    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
5088    tx_id: u32,
5089}
5090
5091/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
5092/// if the responder is dropped without sending a response, so that the client
5093/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5094impl std::ops::Drop for PackageCacheGetSubpackageResponder {
5095    fn drop(&mut self) {
5096        self.control_handle.shutdown();
5097        // Safety: drops once, never accessed again
5098        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5099    }
5100}
5101
5102impl fidl::endpoints::Responder for PackageCacheGetSubpackageResponder {
5103    type ControlHandle = PackageCacheControlHandle;
5104
5105    fn control_handle(&self) -> &PackageCacheControlHandle {
5106        &self.control_handle
5107    }
5108
5109    fn drop_without_shutdown(mut self) {
5110        // Safety: drops once, never accessed again due to mem::forget
5111        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5112        // Prevent Drop from running (which would shut down the channel)
5113        std::mem::forget(self);
5114    }
5115}
5116
5117impl PackageCacheGetSubpackageResponder {
5118    /// Sends a response to the FIDL transaction.
5119    ///
5120    /// Sets the channel to shutdown if an error occurs.
5121    pub fn send(self, mut result: Result<(), GetSubpackageError>) -> Result<(), fidl::Error> {
5122        let _result = self.send_raw(result);
5123        if _result.is_err() {
5124            self.control_handle.shutdown();
5125        }
5126        self.drop_without_shutdown();
5127        _result
5128    }
5129
5130    /// Similar to "send" but does not shutdown the channel if an error occurs.
5131    pub fn send_no_shutdown_on_err(
5132        self,
5133        mut result: Result<(), GetSubpackageError>,
5134    ) -> Result<(), fidl::Error> {
5135        let _result = self.send_raw(result);
5136        self.drop_without_shutdown();
5137        _result
5138    }
5139
5140    fn send_raw(&self, mut result: Result<(), GetSubpackageError>) -> Result<(), fidl::Error> {
5141        self.control_handle.inner.send::<fidl::encoding::ResultType<
5142            fidl::encoding::EmptyStruct,
5143            GetSubpackageError,
5144        >>(
5145            result,
5146            self.tx_id,
5147            0x29478df87c29ffa3,
5148            fidl::encoding::DynamicFlags::empty(),
5149        )
5150    }
5151}
5152
5153#[must_use = "FIDL methods require a response to be sent"]
5154#[derive(Debug)]
5155pub struct PackageCacheSyncResponder {
5156    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
5157    tx_id: u32,
5158}
5159
5160/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
5161/// if the responder is dropped without sending a response, so that the client
5162/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5163impl std::ops::Drop for PackageCacheSyncResponder {
5164    fn drop(&mut self) {
5165        self.control_handle.shutdown();
5166        // Safety: drops once, never accessed again
5167        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5168    }
5169}
5170
5171impl fidl::endpoints::Responder for PackageCacheSyncResponder {
5172    type ControlHandle = PackageCacheControlHandle;
5173
5174    fn control_handle(&self) -> &PackageCacheControlHandle {
5175        &self.control_handle
5176    }
5177
5178    fn drop_without_shutdown(mut self) {
5179        // Safety: drops once, never accessed again due to mem::forget
5180        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5181        // Prevent Drop from running (which would shut down the channel)
5182        std::mem::forget(self);
5183    }
5184}
5185
5186impl PackageCacheSyncResponder {
5187    /// Sends a response to the FIDL transaction.
5188    ///
5189    /// Sets the channel to shutdown if an error occurs.
5190    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5191        let _result = self.send_raw(result);
5192        if _result.is_err() {
5193            self.control_handle.shutdown();
5194        }
5195        self.drop_without_shutdown();
5196        _result
5197    }
5198
5199    /// Similar to "send" but does not shutdown the channel if an error occurs.
5200    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5201        let _result = self.send_raw(result);
5202        self.drop_without_shutdown();
5203        _result
5204    }
5205
5206    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5207        self.control_handle
5208            .inner
5209            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5210                result,
5211                self.tx_id,
5212                0x5c10a84094535a74,
5213                fidl::encoding::DynamicFlags::empty(),
5214            )
5215    }
5216}
5217
5218#[must_use = "FIDL methods require a response to be sent"]
5219#[derive(Debug)]
5220pub struct PackageCacheSetUpgradableUrlsResponder {
5221    control_handle: std::mem::ManuallyDrop<PackageCacheControlHandle>,
5222    tx_id: u32,
5223}
5224
5225/// Set the the channel to be shutdown (see [`PackageCacheControlHandle::shutdown`])
5226/// if the responder is dropped without sending a response, so that the client
5227/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5228impl std::ops::Drop for PackageCacheSetUpgradableUrlsResponder {
5229    fn drop(&mut self) {
5230        self.control_handle.shutdown();
5231        // Safety: drops once, never accessed again
5232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5233    }
5234}
5235
5236impl fidl::endpoints::Responder for PackageCacheSetUpgradableUrlsResponder {
5237    type ControlHandle = PackageCacheControlHandle;
5238
5239    fn control_handle(&self) -> &PackageCacheControlHandle {
5240        &self.control_handle
5241    }
5242
5243    fn drop_without_shutdown(mut self) {
5244        // Safety: drops once, never accessed again due to mem::forget
5245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5246        // Prevent Drop from running (which would shut down the channel)
5247        std::mem::forget(self);
5248    }
5249}
5250
5251impl PackageCacheSetUpgradableUrlsResponder {
5252    /// Sends a response to the FIDL transaction.
5253    ///
5254    /// Sets the channel to shutdown if an error occurs.
5255    pub fn send(self, mut result: Result<(), SetUpgradableUrlsError>) -> Result<(), fidl::Error> {
5256        let _result = self.send_raw(result);
5257        if _result.is_err() {
5258            self.control_handle.shutdown();
5259        }
5260        self.drop_without_shutdown();
5261        _result
5262    }
5263
5264    /// Similar to "send" but does not shutdown the channel if an error occurs.
5265    pub fn send_no_shutdown_on_err(
5266        self,
5267        mut result: Result<(), SetUpgradableUrlsError>,
5268    ) -> Result<(), fidl::Error> {
5269        let _result = self.send_raw(result);
5270        self.drop_without_shutdown();
5271        _result
5272    }
5273
5274    fn send_raw(&self, mut result: Result<(), SetUpgradableUrlsError>) -> Result<(), fidl::Error> {
5275        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5276            fidl::encoding::EmptyStruct,
5277            SetUpgradableUrlsError,
5278        >>(
5279            fidl::encoding::FlexibleResult::new(result),
5280            self.tx_id,
5281            0x2c235f7efdb5e2d1,
5282            fidl::encoding::DynamicFlags::FLEXIBLE,
5283        )
5284    }
5285}
5286
5287#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5288pub struct PackageIndexIteratorMarker;
5289
5290impl fidl::endpoints::ProtocolMarker for PackageIndexIteratorMarker {
5291    type Proxy = PackageIndexIteratorProxy;
5292    type RequestStream = PackageIndexIteratorRequestStream;
5293    #[cfg(target_os = "fuchsia")]
5294    type SynchronousProxy = PackageIndexIteratorSynchronousProxy;
5295
5296    const DEBUG_NAME: &'static str = "(anonymous) PackageIndexIterator";
5297}
5298
5299pub trait PackageIndexIteratorProxyInterface: Send + Sync {
5300    type NextResponseFut: std::future::Future<Output = Result<Vec<PackageIndexEntry>, fidl::Error>>
5301        + Send;
5302    fn r#next(&self) -> Self::NextResponseFut;
5303}
5304#[derive(Debug)]
5305#[cfg(target_os = "fuchsia")]
5306pub struct PackageIndexIteratorSynchronousProxy {
5307    client: fidl::client::sync::Client,
5308}
5309
5310#[cfg(target_os = "fuchsia")]
5311impl fidl::endpoints::SynchronousProxy for PackageIndexIteratorSynchronousProxy {
5312    type Proxy = PackageIndexIteratorProxy;
5313    type Protocol = PackageIndexIteratorMarker;
5314
5315    fn from_channel(inner: fidl::Channel) -> Self {
5316        Self::new(inner)
5317    }
5318
5319    fn into_channel(self) -> fidl::Channel {
5320        self.client.into_channel()
5321    }
5322
5323    fn as_channel(&self) -> &fidl::Channel {
5324        self.client.as_channel()
5325    }
5326}
5327
5328#[cfg(target_os = "fuchsia")]
5329impl PackageIndexIteratorSynchronousProxy {
5330    pub fn new(channel: fidl::Channel) -> Self {
5331        let protocol_name =
5332            <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5333        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5334    }
5335
5336    pub fn into_channel(self) -> fidl::Channel {
5337        self.client.into_channel()
5338    }
5339
5340    /// Waits until an event arrives and returns it. It is safe for other
5341    /// threads to make concurrent requests while waiting for an event.
5342    pub fn wait_for_event(
5343        &self,
5344        deadline: zx::MonotonicInstant,
5345    ) -> Result<PackageIndexIteratorEvent, fidl::Error> {
5346        PackageIndexIteratorEvent::decode(self.client.wait_for_event(deadline)?)
5347    }
5348
5349    /// Returns the next chunk of package index entries. When the iterator is exhausted,
5350    /// this returns an empty vector.
5351    ///
5352    /// - response `entries` the next chunk of entries in the package index.
5353    pub fn r#next(
5354        &self,
5355        ___deadline: zx::MonotonicInstant,
5356    ) -> Result<Vec<PackageIndexEntry>, fidl::Error> {
5357        let _response = self
5358            .client
5359            .send_query::<fidl::encoding::EmptyPayload, PackageIndexIteratorNextResponse>(
5360                (),
5361                0x9de6bbc87c314d9,
5362                fidl::encoding::DynamicFlags::empty(),
5363                ___deadline,
5364            )?;
5365        Ok(_response.entries)
5366    }
5367}
5368
5369#[derive(Debug, Clone)]
5370pub struct PackageIndexIteratorProxy {
5371    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5372}
5373
5374impl fidl::endpoints::Proxy for PackageIndexIteratorProxy {
5375    type Protocol = PackageIndexIteratorMarker;
5376
5377    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5378        Self::new(inner)
5379    }
5380
5381    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5382        self.client.into_channel().map_err(|client| Self { client })
5383    }
5384
5385    fn as_channel(&self) -> &::fidl::AsyncChannel {
5386        self.client.as_channel()
5387    }
5388}
5389
5390impl PackageIndexIteratorProxy {
5391    /// Create a new Proxy for fuchsia.pkg/PackageIndexIterator.
5392    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5393        let protocol_name =
5394            <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5395        Self { client: fidl::client::Client::new(channel, protocol_name) }
5396    }
5397
5398    /// Get a Stream of events from the remote end of the protocol.
5399    ///
5400    /// # Panics
5401    ///
5402    /// Panics if the event stream was already taken.
5403    pub fn take_event_stream(&self) -> PackageIndexIteratorEventStream {
5404        PackageIndexIteratorEventStream { event_receiver: self.client.take_event_receiver() }
5405    }
5406
5407    /// Returns the next chunk of package index entries. When the iterator is exhausted,
5408    /// this returns an empty vector.
5409    ///
5410    /// - response `entries` the next chunk of entries in the package index.
5411    pub fn r#next(
5412        &self,
5413    ) -> fidl::client::QueryResponseFut<
5414        Vec<PackageIndexEntry>,
5415        fidl::encoding::DefaultFuchsiaResourceDialect,
5416    > {
5417        PackageIndexIteratorProxyInterface::r#next(self)
5418    }
5419}
5420
5421impl PackageIndexIteratorProxyInterface for PackageIndexIteratorProxy {
5422    type NextResponseFut = fidl::client::QueryResponseFut<
5423        Vec<PackageIndexEntry>,
5424        fidl::encoding::DefaultFuchsiaResourceDialect,
5425    >;
5426    fn r#next(&self) -> Self::NextResponseFut {
5427        fn _decode(
5428            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5429        ) -> Result<Vec<PackageIndexEntry>, fidl::Error> {
5430            let _response = fidl::client::decode_transaction_body::<
5431                PackageIndexIteratorNextResponse,
5432                fidl::encoding::DefaultFuchsiaResourceDialect,
5433                0x9de6bbc87c314d9,
5434            >(_buf?)?;
5435            Ok(_response.entries)
5436        }
5437        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PackageIndexEntry>>(
5438            (),
5439            0x9de6bbc87c314d9,
5440            fidl::encoding::DynamicFlags::empty(),
5441            _decode,
5442        )
5443    }
5444}
5445
5446pub struct PackageIndexIteratorEventStream {
5447    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5448}
5449
5450impl std::marker::Unpin for PackageIndexIteratorEventStream {}
5451
5452impl futures::stream::FusedStream for PackageIndexIteratorEventStream {
5453    fn is_terminated(&self) -> bool {
5454        self.event_receiver.is_terminated()
5455    }
5456}
5457
5458impl futures::Stream for PackageIndexIteratorEventStream {
5459    type Item = Result<PackageIndexIteratorEvent, fidl::Error>;
5460
5461    fn poll_next(
5462        mut self: std::pin::Pin<&mut Self>,
5463        cx: &mut std::task::Context<'_>,
5464    ) -> std::task::Poll<Option<Self::Item>> {
5465        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5466            &mut self.event_receiver,
5467            cx
5468        )?) {
5469            Some(buf) => std::task::Poll::Ready(Some(PackageIndexIteratorEvent::decode(buf))),
5470            None => std::task::Poll::Ready(None),
5471        }
5472    }
5473}
5474
5475#[derive(Debug)]
5476pub enum PackageIndexIteratorEvent {}
5477
5478impl PackageIndexIteratorEvent {
5479    /// Decodes a message buffer as a [`PackageIndexIteratorEvent`].
5480    fn decode(
5481        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5482    ) -> Result<PackageIndexIteratorEvent, fidl::Error> {
5483        let (bytes, _handles) = buf.split_mut();
5484        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5485        debug_assert_eq!(tx_header.tx_id, 0);
5486        match tx_header.ordinal {
5487            _ => Err(fidl::Error::UnknownOrdinal {
5488                ordinal: tx_header.ordinal,
5489                protocol_name:
5490                    <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5491            }),
5492        }
5493    }
5494}
5495
5496/// A Stream of incoming requests for fuchsia.pkg/PackageIndexIterator.
5497pub struct PackageIndexIteratorRequestStream {
5498    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5499    is_terminated: bool,
5500}
5501
5502impl std::marker::Unpin for PackageIndexIteratorRequestStream {}
5503
5504impl futures::stream::FusedStream for PackageIndexIteratorRequestStream {
5505    fn is_terminated(&self) -> bool {
5506        self.is_terminated
5507    }
5508}
5509
5510impl fidl::endpoints::RequestStream for PackageIndexIteratorRequestStream {
5511    type Protocol = PackageIndexIteratorMarker;
5512    type ControlHandle = PackageIndexIteratorControlHandle;
5513
5514    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5515        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5516    }
5517
5518    fn control_handle(&self) -> Self::ControlHandle {
5519        PackageIndexIteratorControlHandle { inner: self.inner.clone() }
5520    }
5521
5522    fn into_inner(
5523        self,
5524    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5525    {
5526        (self.inner, self.is_terminated)
5527    }
5528
5529    fn from_inner(
5530        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5531        is_terminated: bool,
5532    ) -> Self {
5533        Self { inner, is_terminated }
5534    }
5535}
5536
5537impl futures::Stream for PackageIndexIteratorRequestStream {
5538    type Item = Result<PackageIndexIteratorRequest, fidl::Error>;
5539
5540    fn poll_next(
5541        mut self: std::pin::Pin<&mut Self>,
5542        cx: &mut std::task::Context<'_>,
5543    ) -> std::task::Poll<Option<Self::Item>> {
5544        let this = &mut *self;
5545        if this.inner.check_shutdown(cx) {
5546            this.is_terminated = true;
5547            return std::task::Poll::Ready(None);
5548        }
5549        if this.is_terminated {
5550            panic!("polled PackageIndexIteratorRequestStream after completion");
5551        }
5552        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5553            |bytes, handles| {
5554                match this.inner.channel().read_etc(cx, bytes, handles) {
5555                    std::task::Poll::Ready(Ok(())) => {}
5556                    std::task::Poll::Pending => return std::task::Poll::Pending,
5557                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5558                        this.is_terminated = true;
5559                        return std::task::Poll::Ready(None);
5560                    }
5561                    std::task::Poll::Ready(Err(e)) => {
5562                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5563                            e.into(),
5564                        ))))
5565                    }
5566                }
5567
5568                // A message has been received from the channel
5569                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5570
5571                std::task::Poll::Ready(Some(match header.ordinal {
5572                0x9de6bbc87c314d9 => {
5573                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5574                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5575                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5576                    let control_handle = PackageIndexIteratorControlHandle {
5577                        inner: this.inner.clone(),
5578                    };
5579                    Ok(PackageIndexIteratorRequest::Next {
5580                        responder: PackageIndexIteratorNextResponder {
5581                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5582                            tx_id: header.tx_id,
5583                        },
5584                    })
5585                }
5586                _ => Err(fidl::Error::UnknownOrdinal {
5587                    ordinal: header.ordinal,
5588                    protocol_name: <PackageIndexIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5589                }),
5590            }))
5591            },
5592        )
5593    }
5594}
5595
5596/// A chunk iterator for the package index. This is required because it is possible for the
5597/// package index to be too large to send over in a single request (over 64KiB).
5598#[derive(Debug)]
5599pub enum PackageIndexIteratorRequest {
5600    /// Returns the next chunk of package index entries. When the iterator is exhausted,
5601    /// this returns an empty vector.
5602    ///
5603    /// - response `entries` the next chunk of entries in the package index.
5604    Next { responder: PackageIndexIteratorNextResponder },
5605}
5606
5607impl PackageIndexIteratorRequest {
5608    #[allow(irrefutable_let_patterns)]
5609    pub fn into_next(self) -> Option<(PackageIndexIteratorNextResponder)> {
5610        if let PackageIndexIteratorRequest::Next { responder } = self {
5611            Some((responder))
5612        } else {
5613            None
5614        }
5615    }
5616
5617    /// Name of the method defined in FIDL
5618    pub fn method_name(&self) -> &'static str {
5619        match *self {
5620            PackageIndexIteratorRequest::Next { .. } => "next",
5621        }
5622    }
5623}
5624
5625#[derive(Debug, Clone)]
5626pub struct PackageIndexIteratorControlHandle {
5627    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5628}
5629
5630impl fidl::endpoints::ControlHandle for PackageIndexIteratorControlHandle {
5631    fn shutdown(&self) {
5632        self.inner.shutdown()
5633    }
5634    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5635        self.inner.shutdown_with_epitaph(status)
5636    }
5637
5638    fn is_closed(&self) -> bool {
5639        self.inner.channel().is_closed()
5640    }
5641    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5642        self.inner.channel().on_closed()
5643    }
5644
5645    #[cfg(target_os = "fuchsia")]
5646    fn signal_peer(
5647        &self,
5648        clear_mask: zx::Signals,
5649        set_mask: zx::Signals,
5650    ) -> Result<(), zx_status::Status> {
5651        use fidl::Peered;
5652        self.inner.channel().signal_peer(clear_mask, set_mask)
5653    }
5654}
5655
5656impl PackageIndexIteratorControlHandle {}
5657
5658#[must_use = "FIDL methods require a response to be sent"]
5659#[derive(Debug)]
5660pub struct PackageIndexIteratorNextResponder {
5661    control_handle: std::mem::ManuallyDrop<PackageIndexIteratorControlHandle>,
5662    tx_id: u32,
5663}
5664
5665/// Set the the channel to be shutdown (see [`PackageIndexIteratorControlHandle::shutdown`])
5666/// if the responder is dropped without sending a response, so that the client
5667/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5668impl std::ops::Drop for PackageIndexIteratorNextResponder {
5669    fn drop(&mut self) {
5670        self.control_handle.shutdown();
5671        // Safety: drops once, never accessed again
5672        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5673    }
5674}
5675
5676impl fidl::endpoints::Responder for PackageIndexIteratorNextResponder {
5677    type ControlHandle = PackageIndexIteratorControlHandle;
5678
5679    fn control_handle(&self) -> &PackageIndexIteratorControlHandle {
5680        &self.control_handle
5681    }
5682
5683    fn drop_without_shutdown(mut self) {
5684        // Safety: drops once, never accessed again due to mem::forget
5685        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5686        // Prevent Drop from running (which would shut down the channel)
5687        std::mem::forget(self);
5688    }
5689}
5690
5691impl PackageIndexIteratorNextResponder {
5692    /// Sends a response to the FIDL transaction.
5693    ///
5694    /// Sets the channel to shutdown if an error occurs.
5695    pub fn send(self, mut entries: &[PackageIndexEntry]) -> Result<(), fidl::Error> {
5696        let _result = self.send_raw(entries);
5697        if _result.is_err() {
5698            self.control_handle.shutdown();
5699        }
5700        self.drop_without_shutdown();
5701        _result
5702    }
5703
5704    /// Similar to "send" but does not shutdown the channel if an error occurs.
5705    pub fn send_no_shutdown_on_err(
5706        self,
5707        mut entries: &[PackageIndexEntry],
5708    ) -> Result<(), fidl::Error> {
5709        let _result = self.send_raw(entries);
5710        self.drop_without_shutdown();
5711        _result
5712    }
5713
5714    fn send_raw(&self, mut entries: &[PackageIndexEntry]) -> Result<(), fidl::Error> {
5715        self.control_handle.inner.send::<PackageIndexIteratorNextResponse>(
5716            (entries,),
5717            self.tx_id,
5718            0x9de6bbc87c314d9,
5719            fidl::encoding::DynamicFlags::empty(),
5720        )
5721    }
5722}
5723
5724#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5725pub struct PackageResolverMarker;
5726
5727impl fidl::endpoints::ProtocolMarker for PackageResolverMarker {
5728    type Proxy = PackageResolverProxy;
5729    type RequestStream = PackageResolverRequestStream;
5730    #[cfg(target_os = "fuchsia")]
5731    type SynchronousProxy = PackageResolverSynchronousProxy;
5732
5733    const DEBUG_NAME: &'static str = "fuchsia.pkg.PackageResolver";
5734}
5735impl fidl::endpoints::DiscoverableProtocolMarker for PackageResolverMarker {}
5736pub type PackageResolverResolveResult = Result<ResolutionContext, ResolveError>;
5737pub type PackageResolverResolveWithContextResult = Result<ResolutionContext, ResolveError>;
5738pub type PackageResolverGetHashResult = Result<BlobId, i32>;
5739
5740pub trait PackageResolverProxyInterface: Send + Sync {
5741    type ResolveResponseFut: std::future::Future<Output = Result<PackageResolverResolveResult, fidl::Error>>
5742        + Send;
5743    fn r#resolve(
5744        &self,
5745        package_url: &str,
5746        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5747    ) -> Self::ResolveResponseFut;
5748    type ResolveWithContextResponseFut: std::future::Future<Output = Result<PackageResolverResolveWithContextResult, fidl::Error>>
5749        + Send;
5750    fn r#resolve_with_context(
5751        &self,
5752        package_url: &str,
5753        context: &ResolutionContext,
5754        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5755    ) -> Self::ResolveWithContextResponseFut;
5756    type GetHashResponseFut: std::future::Future<Output = Result<PackageResolverGetHashResult, fidl::Error>>
5757        + Send;
5758    fn r#get_hash(&self, package_url: &PackageUrl) -> Self::GetHashResponseFut;
5759}
5760#[derive(Debug)]
5761#[cfg(target_os = "fuchsia")]
5762pub struct PackageResolverSynchronousProxy {
5763    client: fidl::client::sync::Client,
5764}
5765
5766#[cfg(target_os = "fuchsia")]
5767impl fidl::endpoints::SynchronousProxy for PackageResolverSynchronousProxy {
5768    type Proxy = PackageResolverProxy;
5769    type Protocol = PackageResolverMarker;
5770
5771    fn from_channel(inner: fidl::Channel) -> Self {
5772        Self::new(inner)
5773    }
5774
5775    fn into_channel(self) -> fidl::Channel {
5776        self.client.into_channel()
5777    }
5778
5779    fn as_channel(&self) -> &fidl::Channel {
5780        self.client.as_channel()
5781    }
5782}
5783
5784#[cfg(target_os = "fuchsia")]
5785impl PackageResolverSynchronousProxy {
5786    pub fn new(channel: fidl::Channel) -> Self {
5787        let protocol_name = <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5788        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5789    }
5790
5791    pub fn into_channel(self) -> fidl::Channel {
5792        self.client.into_channel()
5793    }
5794
5795    /// Waits until an event arrives and returns it. It is safe for other
5796    /// threads to make concurrent requests while waiting for an event.
5797    pub fn wait_for_event(
5798        &self,
5799        deadline: zx::MonotonicInstant,
5800    ) -> Result<PackageResolverEvent, fidl::Error> {
5801        PackageResolverEvent::decode(self.client.wait_for_event(deadline)?)
5802    }
5803
5804    /// Populates or updates the cache of a package using an absolute package
5805    /// URL.
5806    ///
5807    /// Ensures that a package, and any transitive subpackages, are on the local
5808    /// filesystem.
5809    ///
5810    /// + request `package_url` the absolute package URL for a package.  The
5811    ///   following link describes the format:
5812    ///   https://fuchsia.dev/fuchsia-src/concepts/packages/package_url.
5813    ///   Resource paths are not allowed.
5814    /// + request `dir` a request for a directory that will be resolved when the
5815    ///   package has been successfully cached.
5816    /// + returns a `resolved_context`, which can be passed to
5817    ///   `ResolveWithContext`, with a relative URL, to resolve a subpackage of
5818    ///   this package.
5819    /// * error indicates failure. See `ResolveError` for values and error
5820    ///   scenarios.
5821    pub fn r#resolve(
5822        &self,
5823        mut package_url: &str,
5824        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5825        ___deadline: zx::MonotonicInstant,
5826    ) -> Result<PackageResolverResolveResult, fidl::Error> {
5827        let _response = self.client.send_query::<
5828            PackageResolverResolveRequest,
5829            fidl::encoding::ResultType<PackageResolverResolveResponse, ResolveError>,
5830        >(
5831            (package_url, dir,),
5832            0x6611263be4052d4f,
5833            fidl::encoding::DynamicFlags::empty(),
5834            ___deadline,
5835        )?;
5836        Ok(_response.map(|x| x.resolved_context))
5837    }
5838
5839    /// Populates or updates the cache of a package using either an absolute or
5840    /// a relative package URL. If relative, the package will be resolved
5841    /// relative to the supplied `context`.
5842    ///
5843    /// Ensures that a package is on the local filesystem.
5844    ///
5845    /// + request `package_url` the absolute or relative package URL for a
5846    ///   package. If absolute, the `context` is ignored, and the behavior is
5847    ///   identical to calling `Resolve()`. A relative `package_url` is a
5848    ///   subpackage name.
5849    /// + request `context` a `ResolutionContext` associated with a previously
5850    ///   resolved package, for resolving subpackages relative to that package.
5851    /// + request `dir` a request for a directory that will be resolved when the
5852    ///   package has been successfully cached.
5853    /// + returns a `resolved_context`, which can be passed to a subsequent call
5854    ///   to `ResolveWithContext`, with a relative URL, to resolve a subpackage
5855    ///   of this package or subpackage.
5856    /// * error indicates failure. See `ResolveError` for values and error
5857    ///   scenarios.
5858    pub fn r#resolve_with_context(
5859        &self,
5860        mut package_url: &str,
5861        mut context: &ResolutionContext,
5862        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5863        ___deadline: zx::MonotonicInstant,
5864    ) -> Result<PackageResolverResolveWithContextResult, fidl::Error> {
5865        let _response =
5866            self.client
5867                .send_query::<PackageResolverResolveWithContextRequest, fidl::encoding::ResultType<
5868                    PackageResolverResolveWithContextResponse,
5869                    ResolveError,
5870                >>(
5871                    (package_url, context, dir),
5872                    0x4c255ae7260298d4,
5873                    fidl::encoding::DynamicFlags::empty(),
5874                    ___deadline,
5875                )?;
5876        Ok(_response.map(|x| x.resolved_context))
5877    }
5878
5879    /// Determines the hash of a package.
5880    ///
5881    /// + request `package_url` the package URL for a package.
5882    /// - response `meta_far_blob_id` the hash of the package.
5883    /// * error a zx_status value indicating failure. One of the following:
5884    ///     * `ZX_ERR_INTERNAL` if the resolver encountered an otherwise unspecified error
5885    ///       while handling the request.
5886    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist in the repository specified by
5887    ///       `package_url`.
5888    ///     * `ZX_ERR_BAD_STATE` if the resolver does not know about the repository specified by
5889    ///       `package_url`.
5890    pub fn r#get_hash(
5891        &self,
5892        mut package_url: &PackageUrl,
5893        ___deadline: zx::MonotonicInstant,
5894    ) -> Result<PackageResolverGetHashResult, fidl::Error> {
5895        let _response = self.client.send_query::<
5896            PackageResolverGetHashRequest,
5897            fidl::encoding::ResultType<PackageResolverGetHashResponse, i32>,
5898        >(
5899            (package_url,),
5900            0x594e8b4db51efd87,
5901            fidl::encoding::DynamicFlags::empty(),
5902            ___deadline,
5903        )?;
5904        Ok(_response.map(|x| x.meta_far_blob_id))
5905    }
5906}
5907
5908#[derive(Debug, Clone)]
5909pub struct PackageResolverProxy {
5910    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5911}
5912
5913impl fidl::endpoints::Proxy for PackageResolverProxy {
5914    type Protocol = PackageResolverMarker;
5915
5916    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5917        Self::new(inner)
5918    }
5919
5920    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5921        self.client.into_channel().map_err(|client| Self { client })
5922    }
5923
5924    fn as_channel(&self) -> &::fidl::AsyncChannel {
5925        self.client.as_channel()
5926    }
5927}
5928
5929impl PackageResolverProxy {
5930    /// Create a new Proxy for fuchsia.pkg/PackageResolver.
5931    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5932        let protocol_name = <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5933        Self { client: fidl::client::Client::new(channel, protocol_name) }
5934    }
5935
5936    /// Get a Stream of events from the remote end of the protocol.
5937    ///
5938    /// # Panics
5939    ///
5940    /// Panics if the event stream was already taken.
5941    pub fn take_event_stream(&self) -> PackageResolverEventStream {
5942        PackageResolverEventStream { event_receiver: self.client.take_event_receiver() }
5943    }
5944
5945    /// Populates or updates the cache of a package using an absolute package
5946    /// URL.
5947    ///
5948    /// Ensures that a package, and any transitive subpackages, are on the local
5949    /// filesystem.
5950    ///
5951    /// + request `package_url` the absolute package URL for a package.  The
5952    ///   following link describes the format:
5953    ///   https://fuchsia.dev/fuchsia-src/concepts/packages/package_url.
5954    ///   Resource paths are not allowed.
5955    /// + request `dir` a request for a directory that will be resolved when the
5956    ///   package has been successfully cached.
5957    /// + returns a `resolved_context`, which can be passed to
5958    ///   `ResolveWithContext`, with a relative URL, to resolve a subpackage of
5959    ///   this package.
5960    /// * error indicates failure. See `ResolveError` for values and error
5961    ///   scenarios.
5962    pub fn r#resolve(
5963        &self,
5964        mut package_url: &str,
5965        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5966    ) -> fidl::client::QueryResponseFut<
5967        PackageResolverResolveResult,
5968        fidl::encoding::DefaultFuchsiaResourceDialect,
5969    > {
5970        PackageResolverProxyInterface::r#resolve(self, package_url, dir)
5971    }
5972
5973    /// Populates or updates the cache of a package using either an absolute or
5974    /// a relative package URL. If relative, the package will be resolved
5975    /// relative to the supplied `context`.
5976    ///
5977    /// Ensures that a package is on the local filesystem.
5978    ///
5979    /// + request `package_url` the absolute or relative package URL for a
5980    ///   package. If absolute, the `context` is ignored, and the behavior is
5981    ///   identical to calling `Resolve()`. A relative `package_url` is a
5982    ///   subpackage name.
5983    /// + request `context` a `ResolutionContext` associated with a previously
5984    ///   resolved package, for resolving subpackages relative to that package.
5985    /// + request `dir` a request for a directory that will be resolved when the
5986    ///   package has been successfully cached.
5987    /// + returns a `resolved_context`, which can be passed to a subsequent call
5988    ///   to `ResolveWithContext`, with a relative URL, to resolve a subpackage
5989    ///   of this package or subpackage.
5990    /// * error indicates failure. See `ResolveError` for values and error
5991    ///   scenarios.
5992    pub fn r#resolve_with_context(
5993        &self,
5994        mut package_url: &str,
5995        mut context: &ResolutionContext,
5996        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5997    ) -> fidl::client::QueryResponseFut<
5998        PackageResolverResolveWithContextResult,
5999        fidl::encoding::DefaultFuchsiaResourceDialect,
6000    > {
6001        PackageResolverProxyInterface::r#resolve_with_context(self, package_url, context, dir)
6002    }
6003
6004    /// Determines the hash of a package.
6005    ///
6006    /// + request `package_url` the package URL for a package.
6007    /// - response `meta_far_blob_id` the hash of the package.
6008    /// * error a zx_status value indicating failure. One of the following:
6009    ///     * `ZX_ERR_INTERNAL` if the resolver encountered an otherwise unspecified error
6010    ///       while handling the request.
6011    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist in the repository specified by
6012    ///       `package_url`.
6013    ///     * `ZX_ERR_BAD_STATE` if the resolver does not know about the repository specified by
6014    ///       `package_url`.
6015    pub fn r#get_hash(
6016        &self,
6017        mut package_url: &PackageUrl,
6018    ) -> fidl::client::QueryResponseFut<
6019        PackageResolverGetHashResult,
6020        fidl::encoding::DefaultFuchsiaResourceDialect,
6021    > {
6022        PackageResolverProxyInterface::r#get_hash(self, package_url)
6023    }
6024}
6025
6026impl PackageResolverProxyInterface for PackageResolverProxy {
6027    type ResolveResponseFut = fidl::client::QueryResponseFut<
6028        PackageResolverResolveResult,
6029        fidl::encoding::DefaultFuchsiaResourceDialect,
6030    >;
6031    fn r#resolve(
6032        &self,
6033        mut package_url: &str,
6034        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6035    ) -> Self::ResolveResponseFut {
6036        fn _decode(
6037            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6038        ) -> Result<PackageResolverResolveResult, fidl::Error> {
6039            let _response = fidl::client::decode_transaction_body::<
6040                fidl::encoding::ResultType<PackageResolverResolveResponse, ResolveError>,
6041                fidl::encoding::DefaultFuchsiaResourceDialect,
6042                0x6611263be4052d4f,
6043            >(_buf?)?;
6044            Ok(_response.map(|x| x.resolved_context))
6045        }
6046        self.client
6047            .send_query_and_decode::<PackageResolverResolveRequest, PackageResolverResolveResult>(
6048                (package_url, dir),
6049                0x6611263be4052d4f,
6050                fidl::encoding::DynamicFlags::empty(),
6051                _decode,
6052            )
6053    }
6054
6055    type ResolveWithContextResponseFut = fidl::client::QueryResponseFut<
6056        PackageResolverResolveWithContextResult,
6057        fidl::encoding::DefaultFuchsiaResourceDialect,
6058    >;
6059    fn r#resolve_with_context(
6060        &self,
6061        mut package_url: &str,
6062        mut context: &ResolutionContext,
6063        mut dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6064    ) -> Self::ResolveWithContextResponseFut {
6065        fn _decode(
6066            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6067        ) -> Result<PackageResolverResolveWithContextResult, fidl::Error> {
6068            let _response = fidl::client::decode_transaction_body::<
6069                fidl::encoding::ResultType<PackageResolverResolveWithContextResponse, ResolveError>,
6070                fidl::encoding::DefaultFuchsiaResourceDialect,
6071                0x4c255ae7260298d4,
6072            >(_buf?)?;
6073            Ok(_response.map(|x| x.resolved_context))
6074        }
6075        self.client.send_query_and_decode::<
6076            PackageResolverResolveWithContextRequest,
6077            PackageResolverResolveWithContextResult,
6078        >(
6079            (package_url, context, dir,),
6080            0x4c255ae7260298d4,
6081            fidl::encoding::DynamicFlags::empty(),
6082            _decode,
6083        )
6084    }
6085
6086    type GetHashResponseFut = fidl::client::QueryResponseFut<
6087        PackageResolverGetHashResult,
6088        fidl::encoding::DefaultFuchsiaResourceDialect,
6089    >;
6090    fn r#get_hash(&self, mut package_url: &PackageUrl) -> Self::GetHashResponseFut {
6091        fn _decode(
6092            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6093        ) -> Result<PackageResolverGetHashResult, fidl::Error> {
6094            let _response = fidl::client::decode_transaction_body::<
6095                fidl::encoding::ResultType<PackageResolverGetHashResponse, i32>,
6096                fidl::encoding::DefaultFuchsiaResourceDialect,
6097                0x594e8b4db51efd87,
6098            >(_buf?)?;
6099            Ok(_response.map(|x| x.meta_far_blob_id))
6100        }
6101        self.client
6102            .send_query_and_decode::<PackageResolverGetHashRequest, PackageResolverGetHashResult>(
6103                (package_url,),
6104                0x594e8b4db51efd87,
6105                fidl::encoding::DynamicFlags::empty(),
6106                _decode,
6107            )
6108    }
6109}
6110
6111pub struct PackageResolverEventStream {
6112    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6113}
6114
6115impl std::marker::Unpin for PackageResolverEventStream {}
6116
6117impl futures::stream::FusedStream for PackageResolverEventStream {
6118    fn is_terminated(&self) -> bool {
6119        self.event_receiver.is_terminated()
6120    }
6121}
6122
6123impl futures::Stream for PackageResolverEventStream {
6124    type Item = Result<PackageResolverEvent, fidl::Error>;
6125
6126    fn poll_next(
6127        mut self: std::pin::Pin<&mut Self>,
6128        cx: &mut std::task::Context<'_>,
6129    ) -> std::task::Poll<Option<Self::Item>> {
6130        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6131            &mut self.event_receiver,
6132            cx
6133        )?) {
6134            Some(buf) => std::task::Poll::Ready(Some(PackageResolverEvent::decode(buf))),
6135            None => std::task::Poll::Ready(None),
6136        }
6137    }
6138}
6139
6140#[derive(Debug)]
6141pub enum PackageResolverEvent {}
6142
6143impl PackageResolverEvent {
6144    /// Decodes a message buffer as a [`PackageResolverEvent`].
6145    fn decode(
6146        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6147    ) -> Result<PackageResolverEvent, fidl::Error> {
6148        let (bytes, _handles) = buf.split_mut();
6149        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6150        debug_assert_eq!(tx_header.tx_id, 0);
6151        match tx_header.ordinal {
6152            _ => Err(fidl::Error::UnknownOrdinal {
6153                ordinal: tx_header.ordinal,
6154                protocol_name:
6155                    <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6156            }),
6157        }
6158    }
6159}
6160
6161/// A Stream of incoming requests for fuchsia.pkg/PackageResolver.
6162pub struct PackageResolverRequestStream {
6163    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6164    is_terminated: bool,
6165}
6166
6167impl std::marker::Unpin for PackageResolverRequestStream {}
6168
6169impl futures::stream::FusedStream for PackageResolverRequestStream {
6170    fn is_terminated(&self) -> bool {
6171        self.is_terminated
6172    }
6173}
6174
6175impl fidl::endpoints::RequestStream for PackageResolverRequestStream {
6176    type Protocol = PackageResolverMarker;
6177    type ControlHandle = PackageResolverControlHandle;
6178
6179    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6180        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6181    }
6182
6183    fn control_handle(&self) -> Self::ControlHandle {
6184        PackageResolverControlHandle { inner: self.inner.clone() }
6185    }
6186
6187    fn into_inner(
6188        self,
6189    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6190    {
6191        (self.inner, self.is_terminated)
6192    }
6193
6194    fn from_inner(
6195        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6196        is_terminated: bool,
6197    ) -> Self {
6198        Self { inner, is_terminated }
6199    }
6200}
6201
6202impl futures::Stream for PackageResolverRequestStream {
6203    type Item = Result<PackageResolverRequest, fidl::Error>;
6204
6205    fn poll_next(
6206        mut self: std::pin::Pin<&mut Self>,
6207        cx: &mut std::task::Context<'_>,
6208    ) -> std::task::Poll<Option<Self::Item>> {
6209        let this = &mut *self;
6210        if this.inner.check_shutdown(cx) {
6211            this.is_terminated = true;
6212            return std::task::Poll::Ready(None);
6213        }
6214        if this.is_terminated {
6215            panic!("polled PackageResolverRequestStream after completion");
6216        }
6217        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6218            |bytes, handles| {
6219                match this.inner.channel().read_etc(cx, bytes, handles) {
6220                    std::task::Poll::Ready(Ok(())) => {}
6221                    std::task::Poll::Pending => return std::task::Poll::Pending,
6222                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6223                        this.is_terminated = true;
6224                        return std::task::Poll::Ready(None);
6225                    }
6226                    std::task::Poll::Ready(Err(e)) => {
6227                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6228                            e.into(),
6229                        ))))
6230                    }
6231                }
6232
6233                // A message has been received from the channel
6234                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6235
6236                std::task::Poll::Ready(Some(match header.ordinal {
6237                    0x6611263be4052d4f => {
6238                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6239                        let mut req = fidl::new_empty!(
6240                            PackageResolverResolveRequest,
6241                            fidl::encoding::DefaultFuchsiaResourceDialect
6242                        );
6243                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageResolverResolveRequest>(&header, _body_bytes, handles, &mut req)?;
6244                        let control_handle =
6245                            PackageResolverControlHandle { inner: this.inner.clone() };
6246                        Ok(PackageResolverRequest::Resolve {
6247                            package_url: req.package_url,
6248                            dir: req.dir,
6249
6250                            responder: PackageResolverResolveResponder {
6251                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6252                                tx_id: header.tx_id,
6253                            },
6254                        })
6255                    }
6256                    0x4c255ae7260298d4 => {
6257                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6258                        let mut req = fidl::new_empty!(
6259                            PackageResolverResolveWithContextRequest,
6260                            fidl::encoding::DefaultFuchsiaResourceDialect
6261                        );
6262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageResolverResolveWithContextRequest>(&header, _body_bytes, handles, &mut req)?;
6263                        let control_handle =
6264                            PackageResolverControlHandle { inner: this.inner.clone() };
6265                        Ok(PackageResolverRequest::ResolveWithContext {
6266                            package_url: req.package_url,
6267                            context: req.context,
6268                            dir: req.dir,
6269
6270                            responder: PackageResolverResolveWithContextResponder {
6271                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6272                                tx_id: header.tx_id,
6273                            },
6274                        })
6275                    }
6276                    0x594e8b4db51efd87 => {
6277                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6278                        let mut req = fidl::new_empty!(
6279                            PackageResolverGetHashRequest,
6280                            fidl::encoding::DefaultFuchsiaResourceDialect
6281                        );
6282                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PackageResolverGetHashRequest>(&header, _body_bytes, handles, &mut req)?;
6283                        let control_handle =
6284                            PackageResolverControlHandle { inner: this.inner.clone() };
6285                        Ok(PackageResolverRequest::GetHash {
6286                            package_url: req.package_url,
6287
6288                            responder: PackageResolverGetHashResponder {
6289                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6290                                tx_id: header.tx_id,
6291                            },
6292                        })
6293                    }
6294                    _ => Err(fidl::Error::UnknownOrdinal {
6295                        ordinal: header.ordinal,
6296                        protocol_name:
6297                            <PackageResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6298                    }),
6299                }))
6300            },
6301        )
6302    }
6303}
6304
6305/// This resolves packages from a repository.
6306///
6307/// This is intended to be implemented by package resolver components, and used by
6308/// repository administration tools.
6309#[derive(Debug)]
6310pub enum PackageResolverRequest {
6311    /// Populates or updates the cache of a package using an absolute package
6312    /// URL.
6313    ///
6314    /// Ensures that a package, and any transitive subpackages, are on the local
6315    /// filesystem.
6316    ///
6317    /// + request `package_url` the absolute package URL for a package.  The
6318    ///   following link describes the format:
6319    ///   https://fuchsia.dev/fuchsia-src/concepts/packages/package_url.
6320    ///   Resource paths are not allowed.
6321    /// + request `dir` a request for a directory that will be resolved when the
6322    ///   package has been successfully cached.
6323    /// + returns a `resolved_context`, which can be passed to
6324    ///   `ResolveWithContext`, with a relative URL, to resolve a subpackage of
6325    ///   this package.
6326    /// * error indicates failure. See `ResolveError` for values and error
6327    ///   scenarios.
6328    Resolve {
6329        package_url: String,
6330        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6331        responder: PackageResolverResolveResponder,
6332    },
6333    /// Populates or updates the cache of a package using either an absolute or
6334    /// a relative package URL. If relative, the package will be resolved
6335    /// relative to the supplied `context`.
6336    ///
6337    /// Ensures that a package is on the local filesystem.
6338    ///
6339    /// + request `package_url` the absolute or relative package URL for a
6340    ///   package. If absolute, the `context` is ignored, and the behavior is
6341    ///   identical to calling `Resolve()`. A relative `package_url` is a
6342    ///   subpackage name.
6343    /// + request `context` a `ResolutionContext` associated with a previously
6344    ///   resolved package, for resolving subpackages relative to that package.
6345    /// + request `dir` a request for a directory that will be resolved when the
6346    ///   package has been successfully cached.
6347    /// + returns a `resolved_context`, which can be passed to a subsequent call
6348    ///   to `ResolveWithContext`, with a relative URL, to resolve a subpackage
6349    ///   of this package or subpackage.
6350    /// * error indicates failure. See `ResolveError` for values and error
6351    ///   scenarios.
6352    ResolveWithContext {
6353        package_url: String,
6354        context: ResolutionContext,
6355        dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6356        responder: PackageResolverResolveWithContextResponder,
6357    },
6358    /// Determines the hash of a package.
6359    ///
6360    /// + request `package_url` the package URL for a package.
6361    /// - response `meta_far_blob_id` the hash of the package.
6362    /// * error a zx_status value indicating failure. One of the following:
6363    ///     * `ZX_ERR_INTERNAL` if the resolver encountered an otherwise unspecified error
6364    ///       while handling the request.
6365    ///     * `ZX_ERR_NOT_FOUND` if the package does not exist in the repository specified by
6366    ///       `package_url`.
6367    ///     * `ZX_ERR_BAD_STATE` if the resolver does not know about the repository specified by
6368    ///       `package_url`.
6369    GetHash { package_url: PackageUrl, responder: PackageResolverGetHashResponder },
6370}
6371
6372impl PackageResolverRequest {
6373    #[allow(irrefutable_let_patterns)]
6374    pub fn into_resolve(
6375        self,
6376    ) -> Option<(
6377        String,
6378        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6379        PackageResolverResolveResponder,
6380    )> {
6381        if let PackageResolverRequest::Resolve { package_url, dir, responder } = self {
6382            Some((package_url, dir, responder))
6383        } else {
6384            None
6385        }
6386    }
6387
6388    #[allow(irrefutable_let_patterns)]
6389    pub fn into_resolve_with_context(
6390        self,
6391    ) -> Option<(
6392        String,
6393        ResolutionContext,
6394        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6395        PackageResolverResolveWithContextResponder,
6396    )> {
6397        if let PackageResolverRequest::ResolveWithContext { package_url, context, dir, responder } =
6398            self
6399        {
6400            Some((package_url, context, dir, responder))
6401        } else {
6402            None
6403        }
6404    }
6405
6406    #[allow(irrefutable_let_patterns)]
6407    pub fn into_get_hash(self) -> Option<(PackageUrl, PackageResolverGetHashResponder)> {
6408        if let PackageResolverRequest::GetHash { package_url, responder } = self {
6409            Some((package_url, responder))
6410        } else {
6411            None
6412        }
6413    }
6414
6415    /// Name of the method defined in FIDL
6416    pub fn method_name(&self) -> &'static str {
6417        match *self {
6418            PackageResolverRequest::Resolve { .. } => "resolve",
6419            PackageResolverRequest::ResolveWithContext { .. } => "resolve_with_context",
6420            PackageResolverRequest::GetHash { .. } => "get_hash",
6421        }
6422    }
6423}
6424
6425#[derive(Debug, Clone)]
6426pub struct PackageResolverControlHandle {
6427    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6428}
6429
6430impl fidl::endpoints::ControlHandle for PackageResolverControlHandle {
6431    fn shutdown(&self) {
6432        self.inner.shutdown()
6433    }
6434    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6435        self.inner.shutdown_with_epitaph(status)
6436    }
6437
6438    fn is_closed(&self) -> bool {
6439        self.inner.channel().is_closed()
6440    }
6441    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6442        self.inner.channel().on_closed()
6443    }
6444
6445    #[cfg(target_os = "fuchsia")]
6446    fn signal_peer(
6447        &self,
6448        clear_mask: zx::Signals,
6449        set_mask: zx::Signals,
6450    ) -> Result<(), zx_status::Status> {
6451        use fidl::Peered;
6452        self.inner.channel().signal_peer(clear_mask, set_mask)
6453    }
6454}
6455
6456impl PackageResolverControlHandle {}
6457
6458#[must_use = "FIDL methods require a response to be sent"]
6459#[derive(Debug)]
6460pub struct PackageResolverResolveResponder {
6461    control_handle: std::mem::ManuallyDrop<PackageResolverControlHandle>,
6462    tx_id: u32,
6463}
6464
6465/// Set the the channel to be shutdown (see [`PackageResolverControlHandle::shutdown`])
6466/// if the responder is dropped without sending a response, so that the client
6467/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6468impl std::ops::Drop for PackageResolverResolveResponder {
6469    fn drop(&mut self) {
6470        self.control_handle.shutdown();
6471        // Safety: drops once, never accessed again
6472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6473    }
6474}
6475
6476impl fidl::endpoints::Responder for PackageResolverResolveResponder {
6477    type ControlHandle = PackageResolverControlHandle;
6478
6479    fn control_handle(&self) -> &PackageResolverControlHandle {
6480        &self.control_handle
6481    }
6482
6483    fn drop_without_shutdown(mut self) {
6484        // Safety: drops once, never accessed again due to mem::forget
6485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6486        // Prevent Drop from running (which would shut down the channel)
6487        std::mem::forget(self);
6488    }
6489}
6490
6491impl PackageResolverResolveResponder {
6492    /// Sends a response to the FIDL transaction.
6493    ///
6494    /// Sets the channel to shutdown if an error occurs.
6495    pub fn send(
6496        self,
6497        mut result: Result<&ResolutionContext, ResolveError>,
6498    ) -> Result<(), fidl::Error> {
6499        let _result = self.send_raw(result);
6500        if _result.is_err() {
6501            self.control_handle.shutdown();
6502        }
6503        self.drop_without_shutdown();
6504        _result
6505    }
6506
6507    /// Similar to "send" but does not shutdown the channel if an error occurs.
6508    pub fn send_no_shutdown_on_err(
6509        self,
6510        mut result: Result<&ResolutionContext, ResolveError>,
6511    ) -> Result<(), fidl::Error> {
6512        let _result = self.send_raw(result);
6513        self.drop_without_shutdown();
6514        _result
6515    }
6516
6517    fn send_raw(
6518        &self,
6519        mut result: Result<&ResolutionContext, ResolveError>,
6520    ) -> Result<(), fidl::Error> {
6521        self.control_handle.inner.send::<fidl::encoding::ResultType<
6522            PackageResolverResolveResponse,
6523            ResolveError,
6524        >>(
6525            result.map(|resolved_context| (resolved_context,)),
6526            self.tx_id,
6527            0x6611263be4052d4f,
6528            fidl::encoding::DynamicFlags::empty(),
6529        )
6530    }
6531}
6532
6533#[must_use = "FIDL methods require a response to be sent"]
6534#[derive(Debug)]
6535pub struct PackageResolverResolveWithContextResponder {
6536    control_handle: std::mem::ManuallyDrop<PackageResolverControlHandle>,
6537    tx_id: u32,
6538}
6539
6540/// Set the the channel to be shutdown (see [`PackageResolverControlHandle::shutdown`])
6541/// if the responder is dropped without sending a response, so that the client
6542/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6543impl std::ops::Drop for PackageResolverResolveWithContextResponder {
6544    fn drop(&mut self) {
6545        self.control_handle.shutdown();
6546        // Safety: drops once, never accessed again
6547        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6548    }
6549}
6550
6551impl fidl::endpoints::Responder for PackageResolverResolveWithContextResponder {
6552    type ControlHandle = PackageResolverControlHandle;
6553
6554    fn control_handle(&self) -> &PackageResolverControlHandle {
6555        &self.control_handle
6556    }
6557
6558    fn drop_without_shutdown(mut self) {
6559        // Safety: drops once, never accessed again due to mem::forget
6560        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6561        // Prevent Drop from running (which would shut down the channel)
6562        std::mem::forget(self);
6563    }
6564}
6565
6566impl PackageResolverResolveWithContextResponder {
6567    /// Sends a response to the FIDL transaction.
6568    ///
6569    /// Sets the channel to shutdown if an error occurs.
6570    pub fn send(
6571        self,
6572        mut result: Result<&ResolutionContext, ResolveError>,
6573    ) -> Result<(), fidl::Error> {
6574        let _result = self.send_raw(result);
6575        if _result.is_err() {
6576            self.control_handle.shutdown();
6577        }
6578        self.drop_without_shutdown();
6579        _result
6580    }
6581
6582    /// Similar to "send" but does not shutdown the channel if an error occurs.
6583    pub fn send_no_shutdown_on_err(
6584        self,
6585        mut result: Result<&ResolutionContext, ResolveError>,
6586    ) -> Result<(), fidl::Error> {
6587        let _result = self.send_raw(result);
6588        self.drop_without_shutdown();
6589        _result
6590    }
6591
6592    fn send_raw(
6593        &self,
6594        mut result: Result<&ResolutionContext, ResolveError>,
6595    ) -> Result<(), fidl::Error> {
6596        self.control_handle.inner.send::<fidl::encoding::ResultType<
6597            PackageResolverResolveWithContextResponse,
6598            ResolveError,
6599        >>(
6600            result.map(|resolved_context| (resolved_context,)),
6601            self.tx_id,
6602            0x4c255ae7260298d4,
6603            fidl::encoding::DynamicFlags::empty(),
6604        )
6605    }
6606}
6607
6608#[must_use = "FIDL methods require a response to be sent"]
6609#[derive(Debug)]
6610pub struct PackageResolverGetHashResponder {
6611    control_handle: std::mem::ManuallyDrop<PackageResolverControlHandle>,
6612    tx_id: u32,
6613}
6614
6615/// Set the the channel to be shutdown (see [`PackageResolverControlHandle::shutdown`])
6616/// if the responder is dropped without sending a response, so that the client
6617/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6618impl std::ops::Drop for PackageResolverGetHashResponder {
6619    fn drop(&mut self) {
6620        self.control_handle.shutdown();
6621        // Safety: drops once, never accessed again
6622        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6623    }
6624}
6625
6626impl fidl::endpoints::Responder for PackageResolverGetHashResponder {
6627    type ControlHandle = PackageResolverControlHandle;
6628
6629    fn control_handle(&self) -> &PackageResolverControlHandle {
6630        &self.control_handle
6631    }
6632
6633    fn drop_without_shutdown(mut self) {
6634        // Safety: drops once, never accessed again due to mem::forget
6635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6636        // Prevent Drop from running (which would shut down the channel)
6637        std::mem::forget(self);
6638    }
6639}
6640
6641impl PackageResolverGetHashResponder {
6642    /// Sends a response to the FIDL transaction.
6643    ///
6644    /// Sets the channel to shutdown if an error occurs.
6645    pub fn send(self, mut result: Result<&BlobId, i32>) -> Result<(), fidl::Error> {
6646        let _result = self.send_raw(result);
6647        if _result.is_err() {
6648            self.control_handle.shutdown();
6649        }
6650        self.drop_without_shutdown();
6651        _result
6652    }
6653
6654    /// Similar to "send" but does not shutdown the channel if an error occurs.
6655    pub fn send_no_shutdown_on_err(
6656        self,
6657        mut result: Result<&BlobId, i32>,
6658    ) -> Result<(), fidl::Error> {
6659        let _result = self.send_raw(result);
6660        self.drop_without_shutdown();
6661        _result
6662    }
6663
6664    fn send_raw(&self, mut result: Result<&BlobId, i32>) -> Result<(), fidl::Error> {
6665        self.control_handle
6666            .inner
6667            .send::<fidl::encoding::ResultType<PackageResolverGetHashResponse, i32>>(
6668                result.map(|meta_far_blob_id| (meta_far_blob_id,)),
6669                self.tx_id,
6670                0x594e8b4db51efd87,
6671                fidl::encoding::DynamicFlags::empty(),
6672            )
6673    }
6674}
6675
6676#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6677pub struct RepositoryIteratorMarker;
6678
6679impl fidl::endpoints::ProtocolMarker for RepositoryIteratorMarker {
6680    type Proxy = RepositoryIteratorProxy;
6681    type RequestStream = RepositoryIteratorRequestStream;
6682    #[cfg(target_os = "fuchsia")]
6683    type SynchronousProxy = RepositoryIteratorSynchronousProxy;
6684
6685    const DEBUG_NAME: &'static str = "(anonymous) RepositoryIterator";
6686}
6687
6688pub trait RepositoryIteratorProxyInterface: Send + Sync {
6689    type NextResponseFut: std::future::Future<Output = Result<Vec<RepositoryConfig>, fidl::Error>>
6690        + Send;
6691    fn r#next(&self) -> Self::NextResponseFut;
6692}
6693#[derive(Debug)]
6694#[cfg(target_os = "fuchsia")]
6695pub struct RepositoryIteratorSynchronousProxy {
6696    client: fidl::client::sync::Client,
6697}
6698
6699#[cfg(target_os = "fuchsia")]
6700impl fidl::endpoints::SynchronousProxy for RepositoryIteratorSynchronousProxy {
6701    type Proxy = RepositoryIteratorProxy;
6702    type Protocol = RepositoryIteratorMarker;
6703
6704    fn from_channel(inner: fidl::Channel) -> Self {
6705        Self::new(inner)
6706    }
6707
6708    fn into_channel(self) -> fidl::Channel {
6709        self.client.into_channel()
6710    }
6711
6712    fn as_channel(&self) -> &fidl::Channel {
6713        self.client.as_channel()
6714    }
6715}
6716
6717#[cfg(target_os = "fuchsia")]
6718impl RepositoryIteratorSynchronousProxy {
6719    pub fn new(channel: fidl::Channel) -> Self {
6720        let protocol_name =
6721            <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6722        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6723    }
6724
6725    pub fn into_channel(self) -> fidl::Channel {
6726        self.client.into_channel()
6727    }
6728
6729    /// Waits until an event arrives and returns it. It is safe for other
6730    /// threads to make concurrent requests while waiting for an event.
6731    pub fn wait_for_event(
6732        &self,
6733        deadline: zx::MonotonicInstant,
6734    ) -> Result<RepositoryIteratorEvent, fidl::Error> {
6735        RepositoryIteratorEvent::decode(self.client.wait_for_event(deadline)?)
6736    }
6737
6738    /// Advances the iterator and returns the next batch of repositories.
6739    ///
6740    /// - response `repos` a vector of `RepositoryConfig` repositories.
6741    ///   Will return an empty vector when there are no more repositories.
6742    pub fn r#next(
6743        &self,
6744        ___deadline: zx::MonotonicInstant,
6745    ) -> Result<Vec<RepositoryConfig>, fidl::Error> {
6746        let _response = self
6747            .client
6748            .send_query::<fidl::encoding::EmptyPayload, RepositoryIteratorNextResponse>(
6749                (),
6750                0x5502086bc0cdd25e,
6751                fidl::encoding::DynamicFlags::empty(),
6752                ___deadline,
6753            )?;
6754        Ok(_response.repos)
6755    }
6756}
6757
6758#[derive(Debug, Clone)]
6759pub struct RepositoryIteratorProxy {
6760    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6761}
6762
6763impl fidl::endpoints::Proxy for RepositoryIteratorProxy {
6764    type Protocol = RepositoryIteratorMarker;
6765
6766    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6767        Self::new(inner)
6768    }
6769
6770    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6771        self.client.into_channel().map_err(|client| Self { client })
6772    }
6773
6774    fn as_channel(&self) -> &::fidl::AsyncChannel {
6775        self.client.as_channel()
6776    }
6777}
6778
6779impl RepositoryIteratorProxy {
6780    /// Create a new Proxy for fuchsia.pkg/RepositoryIterator.
6781    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6782        let protocol_name =
6783            <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6784        Self { client: fidl::client::Client::new(channel, protocol_name) }
6785    }
6786
6787    /// Get a Stream of events from the remote end of the protocol.
6788    ///
6789    /// # Panics
6790    ///
6791    /// Panics if the event stream was already taken.
6792    pub fn take_event_stream(&self) -> RepositoryIteratorEventStream {
6793        RepositoryIteratorEventStream { event_receiver: self.client.take_event_receiver() }
6794    }
6795
6796    /// Advances the iterator and returns the next batch of repositories.
6797    ///
6798    /// - response `repos` a vector of `RepositoryConfig` repositories.
6799    ///   Will return an empty vector when there are no more repositories.
6800    pub fn r#next(
6801        &self,
6802    ) -> fidl::client::QueryResponseFut<
6803        Vec<RepositoryConfig>,
6804        fidl::encoding::DefaultFuchsiaResourceDialect,
6805    > {
6806        RepositoryIteratorProxyInterface::r#next(self)
6807    }
6808}
6809
6810impl RepositoryIteratorProxyInterface for RepositoryIteratorProxy {
6811    type NextResponseFut = fidl::client::QueryResponseFut<
6812        Vec<RepositoryConfig>,
6813        fidl::encoding::DefaultFuchsiaResourceDialect,
6814    >;
6815    fn r#next(&self) -> Self::NextResponseFut {
6816        fn _decode(
6817            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6818        ) -> Result<Vec<RepositoryConfig>, fidl::Error> {
6819            let _response = fidl::client::decode_transaction_body::<
6820                RepositoryIteratorNextResponse,
6821                fidl::encoding::DefaultFuchsiaResourceDialect,
6822                0x5502086bc0cdd25e,
6823            >(_buf?)?;
6824            Ok(_response.repos)
6825        }
6826        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RepositoryConfig>>(
6827            (),
6828            0x5502086bc0cdd25e,
6829            fidl::encoding::DynamicFlags::empty(),
6830            _decode,
6831        )
6832    }
6833}
6834
6835pub struct RepositoryIteratorEventStream {
6836    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6837}
6838
6839impl std::marker::Unpin for RepositoryIteratorEventStream {}
6840
6841impl futures::stream::FusedStream for RepositoryIteratorEventStream {
6842    fn is_terminated(&self) -> bool {
6843        self.event_receiver.is_terminated()
6844    }
6845}
6846
6847impl futures::Stream for RepositoryIteratorEventStream {
6848    type Item = Result<RepositoryIteratorEvent, fidl::Error>;
6849
6850    fn poll_next(
6851        mut self: std::pin::Pin<&mut Self>,
6852        cx: &mut std::task::Context<'_>,
6853    ) -> std::task::Poll<Option<Self::Item>> {
6854        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6855            &mut self.event_receiver,
6856            cx
6857        )?) {
6858            Some(buf) => std::task::Poll::Ready(Some(RepositoryIteratorEvent::decode(buf))),
6859            None => std::task::Poll::Ready(None),
6860        }
6861    }
6862}
6863
6864#[derive(Debug)]
6865pub enum RepositoryIteratorEvent {}
6866
6867impl RepositoryIteratorEvent {
6868    /// Decodes a message buffer as a [`RepositoryIteratorEvent`].
6869    fn decode(
6870        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6871    ) -> Result<RepositoryIteratorEvent, fidl::Error> {
6872        let (bytes, _handles) = buf.split_mut();
6873        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6874        debug_assert_eq!(tx_header.tx_id, 0);
6875        match tx_header.ordinal {
6876            _ => Err(fidl::Error::UnknownOrdinal {
6877                ordinal: tx_header.ordinal,
6878                protocol_name:
6879                    <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6880            }),
6881        }
6882    }
6883}
6884
6885/// A Stream of incoming requests for fuchsia.pkg/RepositoryIterator.
6886pub struct RepositoryIteratorRequestStream {
6887    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6888    is_terminated: bool,
6889}
6890
6891impl std::marker::Unpin for RepositoryIteratorRequestStream {}
6892
6893impl futures::stream::FusedStream for RepositoryIteratorRequestStream {
6894    fn is_terminated(&self) -> bool {
6895        self.is_terminated
6896    }
6897}
6898
6899impl fidl::endpoints::RequestStream for RepositoryIteratorRequestStream {
6900    type Protocol = RepositoryIteratorMarker;
6901    type ControlHandle = RepositoryIteratorControlHandle;
6902
6903    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6904        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6905    }
6906
6907    fn control_handle(&self) -> Self::ControlHandle {
6908        RepositoryIteratorControlHandle { inner: self.inner.clone() }
6909    }
6910
6911    fn into_inner(
6912        self,
6913    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6914    {
6915        (self.inner, self.is_terminated)
6916    }
6917
6918    fn from_inner(
6919        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6920        is_terminated: bool,
6921    ) -> Self {
6922        Self { inner, is_terminated }
6923    }
6924}
6925
6926impl futures::Stream for RepositoryIteratorRequestStream {
6927    type Item = Result<RepositoryIteratorRequest, fidl::Error>;
6928
6929    fn poll_next(
6930        mut self: std::pin::Pin<&mut Self>,
6931        cx: &mut std::task::Context<'_>,
6932    ) -> std::task::Poll<Option<Self::Item>> {
6933        let this = &mut *self;
6934        if this.inner.check_shutdown(cx) {
6935            this.is_terminated = true;
6936            return std::task::Poll::Ready(None);
6937        }
6938        if this.is_terminated {
6939            panic!("polled RepositoryIteratorRequestStream after completion");
6940        }
6941        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6942            |bytes, handles| {
6943                match this.inner.channel().read_etc(cx, bytes, handles) {
6944                    std::task::Poll::Ready(Ok(())) => {}
6945                    std::task::Poll::Pending => return std::task::Poll::Pending,
6946                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6947                        this.is_terminated = true;
6948                        return std::task::Poll::Ready(None);
6949                    }
6950                    std::task::Poll::Ready(Err(e)) => {
6951                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6952                            e.into(),
6953                        ))))
6954                    }
6955                }
6956
6957                // A message has been received from the channel
6958                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6959
6960                std::task::Poll::Ready(Some(match header.ordinal {
6961                0x5502086bc0cdd25e => {
6962                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6963                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6964                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6965                    let control_handle = RepositoryIteratorControlHandle {
6966                        inner: this.inner.clone(),
6967                    };
6968                    Ok(RepositoryIteratorRequest::Next {
6969                        responder: RepositoryIteratorNextResponder {
6970                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6971                            tx_id: header.tx_id,
6972                        },
6973                    })
6974                }
6975                _ => Err(fidl::Error::UnknownOrdinal {
6976                    ordinal: header.ordinal,
6977                    protocol_name: <RepositoryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6978                }),
6979            }))
6980            },
6981        )
6982    }
6983}
6984
6985/// The iterator over all the repositories defined in a `PackageResolver`.
6986#[derive(Debug)]
6987pub enum RepositoryIteratorRequest {
6988    /// Advances the iterator and returns the next batch of repositories.
6989    ///
6990    /// - response `repos` a vector of `RepositoryConfig` repositories.
6991    ///   Will return an empty vector when there are no more repositories.
6992    Next { responder: RepositoryIteratorNextResponder },
6993}
6994
6995impl RepositoryIteratorRequest {
6996    #[allow(irrefutable_let_patterns)]
6997    pub fn into_next(self) -> Option<(RepositoryIteratorNextResponder)> {
6998        if let RepositoryIteratorRequest::Next { responder } = self {
6999            Some((responder))
7000        } else {
7001            None
7002        }
7003    }
7004
7005    /// Name of the method defined in FIDL
7006    pub fn method_name(&self) -> &'static str {
7007        match *self {
7008            RepositoryIteratorRequest::Next { .. } => "next",
7009        }
7010    }
7011}
7012
7013#[derive(Debug, Clone)]
7014pub struct RepositoryIteratorControlHandle {
7015    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7016}
7017
7018impl fidl::endpoints::ControlHandle for RepositoryIteratorControlHandle {
7019    fn shutdown(&self) {
7020        self.inner.shutdown()
7021    }
7022    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7023        self.inner.shutdown_with_epitaph(status)
7024    }
7025
7026    fn is_closed(&self) -> bool {
7027        self.inner.channel().is_closed()
7028    }
7029    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7030        self.inner.channel().on_closed()
7031    }
7032
7033    #[cfg(target_os = "fuchsia")]
7034    fn signal_peer(
7035        &self,
7036        clear_mask: zx::Signals,
7037        set_mask: zx::Signals,
7038    ) -> Result<(), zx_status::Status> {
7039        use fidl::Peered;
7040        self.inner.channel().signal_peer(clear_mask, set_mask)
7041    }
7042}
7043
7044impl RepositoryIteratorControlHandle {}
7045
7046#[must_use = "FIDL methods require a response to be sent"]
7047#[derive(Debug)]
7048pub struct RepositoryIteratorNextResponder {
7049    control_handle: std::mem::ManuallyDrop<RepositoryIteratorControlHandle>,
7050    tx_id: u32,
7051}
7052
7053/// Set the the channel to be shutdown (see [`RepositoryIteratorControlHandle::shutdown`])
7054/// if the responder is dropped without sending a response, so that the client
7055/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7056impl std::ops::Drop for RepositoryIteratorNextResponder {
7057    fn drop(&mut self) {
7058        self.control_handle.shutdown();
7059        // Safety: drops once, never accessed again
7060        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7061    }
7062}
7063
7064impl fidl::endpoints::Responder for RepositoryIteratorNextResponder {
7065    type ControlHandle = RepositoryIteratorControlHandle;
7066
7067    fn control_handle(&self) -> &RepositoryIteratorControlHandle {
7068        &self.control_handle
7069    }
7070
7071    fn drop_without_shutdown(mut self) {
7072        // Safety: drops once, never accessed again due to mem::forget
7073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7074        // Prevent Drop from running (which would shut down the channel)
7075        std::mem::forget(self);
7076    }
7077}
7078
7079impl RepositoryIteratorNextResponder {
7080    /// Sends a response to the FIDL transaction.
7081    ///
7082    /// Sets the channel to shutdown if an error occurs.
7083    pub fn send(self, mut repos: &[RepositoryConfig]) -> Result<(), fidl::Error> {
7084        let _result = self.send_raw(repos);
7085        if _result.is_err() {
7086            self.control_handle.shutdown();
7087        }
7088        self.drop_without_shutdown();
7089        _result
7090    }
7091
7092    /// Similar to "send" but does not shutdown the channel if an error occurs.
7093    pub fn send_no_shutdown_on_err(
7094        self,
7095        mut repos: &[RepositoryConfig],
7096    ) -> Result<(), fidl::Error> {
7097        let _result = self.send_raw(repos);
7098        self.drop_without_shutdown();
7099        _result
7100    }
7101
7102    fn send_raw(&self, mut repos: &[RepositoryConfig]) -> Result<(), fidl::Error> {
7103        self.control_handle.inner.send::<RepositoryIteratorNextResponse>(
7104            (repos,),
7105            self.tx_id,
7106            0x5502086bc0cdd25e,
7107            fidl::encoding::DynamicFlags::empty(),
7108        )
7109    }
7110}
7111
7112#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7113pub struct RepositoryManagerMarker;
7114
7115impl fidl::endpoints::ProtocolMarker for RepositoryManagerMarker {
7116    type Proxy = RepositoryManagerProxy;
7117    type RequestStream = RepositoryManagerRequestStream;
7118    #[cfg(target_os = "fuchsia")]
7119    type SynchronousProxy = RepositoryManagerSynchronousProxy;
7120
7121    const DEBUG_NAME: &'static str = "fuchsia.pkg.RepositoryManager";
7122}
7123impl fidl::endpoints::DiscoverableProtocolMarker for RepositoryManagerMarker {}
7124pub type RepositoryManagerAddResult = Result<(), i32>;
7125pub type RepositoryManagerRemoveResult = Result<(), i32>;
7126pub type RepositoryManagerAddMirrorResult = Result<(), i32>;
7127pub type RepositoryManagerRemoveMirrorResult = Result<(), i32>;
7128
7129pub trait RepositoryManagerProxyInterface: Send + Sync {
7130    type AddResponseFut: std::future::Future<Output = Result<RepositoryManagerAddResult, fidl::Error>>
7131        + Send;
7132    fn r#add(&self, repo: &RepositoryConfig) -> Self::AddResponseFut;
7133    type RemoveResponseFut: std::future::Future<Output = Result<RepositoryManagerRemoveResult, fidl::Error>>
7134        + Send;
7135    fn r#remove(&self, repo_url: &str) -> Self::RemoveResponseFut;
7136    type AddMirrorResponseFut: std::future::Future<Output = Result<RepositoryManagerAddMirrorResult, fidl::Error>>
7137        + Send;
7138    fn r#add_mirror(&self, repo_url: &str, mirror: &MirrorConfig) -> Self::AddMirrorResponseFut;
7139    type RemoveMirrorResponseFut: std::future::Future<Output = Result<RepositoryManagerRemoveMirrorResult, fidl::Error>>
7140        + Send;
7141    fn r#remove_mirror(&self, repo_url: &str, mirror_url: &str) -> Self::RemoveMirrorResponseFut;
7142    fn r#list(
7143        &self,
7144        iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7145    ) -> Result<(), fidl::Error>;
7146}
7147#[derive(Debug)]
7148#[cfg(target_os = "fuchsia")]
7149pub struct RepositoryManagerSynchronousProxy {
7150    client: fidl::client::sync::Client,
7151}
7152
7153#[cfg(target_os = "fuchsia")]
7154impl fidl::endpoints::SynchronousProxy for RepositoryManagerSynchronousProxy {
7155    type Proxy = RepositoryManagerProxy;
7156    type Protocol = RepositoryManagerMarker;
7157
7158    fn from_channel(inner: fidl::Channel) -> Self {
7159        Self::new(inner)
7160    }
7161
7162    fn into_channel(self) -> fidl::Channel {
7163        self.client.into_channel()
7164    }
7165
7166    fn as_channel(&self) -> &fidl::Channel {
7167        self.client.as_channel()
7168    }
7169}
7170
7171#[cfg(target_os = "fuchsia")]
7172impl RepositoryManagerSynchronousProxy {
7173    pub fn new(channel: fidl::Channel) -> Self {
7174        let protocol_name =
7175            <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7176        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7177    }
7178
7179    pub fn into_channel(self) -> fidl::Channel {
7180        self.client.into_channel()
7181    }
7182
7183    /// Waits until an event arrives and returns it. It is safe for other
7184    /// threads to make concurrent requests while waiting for an event.
7185    pub fn wait_for_event(
7186        &self,
7187        deadline: zx::MonotonicInstant,
7188    ) -> Result<RepositoryManagerEvent, fidl::Error> {
7189        RepositoryManagerEvent::decode(self.client.wait_for_event(deadline)?)
7190    }
7191
7192    /// Adds a repository. This will overwrite the repository if it already exists.
7193    ///
7194    /// + request `repo` a repository to add to the resolver.
7195    /// * error a zx_status value indicating failure. One of the following:
7196    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
7197    ///     * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
7198    ///     * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
7199    pub fn r#add(
7200        &self,
7201        mut repo: &RepositoryConfig,
7202        ___deadline: zx::MonotonicInstant,
7203    ) -> Result<RepositoryManagerAddResult, fidl::Error> {
7204        let _response = self.client.send_query::<
7205            RepositoryManagerAddRequest,
7206            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7207        >(
7208            (repo,),
7209            0x7fff4b8c733c7151,
7210            fidl::encoding::DynamicFlags::empty(),
7211            ___deadline,
7212        )?;
7213        Ok(_response.map(|x| x))
7214    }
7215
7216    /// Removes a repository.
7217    ///
7218    /// Removing a repository will prevent future packages from being cached from this repository,
7219    /// but in-flight downloads may not be interrupted.
7220    ///
7221    /// + request `repo_url` the URL of the repository we want to remove.
7222    /// * error a zx_status value indicating failure. One of the following:
7223    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
7224    ///       `repo_url` matches a static repository.
7225    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
7226    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7227    pub fn r#remove(
7228        &self,
7229        mut repo_url: &str,
7230        ___deadline: zx::MonotonicInstant,
7231    ) -> Result<RepositoryManagerRemoveResult, fidl::Error> {
7232        let _response = self.client.send_query::<
7233            RepositoryManagerRemoveRequest,
7234            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7235        >(
7236            (repo_url,),
7237            0x5de23dc0e0dea4ba,
7238            fidl::encoding::DynamicFlags::empty(),
7239            ___deadline,
7240        )?;
7241        Ok(_response.map(|x| x))
7242    }
7243
7244    /// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
7245    ///
7246    /// + request `repo_url` the URL of the repository to add the mirror to.
7247    /// + request `mirror` the mirror config used to add the mirror.
7248    /// * error a zx_status value indicating failure. One of the following:
7249    ///     * `ZX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
7250    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
7251    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7252    pub fn r#add_mirror(
7253        &self,
7254        mut repo_url: &str,
7255        mut mirror: &MirrorConfig,
7256        ___deadline: zx::MonotonicInstant,
7257    ) -> Result<RepositoryManagerAddMirrorResult, fidl::Error> {
7258        let _response = self.client.send_query::<
7259            RepositoryManagerAddMirrorRequest,
7260            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7261        >(
7262            (repo_url, mirror,),
7263            0x3b7ef213730dd24c,
7264            fidl::encoding::DynamicFlags::empty(),
7265            ___deadline,
7266        )?;
7267        Ok(_response.map(|x| x))
7268    }
7269
7270    /// Removes a mirror from a repository.
7271    ///
7272    /// Removing a mirror will prevent future packages from being cached from that mirror, but
7273    /// in-flight downloads may not be interrupted.
7274    ///
7275    /// + request `repo_url` the URL of the mirror's repository.
7276    /// + request `mirror_url` the URL of the mirror we want to remove.
7277    /// * error a zx_status value indicating failure. One of the following:
7278    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
7279    ///     * `ZX_ERR_NOT_FOUND` if the repository or mirror does not exist.
7280    pub fn r#remove_mirror(
7281        &self,
7282        mut repo_url: &str,
7283        mut mirror_url: &str,
7284        ___deadline: zx::MonotonicInstant,
7285    ) -> Result<RepositoryManagerRemoveMirrorResult, fidl::Error> {
7286        let _response = self.client.send_query::<
7287            RepositoryManagerRemoveMirrorRequest,
7288            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7289        >(
7290            (repo_url, mirror_url,),
7291            0x4682584cc47c23a2,
7292            fidl::encoding::DynamicFlags::empty(),
7293            ___deadline,
7294        )?;
7295        Ok(_response.map(|x| x))
7296    }
7297
7298    /// Returns an iterator over all repositories.
7299    ///
7300    /// + request `iterator` a request for an iterator.
7301    pub fn r#list(
7302        &self,
7303        mut iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7304    ) -> Result<(), fidl::Error> {
7305        self.client.send::<RepositoryManagerListRequest>(
7306            (iterator,),
7307            0x61837314ba6f4afb,
7308            fidl::encoding::DynamicFlags::empty(),
7309        )
7310    }
7311}
7312
7313#[derive(Debug, Clone)]
7314pub struct RepositoryManagerProxy {
7315    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7316}
7317
7318impl fidl::endpoints::Proxy for RepositoryManagerProxy {
7319    type Protocol = RepositoryManagerMarker;
7320
7321    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7322        Self::new(inner)
7323    }
7324
7325    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7326        self.client.into_channel().map_err(|client| Self { client })
7327    }
7328
7329    fn as_channel(&self) -> &::fidl::AsyncChannel {
7330        self.client.as_channel()
7331    }
7332}
7333
7334impl RepositoryManagerProxy {
7335    /// Create a new Proxy for fuchsia.pkg/RepositoryManager.
7336    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7337        let protocol_name =
7338            <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7339        Self { client: fidl::client::Client::new(channel, protocol_name) }
7340    }
7341
7342    /// Get a Stream of events from the remote end of the protocol.
7343    ///
7344    /// # Panics
7345    ///
7346    /// Panics if the event stream was already taken.
7347    pub fn take_event_stream(&self) -> RepositoryManagerEventStream {
7348        RepositoryManagerEventStream { event_receiver: self.client.take_event_receiver() }
7349    }
7350
7351    /// Adds a repository. This will overwrite the repository if it already exists.
7352    ///
7353    /// + request `repo` a repository to add to the resolver.
7354    /// * error a zx_status value indicating failure. One of the following:
7355    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
7356    ///     * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
7357    ///     * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
7358    pub fn r#add(
7359        &self,
7360        mut repo: &RepositoryConfig,
7361    ) -> fidl::client::QueryResponseFut<
7362        RepositoryManagerAddResult,
7363        fidl::encoding::DefaultFuchsiaResourceDialect,
7364    > {
7365        RepositoryManagerProxyInterface::r#add(self, repo)
7366    }
7367
7368    /// Removes a repository.
7369    ///
7370    /// Removing a repository will prevent future packages from being cached from this repository,
7371    /// but in-flight downloads may not be interrupted.
7372    ///
7373    /// + request `repo_url` the URL of the repository we want to remove.
7374    /// * error a zx_status value indicating failure. One of the following:
7375    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
7376    ///       `repo_url` matches a static repository.
7377    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
7378    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7379    pub fn r#remove(
7380        &self,
7381        mut repo_url: &str,
7382    ) -> fidl::client::QueryResponseFut<
7383        RepositoryManagerRemoveResult,
7384        fidl::encoding::DefaultFuchsiaResourceDialect,
7385    > {
7386        RepositoryManagerProxyInterface::r#remove(self, repo_url)
7387    }
7388
7389    /// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
7390    ///
7391    /// + request `repo_url` the URL of the repository to add the mirror to.
7392    /// + request `mirror` the mirror config used to add the mirror.
7393    /// * error a zx_status value indicating failure. One of the following:
7394    ///     * `ZX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
7395    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
7396    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7397    pub fn r#add_mirror(
7398        &self,
7399        mut repo_url: &str,
7400        mut mirror: &MirrorConfig,
7401    ) -> fidl::client::QueryResponseFut<
7402        RepositoryManagerAddMirrorResult,
7403        fidl::encoding::DefaultFuchsiaResourceDialect,
7404    > {
7405        RepositoryManagerProxyInterface::r#add_mirror(self, repo_url, mirror)
7406    }
7407
7408    /// Removes a mirror from a repository.
7409    ///
7410    /// Removing a mirror will prevent future packages from being cached from that mirror, but
7411    /// in-flight downloads may not be interrupted.
7412    ///
7413    /// + request `repo_url` the URL of the mirror's repository.
7414    /// + request `mirror_url` the URL of the mirror we want to remove.
7415    /// * error a zx_status value indicating failure. One of the following:
7416    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
7417    ///     * `ZX_ERR_NOT_FOUND` if the repository or mirror does not exist.
7418    pub fn r#remove_mirror(
7419        &self,
7420        mut repo_url: &str,
7421        mut mirror_url: &str,
7422    ) -> fidl::client::QueryResponseFut<
7423        RepositoryManagerRemoveMirrorResult,
7424        fidl::encoding::DefaultFuchsiaResourceDialect,
7425    > {
7426        RepositoryManagerProxyInterface::r#remove_mirror(self, repo_url, mirror_url)
7427    }
7428
7429    /// Returns an iterator over all repositories.
7430    ///
7431    /// + request `iterator` a request for an iterator.
7432    pub fn r#list(
7433        &self,
7434        mut iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7435    ) -> Result<(), fidl::Error> {
7436        RepositoryManagerProxyInterface::r#list(self, iterator)
7437    }
7438}
7439
7440impl RepositoryManagerProxyInterface for RepositoryManagerProxy {
7441    type AddResponseFut = fidl::client::QueryResponseFut<
7442        RepositoryManagerAddResult,
7443        fidl::encoding::DefaultFuchsiaResourceDialect,
7444    >;
7445    fn r#add(&self, mut repo: &RepositoryConfig) -> Self::AddResponseFut {
7446        fn _decode(
7447            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7448        ) -> Result<RepositoryManagerAddResult, fidl::Error> {
7449            let _response = fidl::client::decode_transaction_body::<
7450                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7451                fidl::encoding::DefaultFuchsiaResourceDialect,
7452                0x7fff4b8c733c7151,
7453            >(_buf?)?;
7454            Ok(_response.map(|x| x))
7455        }
7456        self.client
7457            .send_query_and_decode::<RepositoryManagerAddRequest, RepositoryManagerAddResult>(
7458                (repo,),
7459                0x7fff4b8c733c7151,
7460                fidl::encoding::DynamicFlags::empty(),
7461                _decode,
7462            )
7463    }
7464
7465    type RemoveResponseFut = fidl::client::QueryResponseFut<
7466        RepositoryManagerRemoveResult,
7467        fidl::encoding::DefaultFuchsiaResourceDialect,
7468    >;
7469    fn r#remove(&self, mut repo_url: &str) -> Self::RemoveResponseFut {
7470        fn _decode(
7471            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7472        ) -> Result<RepositoryManagerRemoveResult, fidl::Error> {
7473            let _response = fidl::client::decode_transaction_body::<
7474                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7475                fidl::encoding::DefaultFuchsiaResourceDialect,
7476                0x5de23dc0e0dea4ba,
7477            >(_buf?)?;
7478            Ok(_response.map(|x| x))
7479        }
7480        self.client
7481            .send_query_and_decode::<RepositoryManagerRemoveRequest, RepositoryManagerRemoveResult>(
7482                (repo_url,),
7483                0x5de23dc0e0dea4ba,
7484                fidl::encoding::DynamicFlags::empty(),
7485                _decode,
7486            )
7487    }
7488
7489    type AddMirrorResponseFut = fidl::client::QueryResponseFut<
7490        RepositoryManagerAddMirrorResult,
7491        fidl::encoding::DefaultFuchsiaResourceDialect,
7492    >;
7493    fn r#add_mirror(
7494        &self,
7495        mut repo_url: &str,
7496        mut mirror: &MirrorConfig,
7497    ) -> Self::AddMirrorResponseFut {
7498        fn _decode(
7499            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7500        ) -> Result<RepositoryManagerAddMirrorResult, fidl::Error> {
7501            let _response = fidl::client::decode_transaction_body::<
7502                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7503                fidl::encoding::DefaultFuchsiaResourceDialect,
7504                0x3b7ef213730dd24c,
7505            >(_buf?)?;
7506            Ok(_response.map(|x| x))
7507        }
7508        self.client.send_query_and_decode::<
7509            RepositoryManagerAddMirrorRequest,
7510            RepositoryManagerAddMirrorResult,
7511        >(
7512            (repo_url, mirror,),
7513            0x3b7ef213730dd24c,
7514            fidl::encoding::DynamicFlags::empty(),
7515            _decode,
7516        )
7517    }
7518
7519    type RemoveMirrorResponseFut = fidl::client::QueryResponseFut<
7520        RepositoryManagerRemoveMirrorResult,
7521        fidl::encoding::DefaultFuchsiaResourceDialect,
7522    >;
7523    fn r#remove_mirror(
7524        &self,
7525        mut repo_url: &str,
7526        mut mirror_url: &str,
7527    ) -> Self::RemoveMirrorResponseFut {
7528        fn _decode(
7529            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7530        ) -> Result<RepositoryManagerRemoveMirrorResult, fidl::Error> {
7531            let _response = fidl::client::decode_transaction_body::<
7532                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7533                fidl::encoding::DefaultFuchsiaResourceDialect,
7534                0x4682584cc47c23a2,
7535            >(_buf?)?;
7536            Ok(_response.map(|x| x))
7537        }
7538        self.client.send_query_and_decode::<
7539            RepositoryManagerRemoveMirrorRequest,
7540            RepositoryManagerRemoveMirrorResult,
7541        >(
7542            (repo_url, mirror_url,),
7543            0x4682584cc47c23a2,
7544            fidl::encoding::DynamicFlags::empty(),
7545            _decode,
7546        )
7547    }
7548
7549    fn r#list(
7550        &self,
7551        mut iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7552    ) -> Result<(), fidl::Error> {
7553        self.client.send::<RepositoryManagerListRequest>(
7554            (iterator,),
7555            0x61837314ba6f4afb,
7556            fidl::encoding::DynamicFlags::empty(),
7557        )
7558    }
7559}
7560
7561pub struct RepositoryManagerEventStream {
7562    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7563}
7564
7565impl std::marker::Unpin for RepositoryManagerEventStream {}
7566
7567impl futures::stream::FusedStream for RepositoryManagerEventStream {
7568    fn is_terminated(&self) -> bool {
7569        self.event_receiver.is_terminated()
7570    }
7571}
7572
7573impl futures::Stream for RepositoryManagerEventStream {
7574    type Item = Result<RepositoryManagerEvent, fidl::Error>;
7575
7576    fn poll_next(
7577        mut self: std::pin::Pin<&mut Self>,
7578        cx: &mut std::task::Context<'_>,
7579    ) -> std::task::Poll<Option<Self::Item>> {
7580        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7581            &mut self.event_receiver,
7582            cx
7583        )?) {
7584            Some(buf) => std::task::Poll::Ready(Some(RepositoryManagerEvent::decode(buf))),
7585            None => std::task::Poll::Ready(None),
7586        }
7587    }
7588}
7589
7590#[derive(Debug)]
7591pub enum RepositoryManagerEvent {}
7592
7593impl RepositoryManagerEvent {
7594    /// Decodes a message buffer as a [`RepositoryManagerEvent`].
7595    fn decode(
7596        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7597    ) -> Result<RepositoryManagerEvent, fidl::Error> {
7598        let (bytes, _handles) = buf.split_mut();
7599        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7600        debug_assert_eq!(tx_header.tx_id, 0);
7601        match tx_header.ordinal {
7602            _ => Err(fidl::Error::UnknownOrdinal {
7603                ordinal: tx_header.ordinal,
7604                protocol_name:
7605                    <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7606            }),
7607        }
7608    }
7609}
7610
7611/// A Stream of incoming requests for fuchsia.pkg/RepositoryManager.
7612pub struct RepositoryManagerRequestStream {
7613    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7614    is_terminated: bool,
7615}
7616
7617impl std::marker::Unpin for RepositoryManagerRequestStream {}
7618
7619impl futures::stream::FusedStream for RepositoryManagerRequestStream {
7620    fn is_terminated(&self) -> bool {
7621        self.is_terminated
7622    }
7623}
7624
7625impl fidl::endpoints::RequestStream for RepositoryManagerRequestStream {
7626    type Protocol = RepositoryManagerMarker;
7627    type ControlHandle = RepositoryManagerControlHandle;
7628
7629    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7630        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7631    }
7632
7633    fn control_handle(&self) -> Self::ControlHandle {
7634        RepositoryManagerControlHandle { inner: self.inner.clone() }
7635    }
7636
7637    fn into_inner(
7638        self,
7639    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7640    {
7641        (self.inner, self.is_terminated)
7642    }
7643
7644    fn from_inner(
7645        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7646        is_terminated: bool,
7647    ) -> Self {
7648        Self { inner, is_terminated }
7649    }
7650}
7651
7652impl futures::Stream for RepositoryManagerRequestStream {
7653    type Item = Result<RepositoryManagerRequest, fidl::Error>;
7654
7655    fn poll_next(
7656        mut self: std::pin::Pin<&mut Self>,
7657        cx: &mut std::task::Context<'_>,
7658    ) -> std::task::Poll<Option<Self::Item>> {
7659        let this = &mut *self;
7660        if this.inner.check_shutdown(cx) {
7661            this.is_terminated = true;
7662            return std::task::Poll::Ready(None);
7663        }
7664        if this.is_terminated {
7665            panic!("polled RepositoryManagerRequestStream after completion");
7666        }
7667        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7668            |bytes, handles| {
7669                match this.inner.channel().read_etc(cx, bytes, handles) {
7670                    std::task::Poll::Ready(Ok(())) => {}
7671                    std::task::Poll::Pending => return std::task::Poll::Pending,
7672                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7673                        this.is_terminated = true;
7674                        return std::task::Poll::Ready(None);
7675                    }
7676                    std::task::Poll::Ready(Err(e)) => {
7677                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7678                            e.into(),
7679                        ))))
7680                    }
7681                }
7682
7683                // A message has been received from the channel
7684                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7685
7686                std::task::Poll::Ready(Some(match header.ordinal {
7687                    0x7fff4b8c733c7151 => {
7688                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7689                        let mut req = fidl::new_empty!(
7690                            RepositoryManagerAddRequest,
7691                            fidl::encoding::DefaultFuchsiaResourceDialect
7692                        );
7693                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerAddRequest>(&header, _body_bytes, handles, &mut req)?;
7694                        let control_handle =
7695                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7696                        Ok(RepositoryManagerRequest::Add {
7697                            repo: req.repo,
7698
7699                            responder: RepositoryManagerAddResponder {
7700                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7701                                tx_id: header.tx_id,
7702                            },
7703                        })
7704                    }
7705                    0x5de23dc0e0dea4ba => {
7706                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7707                        let mut req = fidl::new_empty!(
7708                            RepositoryManagerRemoveRequest,
7709                            fidl::encoding::DefaultFuchsiaResourceDialect
7710                        );
7711                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
7712                        let control_handle =
7713                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7714                        Ok(RepositoryManagerRequest::Remove {
7715                            repo_url: req.repo_url,
7716
7717                            responder: RepositoryManagerRemoveResponder {
7718                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7719                                tx_id: header.tx_id,
7720                            },
7721                        })
7722                    }
7723                    0x3b7ef213730dd24c => {
7724                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7725                        let mut req = fidl::new_empty!(
7726                            RepositoryManagerAddMirrorRequest,
7727                            fidl::encoding::DefaultFuchsiaResourceDialect
7728                        );
7729                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerAddMirrorRequest>(&header, _body_bytes, handles, &mut req)?;
7730                        let control_handle =
7731                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7732                        Ok(RepositoryManagerRequest::AddMirror {
7733                            repo_url: req.repo_url,
7734                            mirror: req.mirror,
7735
7736                            responder: RepositoryManagerAddMirrorResponder {
7737                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7738                                tx_id: header.tx_id,
7739                            },
7740                        })
7741                    }
7742                    0x4682584cc47c23a2 => {
7743                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7744                        let mut req = fidl::new_empty!(
7745                            RepositoryManagerRemoveMirrorRequest,
7746                            fidl::encoding::DefaultFuchsiaResourceDialect
7747                        );
7748                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerRemoveMirrorRequest>(&header, _body_bytes, handles, &mut req)?;
7749                        let control_handle =
7750                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7751                        Ok(RepositoryManagerRequest::RemoveMirror {
7752                            repo_url: req.repo_url,
7753                            mirror_url: req.mirror_url,
7754
7755                            responder: RepositoryManagerRemoveMirrorResponder {
7756                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7757                                tx_id: header.tx_id,
7758                            },
7759                        })
7760                    }
7761                    0x61837314ba6f4afb => {
7762                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7763                        let mut req = fidl::new_empty!(
7764                            RepositoryManagerListRequest,
7765                            fidl::encoding::DefaultFuchsiaResourceDialect
7766                        );
7767                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RepositoryManagerListRequest>(&header, _body_bytes, handles, &mut req)?;
7768                        let control_handle =
7769                            RepositoryManagerControlHandle { inner: this.inner.clone() };
7770                        Ok(RepositoryManagerRequest::List {
7771                            iterator: req.iterator,
7772
7773                            control_handle,
7774                        })
7775                    }
7776                    _ => Err(fidl::Error::UnknownOrdinal {
7777                        ordinal: header.ordinal,
7778                        protocol_name:
7779                            <RepositoryManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7780                    }),
7781                }))
7782            },
7783        )
7784    }
7785}
7786
7787/// This manages package repositories.
7788///
7789/// This is intended to be implemented by package resolver components, and used by
7790/// repository administration tools.
7791#[derive(Debug)]
7792pub enum RepositoryManagerRequest {
7793    /// Adds a repository. This will overwrite the repository if it already exists.
7794    ///
7795    /// + request `repo` a repository to add to the resolver.
7796    /// * error a zx_status value indicating failure. One of the following:
7797    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
7798    ///     * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
7799    ///     * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
7800    Add { repo: RepositoryConfig, responder: RepositoryManagerAddResponder },
7801    /// Removes a repository.
7802    ///
7803    /// Removing a repository will prevent future packages from being cached from this repository,
7804    /// but in-flight downloads may not be interrupted.
7805    ///
7806    /// + request `repo_url` the URL of the repository we want to remove.
7807    /// * error a zx_status value indicating failure. One of the following:
7808    ///     * `ZX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
7809    ///       `repo_url` matches a static repository.
7810    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
7811    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7812    Remove { repo_url: String, responder: RepositoryManagerRemoveResponder },
7813    /// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
7814    ///
7815    /// + request `repo_url` the URL of the repository to add the mirror to.
7816    /// + request `mirror` the mirror config used to add the mirror.
7817    /// * error a zx_status value indicating failure. One of the following:
7818    ///     * `ZX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
7819    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
7820    ///     * `ZX_ERR_NOT_FOUND` if the repository does not exist.
7821    AddMirror {
7822        repo_url: String,
7823        mirror: MirrorConfig,
7824        responder: RepositoryManagerAddMirrorResponder,
7825    },
7826    /// Removes a mirror from a repository.
7827    ///
7828    /// Removing a mirror will prevent future packages from being cached from that mirror, but
7829    /// in-flight downloads may not be interrupted.
7830    ///
7831    /// + request `repo_url` the URL of the mirror's repository.
7832    /// + request `mirror_url` the URL of the mirror we want to remove.
7833    /// * error a zx_status value indicating failure. One of the following:
7834    ///     * `ZX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
7835    ///     * `ZX_ERR_NOT_FOUND` if the repository or mirror does not exist.
7836    RemoveMirror {
7837        repo_url: String,
7838        mirror_url: String,
7839        responder: RepositoryManagerRemoveMirrorResponder,
7840    },
7841    /// Returns an iterator over all repositories.
7842    ///
7843    /// + request `iterator` a request for an iterator.
7844    List {
7845        iterator: fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7846        control_handle: RepositoryManagerControlHandle,
7847    },
7848}
7849
7850impl RepositoryManagerRequest {
7851    #[allow(irrefutable_let_patterns)]
7852    pub fn into_add(self) -> Option<(RepositoryConfig, RepositoryManagerAddResponder)> {
7853        if let RepositoryManagerRequest::Add { repo, responder } = self {
7854            Some((repo, responder))
7855        } else {
7856            None
7857        }
7858    }
7859
7860    #[allow(irrefutable_let_patterns)]
7861    pub fn into_remove(self) -> Option<(String, RepositoryManagerRemoveResponder)> {
7862        if let RepositoryManagerRequest::Remove { repo_url, responder } = self {
7863            Some((repo_url, responder))
7864        } else {
7865            None
7866        }
7867    }
7868
7869    #[allow(irrefutable_let_patterns)]
7870    pub fn into_add_mirror(
7871        self,
7872    ) -> Option<(String, MirrorConfig, RepositoryManagerAddMirrorResponder)> {
7873        if let RepositoryManagerRequest::AddMirror { repo_url, mirror, responder } = self {
7874            Some((repo_url, mirror, responder))
7875        } else {
7876            None
7877        }
7878    }
7879
7880    #[allow(irrefutable_let_patterns)]
7881    pub fn into_remove_mirror(
7882        self,
7883    ) -> Option<(String, String, RepositoryManagerRemoveMirrorResponder)> {
7884        if let RepositoryManagerRequest::RemoveMirror { repo_url, mirror_url, responder } = self {
7885            Some((repo_url, mirror_url, responder))
7886        } else {
7887            None
7888        }
7889    }
7890
7891    #[allow(irrefutable_let_patterns)]
7892    pub fn into_list(
7893        self,
7894    ) -> Option<(
7895        fidl::endpoints::ServerEnd<RepositoryIteratorMarker>,
7896        RepositoryManagerControlHandle,
7897    )> {
7898        if let RepositoryManagerRequest::List { iterator, control_handle } = self {
7899            Some((iterator, control_handle))
7900        } else {
7901            None
7902        }
7903    }
7904
7905    /// Name of the method defined in FIDL
7906    pub fn method_name(&self) -> &'static str {
7907        match *self {
7908            RepositoryManagerRequest::Add { .. } => "add",
7909            RepositoryManagerRequest::Remove { .. } => "remove",
7910            RepositoryManagerRequest::AddMirror { .. } => "add_mirror",
7911            RepositoryManagerRequest::RemoveMirror { .. } => "remove_mirror",
7912            RepositoryManagerRequest::List { .. } => "list",
7913        }
7914    }
7915}
7916
7917#[derive(Debug, Clone)]
7918pub struct RepositoryManagerControlHandle {
7919    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7920}
7921
7922impl fidl::endpoints::ControlHandle for RepositoryManagerControlHandle {
7923    fn shutdown(&self) {
7924        self.inner.shutdown()
7925    }
7926    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7927        self.inner.shutdown_with_epitaph(status)
7928    }
7929
7930    fn is_closed(&self) -> bool {
7931        self.inner.channel().is_closed()
7932    }
7933    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7934        self.inner.channel().on_closed()
7935    }
7936
7937    #[cfg(target_os = "fuchsia")]
7938    fn signal_peer(
7939        &self,
7940        clear_mask: zx::Signals,
7941        set_mask: zx::Signals,
7942    ) -> Result<(), zx_status::Status> {
7943        use fidl::Peered;
7944        self.inner.channel().signal_peer(clear_mask, set_mask)
7945    }
7946}
7947
7948impl RepositoryManagerControlHandle {}
7949
7950#[must_use = "FIDL methods require a response to be sent"]
7951#[derive(Debug)]
7952pub struct RepositoryManagerAddResponder {
7953    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
7954    tx_id: u32,
7955}
7956
7957/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
7958/// if the responder is dropped without sending a response, so that the client
7959/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7960impl std::ops::Drop for RepositoryManagerAddResponder {
7961    fn drop(&mut self) {
7962        self.control_handle.shutdown();
7963        // Safety: drops once, never accessed again
7964        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7965    }
7966}
7967
7968impl fidl::endpoints::Responder for RepositoryManagerAddResponder {
7969    type ControlHandle = RepositoryManagerControlHandle;
7970
7971    fn control_handle(&self) -> &RepositoryManagerControlHandle {
7972        &self.control_handle
7973    }
7974
7975    fn drop_without_shutdown(mut self) {
7976        // Safety: drops once, never accessed again due to mem::forget
7977        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7978        // Prevent Drop from running (which would shut down the channel)
7979        std::mem::forget(self);
7980    }
7981}
7982
7983impl RepositoryManagerAddResponder {
7984    /// Sends a response to the FIDL transaction.
7985    ///
7986    /// Sets the channel to shutdown if an error occurs.
7987    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7988        let _result = self.send_raw(result);
7989        if _result.is_err() {
7990            self.control_handle.shutdown();
7991        }
7992        self.drop_without_shutdown();
7993        _result
7994    }
7995
7996    /// Similar to "send" but does not shutdown the channel if an error occurs.
7997    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7998        let _result = self.send_raw(result);
7999        self.drop_without_shutdown();
8000        _result
8001    }
8002
8003    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8004        self.control_handle
8005            .inner
8006            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
8007                result,
8008                self.tx_id,
8009                0x7fff4b8c733c7151,
8010                fidl::encoding::DynamicFlags::empty(),
8011            )
8012    }
8013}
8014
8015#[must_use = "FIDL methods require a response to be sent"]
8016#[derive(Debug)]
8017pub struct RepositoryManagerRemoveResponder {
8018    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
8019    tx_id: u32,
8020}
8021
8022/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
8023/// if the responder is dropped without sending a response, so that the client
8024/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8025impl std::ops::Drop for RepositoryManagerRemoveResponder {
8026    fn drop(&mut self) {
8027        self.control_handle.shutdown();
8028        // Safety: drops once, never accessed again
8029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8030    }
8031}
8032
8033impl fidl::endpoints::Responder for RepositoryManagerRemoveResponder {
8034    type ControlHandle = RepositoryManagerControlHandle;
8035
8036    fn control_handle(&self) -> &RepositoryManagerControlHandle {
8037        &self.control_handle
8038    }
8039
8040    fn drop_without_shutdown(mut self) {
8041        // Safety: drops once, never accessed again due to mem::forget
8042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8043        // Prevent Drop from running (which would shut down the channel)
8044        std::mem::forget(self);
8045    }
8046}
8047
8048impl RepositoryManagerRemoveResponder {
8049    /// Sends a response to the FIDL transaction.
8050    ///
8051    /// Sets the channel to shutdown if an error occurs.
8052    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8053        let _result = self.send_raw(result);
8054        if _result.is_err() {
8055            self.control_handle.shutdown();
8056        }
8057        self.drop_without_shutdown();
8058        _result
8059    }
8060
8061    /// Similar to "send" but does not shutdown the channel if an error occurs.
8062    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8063        let _result = self.send_raw(result);
8064        self.drop_without_shutdown();
8065        _result
8066    }
8067
8068    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8069        self.control_handle
8070            .inner
8071            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
8072                result,
8073                self.tx_id,
8074                0x5de23dc0e0dea4ba,
8075                fidl::encoding::DynamicFlags::empty(),
8076            )
8077    }
8078}
8079
8080#[must_use = "FIDL methods require a response to be sent"]
8081#[derive(Debug)]
8082pub struct RepositoryManagerAddMirrorResponder {
8083    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
8084    tx_id: u32,
8085}
8086
8087/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
8088/// if the responder is dropped without sending a response, so that the client
8089/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8090impl std::ops::Drop for RepositoryManagerAddMirrorResponder {
8091    fn drop(&mut self) {
8092        self.control_handle.shutdown();
8093        // Safety: drops once, never accessed again
8094        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8095    }
8096}
8097
8098impl fidl::endpoints::Responder for RepositoryManagerAddMirrorResponder {
8099    type ControlHandle = RepositoryManagerControlHandle;
8100
8101    fn control_handle(&self) -> &RepositoryManagerControlHandle {
8102        &self.control_handle
8103    }
8104
8105    fn drop_without_shutdown(mut self) {
8106        // Safety: drops once, never accessed again due to mem::forget
8107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8108        // Prevent Drop from running (which would shut down the channel)
8109        std::mem::forget(self);
8110    }
8111}
8112
8113impl RepositoryManagerAddMirrorResponder {
8114    /// Sends a response to the FIDL transaction.
8115    ///
8116    /// Sets the channel to shutdown if an error occurs.
8117    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8118        let _result = self.send_raw(result);
8119        if _result.is_err() {
8120            self.control_handle.shutdown();
8121        }
8122        self.drop_without_shutdown();
8123        _result
8124    }
8125
8126    /// Similar to "send" but does not shutdown the channel if an error occurs.
8127    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8128        let _result = self.send_raw(result);
8129        self.drop_without_shutdown();
8130        _result
8131    }
8132
8133    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8134        self.control_handle
8135            .inner
8136            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
8137                result,
8138                self.tx_id,
8139                0x3b7ef213730dd24c,
8140                fidl::encoding::DynamicFlags::empty(),
8141            )
8142    }
8143}
8144
8145#[must_use = "FIDL methods require a response to be sent"]
8146#[derive(Debug)]
8147pub struct RepositoryManagerRemoveMirrorResponder {
8148    control_handle: std::mem::ManuallyDrop<RepositoryManagerControlHandle>,
8149    tx_id: u32,
8150}
8151
8152/// Set the the channel to be shutdown (see [`RepositoryManagerControlHandle::shutdown`])
8153/// if the responder is dropped without sending a response, so that the client
8154/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8155impl std::ops::Drop for RepositoryManagerRemoveMirrorResponder {
8156    fn drop(&mut self) {
8157        self.control_handle.shutdown();
8158        // Safety: drops once, never accessed again
8159        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8160    }
8161}
8162
8163impl fidl::endpoints::Responder for RepositoryManagerRemoveMirrorResponder {
8164    type ControlHandle = RepositoryManagerControlHandle;
8165
8166    fn control_handle(&self) -> &RepositoryManagerControlHandle {
8167        &self.control_handle
8168    }
8169
8170    fn drop_without_shutdown(mut self) {
8171        // Safety: drops once, never accessed again due to mem::forget
8172        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8173        // Prevent Drop from running (which would shut down the channel)
8174        std::mem::forget(self);
8175    }
8176}
8177
8178impl RepositoryManagerRemoveMirrorResponder {
8179    /// Sends a response to the FIDL transaction.
8180    ///
8181    /// Sets the channel to shutdown if an error occurs.
8182    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8183        let _result = self.send_raw(result);
8184        if _result.is_err() {
8185            self.control_handle.shutdown();
8186        }
8187        self.drop_without_shutdown();
8188        _result
8189    }
8190
8191    /// Similar to "send" but does not shutdown the channel if an error occurs.
8192    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8193        let _result = self.send_raw(result);
8194        self.drop_without_shutdown();
8195        _result
8196    }
8197
8198    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8199        self.control_handle
8200            .inner
8201            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
8202                result,
8203                self.tx_id,
8204                0x4682584cc47c23a2,
8205                fidl::encoding::DynamicFlags::empty(),
8206            )
8207    }
8208}
8209
8210#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8211pub struct RetainedPackagesMarker;
8212
8213impl fidl::endpoints::ProtocolMarker for RetainedPackagesMarker {
8214    type Proxy = RetainedPackagesProxy;
8215    type RequestStream = RetainedPackagesRequestStream;
8216    #[cfg(target_os = "fuchsia")]
8217    type SynchronousProxy = RetainedPackagesSynchronousProxy;
8218
8219    const DEBUG_NAME: &'static str = "fuchsia.pkg.RetainedPackages";
8220}
8221impl fidl::endpoints::DiscoverableProtocolMarker for RetainedPackagesMarker {}
8222
8223pub trait RetainedPackagesProxyInterface: Send + Sync {
8224    type ClearResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8225    fn r#clear(&self) -> Self::ClearResponseFut;
8226    type ReplaceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8227    fn r#replace(
8228        &self,
8229        iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8230    ) -> Self::ReplaceResponseFut;
8231}
8232#[derive(Debug)]
8233#[cfg(target_os = "fuchsia")]
8234pub struct RetainedPackagesSynchronousProxy {
8235    client: fidl::client::sync::Client,
8236}
8237
8238#[cfg(target_os = "fuchsia")]
8239impl fidl::endpoints::SynchronousProxy for RetainedPackagesSynchronousProxy {
8240    type Proxy = RetainedPackagesProxy;
8241    type Protocol = RetainedPackagesMarker;
8242
8243    fn from_channel(inner: fidl::Channel) -> Self {
8244        Self::new(inner)
8245    }
8246
8247    fn into_channel(self) -> fidl::Channel {
8248        self.client.into_channel()
8249    }
8250
8251    fn as_channel(&self) -> &fidl::Channel {
8252        self.client.as_channel()
8253    }
8254}
8255
8256#[cfg(target_os = "fuchsia")]
8257impl RetainedPackagesSynchronousProxy {
8258    pub fn new(channel: fidl::Channel) -> Self {
8259        let protocol_name = <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8260        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8261    }
8262
8263    pub fn into_channel(self) -> fidl::Channel {
8264        self.client.into_channel()
8265    }
8266
8267    /// Waits until an event arrives and returns it. It is safe for other
8268    /// threads to make concurrent requests while waiting for an event.
8269    pub fn wait_for_event(
8270        &self,
8271        deadline: zx::MonotonicInstant,
8272    ) -> Result<RetainedPackagesEvent, fidl::Error> {
8273        RetainedPackagesEvent::decode(self.client.wait_for_event(deadline)?)
8274    }
8275
8276    /// Atomically clear the retained package set, releasing any previously
8277    /// retained packages.
8278    pub fn r#clear(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
8279        let _response =
8280            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
8281                (),
8282                0x7f17476f097961ac,
8283                fidl::encoding::DynamicFlags::empty(),
8284                ___deadline,
8285            )?;
8286        Ok(_response)
8287    }
8288
8289    /// Atomically replace the retained package set with the [package hashes](
8290    /// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package-hash)
8291    /// provided by the given iterator.
8292    /// Duplicate IDs provided will be merged and processed as a single one.
8293    ///
8294    /// + request `iterator` an iterator of package blob IDs that should be
8295    ///   retained.
8296    pub fn r#replace(
8297        &self,
8298        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8299        ___deadline: zx::MonotonicInstant,
8300    ) -> Result<(), fidl::Error> {
8301        let _response = self
8302            .client
8303            .send_query::<RetainedPackagesReplaceRequest, fidl::encoding::EmptyPayload>(
8304                (iterator,),
8305                0x5021e479570f3a9f,
8306                fidl::encoding::DynamicFlags::empty(),
8307                ___deadline,
8308            )?;
8309        Ok(_response)
8310    }
8311}
8312
8313#[derive(Debug, Clone)]
8314pub struct RetainedPackagesProxy {
8315    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8316}
8317
8318impl fidl::endpoints::Proxy for RetainedPackagesProxy {
8319    type Protocol = RetainedPackagesMarker;
8320
8321    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8322        Self::new(inner)
8323    }
8324
8325    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8326        self.client.into_channel().map_err(|client| Self { client })
8327    }
8328
8329    fn as_channel(&self) -> &::fidl::AsyncChannel {
8330        self.client.as_channel()
8331    }
8332}
8333
8334impl RetainedPackagesProxy {
8335    /// Create a new Proxy for fuchsia.pkg/RetainedPackages.
8336    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8337        let protocol_name = <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8338        Self { client: fidl::client::Client::new(channel, protocol_name) }
8339    }
8340
8341    /// Get a Stream of events from the remote end of the protocol.
8342    ///
8343    /// # Panics
8344    ///
8345    /// Panics if the event stream was already taken.
8346    pub fn take_event_stream(&self) -> RetainedPackagesEventStream {
8347        RetainedPackagesEventStream { event_receiver: self.client.take_event_receiver() }
8348    }
8349
8350    /// Atomically clear the retained package set, releasing any previously
8351    /// retained packages.
8352    pub fn r#clear(
8353        &self,
8354    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8355        RetainedPackagesProxyInterface::r#clear(self)
8356    }
8357
8358    /// Atomically replace the retained package set with the [package hashes](
8359    /// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package-hash)
8360    /// provided by the given iterator.
8361    /// Duplicate IDs provided will be merged and processed as a single one.
8362    ///
8363    /// + request `iterator` an iterator of package blob IDs that should be
8364    ///   retained.
8365    pub fn r#replace(
8366        &self,
8367        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8368    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8369        RetainedPackagesProxyInterface::r#replace(self, iterator)
8370    }
8371}
8372
8373impl RetainedPackagesProxyInterface for RetainedPackagesProxy {
8374    type ClearResponseFut =
8375        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8376    fn r#clear(&self) -> Self::ClearResponseFut {
8377        fn _decode(
8378            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8379        ) -> Result<(), fidl::Error> {
8380            let _response = fidl::client::decode_transaction_body::<
8381                fidl::encoding::EmptyPayload,
8382                fidl::encoding::DefaultFuchsiaResourceDialect,
8383                0x7f17476f097961ac,
8384            >(_buf?)?;
8385            Ok(_response)
8386        }
8387        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8388            (),
8389            0x7f17476f097961ac,
8390            fidl::encoding::DynamicFlags::empty(),
8391            _decode,
8392        )
8393    }
8394
8395    type ReplaceResponseFut =
8396        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8397    fn r#replace(
8398        &self,
8399        mut iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8400    ) -> Self::ReplaceResponseFut {
8401        fn _decode(
8402            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8403        ) -> Result<(), fidl::Error> {
8404            let _response = fidl::client::decode_transaction_body::<
8405                fidl::encoding::EmptyPayload,
8406                fidl::encoding::DefaultFuchsiaResourceDialect,
8407                0x5021e479570f3a9f,
8408            >(_buf?)?;
8409            Ok(_response)
8410        }
8411        self.client.send_query_and_decode::<RetainedPackagesReplaceRequest, ()>(
8412            (iterator,),
8413            0x5021e479570f3a9f,
8414            fidl::encoding::DynamicFlags::empty(),
8415            _decode,
8416        )
8417    }
8418}
8419
8420pub struct RetainedPackagesEventStream {
8421    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8422}
8423
8424impl std::marker::Unpin for RetainedPackagesEventStream {}
8425
8426impl futures::stream::FusedStream for RetainedPackagesEventStream {
8427    fn is_terminated(&self) -> bool {
8428        self.event_receiver.is_terminated()
8429    }
8430}
8431
8432impl futures::Stream for RetainedPackagesEventStream {
8433    type Item = Result<RetainedPackagesEvent, fidl::Error>;
8434
8435    fn poll_next(
8436        mut self: std::pin::Pin<&mut Self>,
8437        cx: &mut std::task::Context<'_>,
8438    ) -> std::task::Poll<Option<Self::Item>> {
8439        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8440            &mut self.event_receiver,
8441            cx
8442        )?) {
8443            Some(buf) => std::task::Poll::Ready(Some(RetainedPackagesEvent::decode(buf))),
8444            None => std::task::Poll::Ready(None),
8445        }
8446    }
8447}
8448
8449#[derive(Debug)]
8450pub enum RetainedPackagesEvent {}
8451
8452impl RetainedPackagesEvent {
8453    /// Decodes a message buffer as a [`RetainedPackagesEvent`].
8454    fn decode(
8455        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8456    ) -> Result<RetainedPackagesEvent, fidl::Error> {
8457        let (bytes, _handles) = buf.split_mut();
8458        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8459        debug_assert_eq!(tx_header.tx_id, 0);
8460        match tx_header.ordinal {
8461            _ => Err(fidl::Error::UnknownOrdinal {
8462                ordinal: tx_header.ordinal,
8463                protocol_name:
8464                    <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8465            }),
8466        }
8467    }
8468}
8469
8470/// A Stream of incoming requests for fuchsia.pkg/RetainedPackages.
8471pub struct RetainedPackagesRequestStream {
8472    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8473    is_terminated: bool,
8474}
8475
8476impl std::marker::Unpin for RetainedPackagesRequestStream {}
8477
8478impl futures::stream::FusedStream for RetainedPackagesRequestStream {
8479    fn is_terminated(&self) -> bool {
8480        self.is_terminated
8481    }
8482}
8483
8484impl fidl::endpoints::RequestStream for RetainedPackagesRequestStream {
8485    type Protocol = RetainedPackagesMarker;
8486    type ControlHandle = RetainedPackagesControlHandle;
8487
8488    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8489        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8490    }
8491
8492    fn control_handle(&self) -> Self::ControlHandle {
8493        RetainedPackagesControlHandle { inner: self.inner.clone() }
8494    }
8495
8496    fn into_inner(
8497        self,
8498    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8499    {
8500        (self.inner, self.is_terminated)
8501    }
8502
8503    fn from_inner(
8504        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8505        is_terminated: bool,
8506    ) -> Self {
8507        Self { inner, is_terminated }
8508    }
8509}
8510
8511impl futures::Stream for RetainedPackagesRequestStream {
8512    type Item = Result<RetainedPackagesRequest, fidl::Error>;
8513
8514    fn poll_next(
8515        mut self: std::pin::Pin<&mut Self>,
8516        cx: &mut std::task::Context<'_>,
8517    ) -> std::task::Poll<Option<Self::Item>> {
8518        let this = &mut *self;
8519        if this.inner.check_shutdown(cx) {
8520            this.is_terminated = true;
8521            return std::task::Poll::Ready(None);
8522        }
8523        if this.is_terminated {
8524            panic!("polled RetainedPackagesRequestStream after completion");
8525        }
8526        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8527            |bytes, handles| {
8528                match this.inner.channel().read_etc(cx, bytes, handles) {
8529                    std::task::Poll::Ready(Ok(())) => {}
8530                    std::task::Poll::Pending => return std::task::Poll::Pending,
8531                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8532                        this.is_terminated = true;
8533                        return std::task::Poll::Ready(None);
8534                    }
8535                    std::task::Poll::Ready(Err(e)) => {
8536                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8537                            e.into(),
8538                        ))))
8539                    }
8540                }
8541
8542                // A message has been received from the channel
8543                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8544
8545                std::task::Poll::Ready(Some(match header.ordinal {
8546                    0x7f17476f097961ac => {
8547                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8548                        let mut req = fidl::new_empty!(
8549                            fidl::encoding::EmptyPayload,
8550                            fidl::encoding::DefaultFuchsiaResourceDialect
8551                        );
8552                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8553                        let control_handle =
8554                            RetainedPackagesControlHandle { inner: this.inner.clone() };
8555                        Ok(RetainedPackagesRequest::Clear {
8556                            responder: RetainedPackagesClearResponder {
8557                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8558                                tx_id: header.tx_id,
8559                            },
8560                        })
8561                    }
8562                    0x5021e479570f3a9f => {
8563                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8564                        let mut req = fidl::new_empty!(
8565                            RetainedPackagesReplaceRequest,
8566                            fidl::encoding::DefaultFuchsiaResourceDialect
8567                        );
8568                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RetainedPackagesReplaceRequest>(&header, _body_bytes, handles, &mut req)?;
8569                        let control_handle =
8570                            RetainedPackagesControlHandle { inner: this.inner.clone() };
8571                        Ok(RetainedPackagesRequest::Replace {
8572                            iterator: req.iterator,
8573
8574                            responder: RetainedPackagesReplaceResponder {
8575                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8576                                tx_id: header.tx_id,
8577                            },
8578                        })
8579                    }
8580                    _ => Err(fidl::Error::UnknownOrdinal {
8581                        ordinal: header.ordinal,
8582                        protocol_name:
8583                            <RetainedPackagesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8584                    }),
8585                }))
8586            },
8587        )
8588    }
8589}
8590
8591/// Manages the set of retained packages.
8592///
8593/// Retained packages will not be removed from the package cache, even if they
8594/// aren't fully present. There is only a single set active at once, and the
8595/// provided APIs for configuring the set atomically replace that set. On boot,
8596/// the retained package set is always initialized to the empty set.
8597/// Documentation on [garbage collection](
8598/// https://fuchsia.dev/fuchsia-src/concepts/packages/garbage_collection) contains
8599/// details on various types of package indexes (static, retained, etc) and
8600/// describes when a package will be garbage collected or retained.
8601#[derive(Debug)]
8602pub enum RetainedPackagesRequest {
8603    /// Atomically clear the retained package set, releasing any previously
8604    /// retained packages.
8605    Clear { responder: RetainedPackagesClearResponder },
8606    /// Atomically replace the retained package set with the [package hashes](
8607    /// https://fuchsia.dev/fuchsia-src/concepts/packages/package_url#package-hash)
8608    /// provided by the given iterator.
8609    /// Duplicate IDs provided will be merged and processed as a single one.
8610    ///
8611    /// + request `iterator` an iterator of package blob IDs that should be
8612    ///   retained.
8613    Replace {
8614        iterator: fidl::endpoints::ClientEnd<BlobIdIteratorMarker>,
8615        responder: RetainedPackagesReplaceResponder,
8616    },
8617}
8618
8619impl RetainedPackagesRequest {
8620    #[allow(irrefutable_let_patterns)]
8621    pub fn into_clear(self) -> Option<(RetainedPackagesClearResponder)> {
8622        if let RetainedPackagesRequest::Clear { responder } = self {
8623            Some((responder))
8624        } else {
8625            None
8626        }
8627    }
8628
8629    #[allow(irrefutable_let_patterns)]
8630    pub fn into_replace(
8631        self,
8632    ) -> Option<(fidl::endpoints::ClientEnd<BlobIdIteratorMarker>, RetainedPackagesReplaceResponder)>
8633    {
8634        if let RetainedPackagesRequest::Replace { iterator, responder } = self {
8635            Some((iterator, responder))
8636        } else {
8637            None
8638        }
8639    }
8640
8641    /// Name of the method defined in FIDL
8642    pub fn method_name(&self) -> &'static str {
8643        match *self {
8644            RetainedPackagesRequest::Clear { .. } => "clear",
8645            RetainedPackagesRequest::Replace { .. } => "replace",
8646        }
8647    }
8648}
8649
8650#[derive(Debug, Clone)]
8651pub struct RetainedPackagesControlHandle {
8652    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8653}
8654
8655impl fidl::endpoints::ControlHandle for RetainedPackagesControlHandle {
8656    fn shutdown(&self) {
8657        self.inner.shutdown()
8658    }
8659    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8660        self.inner.shutdown_with_epitaph(status)
8661    }
8662
8663    fn is_closed(&self) -> bool {
8664        self.inner.channel().is_closed()
8665    }
8666    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8667        self.inner.channel().on_closed()
8668    }
8669
8670    #[cfg(target_os = "fuchsia")]
8671    fn signal_peer(
8672        &self,
8673        clear_mask: zx::Signals,
8674        set_mask: zx::Signals,
8675    ) -> Result<(), zx_status::Status> {
8676        use fidl::Peered;
8677        self.inner.channel().signal_peer(clear_mask, set_mask)
8678    }
8679}
8680
8681impl RetainedPackagesControlHandle {}
8682
8683#[must_use = "FIDL methods require a response to be sent"]
8684#[derive(Debug)]
8685pub struct RetainedPackagesClearResponder {
8686    control_handle: std::mem::ManuallyDrop<RetainedPackagesControlHandle>,
8687    tx_id: u32,
8688}
8689
8690/// Set the the channel to be shutdown (see [`RetainedPackagesControlHandle::shutdown`])
8691/// if the responder is dropped without sending a response, so that the client
8692/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8693impl std::ops::Drop for RetainedPackagesClearResponder {
8694    fn drop(&mut self) {
8695        self.control_handle.shutdown();
8696        // Safety: drops once, never accessed again
8697        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8698    }
8699}
8700
8701impl fidl::endpoints::Responder for RetainedPackagesClearResponder {
8702    type ControlHandle = RetainedPackagesControlHandle;
8703
8704    fn control_handle(&self) -> &RetainedPackagesControlHandle {
8705        &self.control_handle
8706    }
8707
8708    fn drop_without_shutdown(mut self) {
8709        // Safety: drops once, never accessed again due to mem::forget
8710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8711        // Prevent Drop from running (which would shut down the channel)
8712        std::mem::forget(self);
8713    }
8714}
8715
8716impl RetainedPackagesClearResponder {
8717    /// Sends a response to the FIDL transaction.
8718    ///
8719    /// Sets the channel to shutdown if an error occurs.
8720    pub fn send(self) -> Result<(), fidl::Error> {
8721        let _result = self.send_raw();
8722        if _result.is_err() {
8723            self.control_handle.shutdown();
8724        }
8725        self.drop_without_shutdown();
8726        _result
8727    }
8728
8729    /// Similar to "send" but does not shutdown the channel if an error occurs.
8730    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8731        let _result = self.send_raw();
8732        self.drop_without_shutdown();
8733        _result
8734    }
8735
8736    fn send_raw(&self) -> Result<(), fidl::Error> {
8737        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8738            (),
8739            self.tx_id,
8740            0x7f17476f097961ac,
8741            fidl::encoding::DynamicFlags::empty(),
8742        )
8743    }
8744}
8745
8746#[must_use = "FIDL methods require a response to be sent"]
8747#[derive(Debug)]
8748pub struct RetainedPackagesReplaceResponder {
8749    control_handle: std::mem::ManuallyDrop<RetainedPackagesControlHandle>,
8750    tx_id: u32,
8751}
8752
8753/// Set the the channel to be shutdown (see [`RetainedPackagesControlHandle::shutdown`])
8754/// if the responder is dropped without sending a response, so that the client
8755/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8756impl std::ops::Drop for RetainedPackagesReplaceResponder {
8757    fn drop(&mut self) {
8758        self.control_handle.shutdown();
8759        // Safety: drops once, never accessed again
8760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8761    }
8762}
8763
8764impl fidl::endpoints::Responder for RetainedPackagesReplaceResponder {
8765    type ControlHandle = RetainedPackagesControlHandle;
8766
8767    fn control_handle(&self) -> &RetainedPackagesControlHandle {
8768        &self.control_handle
8769    }
8770
8771    fn drop_without_shutdown(mut self) {
8772        // Safety: drops once, never accessed again due to mem::forget
8773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8774        // Prevent Drop from running (which would shut down the channel)
8775        std::mem::forget(self);
8776    }
8777}
8778
8779impl RetainedPackagesReplaceResponder {
8780    /// Sends a response to the FIDL transaction.
8781    ///
8782    /// Sets the channel to shutdown if an error occurs.
8783    pub fn send(self) -> Result<(), fidl::Error> {
8784        let _result = self.send_raw();
8785        if _result.is_err() {
8786            self.control_handle.shutdown();
8787        }
8788        self.drop_without_shutdown();
8789        _result
8790    }
8791
8792    /// Similar to "send" but does not shutdown the channel if an error occurs.
8793    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8794        let _result = self.send_raw();
8795        self.drop_without_shutdown();
8796        _result
8797    }
8798
8799    fn send_raw(&self) -> Result<(), fidl::Error> {
8800        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8801            (),
8802            self.tx_id,
8803            0x5021e479570f3a9f,
8804            fidl::encoding::DynamicFlags::empty(),
8805        )
8806    }
8807}
8808
8809mod internal {
8810    use super::*;
8811    unsafe impl fidl::encoding::TypeMarker for BlobWrittenError {
8812        type Owned = Self;
8813
8814        #[inline(always)]
8815        fn inline_align(_context: fidl::encoding::Context) -> usize {
8816            std::mem::align_of::<u32>()
8817        }
8818
8819        #[inline(always)]
8820        fn inline_size(_context: fidl::encoding::Context) -> usize {
8821            std::mem::size_of::<u32>()
8822        }
8823
8824        #[inline(always)]
8825        fn encode_is_copy() -> bool {
8826            true
8827        }
8828
8829        #[inline(always)]
8830        fn decode_is_copy() -> bool {
8831            false
8832        }
8833    }
8834
8835    impl fidl::encoding::ValueTypeMarker for BlobWrittenError {
8836        type Borrowed<'a> = Self;
8837        #[inline(always)]
8838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8839            *value
8840        }
8841    }
8842
8843    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
8844        for BlobWrittenError
8845    {
8846        #[inline]
8847        unsafe fn encode(
8848            self,
8849            encoder: &mut fidl::encoding::Encoder<'_, D>,
8850            offset: usize,
8851            _depth: fidl::encoding::Depth,
8852        ) -> fidl::Result<()> {
8853            encoder.debug_check_bounds::<Self>(offset);
8854            encoder.write_num(self.into_primitive(), offset);
8855            Ok(())
8856        }
8857    }
8858
8859    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlobWrittenError {
8860        #[inline(always)]
8861        fn new_empty() -> Self {
8862            Self::NotWritten
8863        }
8864
8865        #[inline]
8866        unsafe fn decode(
8867            &mut self,
8868            decoder: &mut fidl::encoding::Decoder<'_, D>,
8869            offset: usize,
8870            _depth: fidl::encoding::Depth,
8871        ) -> fidl::Result<()> {
8872            decoder.debug_check_bounds::<Self>(offset);
8873            let prim = decoder.read_num::<u32>(offset);
8874
8875            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
8876            Ok(())
8877        }
8878    }
8879    unsafe impl fidl::encoding::TypeMarker for GcProtection {
8880        type Owned = Self;
8881
8882        #[inline(always)]
8883        fn inline_align(_context: fidl::encoding::Context) -> usize {
8884            std::mem::align_of::<u32>()
8885        }
8886
8887        #[inline(always)]
8888        fn inline_size(_context: fidl::encoding::Context) -> usize {
8889            std::mem::size_of::<u32>()
8890        }
8891
8892        #[inline(always)]
8893        fn encode_is_copy() -> bool {
8894            true
8895        }
8896
8897        #[inline(always)]
8898        fn decode_is_copy() -> bool {
8899            false
8900        }
8901    }
8902
8903    impl fidl::encoding::ValueTypeMarker for GcProtection {
8904        type Borrowed<'a> = Self;
8905        #[inline(always)]
8906        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8907            *value
8908        }
8909    }
8910
8911    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GcProtection {
8912        #[inline]
8913        unsafe fn encode(
8914            self,
8915            encoder: &mut fidl::encoding::Encoder<'_, D>,
8916            offset: usize,
8917            _depth: fidl::encoding::Depth,
8918        ) -> fidl::Result<()> {
8919            encoder.debug_check_bounds::<Self>(offset);
8920            encoder.write_num(self.into_primitive(), offset);
8921            Ok(())
8922        }
8923    }
8924
8925    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GcProtection {
8926        #[inline(always)]
8927        fn new_empty() -> Self {
8928            Self::OpenPackageTracking
8929        }
8930
8931        #[inline]
8932        unsafe fn decode(
8933            &mut self,
8934            decoder: &mut fidl::encoding::Decoder<'_, D>,
8935            offset: usize,
8936            _depth: fidl::encoding::Depth,
8937        ) -> fidl::Result<()> {
8938            decoder.debug_check_bounds::<Self>(offset);
8939            let prim = decoder.read_num::<u32>(offset);
8940
8941            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
8942            Ok(())
8943        }
8944    }
8945    unsafe impl fidl::encoding::TypeMarker for GetInfoError {
8946        type Owned = Self;
8947
8948        #[inline(always)]
8949        fn inline_align(_context: fidl::encoding::Context) -> usize {
8950            std::mem::align_of::<u32>()
8951        }
8952
8953        #[inline(always)]
8954        fn inline_size(_context: fidl::encoding::Context) -> usize {
8955            std::mem::size_of::<u32>()
8956        }
8957
8958        #[inline(always)]
8959        fn encode_is_copy() -> bool {
8960            true
8961        }
8962
8963        #[inline(always)]
8964        fn decode_is_copy() -> bool {
8965            false
8966        }
8967    }
8968
8969    impl fidl::encoding::ValueTypeMarker for GetInfoError {
8970        type Borrowed<'a> = Self;
8971        #[inline(always)]
8972        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8973            *value
8974        }
8975    }
8976
8977    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GetInfoError {
8978        #[inline]
8979        unsafe fn encode(
8980            self,
8981            encoder: &mut fidl::encoding::Encoder<'_, D>,
8982            offset: usize,
8983            _depth: fidl::encoding::Depth,
8984        ) -> fidl::Result<()> {
8985            encoder.debug_check_bounds::<Self>(offset);
8986            encoder.write_num(self.into_primitive(), offset);
8987            Ok(())
8988        }
8989    }
8990
8991    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GetInfoError {
8992        #[inline(always)]
8993        fn new_empty() -> Self {
8994            Self::UnknownUrl
8995        }
8996
8997        #[inline]
8998        unsafe fn decode(
8999            &mut self,
9000            decoder: &mut fidl::encoding::Decoder<'_, D>,
9001            offset: usize,
9002            _depth: fidl::encoding::Depth,
9003        ) -> fidl::Result<()> {
9004            decoder.debug_check_bounds::<Self>(offset);
9005            let prim = decoder.read_num::<u32>(offset);
9006
9007            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
9008            Ok(())
9009        }
9010    }
9011    unsafe impl fidl::encoding::TypeMarker for GetSubpackageError {
9012        type Owned = Self;
9013
9014        #[inline(always)]
9015        fn inline_align(_context: fidl::encoding::Context) -> usize {
9016            std::mem::align_of::<u32>()
9017        }
9018
9019        #[inline(always)]
9020        fn inline_size(_context: fidl::encoding::Context) -> usize {
9021            std::mem::size_of::<u32>()
9022        }
9023
9024        #[inline(always)]
9025        fn encode_is_copy() -> bool {
9026            true
9027        }
9028
9029        #[inline(always)]
9030        fn decode_is_copy() -> bool {
9031            false
9032        }
9033    }
9034
9035    impl fidl::encoding::ValueTypeMarker for GetSubpackageError {
9036        type Borrowed<'a> = Self;
9037        #[inline(always)]
9038        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9039            *value
9040        }
9041    }
9042
9043    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
9044        for GetSubpackageError
9045    {
9046        #[inline]
9047        unsafe fn encode(
9048            self,
9049            encoder: &mut fidl::encoding::Encoder<'_, D>,
9050            offset: usize,
9051            _depth: fidl::encoding::Depth,
9052        ) -> fidl::Result<()> {
9053            encoder.debug_check_bounds::<Self>(offset);
9054            encoder.write_num(self.into_primitive(), offset);
9055            Ok(())
9056        }
9057    }
9058
9059    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GetSubpackageError {
9060        #[inline(always)]
9061        fn new_empty() -> Self {
9062            Self::SuperpackageClosed
9063        }
9064
9065        #[inline]
9066        unsafe fn decode(
9067            &mut self,
9068            decoder: &mut fidl::encoding::Decoder<'_, D>,
9069            offset: usize,
9070            _depth: fidl::encoding::Depth,
9071        ) -> fidl::Result<()> {
9072            decoder.debug_check_bounds::<Self>(offset);
9073            let prim = decoder.read_num::<u32>(offset);
9074
9075            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
9076            Ok(())
9077        }
9078    }
9079    unsafe impl fidl::encoding::TypeMarker for OpenBlobError {
9080        type Owned = Self;
9081
9082        #[inline(always)]
9083        fn inline_align(_context: fidl::encoding::Context) -> usize {
9084            std::mem::align_of::<u32>()
9085        }
9086
9087        #[inline(always)]
9088        fn inline_size(_context: fidl::encoding::Context) -> usize {
9089            std::mem::size_of::<u32>()
9090        }
9091
9092        #[inline(always)]
9093        fn encode_is_copy() -> bool {
9094            true
9095        }
9096
9097        #[inline(always)]
9098        fn decode_is_copy() -> bool {
9099            false
9100        }
9101    }
9102
9103    impl fidl::encoding::ValueTypeMarker for OpenBlobError {
9104        type Borrowed<'a> = Self;
9105        #[inline(always)]
9106        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9107            *value
9108        }
9109    }
9110
9111    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for OpenBlobError {
9112        #[inline]
9113        unsafe fn encode(
9114            self,
9115            encoder: &mut fidl::encoding::Encoder<'_, D>,
9116            offset: usize,
9117            _depth: fidl::encoding::Depth,
9118        ) -> fidl::Result<()> {
9119            encoder.debug_check_bounds::<Self>(offset);
9120            encoder.write_num(self.into_primitive(), offset);
9121            Ok(())
9122        }
9123    }
9124
9125    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OpenBlobError {
9126        #[inline(always)]
9127        fn new_empty() -> Self {
9128            Self::OutOfSpace
9129        }
9130
9131        #[inline]
9132        unsafe fn decode(
9133            &mut self,
9134            decoder: &mut fidl::encoding::Decoder<'_, D>,
9135            offset: usize,
9136            _depth: fidl::encoding::Depth,
9137        ) -> fidl::Result<()> {
9138            decoder.debug_check_bounds::<Self>(offset);
9139            let prim = decoder.read_num::<u32>(offset);
9140
9141            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
9142            Ok(())
9143        }
9144    }
9145    unsafe impl fidl::encoding::TypeMarker for RepositoryStorageType {
9146        type Owned = Self;
9147
9148        #[inline(always)]
9149        fn inline_align(_context: fidl::encoding::Context) -> usize {
9150            std::mem::align_of::<u32>()
9151        }
9152
9153        #[inline(always)]
9154        fn inline_size(_context: fidl::encoding::Context) -> usize {
9155            std::mem::size_of::<u32>()
9156        }
9157
9158        #[inline(always)]
9159        fn encode_is_copy() -> bool {
9160            true
9161        }
9162
9163        #[inline(always)]
9164        fn decode_is_copy() -> bool {
9165            false
9166        }
9167    }
9168
9169    impl fidl::encoding::ValueTypeMarker for RepositoryStorageType {
9170        type Borrowed<'a> = Self;
9171        #[inline(always)]
9172        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9173            *value
9174        }
9175    }
9176
9177    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
9178        for RepositoryStorageType
9179    {
9180        #[inline]
9181        unsafe fn encode(
9182            self,
9183            encoder: &mut fidl::encoding::Encoder<'_, D>,
9184            offset: usize,
9185            _depth: fidl::encoding::Depth,
9186        ) -> fidl::Result<()> {
9187            encoder.debug_check_bounds::<Self>(offset);
9188            encoder.write_num(self.into_primitive(), offset);
9189            Ok(())
9190        }
9191    }
9192
9193    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepositoryStorageType {
9194        #[inline(always)]
9195        fn new_empty() -> Self {
9196            Self::Ephemeral
9197        }
9198
9199        #[inline]
9200        unsafe fn decode(
9201            &mut self,
9202            decoder: &mut fidl::encoding::Decoder<'_, D>,
9203            offset: usize,
9204            _depth: fidl::encoding::Depth,
9205        ) -> fidl::Result<()> {
9206            decoder.debug_check_bounds::<Self>(offset);
9207            let prim = decoder.read_num::<u32>(offset);
9208
9209            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
9210            Ok(())
9211        }
9212    }
9213    unsafe impl fidl::encoding::TypeMarker for ResolveError {
9214        type Owned = Self;
9215
9216        #[inline(always)]
9217        fn inline_align(_context: fidl::encoding::Context) -> usize {
9218            std::mem::align_of::<i32>()
9219        }
9220
9221        #[inline(always)]
9222        fn inline_size(_context: fidl::encoding::Context) -> usize {
9223            std::mem::size_of::<i32>()
9224        }
9225
9226        #[inline(always)]
9227        fn encode_is_copy() -> bool {
9228            true
9229        }
9230
9231        #[inline(always)]
9232        fn decode_is_copy() -> bool {
9233            false
9234        }
9235    }
9236
9237    impl fidl::encoding::ValueTypeMarker for ResolveError {
9238        type Borrowed<'a> = Self;
9239        #[inline(always)]
9240        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9241            *value
9242        }
9243    }
9244
9245    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ResolveError {
9246        #[inline]
9247        unsafe fn encode(
9248            self,
9249            encoder: &mut fidl::encoding::Encoder<'_, D>,
9250            offset: usize,
9251            _depth: fidl::encoding::Depth,
9252        ) -> fidl::Result<()> {
9253            encoder.debug_check_bounds::<Self>(offset);
9254            encoder.write_num(self.into_primitive(), offset);
9255            Ok(())
9256        }
9257    }
9258
9259    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResolveError {
9260        #[inline(always)]
9261        fn new_empty() -> Self {
9262            Self::Internal
9263        }
9264
9265        #[inline]
9266        unsafe fn decode(
9267            &mut self,
9268            decoder: &mut fidl::encoding::Decoder<'_, D>,
9269            offset: usize,
9270            _depth: fidl::encoding::Depth,
9271        ) -> fidl::Result<()> {
9272            decoder.debug_check_bounds::<Self>(offset);
9273            let prim = decoder.read_num::<i32>(offset);
9274
9275            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
9276            Ok(())
9277        }
9278    }
9279    unsafe impl fidl::encoding::TypeMarker for SetUpgradableUrlsError {
9280        type Owned = Self;
9281
9282        #[inline(always)]
9283        fn inline_align(_context: fidl::encoding::Context) -> usize {
9284            std::mem::align_of::<u32>()
9285        }
9286
9287        #[inline(always)]
9288        fn inline_size(_context: fidl::encoding::Context) -> usize {
9289            std::mem::size_of::<u32>()
9290        }
9291
9292        #[inline(always)]
9293        fn encode_is_copy() -> bool {
9294            false
9295        }
9296
9297        #[inline(always)]
9298        fn decode_is_copy() -> bool {
9299            false
9300        }
9301    }
9302
9303    impl fidl::encoding::ValueTypeMarker for SetUpgradableUrlsError {
9304        type Borrowed<'a> = Self;
9305        #[inline(always)]
9306        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9307            *value
9308        }
9309    }
9310
9311    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
9312        for SetUpgradableUrlsError
9313    {
9314        #[inline]
9315        unsafe fn encode(
9316            self,
9317            encoder: &mut fidl::encoding::Encoder<'_, D>,
9318            offset: usize,
9319            _depth: fidl::encoding::Depth,
9320        ) -> fidl::Result<()> {
9321            encoder.debug_check_bounds::<Self>(offset);
9322            encoder.write_num(self.into_primitive(), offset);
9323            Ok(())
9324        }
9325    }
9326
9327    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9328        for SetUpgradableUrlsError
9329    {
9330        #[inline(always)]
9331        fn new_empty() -> Self {
9332            Self::unknown()
9333        }
9334
9335        #[inline]
9336        unsafe fn decode(
9337            &mut self,
9338            decoder: &mut fidl::encoding::Decoder<'_, D>,
9339            offset: usize,
9340            _depth: fidl::encoding::Depth,
9341        ) -> fidl::Result<()> {
9342            decoder.debug_check_bounds::<Self>(offset);
9343            let prim = decoder.read_num::<u32>(offset);
9344
9345            *self = Self::from_primitive_allow_unknown(prim);
9346            Ok(())
9347        }
9348    }
9349    unsafe impl fidl::encoding::TypeMarker for WriteError {
9350        type Owned = Self;
9351
9352        #[inline(always)]
9353        fn inline_align(_context: fidl::encoding::Context) -> usize {
9354            std::mem::align_of::<u32>()
9355        }
9356
9357        #[inline(always)]
9358        fn inline_size(_context: fidl::encoding::Context) -> usize {
9359            std::mem::size_of::<u32>()
9360        }
9361
9362        #[inline(always)]
9363        fn encode_is_copy() -> bool {
9364            true
9365        }
9366
9367        #[inline(always)]
9368        fn decode_is_copy() -> bool {
9369            false
9370        }
9371    }
9372
9373    impl fidl::encoding::ValueTypeMarker for WriteError {
9374        type Borrowed<'a> = Self;
9375        #[inline(always)]
9376        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9377            *value
9378        }
9379    }
9380
9381    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WriteError {
9382        #[inline]
9383        unsafe fn encode(
9384            self,
9385            encoder: &mut fidl::encoding::Encoder<'_, D>,
9386            offset: usize,
9387            _depth: fidl::encoding::Depth,
9388        ) -> fidl::Result<()> {
9389            encoder.debug_check_bounds::<Self>(offset);
9390            encoder.write_num(self.into_primitive(), offset);
9391            Ok(())
9392        }
9393    }
9394
9395    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WriteError {
9396        #[inline(always)]
9397        fn new_empty() -> Self {
9398            Self::UnknownUrl
9399        }
9400
9401        #[inline]
9402        unsafe fn decode(
9403            &mut self,
9404            decoder: &mut fidl::encoding::Decoder<'_, D>,
9405            offset: usize,
9406            _depth: fidl::encoding::Depth,
9407        ) -> fidl::Result<()> {
9408            decoder.debug_check_bounds::<Self>(offset);
9409            let prim = decoder.read_num::<u32>(offset);
9410
9411            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
9412            Ok(())
9413        }
9414    }
9415
9416    impl fidl::encoding::ValueTypeMarker for BlobId {
9417        type Borrowed<'a> = &'a Self;
9418        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9419            value
9420        }
9421    }
9422
9423    unsafe impl fidl::encoding::TypeMarker for BlobId {
9424        type Owned = Self;
9425
9426        #[inline(always)]
9427        fn inline_align(_context: fidl::encoding::Context) -> usize {
9428            1
9429        }
9430
9431        #[inline(always)]
9432        fn inline_size(_context: fidl::encoding::Context) -> usize {
9433            32
9434        }
9435        #[inline(always)]
9436        fn encode_is_copy() -> bool {
9437            true
9438        }
9439
9440        #[inline(always)]
9441        fn decode_is_copy() -> bool {
9442            true
9443        }
9444    }
9445
9446    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlobId, D> for &BlobId {
9447        #[inline]
9448        unsafe fn encode(
9449            self,
9450            encoder: &mut fidl::encoding::Encoder<'_, D>,
9451            offset: usize,
9452            _depth: fidl::encoding::Depth,
9453        ) -> fidl::Result<()> {
9454            encoder.debug_check_bounds::<BlobId>(offset);
9455            unsafe {
9456                // Copy the object into the buffer.
9457                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9458                (buf_ptr as *mut BlobId).write_unaligned((self as *const BlobId).read());
9459                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9460                // done second because the memcpy will write garbage to these bytes.
9461            }
9462            Ok(())
9463        }
9464    }
9465    unsafe impl<
9466            D: fidl::encoding::ResourceDialect,
9467            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
9468        > fidl::encoding::Encode<BlobId, D> for (T0,)
9469    {
9470        #[inline]
9471        unsafe fn encode(
9472            self,
9473            encoder: &mut fidl::encoding::Encoder<'_, D>,
9474            offset: usize,
9475            depth: fidl::encoding::Depth,
9476        ) -> fidl::Result<()> {
9477            encoder.debug_check_bounds::<BlobId>(offset);
9478            // Zero out padding regions. There's no need to apply masks
9479            // because the unmasked parts will be overwritten by fields.
9480            // Write the fields.
9481            self.0.encode(encoder, offset + 0, depth)?;
9482            Ok(())
9483        }
9484    }
9485
9486    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlobId {
9487        #[inline(always)]
9488        fn new_empty() -> Self {
9489            Self { merkle_root: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D) }
9490        }
9491
9492        #[inline]
9493        unsafe fn decode(
9494            &mut self,
9495            decoder: &mut fidl::encoding::Decoder<'_, D>,
9496            offset: usize,
9497            _depth: fidl::encoding::Depth,
9498        ) -> fidl::Result<()> {
9499            decoder.debug_check_bounds::<Self>(offset);
9500            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9501            // Verify that padding bytes are zero.
9502            // Copy from the buffer into the object.
9503            unsafe {
9504                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
9505            }
9506            Ok(())
9507        }
9508    }
9509
9510    impl fidl::encoding::ValueTypeMarker for BlobIdIteratorNextResponse {
9511        type Borrowed<'a> = &'a Self;
9512        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9513            value
9514        }
9515    }
9516
9517    unsafe impl fidl::encoding::TypeMarker for BlobIdIteratorNextResponse {
9518        type Owned = Self;
9519
9520        #[inline(always)]
9521        fn inline_align(_context: fidl::encoding::Context) -> usize {
9522            8
9523        }
9524
9525        #[inline(always)]
9526        fn inline_size(_context: fidl::encoding::Context) -> usize {
9527            16
9528        }
9529    }
9530
9531    unsafe impl<D: fidl::encoding::ResourceDialect>
9532        fidl::encoding::Encode<BlobIdIteratorNextResponse, D> for &BlobIdIteratorNextResponse
9533    {
9534        #[inline]
9535        unsafe fn encode(
9536            self,
9537            encoder: &mut fidl::encoding::Encoder<'_, D>,
9538            offset: usize,
9539            _depth: fidl::encoding::Depth,
9540        ) -> fidl::Result<()> {
9541            encoder.debug_check_bounds::<BlobIdIteratorNextResponse>(offset);
9542            // Delegate to tuple encoding.
9543            fidl::encoding::Encode::<BlobIdIteratorNextResponse, D>::encode(
9544                (
9545                    <fidl::encoding::UnboundedVector<BlobId> as fidl::encoding::ValueTypeMarker>::borrow(&self.blobs),
9546                ),
9547                encoder, offset, _depth
9548            )
9549        }
9550    }
9551    unsafe impl<
9552            D: fidl::encoding::ResourceDialect,
9553            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<BlobId>, D>,
9554        > fidl::encoding::Encode<BlobIdIteratorNextResponse, D> for (T0,)
9555    {
9556        #[inline]
9557        unsafe fn encode(
9558            self,
9559            encoder: &mut fidl::encoding::Encoder<'_, D>,
9560            offset: usize,
9561            depth: fidl::encoding::Depth,
9562        ) -> fidl::Result<()> {
9563            encoder.debug_check_bounds::<BlobIdIteratorNextResponse>(offset);
9564            // Zero out padding regions. There's no need to apply masks
9565            // because the unmasked parts will be overwritten by fields.
9566            // Write the fields.
9567            self.0.encode(encoder, offset + 0, depth)?;
9568            Ok(())
9569        }
9570    }
9571
9572    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9573        for BlobIdIteratorNextResponse
9574    {
9575        #[inline(always)]
9576        fn new_empty() -> Self {
9577            Self { blobs: fidl::new_empty!(fidl::encoding::UnboundedVector<BlobId>, D) }
9578        }
9579
9580        #[inline]
9581        unsafe fn decode(
9582            &mut self,
9583            decoder: &mut fidl::encoding::Decoder<'_, D>,
9584            offset: usize,
9585            _depth: fidl::encoding::Depth,
9586        ) -> fidl::Result<()> {
9587            decoder.debug_check_bounds::<Self>(offset);
9588            // Verify that padding bytes are zero.
9589            fidl::decode!(
9590                fidl::encoding::UnboundedVector<BlobId>,
9591                D,
9592                &mut self.blobs,
9593                decoder,
9594                offset + 0,
9595                _depth
9596            )?;
9597            Ok(())
9598        }
9599    }
9600
9601    impl fidl::encoding::ValueTypeMarker for BlobInfo {
9602        type Borrowed<'a> = &'a Self;
9603        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9604            value
9605        }
9606    }
9607
9608    unsafe impl fidl::encoding::TypeMarker for BlobInfo {
9609        type Owned = Self;
9610
9611        #[inline(always)]
9612        fn inline_align(_context: fidl::encoding::Context) -> usize {
9613            8
9614        }
9615
9616        #[inline(always)]
9617        fn inline_size(_context: fidl::encoding::Context) -> usize {
9618            40
9619        }
9620        #[inline(always)]
9621        fn encode_is_copy() -> bool {
9622            true
9623        }
9624
9625        #[inline(always)]
9626        fn decode_is_copy() -> bool {
9627            true
9628        }
9629    }
9630
9631    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlobInfo, D> for &BlobInfo {
9632        #[inline]
9633        unsafe fn encode(
9634            self,
9635            encoder: &mut fidl::encoding::Encoder<'_, D>,
9636            offset: usize,
9637            _depth: fidl::encoding::Depth,
9638        ) -> fidl::Result<()> {
9639            encoder.debug_check_bounds::<BlobInfo>(offset);
9640            unsafe {
9641                // Copy the object into the buffer.
9642                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9643                (buf_ptr as *mut BlobInfo).write_unaligned((self as *const BlobInfo).read());
9644                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9645                // done second because the memcpy will write garbage to these bytes.
9646            }
9647            Ok(())
9648        }
9649    }
9650    unsafe impl<
9651            D: fidl::encoding::ResourceDialect,
9652            T0: fidl::encoding::Encode<BlobId, D>,
9653            T1: fidl::encoding::Encode<u64, D>,
9654        > fidl::encoding::Encode<BlobInfo, D> for (T0, T1)
9655    {
9656        #[inline]
9657        unsafe fn encode(
9658            self,
9659            encoder: &mut fidl::encoding::Encoder<'_, D>,
9660            offset: usize,
9661            depth: fidl::encoding::Depth,
9662        ) -> fidl::Result<()> {
9663            encoder.debug_check_bounds::<BlobInfo>(offset);
9664            // Zero out padding regions. There's no need to apply masks
9665            // because the unmasked parts will be overwritten by fields.
9666            // Write the fields.
9667            self.0.encode(encoder, offset + 0, depth)?;
9668            self.1.encode(encoder, offset + 32, depth)?;
9669            Ok(())
9670        }
9671    }
9672
9673    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlobInfo {
9674        #[inline(always)]
9675        fn new_empty() -> Self {
9676            Self { blob_id: fidl::new_empty!(BlobId, D), length: fidl::new_empty!(u64, D) }
9677        }
9678
9679        #[inline]
9680        unsafe fn decode(
9681            &mut self,
9682            decoder: &mut fidl::encoding::Decoder<'_, D>,
9683            offset: usize,
9684            _depth: fidl::encoding::Depth,
9685        ) -> fidl::Result<()> {
9686            decoder.debug_check_bounds::<Self>(offset);
9687            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9688            // Verify that padding bytes are zero.
9689            // Copy from the buffer into the object.
9690            unsafe {
9691                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
9692            }
9693            Ok(())
9694        }
9695    }
9696
9697    impl fidl::encoding::ValueTypeMarker for BlobInfoIteratorNextResponse {
9698        type Borrowed<'a> = &'a Self;
9699        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9700            value
9701        }
9702    }
9703
9704    unsafe impl fidl::encoding::TypeMarker for BlobInfoIteratorNextResponse {
9705        type Owned = Self;
9706
9707        #[inline(always)]
9708        fn inline_align(_context: fidl::encoding::Context) -> usize {
9709            8
9710        }
9711
9712        #[inline(always)]
9713        fn inline_size(_context: fidl::encoding::Context) -> usize {
9714            16
9715        }
9716    }
9717
9718    unsafe impl<D: fidl::encoding::ResourceDialect>
9719        fidl::encoding::Encode<BlobInfoIteratorNextResponse, D> for &BlobInfoIteratorNextResponse
9720    {
9721        #[inline]
9722        unsafe fn encode(
9723            self,
9724            encoder: &mut fidl::encoding::Encoder<'_, D>,
9725            offset: usize,
9726            _depth: fidl::encoding::Depth,
9727        ) -> fidl::Result<()> {
9728            encoder.debug_check_bounds::<BlobInfoIteratorNextResponse>(offset);
9729            // Delegate to tuple encoding.
9730            fidl::encoding::Encode::<BlobInfoIteratorNextResponse, D>::encode(
9731                (
9732                    <fidl::encoding::UnboundedVector<BlobInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.blobs),
9733                ),
9734                encoder, offset, _depth
9735            )
9736        }
9737    }
9738    unsafe impl<
9739            D: fidl::encoding::ResourceDialect,
9740            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<BlobInfo>, D>,
9741        > fidl::encoding::Encode<BlobInfoIteratorNextResponse, D> for (T0,)
9742    {
9743        #[inline]
9744        unsafe fn encode(
9745            self,
9746            encoder: &mut fidl::encoding::Encoder<'_, D>,
9747            offset: usize,
9748            depth: fidl::encoding::Depth,
9749        ) -> fidl::Result<()> {
9750            encoder.debug_check_bounds::<BlobInfoIteratorNextResponse>(offset);
9751            // Zero out padding regions. There's no need to apply masks
9752            // because the unmasked parts will be overwritten by fields.
9753            // Write the fields.
9754            self.0.encode(encoder, offset + 0, depth)?;
9755            Ok(())
9756        }
9757    }
9758
9759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9760        for BlobInfoIteratorNextResponse
9761    {
9762        #[inline(always)]
9763        fn new_empty() -> Self {
9764            Self { blobs: fidl::new_empty!(fidl::encoding::UnboundedVector<BlobInfo>, D) }
9765        }
9766
9767        #[inline]
9768        unsafe fn decode(
9769            &mut self,
9770            decoder: &mut fidl::encoding::Decoder<'_, D>,
9771            offset: usize,
9772            _depth: fidl::encoding::Depth,
9773        ) -> fidl::Result<()> {
9774            decoder.debug_check_bounds::<Self>(offset);
9775            // Verify that padding bytes are zero.
9776            fidl::decode!(
9777                fidl::encoding::UnboundedVector<BlobInfo>,
9778                D,
9779                &mut self.blobs,
9780                decoder,
9781                offset + 0,
9782                _depth
9783            )?;
9784            Ok(())
9785        }
9786    }
9787
9788    impl fidl::encoding::ValueTypeMarker for CupGetInfoRequest {
9789        type Borrowed<'a> = &'a Self;
9790        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9791            value
9792        }
9793    }
9794
9795    unsafe impl fidl::encoding::TypeMarker for CupGetInfoRequest {
9796        type Owned = Self;
9797
9798        #[inline(always)]
9799        fn inline_align(_context: fidl::encoding::Context) -> usize {
9800            8
9801        }
9802
9803        #[inline(always)]
9804        fn inline_size(_context: fidl::encoding::Context) -> usize {
9805            16
9806        }
9807    }
9808
9809    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CupGetInfoRequest, D>
9810        for &CupGetInfoRequest
9811    {
9812        #[inline]
9813        unsafe fn encode(
9814            self,
9815            encoder: &mut fidl::encoding::Encoder<'_, D>,
9816            offset: usize,
9817            _depth: fidl::encoding::Depth,
9818        ) -> fidl::Result<()> {
9819            encoder.debug_check_bounds::<CupGetInfoRequest>(offset);
9820            // Delegate to tuple encoding.
9821            fidl::encoding::Encode::<CupGetInfoRequest, D>::encode(
9822                (<PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.url),),
9823                encoder,
9824                offset,
9825                _depth,
9826            )
9827        }
9828    }
9829    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PackageUrl, D>>
9830        fidl::encoding::Encode<CupGetInfoRequest, D> for (T0,)
9831    {
9832        #[inline]
9833        unsafe fn encode(
9834            self,
9835            encoder: &mut fidl::encoding::Encoder<'_, D>,
9836            offset: usize,
9837            depth: fidl::encoding::Depth,
9838        ) -> fidl::Result<()> {
9839            encoder.debug_check_bounds::<CupGetInfoRequest>(offset);
9840            // Zero out padding regions. There's no need to apply masks
9841            // because the unmasked parts will be overwritten by fields.
9842            // Write the fields.
9843            self.0.encode(encoder, offset + 0, depth)?;
9844            Ok(())
9845        }
9846    }
9847
9848    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CupGetInfoRequest {
9849        #[inline(always)]
9850        fn new_empty() -> Self {
9851            Self { url: fidl::new_empty!(PackageUrl, D) }
9852        }
9853
9854        #[inline]
9855        unsafe fn decode(
9856            &mut self,
9857            decoder: &mut fidl::encoding::Decoder<'_, D>,
9858            offset: usize,
9859            _depth: fidl::encoding::Depth,
9860        ) -> fidl::Result<()> {
9861            decoder.debug_check_bounds::<Self>(offset);
9862            // Verify that padding bytes are zero.
9863            fidl::decode!(PackageUrl, D, &mut self.url, decoder, offset + 0, _depth)?;
9864            Ok(())
9865        }
9866    }
9867
9868    impl fidl::encoding::ValueTypeMarker for CupWriteRequest {
9869        type Borrowed<'a> = &'a Self;
9870        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9871            value
9872        }
9873    }
9874
9875    unsafe impl fidl::encoding::TypeMarker for CupWriteRequest {
9876        type Owned = Self;
9877
9878        #[inline(always)]
9879        fn inline_align(_context: fidl::encoding::Context) -> usize {
9880            8
9881        }
9882
9883        #[inline(always)]
9884        fn inline_size(_context: fidl::encoding::Context) -> usize {
9885            32
9886        }
9887    }
9888
9889    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CupWriteRequest, D>
9890        for &CupWriteRequest
9891    {
9892        #[inline]
9893        unsafe fn encode(
9894            self,
9895            encoder: &mut fidl::encoding::Encoder<'_, D>,
9896            offset: usize,
9897            _depth: fidl::encoding::Depth,
9898        ) -> fidl::Result<()> {
9899            encoder.debug_check_bounds::<CupWriteRequest>(offset);
9900            // Delegate to tuple encoding.
9901            fidl::encoding::Encode::<CupWriteRequest, D>::encode(
9902                (
9903                    <PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
9904                    <CupData as fidl::encoding::ValueTypeMarker>::borrow(&self.cup),
9905                ),
9906                encoder,
9907                offset,
9908                _depth,
9909            )
9910        }
9911    }
9912    unsafe impl<
9913            D: fidl::encoding::ResourceDialect,
9914            T0: fidl::encoding::Encode<PackageUrl, D>,
9915            T1: fidl::encoding::Encode<CupData, D>,
9916        > fidl::encoding::Encode<CupWriteRequest, D> for (T0, T1)
9917    {
9918        #[inline]
9919        unsafe fn encode(
9920            self,
9921            encoder: &mut fidl::encoding::Encoder<'_, D>,
9922            offset: usize,
9923            depth: fidl::encoding::Depth,
9924        ) -> fidl::Result<()> {
9925            encoder.debug_check_bounds::<CupWriteRequest>(offset);
9926            // Zero out padding regions. There's no need to apply masks
9927            // because the unmasked parts will be overwritten by fields.
9928            // Write the fields.
9929            self.0.encode(encoder, offset + 0, depth)?;
9930            self.1.encode(encoder, offset + 16, depth)?;
9931            Ok(())
9932        }
9933    }
9934
9935    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CupWriteRequest {
9936        #[inline(always)]
9937        fn new_empty() -> Self {
9938            Self { url: fidl::new_empty!(PackageUrl, D), cup: fidl::new_empty!(CupData, D) }
9939        }
9940
9941        #[inline]
9942        unsafe fn decode(
9943            &mut self,
9944            decoder: &mut fidl::encoding::Decoder<'_, D>,
9945            offset: usize,
9946            _depth: fidl::encoding::Depth,
9947        ) -> fidl::Result<()> {
9948            decoder.debug_check_bounds::<Self>(offset);
9949            // Verify that padding bytes are zero.
9950            fidl::decode!(PackageUrl, D, &mut self.url, decoder, offset + 0, _depth)?;
9951            fidl::decode!(CupData, D, &mut self.cup, decoder, offset + 16, _depth)?;
9952            Ok(())
9953        }
9954    }
9955
9956    impl fidl::encoding::ValueTypeMarker for CupGetInfoResponse {
9957        type Borrowed<'a> = &'a Self;
9958        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9959            value
9960        }
9961    }
9962
9963    unsafe impl fidl::encoding::TypeMarker for CupGetInfoResponse {
9964        type Owned = Self;
9965
9966        #[inline(always)]
9967        fn inline_align(_context: fidl::encoding::Context) -> usize {
9968            8
9969        }
9970
9971        #[inline(always)]
9972        fn inline_size(_context: fidl::encoding::Context) -> usize {
9973            32
9974        }
9975    }
9976
9977    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CupGetInfoResponse, D>
9978        for &CupGetInfoResponse
9979    {
9980        #[inline]
9981        unsafe fn encode(
9982            self,
9983            encoder: &mut fidl::encoding::Encoder<'_, D>,
9984            offset: usize,
9985            _depth: fidl::encoding::Depth,
9986        ) -> fidl::Result<()> {
9987            encoder.debug_check_bounds::<CupGetInfoResponse>(offset);
9988            // Delegate to tuple encoding.
9989            fidl::encoding::Encode::<CupGetInfoResponse, D>::encode(
9990                (
9991                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
9992                        &self.version,
9993                    ),
9994                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
9995                        &self.channel,
9996                    ),
9997                ),
9998                encoder,
9999                offset,
10000                _depth,
10001            )
10002        }
10003    }
10004    unsafe impl<
10005            D: fidl::encoding::ResourceDialect,
10006            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
10007            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
10008        > fidl::encoding::Encode<CupGetInfoResponse, D> for (T0, T1)
10009    {
10010        #[inline]
10011        unsafe fn encode(
10012            self,
10013            encoder: &mut fidl::encoding::Encoder<'_, D>,
10014            offset: usize,
10015            depth: fidl::encoding::Depth,
10016        ) -> fidl::Result<()> {
10017            encoder.debug_check_bounds::<CupGetInfoResponse>(offset);
10018            // Zero out padding regions. There's no need to apply masks
10019            // because the unmasked parts will be overwritten by fields.
10020            // Write the fields.
10021            self.0.encode(encoder, offset + 0, depth)?;
10022            self.1.encode(encoder, offset + 16, depth)?;
10023            Ok(())
10024        }
10025    }
10026
10027    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CupGetInfoResponse {
10028        #[inline(always)]
10029        fn new_empty() -> Self {
10030            Self {
10031                version: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
10032                channel: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
10033            }
10034        }
10035
10036        #[inline]
10037        unsafe fn decode(
10038            &mut self,
10039            decoder: &mut fidl::encoding::Decoder<'_, D>,
10040            offset: usize,
10041            _depth: fidl::encoding::Depth,
10042        ) -> fidl::Result<()> {
10043            decoder.debug_check_bounds::<Self>(offset);
10044            // Verify that padding bytes are zero.
10045            fidl::decode!(
10046                fidl::encoding::BoundedString<64>,
10047                D,
10048                &mut self.version,
10049                decoder,
10050                offset + 0,
10051                _depth
10052            )?;
10053            fidl::decode!(
10054                fidl::encoding::BoundedString<128>,
10055                D,
10056                &mut self.channel,
10057                decoder,
10058                offset + 16,
10059                _depth
10060            )?;
10061            Ok(())
10062        }
10063    }
10064
10065    impl fidl::encoding::ResourceTypeMarker for FontResolverResolveRequest {
10066        type Borrowed<'a> = &'a mut Self;
10067        fn take_or_borrow<'a>(
10068            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10069        ) -> Self::Borrowed<'a> {
10070            value
10071        }
10072    }
10073
10074    unsafe impl fidl::encoding::TypeMarker for FontResolverResolveRequest {
10075        type Owned = Self;
10076
10077        #[inline(always)]
10078        fn inline_align(_context: fidl::encoding::Context) -> usize {
10079            8
10080        }
10081
10082        #[inline(always)]
10083        fn inline_size(_context: fidl::encoding::Context) -> usize {
10084            24
10085        }
10086    }
10087
10088    unsafe impl
10089        fidl::encoding::Encode<
10090            FontResolverResolveRequest,
10091            fidl::encoding::DefaultFuchsiaResourceDialect,
10092        > for &mut FontResolverResolveRequest
10093    {
10094        #[inline]
10095        unsafe fn encode(
10096            self,
10097            encoder: &mut fidl::encoding::Encoder<
10098                '_,
10099                fidl::encoding::DefaultFuchsiaResourceDialect,
10100            >,
10101            offset: usize,
10102            _depth: fidl::encoding::Depth,
10103        ) -> fidl::Result<()> {
10104            encoder.debug_check_bounds::<FontResolverResolveRequest>(offset);
10105            // Delegate to tuple encoding.
10106            fidl::encoding::Encode::<
10107                FontResolverResolveRequest,
10108                fidl::encoding::DefaultFuchsiaResourceDialect,
10109            >::encode(
10110                (
10111                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
10112                        &self.package_url,
10113                    ),
10114                    <fidl::encoding::Endpoint<
10115                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10116                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10117                        &mut self.directory_request,
10118                    ),
10119                ),
10120                encoder,
10121                offset,
10122                _depth,
10123            )
10124        }
10125    }
10126    unsafe impl<
10127            T0: fidl::encoding::Encode<
10128                fidl::encoding::UnboundedString,
10129                fidl::encoding::DefaultFuchsiaResourceDialect,
10130            >,
10131            T1: fidl::encoding::Encode<
10132                fidl::encoding::Endpoint<
10133                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10134                >,
10135                fidl::encoding::DefaultFuchsiaResourceDialect,
10136            >,
10137        >
10138        fidl::encoding::Encode<
10139            FontResolverResolveRequest,
10140            fidl::encoding::DefaultFuchsiaResourceDialect,
10141        > for (T0, T1)
10142    {
10143        #[inline]
10144        unsafe fn encode(
10145            self,
10146            encoder: &mut fidl::encoding::Encoder<
10147                '_,
10148                fidl::encoding::DefaultFuchsiaResourceDialect,
10149            >,
10150            offset: usize,
10151            depth: fidl::encoding::Depth,
10152        ) -> fidl::Result<()> {
10153            encoder.debug_check_bounds::<FontResolverResolveRequest>(offset);
10154            // Zero out padding regions. There's no need to apply masks
10155            // because the unmasked parts will be overwritten by fields.
10156            unsafe {
10157                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10158                (ptr as *mut u64).write_unaligned(0);
10159            }
10160            // Write the fields.
10161            self.0.encode(encoder, offset + 0, depth)?;
10162            self.1.encode(encoder, offset + 16, depth)?;
10163            Ok(())
10164        }
10165    }
10166
10167    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10168        for FontResolverResolveRequest
10169    {
10170        #[inline(always)]
10171        fn new_empty() -> Self {
10172            Self {
10173                package_url: fidl::new_empty!(
10174                    fidl::encoding::UnboundedString,
10175                    fidl::encoding::DefaultFuchsiaResourceDialect
10176                ),
10177                directory_request: fidl::new_empty!(
10178                    fidl::encoding::Endpoint<
10179                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10180                    >,
10181                    fidl::encoding::DefaultFuchsiaResourceDialect
10182                ),
10183            }
10184        }
10185
10186        #[inline]
10187        unsafe fn decode(
10188            &mut self,
10189            decoder: &mut fidl::encoding::Decoder<
10190                '_,
10191                fidl::encoding::DefaultFuchsiaResourceDialect,
10192            >,
10193            offset: usize,
10194            _depth: fidl::encoding::Depth,
10195        ) -> fidl::Result<()> {
10196            decoder.debug_check_bounds::<Self>(offset);
10197            // Verify that padding bytes are zero.
10198            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10199            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10200            let mask = 0xffffffff00000000u64;
10201            let maskedval = padval & mask;
10202            if maskedval != 0 {
10203                return Err(fidl::Error::NonZeroPadding {
10204                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10205                });
10206            }
10207            fidl::decode!(
10208                fidl::encoding::UnboundedString,
10209                fidl::encoding::DefaultFuchsiaResourceDialect,
10210                &mut self.package_url,
10211                decoder,
10212                offset + 0,
10213                _depth
10214            )?;
10215            fidl::decode!(
10216                fidl::encoding::Endpoint<
10217                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10218                >,
10219                fidl::encoding::DefaultFuchsiaResourceDialect,
10220                &mut self.directory_request,
10221                decoder,
10222                offset + 16,
10223                _depth
10224            )?;
10225            Ok(())
10226        }
10227    }
10228
10229    impl fidl::encoding::ValueTypeMarker for NeededBlobsBlobWrittenRequest {
10230        type Borrowed<'a> = &'a Self;
10231        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10232            value
10233        }
10234    }
10235
10236    unsafe impl fidl::encoding::TypeMarker for NeededBlobsBlobWrittenRequest {
10237        type Owned = Self;
10238
10239        #[inline(always)]
10240        fn inline_align(_context: fidl::encoding::Context) -> usize {
10241            1
10242        }
10243
10244        #[inline(always)]
10245        fn inline_size(_context: fidl::encoding::Context) -> usize {
10246            32
10247        }
10248        #[inline(always)]
10249        fn encode_is_copy() -> bool {
10250            true
10251        }
10252
10253        #[inline(always)]
10254        fn decode_is_copy() -> bool {
10255            true
10256        }
10257    }
10258
10259    unsafe impl<D: fidl::encoding::ResourceDialect>
10260        fidl::encoding::Encode<NeededBlobsBlobWrittenRequest, D>
10261        for &NeededBlobsBlobWrittenRequest
10262    {
10263        #[inline]
10264        unsafe fn encode(
10265            self,
10266            encoder: &mut fidl::encoding::Encoder<'_, D>,
10267            offset: usize,
10268            _depth: fidl::encoding::Depth,
10269        ) -> fidl::Result<()> {
10270            encoder.debug_check_bounds::<NeededBlobsBlobWrittenRequest>(offset);
10271            unsafe {
10272                // Copy the object into the buffer.
10273                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10274                (buf_ptr as *mut NeededBlobsBlobWrittenRequest)
10275                    .write_unaligned((self as *const NeededBlobsBlobWrittenRequest).read());
10276                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10277                // done second because the memcpy will write garbage to these bytes.
10278            }
10279            Ok(())
10280        }
10281    }
10282    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlobId, D>>
10283        fidl::encoding::Encode<NeededBlobsBlobWrittenRequest, D> for (T0,)
10284    {
10285        #[inline]
10286        unsafe fn encode(
10287            self,
10288            encoder: &mut fidl::encoding::Encoder<'_, D>,
10289            offset: usize,
10290            depth: fidl::encoding::Depth,
10291        ) -> fidl::Result<()> {
10292            encoder.debug_check_bounds::<NeededBlobsBlobWrittenRequest>(offset);
10293            // Zero out padding regions. There's no need to apply masks
10294            // because the unmasked parts will be overwritten by fields.
10295            // Write the fields.
10296            self.0.encode(encoder, offset + 0, depth)?;
10297            Ok(())
10298        }
10299    }
10300
10301    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10302        for NeededBlobsBlobWrittenRequest
10303    {
10304        #[inline(always)]
10305        fn new_empty() -> Self {
10306            Self { blob_id: fidl::new_empty!(BlobId, D) }
10307        }
10308
10309        #[inline]
10310        unsafe fn decode(
10311            &mut self,
10312            decoder: &mut fidl::encoding::Decoder<'_, D>,
10313            offset: usize,
10314            _depth: fidl::encoding::Depth,
10315        ) -> fidl::Result<()> {
10316            decoder.debug_check_bounds::<Self>(offset);
10317            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10318            // Verify that padding bytes are zero.
10319            // Copy from the buffer into the object.
10320            unsafe {
10321                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
10322            }
10323            Ok(())
10324        }
10325    }
10326
10327    impl fidl::encoding::ResourceTypeMarker for NeededBlobsGetMissingBlobsRequest {
10328        type Borrowed<'a> = &'a mut Self;
10329        fn take_or_borrow<'a>(
10330            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10331        ) -> Self::Borrowed<'a> {
10332            value
10333        }
10334    }
10335
10336    unsafe impl fidl::encoding::TypeMarker for NeededBlobsGetMissingBlobsRequest {
10337        type Owned = Self;
10338
10339        #[inline(always)]
10340        fn inline_align(_context: fidl::encoding::Context) -> usize {
10341            4
10342        }
10343
10344        #[inline(always)]
10345        fn inline_size(_context: fidl::encoding::Context) -> usize {
10346            4
10347        }
10348    }
10349
10350    unsafe impl
10351        fidl::encoding::Encode<
10352            NeededBlobsGetMissingBlobsRequest,
10353            fidl::encoding::DefaultFuchsiaResourceDialect,
10354        > for &mut NeededBlobsGetMissingBlobsRequest
10355    {
10356        #[inline]
10357        unsafe fn encode(
10358            self,
10359            encoder: &mut fidl::encoding::Encoder<
10360                '_,
10361                fidl::encoding::DefaultFuchsiaResourceDialect,
10362            >,
10363            offset: usize,
10364            _depth: fidl::encoding::Depth,
10365        ) -> fidl::Result<()> {
10366            encoder.debug_check_bounds::<NeededBlobsGetMissingBlobsRequest>(offset);
10367            // Delegate to tuple encoding.
10368            fidl::encoding::Encode::<NeededBlobsGetMissingBlobsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10369                (
10370                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
10371                ),
10372                encoder, offset, _depth
10373            )
10374        }
10375    }
10376    unsafe impl<
10377            T0: fidl::encoding::Encode<
10378                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>>,
10379                fidl::encoding::DefaultFuchsiaResourceDialect,
10380            >,
10381        >
10382        fidl::encoding::Encode<
10383            NeededBlobsGetMissingBlobsRequest,
10384            fidl::encoding::DefaultFuchsiaResourceDialect,
10385        > for (T0,)
10386    {
10387        #[inline]
10388        unsafe fn encode(
10389            self,
10390            encoder: &mut fidl::encoding::Encoder<
10391                '_,
10392                fidl::encoding::DefaultFuchsiaResourceDialect,
10393            >,
10394            offset: usize,
10395            depth: fidl::encoding::Depth,
10396        ) -> fidl::Result<()> {
10397            encoder.debug_check_bounds::<NeededBlobsGetMissingBlobsRequest>(offset);
10398            // Zero out padding regions. There's no need to apply masks
10399            // because the unmasked parts will be overwritten by fields.
10400            // Write the fields.
10401            self.0.encode(encoder, offset + 0, depth)?;
10402            Ok(())
10403        }
10404    }
10405
10406    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10407        for NeededBlobsGetMissingBlobsRequest
10408    {
10409        #[inline(always)]
10410        fn new_empty() -> Self {
10411            Self {
10412                iterator: fidl::new_empty!(
10413                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>>,
10414                    fidl::encoding::DefaultFuchsiaResourceDialect
10415                ),
10416            }
10417        }
10418
10419        #[inline]
10420        unsafe fn decode(
10421            &mut self,
10422            decoder: &mut fidl::encoding::Decoder<
10423                '_,
10424                fidl::encoding::DefaultFuchsiaResourceDialect,
10425            >,
10426            offset: usize,
10427            _depth: fidl::encoding::Depth,
10428        ) -> fidl::Result<()> {
10429            decoder.debug_check_bounds::<Self>(offset);
10430            // Verify that padding bytes are zero.
10431            fidl::decode!(
10432                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BlobInfoIteratorMarker>>,
10433                fidl::encoding::DefaultFuchsiaResourceDialect,
10434                &mut self.iterator,
10435                decoder,
10436                offset + 0,
10437                _depth
10438            )?;
10439            Ok(())
10440        }
10441    }
10442
10443    impl fidl::encoding::ValueTypeMarker for NeededBlobsOpenBlobRequest {
10444        type Borrowed<'a> = &'a Self;
10445        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10446            value
10447        }
10448    }
10449
10450    unsafe impl fidl::encoding::TypeMarker for NeededBlobsOpenBlobRequest {
10451        type Owned = Self;
10452
10453        #[inline(always)]
10454        fn inline_align(_context: fidl::encoding::Context) -> usize {
10455            1
10456        }
10457
10458        #[inline(always)]
10459        fn inline_size(_context: fidl::encoding::Context) -> usize {
10460            32
10461        }
10462        #[inline(always)]
10463        fn encode_is_copy() -> bool {
10464            true
10465        }
10466
10467        #[inline(always)]
10468        fn decode_is_copy() -> bool {
10469            true
10470        }
10471    }
10472
10473    unsafe impl<D: fidl::encoding::ResourceDialect>
10474        fidl::encoding::Encode<NeededBlobsOpenBlobRequest, D> for &NeededBlobsOpenBlobRequest
10475    {
10476        #[inline]
10477        unsafe fn encode(
10478            self,
10479            encoder: &mut fidl::encoding::Encoder<'_, D>,
10480            offset: usize,
10481            _depth: fidl::encoding::Depth,
10482        ) -> fidl::Result<()> {
10483            encoder.debug_check_bounds::<NeededBlobsOpenBlobRequest>(offset);
10484            unsafe {
10485                // Copy the object into the buffer.
10486                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
10487                (buf_ptr as *mut NeededBlobsOpenBlobRequest)
10488                    .write_unaligned((self as *const NeededBlobsOpenBlobRequest).read());
10489                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
10490                // done second because the memcpy will write garbage to these bytes.
10491            }
10492            Ok(())
10493        }
10494    }
10495    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlobId, D>>
10496        fidl::encoding::Encode<NeededBlobsOpenBlobRequest, D> for (T0,)
10497    {
10498        #[inline]
10499        unsafe fn encode(
10500            self,
10501            encoder: &mut fidl::encoding::Encoder<'_, D>,
10502            offset: usize,
10503            depth: fidl::encoding::Depth,
10504        ) -> fidl::Result<()> {
10505            encoder.debug_check_bounds::<NeededBlobsOpenBlobRequest>(offset);
10506            // Zero out padding regions. There's no need to apply masks
10507            // because the unmasked parts will be overwritten by fields.
10508            // Write the fields.
10509            self.0.encode(encoder, offset + 0, depth)?;
10510            Ok(())
10511        }
10512    }
10513
10514    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10515        for NeededBlobsOpenBlobRequest
10516    {
10517        #[inline(always)]
10518        fn new_empty() -> Self {
10519            Self { blob_id: fidl::new_empty!(BlobId, D) }
10520        }
10521
10522        #[inline]
10523        unsafe fn decode(
10524            &mut self,
10525            decoder: &mut fidl::encoding::Decoder<'_, D>,
10526            offset: usize,
10527            _depth: fidl::encoding::Depth,
10528        ) -> fidl::Result<()> {
10529            decoder.debug_check_bounds::<Self>(offset);
10530            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
10531            // Verify that padding bytes are zero.
10532            // Copy from the buffer into the object.
10533            unsafe {
10534                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
10535            }
10536            Ok(())
10537        }
10538    }
10539
10540    impl fidl::encoding::ResourceTypeMarker for NeededBlobsOpenBlobResponse {
10541        type Borrowed<'a> = &'a mut Self;
10542        fn take_or_borrow<'a>(
10543            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10544        ) -> Self::Borrowed<'a> {
10545            value
10546        }
10547    }
10548
10549    unsafe impl fidl::encoding::TypeMarker for NeededBlobsOpenBlobResponse {
10550        type Owned = Self;
10551
10552        #[inline(always)]
10553        fn inline_align(_context: fidl::encoding::Context) -> usize {
10554            8
10555        }
10556
10557        #[inline(always)]
10558        fn inline_size(_context: fidl::encoding::Context) -> usize {
10559            16
10560        }
10561    }
10562
10563    unsafe impl
10564        fidl::encoding::Encode<
10565            NeededBlobsOpenBlobResponse,
10566            fidl::encoding::DefaultFuchsiaResourceDialect,
10567        > for &mut NeededBlobsOpenBlobResponse
10568    {
10569        #[inline]
10570        unsafe fn encode(
10571            self,
10572            encoder: &mut fidl::encoding::Encoder<
10573                '_,
10574                fidl::encoding::DefaultFuchsiaResourceDialect,
10575            >,
10576            offset: usize,
10577            _depth: fidl::encoding::Depth,
10578        ) -> fidl::Result<()> {
10579            encoder.debug_check_bounds::<NeededBlobsOpenBlobResponse>(offset);
10580            // Delegate to tuple encoding.
10581            fidl::encoding::Encode::<NeededBlobsOpenBlobResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10582                (
10583                    <fidl::encoding::OptionalUnion<BlobWriter> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
10584                ),
10585                encoder, offset, _depth
10586            )
10587        }
10588    }
10589    unsafe impl<
10590            T0: fidl::encoding::Encode<
10591                fidl::encoding::OptionalUnion<BlobWriter>,
10592                fidl::encoding::DefaultFuchsiaResourceDialect,
10593            >,
10594        >
10595        fidl::encoding::Encode<
10596            NeededBlobsOpenBlobResponse,
10597            fidl::encoding::DefaultFuchsiaResourceDialect,
10598        > for (T0,)
10599    {
10600        #[inline]
10601        unsafe fn encode(
10602            self,
10603            encoder: &mut fidl::encoding::Encoder<
10604                '_,
10605                fidl::encoding::DefaultFuchsiaResourceDialect,
10606            >,
10607            offset: usize,
10608            depth: fidl::encoding::Depth,
10609        ) -> fidl::Result<()> {
10610            encoder.debug_check_bounds::<NeededBlobsOpenBlobResponse>(offset);
10611            // Zero out padding regions. There's no need to apply masks
10612            // because the unmasked parts will be overwritten by fields.
10613            // Write the fields.
10614            self.0.encode(encoder, offset + 0, depth)?;
10615            Ok(())
10616        }
10617    }
10618
10619    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10620        for NeededBlobsOpenBlobResponse
10621    {
10622        #[inline(always)]
10623        fn new_empty() -> Self {
10624            Self {
10625                writer: fidl::new_empty!(
10626                    fidl::encoding::OptionalUnion<BlobWriter>,
10627                    fidl::encoding::DefaultFuchsiaResourceDialect
10628                ),
10629            }
10630        }
10631
10632        #[inline]
10633        unsafe fn decode(
10634            &mut self,
10635            decoder: &mut fidl::encoding::Decoder<
10636                '_,
10637                fidl::encoding::DefaultFuchsiaResourceDialect,
10638            >,
10639            offset: usize,
10640            _depth: fidl::encoding::Depth,
10641        ) -> fidl::Result<()> {
10642            decoder.debug_check_bounds::<Self>(offset);
10643            // Verify that padding bytes are zero.
10644            fidl::decode!(
10645                fidl::encoding::OptionalUnion<BlobWriter>,
10646                fidl::encoding::DefaultFuchsiaResourceDialect,
10647                &mut self.writer,
10648                decoder,
10649                offset + 0,
10650                _depth
10651            )?;
10652            Ok(())
10653        }
10654    }
10655
10656    impl fidl::encoding::ResourceTypeMarker for NeededBlobsOpenMetaBlobResponse {
10657        type Borrowed<'a> = &'a mut Self;
10658        fn take_or_borrow<'a>(
10659            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10660        ) -> Self::Borrowed<'a> {
10661            value
10662        }
10663    }
10664
10665    unsafe impl fidl::encoding::TypeMarker for NeededBlobsOpenMetaBlobResponse {
10666        type Owned = Self;
10667
10668        #[inline(always)]
10669        fn inline_align(_context: fidl::encoding::Context) -> usize {
10670            8
10671        }
10672
10673        #[inline(always)]
10674        fn inline_size(_context: fidl::encoding::Context) -> usize {
10675            16
10676        }
10677    }
10678
10679    unsafe impl
10680        fidl::encoding::Encode<
10681            NeededBlobsOpenMetaBlobResponse,
10682            fidl::encoding::DefaultFuchsiaResourceDialect,
10683        > for &mut NeededBlobsOpenMetaBlobResponse
10684    {
10685        #[inline]
10686        unsafe fn encode(
10687            self,
10688            encoder: &mut fidl::encoding::Encoder<
10689                '_,
10690                fidl::encoding::DefaultFuchsiaResourceDialect,
10691            >,
10692            offset: usize,
10693            _depth: fidl::encoding::Depth,
10694        ) -> fidl::Result<()> {
10695            encoder.debug_check_bounds::<NeededBlobsOpenMetaBlobResponse>(offset);
10696            // Delegate to tuple encoding.
10697            fidl::encoding::Encode::<NeededBlobsOpenMetaBlobResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10698                (
10699                    <fidl::encoding::OptionalUnion<BlobWriter> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
10700                ),
10701                encoder, offset, _depth
10702            )
10703        }
10704    }
10705    unsafe impl<
10706            T0: fidl::encoding::Encode<
10707                fidl::encoding::OptionalUnion<BlobWriter>,
10708                fidl::encoding::DefaultFuchsiaResourceDialect,
10709            >,
10710        >
10711        fidl::encoding::Encode<
10712            NeededBlobsOpenMetaBlobResponse,
10713            fidl::encoding::DefaultFuchsiaResourceDialect,
10714        > for (T0,)
10715    {
10716        #[inline]
10717        unsafe fn encode(
10718            self,
10719            encoder: &mut fidl::encoding::Encoder<
10720                '_,
10721                fidl::encoding::DefaultFuchsiaResourceDialect,
10722            >,
10723            offset: usize,
10724            depth: fidl::encoding::Depth,
10725        ) -> fidl::Result<()> {
10726            encoder.debug_check_bounds::<NeededBlobsOpenMetaBlobResponse>(offset);
10727            // Zero out padding regions. There's no need to apply masks
10728            // because the unmasked parts will be overwritten by fields.
10729            // Write the fields.
10730            self.0.encode(encoder, offset + 0, depth)?;
10731            Ok(())
10732        }
10733    }
10734
10735    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10736        for NeededBlobsOpenMetaBlobResponse
10737    {
10738        #[inline(always)]
10739        fn new_empty() -> Self {
10740            Self {
10741                writer: fidl::new_empty!(
10742                    fidl::encoding::OptionalUnion<BlobWriter>,
10743                    fidl::encoding::DefaultFuchsiaResourceDialect
10744                ),
10745            }
10746        }
10747
10748        #[inline]
10749        unsafe fn decode(
10750            &mut self,
10751            decoder: &mut fidl::encoding::Decoder<
10752                '_,
10753                fidl::encoding::DefaultFuchsiaResourceDialect,
10754            >,
10755            offset: usize,
10756            _depth: fidl::encoding::Depth,
10757        ) -> fidl::Result<()> {
10758            decoder.debug_check_bounds::<Self>(offset);
10759            // Verify that padding bytes are zero.
10760            fidl::decode!(
10761                fidl::encoding::OptionalUnion<BlobWriter>,
10762                fidl::encoding::DefaultFuchsiaResourceDialect,
10763                &mut self.writer,
10764                decoder,
10765                offset + 0,
10766                _depth
10767            )?;
10768            Ok(())
10769        }
10770    }
10771
10772    impl fidl::encoding::ResourceTypeMarker for PackageCacheBasePackageIndexRequest {
10773        type Borrowed<'a> = &'a mut Self;
10774        fn take_or_borrow<'a>(
10775            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10776        ) -> Self::Borrowed<'a> {
10777            value
10778        }
10779    }
10780
10781    unsafe impl fidl::encoding::TypeMarker for PackageCacheBasePackageIndexRequest {
10782        type Owned = Self;
10783
10784        #[inline(always)]
10785        fn inline_align(_context: fidl::encoding::Context) -> usize {
10786            4
10787        }
10788
10789        #[inline(always)]
10790        fn inline_size(_context: fidl::encoding::Context) -> usize {
10791            4
10792        }
10793    }
10794
10795    unsafe impl
10796        fidl::encoding::Encode<
10797            PackageCacheBasePackageIndexRequest,
10798            fidl::encoding::DefaultFuchsiaResourceDialect,
10799        > for &mut PackageCacheBasePackageIndexRequest
10800    {
10801        #[inline]
10802        unsafe fn encode(
10803            self,
10804            encoder: &mut fidl::encoding::Encoder<
10805                '_,
10806                fidl::encoding::DefaultFuchsiaResourceDialect,
10807            >,
10808            offset: usize,
10809            _depth: fidl::encoding::Depth,
10810        ) -> fidl::Result<()> {
10811            encoder.debug_check_bounds::<PackageCacheBasePackageIndexRequest>(offset);
10812            // Delegate to tuple encoding.
10813            fidl::encoding::Encode::<
10814                PackageCacheBasePackageIndexRequest,
10815                fidl::encoding::DefaultFuchsiaResourceDialect,
10816            >::encode(
10817                (
10818                    <fidl::encoding::Endpoint<
10819                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
10820                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10821                        &mut self.iterator
10822                    ),
10823                ),
10824                encoder,
10825                offset,
10826                _depth,
10827            )
10828        }
10829    }
10830    unsafe impl<
10831            T0: fidl::encoding::Encode<
10832                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
10833                fidl::encoding::DefaultFuchsiaResourceDialect,
10834            >,
10835        >
10836        fidl::encoding::Encode<
10837            PackageCacheBasePackageIndexRequest,
10838            fidl::encoding::DefaultFuchsiaResourceDialect,
10839        > for (T0,)
10840    {
10841        #[inline]
10842        unsafe fn encode(
10843            self,
10844            encoder: &mut fidl::encoding::Encoder<
10845                '_,
10846                fidl::encoding::DefaultFuchsiaResourceDialect,
10847            >,
10848            offset: usize,
10849            depth: fidl::encoding::Depth,
10850        ) -> fidl::Result<()> {
10851            encoder.debug_check_bounds::<PackageCacheBasePackageIndexRequest>(offset);
10852            // Zero out padding regions. There's no need to apply masks
10853            // because the unmasked parts will be overwritten by fields.
10854            // Write the fields.
10855            self.0.encode(encoder, offset + 0, depth)?;
10856            Ok(())
10857        }
10858    }
10859
10860    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10861        for PackageCacheBasePackageIndexRequest
10862    {
10863        #[inline(always)]
10864        fn new_empty() -> Self {
10865            Self {
10866                iterator: fidl::new_empty!(
10867                    fidl::encoding::Endpoint<
10868                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
10869                    >,
10870                    fidl::encoding::DefaultFuchsiaResourceDialect
10871                ),
10872            }
10873        }
10874
10875        #[inline]
10876        unsafe fn decode(
10877            &mut self,
10878            decoder: &mut fidl::encoding::Decoder<
10879                '_,
10880                fidl::encoding::DefaultFuchsiaResourceDialect,
10881            >,
10882            offset: usize,
10883            _depth: fidl::encoding::Depth,
10884        ) -> fidl::Result<()> {
10885            decoder.debug_check_bounds::<Self>(offset);
10886            // Verify that padding bytes are zero.
10887            fidl::decode!(
10888                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
10889                fidl::encoding::DefaultFuchsiaResourceDialect,
10890                &mut self.iterator,
10891                decoder,
10892                offset + 0,
10893                _depth
10894            )?;
10895            Ok(())
10896        }
10897    }
10898
10899    impl fidl::encoding::ResourceTypeMarker for PackageCacheCachePackageIndexRequest {
10900        type Borrowed<'a> = &'a mut Self;
10901        fn take_or_borrow<'a>(
10902            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10903        ) -> Self::Borrowed<'a> {
10904            value
10905        }
10906    }
10907
10908    unsafe impl fidl::encoding::TypeMarker for PackageCacheCachePackageIndexRequest {
10909        type Owned = Self;
10910
10911        #[inline(always)]
10912        fn inline_align(_context: fidl::encoding::Context) -> usize {
10913            4
10914        }
10915
10916        #[inline(always)]
10917        fn inline_size(_context: fidl::encoding::Context) -> usize {
10918            4
10919        }
10920    }
10921
10922    unsafe impl
10923        fidl::encoding::Encode<
10924            PackageCacheCachePackageIndexRequest,
10925            fidl::encoding::DefaultFuchsiaResourceDialect,
10926        > for &mut PackageCacheCachePackageIndexRequest
10927    {
10928        #[inline]
10929        unsafe fn encode(
10930            self,
10931            encoder: &mut fidl::encoding::Encoder<
10932                '_,
10933                fidl::encoding::DefaultFuchsiaResourceDialect,
10934            >,
10935            offset: usize,
10936            _depth: fidl::encoding::Depth,
10937        ) -> fidl::Result<()> {
10938            encoder.debug_check_bounds::<PackageCacheCachePackageIndexRequest>(offset);
10939            // Delegate to tuple encoding.
10940            fidl::encoding::Encode::<
10941                PackageCacheCachePackageIndexRequest,
10942                fidl::encoding::DefaultFuchsiaResourceDialect,
10943            >::encode(
10944                (
10945                    <fidl::encoding::Endpoint<
10946                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
10947                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10948                        &mut self.iterator
10949                    ),
10950                ),
10951                encoder,
10952                offset,
10953                _depth,
10954            )
10955        }
10956    }
10957    unsafe impl<
10958            T0: fidl::encoding::Encode<
10959                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
10960                fidl::encoding::DefaultFuchsiaResourceDialect,
10961            >,
10962        >
10963        fidl::encoding::Encode<
10964            PackageCacheCachePackageIndexRequest,
10965            fidl::encoding::DefaultFuchsiaResourceDialect,
10966        > for (T0,)
10967    {
10968        #[inline]
10969        unsafe fn encode(
10970            self,
10971            encoder: &mut fidl::encoding::Encoder<
10972                '_,
10973                fidl::encoding::DefaultFuchsiaResourceDialect,
10974            >,
10975            offset: usize,
10976            depth: fidl::encoding::Depth,
10977        ) -> fidl::Result<()> {
10978            encoder.debug_check_bounds::<PackageCacheCachePackageIndexRequest>(offset);
10979            // Zero out padding regions. There's no need to apply masks
10980            // because the unmasked parts will be overwritten by fields.
10981            // Write the fields.
10982            self.0.encode(encoder, offset + 0, depth)?;
10983            Ok(())
10984        }
10985    }
10986
10987    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10988        for PackageCacheCachePackageIndexRequest
10989    {
10990        #[inline(always)]
10991        fn new_empty() -> Self {
10992            Self {
10993                iterator: fidl::new_empty!(
10994                    fidl::encoding::Endpoint<
10995                        fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>,
10996                    >,
10997                    fidl::encoding::DefaultFuchsiaResourceDialect
10998                ),
10999            }
11000        }
11001
11002        #[inline]
11003        unsafe fn decode(
11004            &mut self,
11005            decoder: &mut fidl::encoding::Decoder<
11006                '_,
11007                fidl::encoding::DefaultFuchsiaResourceDialect,
11008            >,
11009            offset: usize,
11010            _depth: fidl::encoding::Depth,
11011        ) -> fidl::Result<()> {
11012            decoder.debug_check_bounds::<Self>(offset);
11013            // Verify that padding bytes are zero.
11014            fidl::decode!(
11015                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PackageIndexIteratorMarker>>,
11016                fidl::encoding::DefaultFuchsiaResourceDialect,
11017                &mut self.iterator,
11018                decoder,
11019                offset + 0,
11020                _depth
11021            )?;
11022            Ok(())
11023        }
11024    }
11025
11026    impl fidl::encoding::ResourceTypeMarker for PackageCacheGetRequest {
11027        type Borrowed<'a> = &'a mut Self;
11028        fn take_or_borrow<'a>(
11029            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11030        ) -> Self::Borrowed<'a> {
11031            value
11032        }
11033    }
11034
11035    unsafe impl fidl::encoding::TypeMarker for PackageCacheGetRequest {
11036        type Owned = Self;
11037
11038        #[inline(always)]
11039        fn inline_align(_context: fidl::encoding::Context) -> usize {
11040            8
11041        }
11042
11043        #[inline(always)]
11044        fn inline_size(_context: fidl::encoding::Context) -> usize {
11045            56
11046        }
11047    }
11048
11049    unsafe impl
11050        fidl::encoding::Encode<
11051            PackageCacheGetRequest,
11052            fidl::encoding::DefaultFuchsiaResourceDialect,
11053        > for &mut PackageCacheGetRequest
11054    {
11055        #[inline]
11056        unsafe fn encode(
11057            self,
11058            encoder: &mut fidl::encoding::Encoder<
11059                '_,
11060                fidl::encoding::DefaultFuchsiaResourceDialect,
11061            >,
11062            offset: usize,
11063            _depth: fidl::encoding::Depth,
11064        ) -> fidl::Result<()> {
11065            encoder.debug_check_bounds::<PackageCacheGetRequest>(offset);
11066            // Delegate to tuple encoding.
11067            fidl::encoding::Encode::<PackageCacheGetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11068                (
11069                    <BlobInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.meta_far_blob),
11070                    <GcProtection as fidl::encoding::ValueTypeMarker>::borrow(&self.gc_protection),
11071                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.needed_blobs),
11072                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dir),
11073                ),
11074                encoder, offset, _depth
11075            )
11076        }
11077    }
11078    unsafe impl<
11079            T0: fidl::encoding::Encode<BlobInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
11080            T1: fidl::encoding::Encode<GcProtection, fidl::encoding::DefaultFuchsiaResourceDialect>,
11081            T2: fidl::encoding::Encode<
11082                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
11083                fidl::encoding::DefaultFuchsiaResourceDialect,
11084            >,
11085            T3: fidl::encoding::Encode<
11086                fidl::encoding::Endpoint<
11087                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11088                >,
11089                fidl::encoding::DefaultFuchsiaResourceDialect,
11090            >,
11091        >
11092        fidl::encoding::Encode<
11093            PackageCacheGetRequest,
11094            fidl::encoding::DefaultFuchsiaResourceDialect,
11095        > for (T0, T1, T2, T3)
11096    {
11097        #[inline]
11098        unsafe fn encode(
11099            self,
11100            encoder: &mut fidl::encoding::Encoder<
11101                '_,
11102                fidl::encoding::DefaultFuchsiaResourceDialect,
11103            >,
11104            offset: usize,
11105            depth: fidl::encoding::Depth,
11106        ) -> fidl::Result<()> {
11107            encoder.debug_check_bounds::<PackageCacheGetRequest>(offset);
11108            // Zero out padding regions. There's no need to apply masks
11109            // because the unmasked parts will be overwritten by fields.
11110            unsafe {
11111                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
11112                (ptr as *mut u64).write_unaligned(0);
11113            }
11114            // Write the fields.
11115            self.0.encode(encoder, offset + 0, depth)?;
11116            self.1.encode(encoder, offset + 40, depth)?;
11117            self.2.encode(encoder, offset + 44, depth)?;
11118            self.3.encode(encoder, offset + 48, depth)?;
11119            Ok(())
11120        }
11121    }
11122
11123    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11124        for PackageCacheGetRequest
11125    {
11126        #[inline(always)]
11127        fn new_empty() -> Self {
11128            Self {
11129                meta_far_blob: fidl::new_empty!(
11130                    BlobInfo,
11131                    fidl::encoding::DefaultFuchsiaResourceDialect
11132                ),
11133                gc_protection: fidl::new_empty!(
11134                    GcProtection,
11135                    fidl::encoding::DefaultFuchsiaResourceDialect
11136                ),
11137                needed_blobs: fidl::new_empty!(
11138                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
11139                    fidl::encoding::DefaultFuchsiaResourceDialect
11140                ),
11141                dir: fidl::new_empty!(
11142                    fidl::encoding::Endpoint<
11143                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11144                    >,
11145                    fidl::encoding::DefaultFuchsiaResourceDialect
11146                ),
11147            }
11148        }
11149
11150        #[inline]
11151        unsafe fn decode(
11152            &mut self,
11153            decoder: &mut fidl::encoding::Decoder<
11154                '_,
11155                fidl::encoding::DefaultFuchsiaResourceDialect,
11156            >,
11157            offset: usize,
11158            _depth: fidl::encoding::Depth,
11159        ) -> fidl::Result<()> {
11160            decoder.debug_check_bounds::<Self>(offset);
11161            // Verify that padding bytes are zero.
11162            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
11163            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11164            let mask = 0xffffffff00000000u64;
11165            let maskedval = padval & mask;
11166            if maskedval != 0 {
11167                return Err(fidl::Error::NonZeroPadding {
11168                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
11169                });
11170            }
11171            fidl::decode!(
11172                BlobInfo,
11173                fidl::encoding::DefaultFuchsiaResourceDialect,
11174                &mut self.meta_far_blob,
11175                decoder,
11176                offset + 0,
11177                _depth
11178            )?;
11179            fidl::decode!(
11180                GcProtection,
11181                fidl::encoding::DefaultFuchsiaResourceDialect,
11182                &mut self.gc_protection,
11183                decoder,
11184                offset + 40,
11185                _depth
11186            )?;
11187            fidl::decode!(
11188                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NeededBlobsMarker>>,
11189                fidl::encoding::DefaultFuchsiaResourceDialect,
11190                &mut self.needed_blobs,
11191                decoder,
11192                offset + 44,
11193                _depth
11194            )?;
11195            fidl::decode!(
11196                fidl::encoding::Endpoint<
11197                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11198                >,
11199                fidl::encoding::DefaultFuchsiaResourceDialect,
11200                &mut self.dir,
11201                decoder,
11202                offset + 48,
11203                _depth
11204            )?;
11205            Ok(())
11206        }
11207    }
11208
11209    impl fidl::encoding::ResourceTypeMarker for PackageCacheGetSubpackageRequest {
11210        type Borrowed<'a> = &'a mut Self;
11211        fn take_or_borrow<'a>(
11212            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11213        ) -> Self::Borrowed<'a> {
11214            value
11215        }
11216    }
11217
11218    unsafe impl fidl::encoding::TypeMarker for PackageCacheGetSubpackageRequest {
11219        type Owned = Self;
11220
11221        #[inline(always)]
11222        fn inline_align(_context: fidl::encoding::Context) -> usize {
11223            8
11224        }
11225
11226        #[inline(always)]
11227        fn inline_size(_context: fidl::encoding::Context) -> usize {
11228            56
11229        }
11230    }
11231
11232    unsafe impl
11233        fidl::encoding::Encode<
11234            PackageCacheGetSubpackageRequest,
11235            fidl::encoding::DefaultFuchsiaResourceDialect,
11236        > for &mut PackageCacheGetSubpackageRequest
11237    {
11238        #[inline]
11239        unsafe fn encode(
11240            self,
11241            encoder: &mut fidl::encoding::Encoder<
11242                '_,
11243                fidl::encoding::DefaultFuchsiaResourceDialect,
11244            >,
11245            offset: usize,
11246            _depth: fidl::encoding::Depth,
11247        ) -> fidl::Result<()> {
11248            encoder.debug_check_bounds::<PackageCacheGetSubpackageRequest>(offset);
11249            // Delegate to tuple encoding.
11250            fidl::encoding::Encode::<
11251                PackageCacheGetSubpackageRequest,
11252                fidl::encoding::DefaultFuchsiaResourceDialect,
11253            >::encode(
11254                (
11255                    <BlobId as fidl::encoding::ValueTypeMarker>::borrow(&self.superpackage),
11256                    <PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.subpackage),
11257                    <fidl::encoding::Endpoint<
11258                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11259                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11260                        &mut self.dir
11261                    ),
11262                ),
11263                encoder,
11264                offset,
11265                _depth,
11266            )
11267        }
11268    }
11269    unsafe impl<
11270            T0: fidl::encoding::Encode<BlobId, fidl::encoding::DefaultFuchsiaResourceDialect>,
11271            T1: fidl::encoding::Encode<PackageUrl, fidl::encoding::DefaultFuchsiaResourceDialect>,
11272            T2: fidl::encoding::Encode<
11273                fidl::encoding::Endpoint<
11274                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11275                >,
11276                fidl::encoding::DefaultFuchsiaResourceDialect,
11277            >,
11278        >
11279        fidl::encoding::Encode<
11280            PackageCacheGetSubpackageRequest,
11281            fidl::encoding::DefaultFuchsiaResourceDialect,
11282        > for (T0, T1, T2)
11283    {
11284        #[inline]
11285        unsafe fn encode(
11286            self,
11287            encoder: &mut fidl::encoding::Encoder<
11288                '_,
11289                fidl::encoding::DefaultFuchsiaResourceDialect,
11290            >,
11291            offset: usize,
11292            depth: fidl::encoding::Depth,
11293        ) -> fidl::Result<()> {
11294            encoder.debug_check_bounds::<PackageCacheGetSubpackageRequest>(offset);
11295            // Zero out padding regions. There's no need to apply masks
11296            // because the unmasked parts will be overwritten by fields.
11297            unsafe {
11298                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
11299                (ptr as *mut u64).write_unaligned(0);
11300            }
11301            // Write the fields.
11302            self.0.encode(encoder, offset + 0, depth)?;
11303            self.1.encode(encoder, offset + 32, depth)?;
11304            self.2.encode(encoder, offset + 48, depth)?;
11305            Ok(())
11306        }
11307    }
11308
11309    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11310        for PackageCacheGetSubpackageRequest
11311    {
11312        #[inline(always)]
11313        fn new_empty() -> Self {
11314            Self {
11315                superpackage: fidl::new_empty!(
11316                    BlobId,
11317                    fidl::encoding::DefaultFuchsiaResourceDialect
11318                ),
11319                subpackage: fidl::new_empty!(
11320                    PackageUrl,
11321                    fidl::encoding::DefaultFuchsiaResourceDialect
11322                ),
11323                dir: fidl::new_empty!(
11324                    fidl::encoding::Endpoint<
11325                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11326                    >,
11327                    fidl::encoding::DefaultFuchsiaResourceDialect
11328                ),
11329            }
11330        }
11331
11332        #[inline]
11333        unsafe fn decode(
11334            &mut self,
11335            decoder: &mut fidl::encoding::Decoder<
11336                '_,
11337                fidl::encoding::DefaultFuchsiaResourceDialect,
11338            >,
11339            offset: usize,
11340            _depth: fidl::encoding::Depth,
11341        ) -> fidl::Result<()> {
11342            decoder.debug_check_bounds::<Self>(offset);
11343            // Verify that padding bytes are zero.
11344            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
11345            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11346            let mask = 0xffffffff00000000u64;
11347            let maskedval = padval & mask;
11348            if maskedval != 0 {
11349                return Err(fidl::Error::NonZeroPadding {
11350                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
11351                });
11352            }
11353            fidl::decode!(
11354                BlobId,
11355                fidl::encoding::DefaultFuchsiaResourceDialect,
11356                &mut self.superpackage,
11357                decoder,
11358                offset + 0,
11359                _depth
11360            )?;
11361            fidl::decode!(
11362                PackageUrl,
11363                fidl::encoding::DefaultFuchsiaResourceDialect,
11364                &mut self.subpackage,
11365                decoder,
11366                offset + 32,
11367                _depth
11368            )?;
11369            fidl::decode!(
11370                fidl::encoding::Endpoint<
11371                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11372                >,
11373                fidl::encoding::DefaultFuchsiaResourceDialect,
11374                &mut self.dir,
11375                decoder,
11376                offset + 48,
11377                _depth
11378            )?;
11379            Ok(())
11380        }
11381    }
11382
11383    impl fidl::encoding::ValueTypeMarker for PackageCacheSetUpgradableUrlsRequest {
11384        type Borrowed<'a> = &'a Self;
11385        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11386            value
11387        }
11388    }
11389
11390    unsafe impl fidl::encoding::TypeMarker for PackageCacheSetUpgradableUrlsRequest {
11391        type Owned = Self;
11392
11393        #[inline(always)]
11394        fn inline_align(_context: fidl::encoding::Context) -> usize {
11395            8
11396        }
11397
11398        #[inline(always)]
11399        fn inline_size(_context: fidl::encoding::Context) -> usize {
11400            16
11401        }
11402    }
11403
11404    unsafe impl<D: fidl::encoding::ResourceDialect>
11405        fidl::encoding::Encode<PackageCacheSetUpgradableUrlsRequest, D>
11406        for &PackageCacheSetUpgradableUrlsRequest
11407    {
11408        #[inline]
11409        unsafe fn encode(
11410            self,
11411            encoder: &mut fidl::encoding::Encoder<'_, D>,
11412            offset: usize,
11413            _depth: fidl::encoding::Depth,
11414        ) -> fidl::Result<()> {
11415            encoder.debug_check_bounds::<PackageCacheSetUpgradableUrlsRequest>(offset);
11416            // Delegate to tuple encoding.
11417            fidl::encoding::Encode::<PackageCacheSetUpgradableUrlsRequest, D>::encode(
11418                (
11419                    <fidl::encoding::UnboundedVector<PackageUrl> as fidl::encoding::ValueTypeMarker>::borrow(&self.pinned_urls),
11420                ),
11421                encoder, offset, _depth
11422            )
11423        }
11424    }
11425    unsafe impl<
11426            D: fidl::encoding::ResourceDialect,
11427            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<PackageUrl>, D>,
11428        > fidl::encoding::Encode<PackageCacheSetUpgradableUrlsRequest, D> for (T0,)
11429    {
11430        #[inline]
11431        unsafe fn encode(
11432            self,
11433            encoder: &mut fidl::encoding::Encoder<'_, D>,
11434            offset: usize,
11435            depth: fidl::encoding::Depth,
11436        ) -> fidl::Result<()> {
11437            encoder.debug_check_bounds::<PackageCacheSetUpgradableUrlsRequest>(offset);
11438            // Zero out padding regions. There's no need to apply masks
11439            // because the unmasked parts will be overwritten by fields.
11440            // Write the fields.
11441            self.0.encode(encoder, offset + 0, depth)?;
11442            Ok(())
11443        }
11444    }
11445
11446    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11447        for PackageCacheSetUpgradableUrlsRequest
11448    {
11449        #[inline(always)]
11450        fn new_empty() -> Self {
11451            Self { pinned_urls: fidl::new_empty!(fidl::encoding::UnboundedVector<PackageUrl>, D) }
11452        }
11453
11454        #[inline]
11455        unsafe fn decode(
11456            &mut self,
11457            decoder: &mut fidl::encoding::Decoder<'_, D>,
11458            offset: usize,
11459            _depth: fidl::encoding::Depth,
11460        ) -> fidl::Result<()> {
11461            decoder.debug_check_bounds::<Self>(offset);
11462            // Verify that padding bytes are zero.
11463            fidl::decode!(
11464                fidl::encoding::UnboundedVector<PackageUrl>,
11465                D,
11466                &mut self.pinned_urls,
11467                decoder,
11468                offset + 0,
11469                _depth
11470            )?;
11471            Ok(())
11472        }
11473    }
11474
11475    impl fidl::encoding::ValueTypeMarker for PackageIndexEntry {
11476        type Borrowed<'a> = &'a Self;
11477        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11478            value
11479        }
11480    }
11481
11482    unsafe impl fidl::encoding::TypeMarker for PackageIndexEntry {
11483        type Owned = Self;
11484
11485        #[inline(always)]
11486        fn inline_align(_context: fidl::encoding::Context) -> usize {
11487            8
11488        }
11489
11490        #[inline(always)]
11491        fn inline_size(_context: fidl::encoding::Context) -> usize {
11492            48
11493        }
11494    }
11495
11496    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PackageIndexEntry, D>
11497        for &PackageIndexEntry
11498    {
11499        #[inline]
11500        unsafe fn encode(
11501            self,
11502            encoder: &mut fidl::encoding::Encoder<'_, D>,
11503            offset: usize,
11504            _depth: fidl::encoding::Depth,
11505        ) -> fidl::Result<()> {
11506            encoder.debug_check_bounds::<PackageIndexEntry>(offset);
11507            // Delegate to tuple encoding.
11508            fidl::encoding::Encode::<PackageIndexEntry, D>::encode(
11509                (
11510                    <PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.package_url),
11511                    <BlobId as fidl::encoding::ValueTypeMarker>::borrow(&self.meta_far_blob_id),
11512                ),
11513                encoder,
11514                offset,
11515                _depth,
11516            )
11517        }
11518    }
11519    unsafe impl<
11520            D: fidl::encoding::ResourceDialect,
11521            T0: fidl::encoding::Encode<PackageUrl, D>,
11522            T1: fidl::encoding::Encode<BlobId, D>,
11523        > fidl::encoding::Encode<PackageIndexEntry, D> for (T0, T1)
11524    {
11525        #[inline]
11526        unsafe fn encode(
11527            self,
11528            encoder: &mut fidl::encoding::Encoder<'_, D>,
11529            offset: usize,
11530            depth: fidl::encoding::Depth,
11531        ) -> fidl::Result<()> {
11532            encoder.debug_check_bounds::<PackageIndexEntry>(offset);
11533            // Zero out padding regions. There's no need to apply masks
11534            // because the unmasked parts will be overwritten by fields.
11535            // Write the fields.
11536            self.0.encode(encoder, offset + 0, depth)?;
11537            self.1.encode(encoder, offset + 16, depth)?;
11538            Ok(())
11539        }
11540    }
11541
11542    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PackageIndexEntry {
11543        #[inline(always)]
11544        fn new_empty() -> Self {
11545            Self {
11546                package_url: fidl::new_empty!(PackageUrl, D),
11547                meta_far_blob_id: fidl::new_empty!(BlobId, D),
11548            }
11549        }
11550
11551        #[inline]
11552        unsafe fn decode(
11553            &mut self,
11554            decoder: &mut fidl::encoding::Decoder<'_, D>,
11555            offset: usize,
11556            _depth: fidl::encoding::Depth,
11557        ) -> fidl::Result<()> {
11558            decoder.debug_check_bounds::<Self>(offset);
11559            // Verify that padding bytes are zero.
11560            fidl::decode!(PackageUrl, D, &mut self.package_url, decoder, offset + 0, _depth)?;
11561            fidl::decode!(BlobId, D, &mut self.meta_far_blob_id, decoder, offset + 16, _depth)?;
11562            Ok(())
11563        }
11564    }
11565
11566    impl fidl::encoding::ValueTypeMarker for PackageIndexIteratorNextResponse {
11567        type Borrowed<'a> = &'a Self;
11568        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11569            value
11570        }
11571    }
11572
11573    unsafe impl fidl::encoding::TypeMarker for PackageIndexIteratorNextResponse {
11574        type Owned = Self;
11575
11576        #[inline(always)]
11577        fn inline_align(_context: fidl::encoding::Context) -> usize {
11578            8
11579        }
11580
11581        #[inline(always)]
11582        fn inline_size(_context: fidl::encoding::Context) -> usize {
11583            16
11584        }
11585    }
11586
11587    unsafe impl<D: fidl::encoding::ResourceDialect>
11588        fidl::encoding::Encode<PackageIndexIteratorNextResponse, D>
11589        for &PackageIndexIteratorNextResponse
11590    {
11591        #[inline]
11592        unsafe fn encode(
11593            self,
11594            encoder: &mut fidl::encoding::Encoder<'_, D>,
11595            offset: usize,
11596            _depth: fidl::encoding::Depth,
11597        ) -> fidl::Result<()> {
11598            encoder.debug_check_bounds::<PackageIndexIteratorNextResponse>(offset);
11599            // Delegate to tuple encoding.
11600            fidl::encoding::Encode::<PackageIndexIteratorNextResponse, D>::encode(
11601                (
11602                    <fidl::encoding::UnboundedVector<PackageIndexEntry> as fidl::encoding::ValueTypeMarker>::borrow(&self.entries),
11603                ),
11604                encoder, offset, _depth
11605            )
11606        }
11607    }
11608    unsafe impl<
11609            D: fidl::encoding::ResourceDialect,
11610            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<PackageIndexEntry>, D>,
11611        > fidl::encoding::Encode<PackageIndexIteratorNextResponse, D> for (T0,)
11612    {
11613        #[inline]
11614        unsafe fn encode(
11615            self,
11616            encoder: &mut fidl::encoding::Encoder<'_, D>,
11617            offset: usize,
11618            depth: fidl::encoding::Depth,
11619        ) -> fidl::Result<()> {
11620            encoder.debug_check_bounds::<PackageIndexIteratorNextResponse>(offset);
11621            // Zero out padding regions. There's no need to apply masks
11622            // because the unmasked parts will be overwritten by fields.
11623            // Write the fields.
11624            self.0.encode(encoder, offset + 0, depth)?;
11625            Ok(())
11626        }
11627    }
11628
11629    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11630        for PackageIndexIteratorNextResponse
11631    {
11632        #[inline(always)]
11633        fn new_empty() -> Self {
11634            Self {
11635                entries: fidl::new_empty!(fidl::encoding::UnboundedVector<PackageIndexEntry>, D),
11636            }
11637        }
11638
11639        #[inline]
11640        unsafe fn decode(
11641            &mut self,
11642            decoder: &mut fidl::encoding::Decoder<'_, D>,
11643            offset: usize,
11644            _depth: fidl::encoding::Depth,
11645        ) -> fidl::Result<()> {
11646            decoder.debug_check_bounds::<Self>(offset);
11647            // Verify that padding bytes are zero.
11648            fidl::decode!(
11649                fidl::encoding::UnboundedVector<PackageIndexEntry>,
11650                D,
11651                &mut self.entries,
11652                decoder,
11653                offset + 0,
11654                _depth
11655            )?;
11656            Ok(())
11657        }
11658    }
11659
11660    impl fidl::encoding::ValueTypeMarker for PackageResolverGetHashRequest {
11661        type Borrowed<'a> = &'a Self;
11662        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11663            value
11664        }
11665    }
11666
11667    unsafe impl fidl::encoding::TypeMarker for PackageResolverGetHashRequest {
11668        type Owned = Self;
11669
11670        #[inline(always)]
11671        fn inline_align(_context: fidl::encoding::Context) -> usize {
11672            8
11673        }
11674
11675        #[inline(always)]
11676        fn inline_size(_context: fidl::encoding::Context) -> usize {
11677            16
11678        }
11679    }
11680
11681    unsafe impl<D: fidl::encoding::ResourceDialect>
11682        fidl::encoding::Encode<PackageResolverGetHashRequest, D>
11683        for &PackageResolverGetHashRequest
11684    {
11685        #[inline]
11686        unsafe fn encode(
11687            self,
11688            encoder: &mut fidl::encoding::Encoder<'_, D>,
11689            offset: usize,
11690            _depth: fidl::encoding::Depth,
11691        ) -> fidl::Result<()> {
11692            encoder.debug_check_bounds::<PackageResolverGetHashRequest>(offset);
11693            // Delegate to tuple encoding.
11694            fidl::encoding::Encode::<PackageResolverGetHashRequest, D>::encode(
11695                (<PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.package_url),),
11696                encoder,
11697                offset,
11698                _depth,
11699            )
11700        }
11701    }
11702    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PackageUrl, D>>
11703        fidl::encoding::Encode<PackageResolverGetHashRequest, D> for (T0,)
11704    {
11705        #[inline]
11706        unsafe fn encode(
11707            self,
11708            encoder: &mut fidl::encoding::Encoder<'_, D>,
11709            offset: usize,
11710            depth: fidl::encoding::Depth,
11711        ) -> fidl::Result<()> {
11712            encoder.debug_check_bounds::<PackageResolverGetHashRequest>(offset);
11713            // Zero out padding regions. There's no need to apply masks
11714            // because the unmasked parts will be overwritten by fields.
11715            // Write the fields.
11716            self.0.encode(encoder, offset + 0, depth)?;
11717            Ok(())
11718        }
11719    }
11720
11721    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11722        for PackageResolverGetHashRequest
11723    {
11724        #[inline(always)]
11725        fn new_empty() -> Self {
11726            Self { package_url: fidl::new_empty!(PackageUrl, D) }
11727        }
11728
11729        #[inline]
11730        unsafe fn decode(
11731            &mut self,
11732            decoder: &mut fidl::encoding::Decoder<'_, D>,
11733            offset: usize,
11734            _depth: fidl::encoding::Depth,
11735        ) -> fidl::Result<()> {
11736            decoder.debug_check_bounds::<Self>(offset);
11737            // Verify that padding bytes are zero.
11738            fidl::decode!(PackageUrl, D, &mut self.package_url, decoder, offset + 0, _depth)?;
11739            Ok(())
11740        }
11741    }
11742
11743    impl fidl::encoding::ResourceTypeMarker for PackageResolverResolveRequest {
11744        type Borrowed<'a> = &'a mut Self;
11745        fn take_or_borrow<'a>(
11746            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11747        ) -> Self::Borrowed<'a> {
11748            value
11749        }
11750    }
11751
11752    unsafe impl fidl::encoding::TypeMarker for PackageResolverResolveRequest {
11753        type Owned = Self;
11754
11755        #[inline(always)]
11756        fn inline_align(_context: fidl::encoding::Context) -> usize {
11757            8
11758        }
11759
11760        #[inline(always)]
11761        fn inline_size(_context: fidl::encoding::Context) -> usize {
11762            24
11763        }
11764    }
11765
11766    unsafe impl
11767        fidl::encoding::Encode<
11768            PackageResolverResolveRequest,
11769            fidl::encoding::DefaultFuchsiaResourceDialect,
11770        > for &mut PackageResolverResolveRequest
11771    {
11772        #[inline]
11773        unsafe fn encode(
11774            self,
11775            encoder: &mut fidl::encoding::Encoder<
11776                '_,
11777                fidl::encoding::DefaultFuchsiaResourceDialect,
11778            >,
11779            offset: usize,
11780            _depth: fidl::encoding::Depth,
11781        ) -> fidl::Result<()> {
11782            encoder.debug_check_bounds::<PackageResolverResolveRequest>(offset);
11783            // Delegate to tuple encoding.
11784            fidl::encoding::Encode::<
11785                PackageResolverResolveRequest,
11786                fidl::encoding::DefaultFuchsiaResourceDialect,
11787            >::encode(
11788                (
11789                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
11790                        &self.package_url,
11791                    ),
11792                    <fidl::encoding::Endpoint<
11793                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11794                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11795                        &mut self.dir
11796                    ),
11797                ),
11798                encoder,
11799                offset,
11800                _depth,
11801            )
11802        }
11803    }
11804    unsafe impl<
11805            T0: fidl::encoding::Encode<
11806                fidl::encoding::UnboundedString,
11807                fidl::encoding::DefaultFuchsiaResourceDialect,
11808            >,
11809            T1: fidl::encoding::Encode<
11810                fidl::encoding::Endpoint<
11811                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11812                >,
11813                fidl::encoding::DefaultFuchsiaResourceDialect,
11814            >,
11815        >
11816        fidl::encoding::Encode<
11817            PackageResolverResolveRequest,
11818            fidl::encoding::DefaultFuchsiaResourceDialect,
11819        > for (T0, T1)
11820    {
11821        #[inline]
11822        unsafe fn encode(
11823            self,
11824            encoder: &mut fidl::encoding::Encoder<
11825                '_,
11826                fidl::encoding::DefaultFuchsiaResourceDialect,
11827            >,
11828            offset: usize,
11829            depth: fidl::encoding::Depth,
11830        ) -> fidl::Result<()> {
11831            encoder.debug_check_bounds::<PackageResolverResolveRequest>(offset);
11832            // Zero out padding regions. There's no need to apply masks
11833            // because the unmasked parts will be overwritten by fields.
11834            unsafe {
11835                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11836                (ptr as *mut u64).write_unaligned(0);
11837            }
11838            // Write the fields.
11839            self.0.encode(encoder, offset + 0, depth)?;
11840            self.1.encode(encoder, offset + 16, depth)?;
11841            Ok(())
11842        }
11843    }
11844
11845    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11846        for PackageResolverResolveRequest
11847    {
11848        #[inline(always)]
11849        fn new_empty() -> Self {
11850            Self {
11851                package_url: fidl::new_empty!(
11852                    fidl::encoding::UnboundedString,
11853                    fidl::encoding::DefaultFuchsiaResourceDialect
11854                ),
11855                dir: fidl::new_empty!(
11856                    fidl::encoding::Endpoint<
11857                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11858                    >,
11859                    fidl::encoding::DefaultFuchsiaResourceDialect
11860                ),
11861            }
11862        }
11863
11864        #[inline]
11865        unsafe fn decode(
11866            &mut self,
11867            decoder: &mut fidl::encoding::Decoder<
11868                '_,
11869                fidl::encoding::DefaultFuchsiaResourceDialect,
11870            >,
11871            offset: usize,
11872            _depth: fidl::encoding::Depth,
11873        ) -> fidl::Result<()> {
11874            decoder.debug_check_bounds::<Self>(offset);
11875            // Verify that padding bytes are zero.
11876            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11877            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11878            let mask = 0xffffffff00000000u64;
11879            let maskedval = padval & mask;
11880            if maskedval != 0 {
11881                return Err(fidl::Error::NonZeroPadding {
11882                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11883                });
11884            }
11885            fidl::decode!(
11886                fidl::encoding::UnboundedString,
11887                fidl::encoding::DefaultFuchsiaResourceDialect,
11888                &mut self.package_url,
11889                decoder,
11890                offset + 0,
11891                _depth
11892            )?;
11893            fidl::decode!(
11894                fidl::encoding::Endpoint<
11895                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11896                >,
11897                fidl::encoding::DefaultFuchsiaResourceDialect,
11898                &mut self.dir,
11899                decoder,
11900                offset + 16,
11901                _depth
11902            )?;
11903            Ok(())
11904        }
11905    }
11906
11907    impl fidl::encoding::ResourceTypeMarker for PackageResolverResolveWithContextRequest {
11908        type Borrowed<'a> = &'a mut Self;
11909        fn take_or_borrow<'a>(
11910            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11911        ) -> Self::Borrowed<'a> {
11912            value
11913        }
11914    }
11915
11916    unsafe impl fidl::encoding::TypeMarker for PackageResolverResolveWithContextRequest {
11917        type Owned = Self;
11918
11919        #[inline(always)]
11920        fn inline_align(_context: fidl::encoding::Context) -> usize {
11921            8
11922        }
11923
11924        #[inline(always)]
11925        fn inline_size(_context: fidl::encoding::Context) -> usize {
11926            40
11927        }
11928    }
11929
11930    unsafe impl
11931        fidl::encoding::Encode<
11932            PackageResolverResolveWithContextRequest,
11933            fidl::encoding::DefaultFuchsiaResourceDialect,
11934        > for &mut PackageResolverResolveWithContextRequest
11935    {
11936        #[inline]
11937        unsafe fn encode(
11938            self,
11939            encoder: &mut fidl::encoding::Encoder<
11940                '_,
11941                fidl::encoding::DefaultFuchsiaResourceDialect,
11942            >,
11943            offset: usize,
11944            _depth: fidl::encoding::Depth,
11945        ) -> fidl::Result<()> {
11946            encoder.debug_check_bounds::<PackageResolverResolveWithContextRequest>(offset);
11947            // Delegate to tuple encoding.
11948            fidl::encoding::Encode::<
11949                PackageResolverResolveWithContextRequest,
11950                fidl::encoding::DefaultFuchsiaResourceDialect,
11951            >::encode(
11952                (
11953                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
11954                        &self.package_url,
11955                    ),
11956                    <ResolutionContext as fidl::encoding::ValueTypeMarker>::borrow(&self.context),
11957                    <fidl::encoding::Endpoint<
11958                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11959                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11960                        &mut self.dir
11961                    ),
11962                ),
11963                encoder,
11964                offset,
11965                _depth,
11966            )
11967        }
11968    }
11969    unsafe impl<
11970            T0: fidl::encoding::Encode<
11971                fidl::encoding::UnboundedString,
11972                fidl::encoding::DefaultFuchsiaResourceDialect,
11973            >,
11974            T1: fidl::encoding::Encode<
11975                ResolutionContext,
11976                fidl::encoding::DefaultFuchsiaResourceDialect,
11977            >,
11978            T2: fidl::encoding::Encode<
11979                fidl::encoding::Endpoint<
11980                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
11981                >,
11982                fidl::encoding::DefaultFuchsiaResourceDialect,
11983            >,
11984        >
11985        fidl::encoding::Encode<
11986            PackageResolverResolveWithContextRequest,
11987            fidl::encoding::DefaultFuchsiaResourceDialect,
11988        > for (T0, T1, T2)
11989    {
11990        #[inline]
11991        unsafe fn encode(
11992            self,
11993            encoder: &mut fidl::encoding::Encoder<
11994                '_,
11995                fidl::encoding::DefaultFuchsiaResourceDialect,
11996            >,
11997            offset: usize,
11998            depth: fidl::encoding::Depth,
11999        ) -> fidl::Result<()> {
12000            encoder.debug_check_bounds::<PackageResolverResolveWithContextRequest>(offset);
12001            // Zero out padding regions. There's no need to apply masks
12002            // because the unmasked parts will be overwritten by fields.
12003            unsafe {
12004                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
12005                (ptr as *mut u64).write_unaligned(0);
12006            }
12007            // Write the fields.
12008            self.0.encode(encoder, offset + 0, depth)?;
12009            self.1.encode(encoder, offset + 16, depth)?;
12010            self.2.encode(encoder, offset + 32, depth)?;
12011            Ok(())
12012        }
12013    }
12014
12015    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12016        for PackageResolverResolveWithContextRequest
12017    {
12018        #[inline(always)]
12019        fn new_empty() -> Self {
12020            Self {
12021                package_url: fidl::new_empty!(
12022                    fidl::encoding::UnboundedString,
12023                    fidl::encoding::DefaultFuchsiaResourceDialect
12024                ),
12025                context: fidl::new_empty!(
12026                    ResolutionContext,
12027                    fidl::encoding::DefaultFuchsiaResourceDialect
12028                ),
12029                dir: fidl::new_empty!(
12030                    fidl::encoding::Endpoint<
12031                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
12032                    >,
12033                    fidl::encoding::DefaultFuchsiaResourceDialect
12034                ),
12035            }
12036        }
12037
12038        #[inline]
12039        unsafe fn decode(
12040            &mut self,
12041            decoder: &mut fidl::encoding::Decoder<
12042                '_,
12043                fidl::encoding::DefaultFuchsiaResourceDialect,
12044            >,
12045            offset: usize,
12046            _depth: fidl::encoding::Depth,
12047        ) -> fidl::Result<()> {
12048            decoder.debug_check_bounds::<Self>(offset);
12049            // Verify that padding bytes are zero.
12050            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
12051            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12052            let mask = 0xffffffff00000000u64;
12053            let maskedval = padval & mask;
12054            if maskedval != 0 {
12055                return Err(fidl::Error::NonZeroPadding {
12056                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
12057                });
12058            }
12059            fidl::decode!(
12060                fidl::encoding::UnboundedString,
12061                fidl::encoding::DefaultFuchsiaResourceDialect,
12062                &mut self.package_url,
12063                decoder,
12064                offset + 0,
12065                _depth
12066            )?;
12067            fidl::decode!(
12068                ResolutionContext,
12069                fidl::encoding::DefaultFuchsiaResourceDialect,
12070                &mut self.context,
12071                decoder,
12072                offset + 16,
12073                _depth
12074            )?;
12075            fidl::decode!(
12076                fidl::encoding::Endpoint<
12077                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
12078                >,
12079                fidl::encoding::DefaultFuchsiaResourceDialect,
12080                &mut self.dir,
12081                decoder,
12082                offset + 32,
12083                _depth
12084            )?;
12085            Ok(())
12086        }
12087    }
12088
12089    impl fidl::encoding::ValueTypeMarker for PackageResolverGetHashResponse {
12090        type Borrowed<'a> = &'a Self;
12091        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12092            value
12093        }
12094    }
12095
12096    unsafe impl fidl::encoding::TypeMarker for PackageResolverGetHashResponse {
12097        type Owned = Self;
12098
12099        #[inline(always)]
12100        fn inline_align(_context: fidl::encoding::Context) -> usize {
12101            1
12102        }
12103
12104        #[inline(always)]
12105        fn inline_size(_context: fidl::encoding::Context) -> usize {
12106            32
12107        }
12108        #[inline(always)]
12109        fn encode_is_copy() -> bool {
12110            true
12111        }
12112
12113        #[inline(always)]
12114        fn decode_is_copy() -> bool {
12115            true
12116        }
12117    }
12118
12119    unsafe impl<D: fidl::encoding::ResourceDialect>
12120        fidl::encoding::Encode<PackageResolverGetHashResponse, D>
12121        for &PackageResolverGetHashResponse
12122    {
12123        #[inline]
12124        unsafe fn encode(
12125            self,
12126            encoder: &mut fidl::encoding::Encoder<'_, D>,
12127            offset: usize,
12128            _depth: fidl::encoding::Depth,
12129        ) -> fidl::Result<()> {
12130            encoder.debug_check_bounds::<PackageResolverGetHashResponse>(offset);
12131            unsafe {
12132                // Copy the object into the buffer.
12133                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
12134                (buf_ptr as *mut PackageResolverGetHashResponse)
12135                    .write_unaligned((self as *const PackageResolverGetHashResponse).read());
12136                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
12137                // done second because the memcpy will write garbage to these bytes.
12138            }
12139            Ok(())
12140        }
12141    }
12142    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlobId, D>>
12143        fidl::encoding::Encode<PackageResolverGetHashResponse, D> for (T0,)
12144    {
12145        #[inline]
12146        unsafe fn encode(
12147            self,
12148            encoder: &mut fidl::encoding::Encoder<'_, D>,
12149            offset: usize,
12150            depth: fidl::encoding::Depth,
12151        ) -> fidl::Result<()> {
12152            encoder.debug_check_bounds::<PackageResolverGetHashResponse>(offset);
12153            // Zero out padding regions. There's no need to apply masks
12154            // because the unmasked parts will be overwritten by fields.
12155            // Write the fields.
12156            self.0.encode(encoder, offset + 0, depth)?;
12157            Ok(())
12158        }
12159    }
12160
12161    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12162        for PackageResolverGetHashResponse
12163    {
12164        #[inline(always)]
12165        fn new_empty() -> Self {
12166            Self { meta_far_blob_id: fidl::new_empty!(BlobId, D) }
12167        }
12168
12169        #[inline]
12170        unsafe fn decode(
12171            &mut self,
12172            decoder: &mut fidl::encoding::Decoder<'_, D>,
12173            offset: usize,
12174            _depth: fidl::encoding::Depth,
12175        ) -> fidl::Result<()> {
12176            decoder.debug_check_bounds::<Self>(offset);
12177            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
12178            // Verify that padding bytes are zero.
12179            // Copy from the buffer into the object.
12180            unsafe {
12181                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
12182            }
12183            Ok(())
12184        }
12185    }
12186
12187    impl fidl::encoding::ValueTypeMarker for PackageResolverResolveWithContextResponse {
12188        type Borrowed<'a> = &'a Self;
12189        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12190            value
12191        }
12192    }
12193
12194    unsafe impl fidl::encoding::TypeMarker for PackageResolverResolveWithContextResponse {
12195        type Owned = Self;
12196
12197        #[inline(always)]
12198        fn inline_align(_context: fidl::encoding::Context) -> usize {
12199            8
12200        }
12201
12202        #[inline(always)]
12203        fn inline_size(_context: fidl::encoding::Context) -> usize {
12204            16
12205        }
12206    }
12207
12208    unsafe impl<D: fidl::encoding::ResourceDialect>
12209        fidl::encoding::Encode<PackageResolverResolveWithContextResponse, D>
12210        for &PackageResolverResolveWithContextResponse
12211    {
12212        #[inline]
12213        unsafe fn encode(
12214            self,
12215            encoder: &mut fidl::encoding::Encoder<'_, D>,
12216            offset: usize,
12217            _depth: fidl::encoding::Depth,
12218        ) -> fidl::Result<()> {
12219            encoder.debug_check_bounds::<PackageResolverResolveWithContextResponse>(offset);
12220            // Delegate to tuple encoding.
12221            fidl::encoding::Encode::<PackageResolverResolveWithContextResponse, D>::encode(
12222                (<ResolutionContext as fidl::encoding::ValueTypeMarker>::borrow(
12223                    &self.resolved_context,
12224                ),),
12225                encoder,
12226                offset,
12227                _depth,
12228            )
12229        }
12230    }
12231    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResolutionContext, D>>
12232        fidl::encoding::Encode<PackageResolverResolveWithContextResponse, D> for (T0,)
12233    {
12234        #[inline]
12235        unsafe fn encode(
12236            self,
12237            encoder: &mut fidl::encoding::Encoder<'_, D>,
12238            offset: usize,
12239            depth: fidl::encoding::Depth,
12240        ) -> fidl::Result<()> {
12241            encoder.debug_check_bounds::<PackageResolverResolveWithContextResponse>(offset);
12242            // Zero out padding regions. There's no need to apply masks
12243            // because the unmasked parts will be overwritten by fields.
12244            // Write the fields.
12245            self.0.encode(encoder, offset + 0, depth)?;
12246            Ok(())
12247        }
12248    }
12249
12250    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12251        for PackageResolverResolveWithContextResponse
12252    {
12253        #[inline(always)]
12254        fn new_empty() -> Self {
12255            Self { resolved_context: fidl::new_empty!(ResolutionContext, D) }
12256        }
12257
12258        #[inline]
12259        unsafe fn decode(
12260            &mut self,
12261            decoder: &mut fidl::encoding::Decoder<'_, D>,
12262            offset: usize,
12263            _depth: fidl::encoding::Depth,
12264        ) -> fidl::Result<()> {
12265            decoder.debug_check_bounds::<Self>(offset);
12266            // Verify that padding bytes are zero.
12267            fidl::decode!(
12268                ResolutionContext,
12269                D,
12270                &mut self.resolved_context,
12271                decoder,
12272                offset + 0,
12273                _depth
12274            )?;
12275            Ok(())
12276        }
12277    }
12278
12279    impl fidl::encoding::ValueTypeMarker for PackageResolverResolveResponse {
12280        type Borrowed<'a> = &'a Self;
12281        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12282            value
12283        }
12284    }
12285
12286    unsafe impl fidl::encoding::TypeMarker for PackageResolverResolveResponse {
12287        type Owned = Self;
12288
12289        #[inline(always)]
12290        fn inline_align(_context: fidl::encoding::Context) -> usize {
12291            8
12292        }
12293
12294        #[inline(always)]
12295        fn inline_size(_context: fidl::encoding::Context) -> usize {
12296            16
12297        }
12298    }
12299
12300    unsafe impl<D: fidl::encoding::ResourceDialect>
12301        fidl::encoding::Encode<PackageResolverResolveResponse, D>
12302        for &PackageResolverResolveResponse
12303    {
12304        #[inline]
12305        unsafe fn encode(
12306            self,
12307            encoder: &mut fidl::encoding::Encoder<'_, D>,
12308            offset: usize,
12309            _depth: fidl::encoding::Depth,
12310        ) -> fidl::Result<()> {
12311            encoder.debug_check_bounds::<PackageResolverResolveResponse>(offset);
12312            // Delegate to tuple encoding.
12313            fidl::encoding::Encode::<PackageResolverResolveResponse, D>::encode(
12314                (<ResolutionContext as fidl::encoding::ValueTypeMarker>::borrow(
12315                    &self.resolved_context,
12316                ),),
12317                encoder,
12318                offset,
12319                _depth,
12320            )
12321        }
12322    }
12323    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResolutionContext, D>>
12324        fidl::encoding::Encode<PackageResolverResolveResponse, D> for (T0,)
12325    {
12326        #[inline]
12327        unsafe fn encode(
12328            self,
12329            encoder: &mut fidl::encoding::Encoder<'_, D>,
12330            offset: usize,
12331            depth: fidl::encoding::Depth,
12332        ) -> fidl::Result<()> {
12333            encoder.debug_check_bounds::<PackageResolverResolveResponse>(offset);
12334            // Zero out padding regions. There's no need to apply masks
12335            // because the unmasked parts will be overwritten by fields.
12336            // Write the fields.
12337            self.0.encode(encoder, offset + 0, depth)?;
12338            Ok(())
12339        }
12340    }
12341
12342    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12343        for PackageResolverResolveResponse
12344    {
12345        #[inline(always)]
12346        fn new_empty() -> Self {
12347            Self { resolved_context: fidl::new_empty!(ResolutionContext, D) }
12348        }
12349
12350        #[inline]
12351        unsafe fn decode(
12352            &mut self,
12353            decoder: &mut fidl::encoding::Decoder<'_, D>,
12354            offset: usize,
12355            _depth: fidl::encoding::Depth,
12356        ) -> fidl::Result<()> {
12357            decoder.debug_check_bounds::<Self>(offset);
12358            // Verify that padding bytes are zero.
12359            fidl::decode!(
12360                ResolutionContext,
12361                D,
12362                &mut self.resolved_context,
12363                decoder,
12364                offset + 0,
12365                _depth
12366            )?;
12367            Ok(())
12368        }
12369    }
12370
12371    impl fidl::encoding::ValueTypeMarker for PackageUrl {
12372        type Borrowed<'a> = &'a Self;
12373        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12374            value
12375        }
12376    }
12377
12378    unsafe impl fidl::encoding::TypeMarker for PackageUrl {
12379        type Owned = Self;
12380
12381        #[inline(always)]
12382        fn inline_align(_context: fidl::encoding::Context) -> usize {
12383            8
12384        }
12385
12386        #[inline(always)]
12387        fn inline_size(_context: fidl::encoding::Context) -> usize {
12388            16
12389        }
12390    }
12391
12392    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PackageUrl, D>
12393        for &PackageUrl
12394    {
12395        #[inline]
12396        unsafe fn encode(
12397            self,
12398            encoder: &mut fidl::encoding::Encoder<'_, D>,
12399            offset: usize,
12400            _depth: fidl::encoding::Depth,
12401        ) -> fidl::Result<()> {
12402            encoder.debug_check_bounds::<PackageUrl>(offset);
12403            // Delegate to tuple encoding.
12404            fidl::encoding::Encode::<PackageUrl, D>::encode(
12405                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
12406                    &self.url,
12407                ),),
12408                encoder,
12409                offset,
12410                _depth,
12411            )
12412        }
12413    }
12414    unsafe impl<
12415            D: fidl::encoding::ResourceDialect,
12416            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
12417        > fidl::encoding::Encode<PackageUrl, D> for (T0,)
12418    {
12419        #[inline]
12420        unsafe fn encode(
12421            self,
12422            encoder: &mut fidl::encoding::Encoder<'_, D>,
12423            offset: usize,
12424            depth: fidl::encoding::Depth,
12425        ) -> fidl::Result<()> {
12426            encoder.debug_check_bounds::<PackageUrl>(offset);
12427            // Zero out padding regions. There's no need to apply masks
12428            // because the unmasked parts will be overwritten by fields.
12429            // Write the fields.
12430            self.0.encode(encoder, offset + 0, depth)?;
12431            Ok(())
12432        }
12433    }
12434
12435    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PackageUrl {
12436        #[inline(always)]
12437        fn new_empty() -> Self {
12438            Self { url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
12439        }
12440
12441        #[inline]
12442        unsafe fn decode(
12443            &mut self,
12444            decoder: &mut fidl::encoding::Decoder<'_, D>,
12445            offset: usize,
12446            _depth: fidl::encoding::Depth,
12447        ) -> fidl::Result<()> {
12448            decoder.debug_check_bounds::<Self>(offset);
12449            // Verify that padding bytes are zero.
12450            fidl::decode!(
12451                fidl::encoding::BoundedString<4096>,
12452                D,
12453                &mut self.url,
12454                decoder,
12455                offset + 0,
12456                _depth
12457            )?;
12458            Ok(())
12459        }
12460    }
12461
12462    impl fidl::encoding::ValueTypeMarker for RepositoryIteratorNextResponse {
12463        type Borrowed<'a> = &'a Self;
12464        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12465            value
12466        }
12467    }
12468
12469    unsafe impl fidl::encoding::TypeMarker for RepositoryIteratorNextResponse {
12470        type Owned = Self;
12471
12472        #[inline(always)]
12473        fn inline_align(_context: fidl::encoding::Context) -> usize {
12474            8
12475        }
12476
12477        #[inline(always)]
12478        fn inline_size(_context: fidl::encoding::Context) -> usize {
12479            16
12480        }
12481    }
12482
12483    unsafe impl<D: fidl::encoding::ResourceDialect>
12484        fidl::encoding::Encode<RepositoryIteratorNextResponse, D>
12485        for &RepositoryIteratorNextResponse
12486    {
12487        #[inline]
12488        unsafe fn encode(
12489            self,
12490            encoder: &mut fidl::encoding::Encoder<'_, D>,
12491            offset: usize,
12492            _depth: fidl::encoding::Depth,
12493        ) -> fidl::Result<()> {
12494            encoder.debug_check_bounds::<RepositoryIteratorNextResponse>(offset);
12495            // Delegate to tuple encoding.
12496            fidl::encoding::Encode::<RepositoryIteratorNextResponse, D>::encode(
12497                (
12498                    <fidl::encoding::UnboundedVector<RepositoryConfig> as fidl::encoding::ValueTypeMarker>::borrow(&self.repos),
12499                ),
12500                encoder, offset, _depth
12501            )
12502        }
12503    }
12504    unsafe impl<
12505            D: fidl::encoding::ResourceDialect,
12506            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<RepositoryConfig>, D>,
12507        > fidl::encoding::Encode<RepositoryIteratorNextResponse, D> for (T0,)
12508    {
12509        #[inline]
12510        unsafe fn encode(
12511            self,
12512            encoder: &mut fidl::encoding::Encoder<'_, D>,
12513            offset: usize,
12514            depth: fidl::encoding::Depth,
12515        ) -> fidl::Result<()> {
12516            encoder.debug_check_bounds::<RepositoryIteratorNextResponse>(offset);
12517            // Zero out padding regions. There's no need to apply masks
12518            // because the unmasked parts will be overwritten by fields.
12519            // Write the fields.
12520            self.0.encode(encoder, offset + 0, depth)?;
12521            Ok(())
12522        }
12523    }
12524
12525    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12526        for RepositoryIteratorNextResponse
12527    {
12528        #[inline(always)]
12529        fn new_empty() -> Self {
12530            Self { repos: fidl::new_empty!(fidl::encoding::UnboundedVector<RepositoryConfig>, D) }
12531        }
12532
12533        #[inline]
12534        unsafe fn decode(
12535            &mut self,
12536            decoder: &mut fidl::encoding::Decoder<'_, D>,
12537            offset: usize,
12538            _depth: fidl::encoding::Depth,
12539        ) -> fidl::Result<()> {
12540            decoder.debug_check_bounds::<Self>(offset);
12541            // Verify that padding bytes are zero.
12542            fidl::decode!(
12543                fidl::encoding::UnboundedVector<RepositoryConfig>,
12544                D,
12545                &mut self.repos,
12546                decoder,
12547                offset + 0,
12548                _depth
12549            )?;
12550            Ok(())
12551        }
12552    }
12553
12554    impl fidl::encoding::ValueTypeMarker for RepositoryManagerAddMirrorRequest {
12555        type Borrowed<'a> = &'a Self;
12556        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12557            value
12558        }
12559    }
12560
12561    unsafe impl fidl::encoding::TypeMarker for RepositoryManagerAddMirrorRequest {
12562        type Owned = Self;
12563
12564        #[inline(always)]
12565        fn inline_align(_context: fidl::encoding::Context) -> usize {
12566            8
12567        }
12568
12569        #[inline(always)]
12570        fn inline_size(_context: fidl::encoding::Context) -> usize {
12571            32
12572        }
12573    }
12574
12575    unsafe impl<D: fidl::encoding::ResourceDialect>
12576        fidl::encoding::Encode<RepositoryManagerAddMirrorRequest, D>
12577        for &RepositoryManagerAddMirrorRequest
12578    {
12579        #[inline]
12580        unsafe fn encode(
12581            self,
12582            encoder: &mut fidl::encoding::Encoder<'_, D>,
12583            offset: usize,
12584            _depth: fidl::encoding::Depth,
12585        ) -> fidl::Result<()> {
12586            encoder.debug_check_bounds::<RepositoryManagerAddMirrorRequest>(offset);
12587            // Delegate to tuple encoding.
12588            fidl::encoding::Encode::<RepositoryManagerAddMirrorRequest, D>::encode(
12589                (
12590                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
12591                        &self.repo_url,
12592                    ),
12593                    <MirrorConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.mirror),
12594                ),
12595                encoder,
12596                offset,
12597                _depth,
12598            )
12599        }
12600    }
12601    unsafe impl<
12602            D: fidl::encoding::ResourceDialect,
12603            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
12604            T1: fidl::encoding::Encode<MirrorConfig, D>,
12605        > fidl::encoding::Encode<RepositoryManagerAddMirrorRequest, D> for (T0, T1)
12606    {
12607        #[inline]
12608        unsafe fn encode(
12609            self,
12610            encoder: &mut fidl::encoding::Encoder<'_, D>,
12611            offset: usize,
12612            depth: fidl::encoding::Depth,
12613        ) -> fidl::Result<()> {
12614            encoder.debug_check_bounds::<RepositoryManagerAddMirrorRequest>(offset);
12615            // Zero out padding regions. There's no need to apply masks
12616            // because the unmasked parts will be overwritten by fields.
12617            // Write the fields.
12618            self.0.encode(encoder, offset + 0, depth)?;
12619            self.1.encode(encoder, offset + 16, depth)?;
12620            Ok(())
12621        }
12622    }
12623
12624    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12625        for RepositoryManagerAddMirrorRequest
12626    {
12627        #[inline(always)]
12628        fn new_empty() -> Self {
12629            Self {
12630                repo_url: fidl::new_empty!(fidl::encoding::UnboundedString, D),
12631                mirror: fidl::new_empty!(MirrorConfig, D),
12632            }
12633        }
12634
12635        #[inline]
12636        unsafe fn decode(
12637            &mut self,
12638            decoder: &mut fidl::encoding::Decoder<'_, D>,
12639            offset: usize,
12640            _depth: fidl::encoding::Depth,
12641        ) -> fidl::Result<()> {
12642            decoder.debug_check_bounds::<Self>(offset);
12643            // Verify that padding bytes are zero.
12644            fidl::decode!(
12645                fidl::encoding::UnboundedString,
12646                D,
12647                &mut self.repo_url,
12648                decoder,
12649                offset + 0,
12650                _depth
12651            )?;
12652            fidl::decode!(MirrorConfig, D, &mut self.mirror, decoder, offset + 16, _depth)?;
12653            Ok(())
12654        }
12655    }
12656
12657    impl fidl::encoding::ValueTypeMarker for RepositoryManagerAddRequest {
12658        type Borrowed<'a> = &'a Self;
12659        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12660            value
12661        }
12662    }
12663
12664    unsafe impl fidl::encoding::TypeMarker for RepositoryManagerAddRequest {
12665        type Owned = Self;
12666
12667        #[inline(always)]
12668        fn inline_align(_context: fidl::encoding::Context) -> usize {
12669            8
12670        }
12671
12672        #[inline(always)]
12673        fn inline_size(_context: fidl::encoding::Context) -> usize {
12674            16
12675        }
12676    }
12677
12678    unsafe impl<D: fidl::encoding::ResourceDialect>
12679        fidl::encoding::Encode<RepositoryManagerAddRequest, D> for &RepositoryManagerAddRequest
12680    {
12681        #[inline]
12682        unsafe fn encode(
12683            self,
12684            encoder: &mut fidl::encoding::Encoder<'_, D>,
12685            offset: usize,
12686            _depth: fidl::encoding::Depth,
12687        ) -> fidl::Result<()> {
12688            encoder.debug_check_bounds::<RepositoryManagerAddRequest>(offset);
12689            // Delegate to tuple encoding.
12690            fidl::encoding::Encode::<RepositoryManagerAddRequest, D>::encode(
12691                (<RepositoryConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.repo),),
12692                encoder,
12693                offset,
12694                _depth,
12695            )
12696        }
12697    }
12698    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepositoryConfig, D>>
12699        fidl::encoding::Encode<RepositoryManagerAddRequest, D> for (T0,)
12700    {
12701        #[inline]
12702        unsafe fn encode(
12703            self,
12704            encoder: &mut fidl::encoding::Encoder<'_, D>,
12705            offset: usize,
12706            depth: fidl::encoding::Depth,
12707        ) -> fidl::Result<()> {
12708            encoder.debug_check_bounds::<RepositoryManagerAddRequest>(offset);
12709            // Zero out padding regions. There's no need to apply masks
12710            // because the unmasked parts will be overwritten by fields.
12711            // Write the fields.
12712            self.0.encode(encoder, offset + 0, depth)?;
12713            Ok(())
12714        }
12715    }
12716
12717    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12718        for RepositoryManagerAddRequest
12719    {
12720        #[inline(always)]
12721        fn new_empty() -> Self {
12722            Self { repo: fidl::new_empty!(RepositoryConfig, D) }
12723        }
12724
12725        #[inline]
12726        unsafe fn decode(
12727            &mut self,
12728            decoder: &mut fidl::encoding::Decoder<'_, D>,
12729            offset: usize,
12730            _depth: fidl::encoding::Depth,
12731        ) -> fidl::Result<()> {
12732            decoder.debug_check_bounds::<Self>(offset);
12733            // Verify that padding bytes are zero.
12734            fidl::decode!(RepositoryConfig, D, &mut self.repo, decoder, offset + 0, _depth)?;
12735            Ok(())
12736        }
12737    }
12738
12739    impl fidl::encoding::ResourceTypeMarker for RepositoryManagerListRequest {
12740        type Borrowed<'a> = &'a mut Self;
12741        fn take_or_borrow<'a>(
12742            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12743        ) -> Self::Borrowed<'a> {
12744            value
12745        }
12746    }
12747
12748    unsafe impl fidl::encoding::TypeMarker for RepositoryManagerListRequest {
12749        type Owned = Self;
12750
12751        #[inline(always)]
12752        fn inline_align(_context: fidl::encoding::Context) -> usize {
12753            4
12754        }
12755
12756        #[inline(always)]
12757        fn inline_size(_context: fidl::encoding::Context) -> usize {
12758            4
12759        }
12760    }
12761
12762    unsafe impl
12763        fidl::encoding::Encode<
12764            RepositoryManagerListRequest,
12765            fidl::encoding::DefaultFuchsiaResourceDialect,
12766        > for &mut RepositoryManagerListRequest
12767    {
12768        #[inline]
12769        unsafe fn encode(
12770            self,
12771            encoder: &mut fidl::encoding::Encoder<
12772                '_,
12773                fidl::encoding::DefaultFuchsiaResourceDialect,
12774            >,
12775            offset: usize,
12776            _depth: fidl::encoding::Depth,
12777        ) -> fidl::Result<()> {
12778            encoder.debug_check_bounds::<RepositoryManagerListRequest>(offset);
12779            // Delegate to tuple encoding.
12780            fidl::encoding::Encode::<RepositoryManagerListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12781                (
12782                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
12783                ),
12784                encoder, offset, _depth
12785            )
12786        }
12787    }
12788    unsafe impl<
12789            T0: fidl::encoding::Encode<
12790                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>>,
12791                fidl::encoding::DefaultFuchsiaResourceDialect,
12792            >,
12793        >
12794        fidl::encoding::Encode<
12795            RepositoryManagerListRequest,
12796            fidl::encoding::DefaultFuchsiaResourceDialect,
12797        > for (T0,)
12798    {
12799        #[inline]
12800        unsafe fn encode(
12801            self,
12802            encoder: &mut fidl::encoding::Encoder<
12803                '_,
12804                fidl::encoding::DefaultFuchsiaResourceDialect,
12805            >,
12806            offset: usize,
12807            depth: fidl::encoding::Depth,
12808        ) -> fidl::Result<()> {
12809            encoder.debug_check_bounds::<RepositoryManagerListRequest>(offset);
12810            // Zero out padding regions. There's no need to apply masks
12811            // because the unmasked parts will be overwritten by fields.
12812            // Write the fields.
12813            self.0.encode(encoder, offset + 0, depth)?;
12814            Ok(())
12815        }
12816    }
12817
12818    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12819        for RepositoryManagerListRequest
12820    {
12821        #[inline(always)]
12822        fn new_empty() -> Self {
12823            Self {
12824                iterator: fidl::new_empty!(
12825                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>>,
12826                    fidl::encoding::DefaultFuchsiaResourceDialect
12827                ),
12828            }
12829        }
12830
12831        #[inline]
12832        unsafe fn decode(
12833            &mut self,
12834            decoder: &mut fidl::encoding::Decoder<
12835                '_,
12836                fidl::encoding::DefaultFuchsiaResourceDialect,
12837            >,
12838            offset: usize,
12839            _depth: fidl::encoding::Depth,
12840        ) -> fidl::Result<()> {
12841            decoder.debug_check_bounds::<Self>(offset);
12842            // Verify that padding bytes are zero.
12843            fidl::decode!(
12844                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RepositoryIteratorMarker>>,
12845                fidl::encoding::DefaultFuchsiaResourceDialect,
12846                &mut self.iterator,
12847                decoder,
12848                offset + 0,
12849                _depth
12850            )?;
12851            Ok(())
12852        }
12853    }
12854
12855    impl fidl::encoding::ValueTypeMarker for RepositoryManagerRemoveMirrorRequest {
12856        type Borrowed<'a> = &'a Self;
12857        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12858            value
12859        }
12860    }
12861
12862    unsafe impl fidl::encoding::TypeMarker for RepositoryManagerRemoveMirrorRequest {
12863        type Owned = Self;
12864
12865        #[inline(always)]
12866        fn inline_align(_context: fidl::encoding::Context) -> usize {
12867            8
12868        }
12869
12870        #[inline(always)]
12871        fn inline_size(_context: fidl::encoding::Context) -> usize {
12872            32
12873        }
12874    }
12875
12876    unsafe impl<D: fidl::encoding::ResourceDialect>
12877        fidl::encoding::Encode<RepositoryManagerRemoveMirrorRequest, D>
12878        for &RepositoryManagerRemoveMirrorRequest
12879    {
12880        #[inline]
12881        unsafe fn encode(
12882            self,
12883            encoder: &mut fidl::encoding::Encoder<'_, D>,
12884            offset: usize,
12885            _depth: fidl::encoding::Depth,
12886        ) -> fidl::Result<()> {
12887            encoder.debug_check_bounds::<RepositoryManagerRemoveMirrorRequest>(offset);
12888            // Delegate to tuple encoding.
12889            fidl::encoding::Encode::<RepositoryManagerRemoveMirrorRequest, D>::encode(
12890                (
12891                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
12892                        &self.repo_url,
12893                    ),
12894                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
12895                        &self.mirror_url,
12896                    ),
12897                ),
12898                encoder,
12899                offset,
12900                _depth,
12901            )
12902        }
12903    }
12904    unsafe impl<
12905            D: fidl::encoding::ResourceDialect,
12906            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
12907            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
12908        > fidl::encoding::Encode<RepositoryManagerRemoveMirrorRequest, D> for (T0, T1)
12909    {
12910        #[inline]
12911        unsafe fn encode(
12912            self,
12913            encoder: &mut fidl::encoding::Encoder<'_, D>,
12914            offset: usize,
12915            depth: fidl::encoding::Depth,
12916        ) -> fidl::Result<()> {
12917            encoder.debug_check_bounds::<RepositoryManagerRemoveMirrorRequest>(offset);
12918            // Zero out padding regions. There's no need to apply masks
12919            // because the unmasked parts will be overwritten by fields.
12920            // Write the fields.
12921            self.0.encode(encoder, offset + 0, depth)?;
12922            self.1.encode(encoder, offset + 16, depth)?;
12923            Ok(())
12924        }
12925    }
12926
12927    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
12928        for RepositoryManagerRemoveMirrorRequest
12929    {
12930        #[inline(always)]
12931        fn new_empty() -> Self {
12932            Self {
12933                repo_url: fidl::new_empty!(fidl::encoding::UnboundedString, D),
12934                mirror_url: fidl::new_empty!(fidl::encoding::UnboundedString, D),
12935            }
12936        }
12937
12938        #[inline]
12939        unsafe fn decode(
12940            &mut self,
12941            decoder: &mut fidl::encoding::Decoder<'_, D>,
12942            offset: usize,
12943            _depth: fidl::encoding::Depth,
12944        ) -> fidl::Result<()> {
12945            decoder.debug_check_bounds::<Self>(offset);
12946            // Verify that padding bytes are zero.
12947            fidl::decode!(
12948                fidl::encoding::UnboundedString,
12949                D,
12950                &mut self.repo_url,
12951                decoder,
12952                offset + 0,
12953                _depth
12954            )?;
12955            fidl::decode!(
12956                fidl::encoding::UnboundedString,
12957                D,
12958                &mut self.mirror_url,
12959                decoder,
12960                offset + 16,
12961                _depth
12962            )?;
12963            Ok(())
12964        }
12965    }
12966
12967    impl fidl::encoding::ValueTypeMarker for RepositoryManagerRemoveRequest {
12968        type Borrowed<'a> = &'a Self;
12969        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12970            value
12971        }
12972    }
12973
12974    unsafe impl fidl::encoding::TypeMarker for RepositoryManagerRemoveRequest {
12975        type Owned = Self;
12976
12977        #[inline(always)]
12978        fn inline_align(_context: fidl::encoding::Context) -> usize {
12979            8
12980        }
12981
12982        #[inline(always)]
12983        fn inline_size(_context: fidl::encoding::Context) -> usize {
12984            16
12985        }
12986    }
12987
12988    unsafe impl<D: fidl::encoding::ResourceDialect>
12989        fidl::encoding::Encode<RepositoryManagerRemoveRequest, D>
12990        for &RepositoryManagerRemoveRequest
12991    {
12992        #[inline]
12993        unsafe fn encode(
12994            self,
12995            encoder: &mut fidl::encoding::Encoder<'_, D>,
12996            offset: usize,
12997            _depth: fidl::encoding::Depth,
12998        ) -> fidl::Result<()> {
12999            encoder.debug_check_bounds::<RepositoryManagerRemoveRequest>(offset);
13000            // Delegate to tuple encoding.
13001            fidl::encoding::Encode::<RepositoryManagerRemoveRequest, D>::encode(
13002                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
13003                    &self.repo_url,
13004                ),),
13005                encoder,
13006                offset,
13007                _depth,
13008            )
13009        }
13010    }
13011    unsafe impl<
13012            D: fidl::encoding::ResourceDialect,
13013            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
13014        > fidl::encoding::Encode<RepositoryManagerRemoveRequest, D> for (T0,)
13015    {
13016        #[inline]
13017        unsafe fn encode(
13018            self,
13019            encoder: &mut fidl::encoding::Encoder<'_, D>,
13020            offset: usize,
13021            depth: fidl::encoding::Depth,
13022        ) -> fidl::Result<()> {
13023            encoder.debug_check_bounds::<RepositoryManagerRemoveRequest>(offset);
13024            // Zero out padding regions. There's no need to apply masks
13025            // because the unmasked parts will be overwritten by fields.
13026            // Write the fields.
13027            self.0.encode(encoder, offset + 0, depth)?;
13028            Ok(())
13029        }
13030    }
13031
13032    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
13033        for RepositoryManagerRemoveRequest
13034    {
13035        #[inline(always)]
13036        fn new_empty() -> Self {
13037            Self { repo_url: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
13038        }
13039
13040        #[inline]
13041        unsafe fn decode(
13042            &mut self,
13043            decoder: &mut fidl::encoding::Decoder<'_, D>,
13044            offset: usize,
13045            _depth: fidl::encoding::Depth,
13046        ) -> fidl::Result<()> {
13047            decoder.debug_check_bounds::<Self>(offset);
13048            // Verify that padding bytes are zero.
13049            fidl::decode!(
13050                fidl::encoding::UnboundedString,
13051                D,
13052                &mut self.repo_url,
13053                decoder,
13054                offset + 0,
13055                _depth
13056            )?;
13057            Ok(())
13058        }
13059    }
13060
13061    impl fidl::encoding::ValueTypeMarker for RepositoryUrl {
13062        type Borrowed<'a> = &'a Self;
13063        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13064            value
13065        }
13066    }
13067
13068    unsafe impl fidl::encoding::TypeMarker for RepositoryUrl {
13069        type Owned = Self;
13070
13071        #[inline(always)]
13072        fn inline_align(_context: fidl::encoding::Context) -> usize {
13073            8
13074        }
13075
13076        #[inline(always)]
13077        fn inline_size(_context: fidl::encoding::Context) -> usize {
13078            16
13079        }
13080    }
13081
13082    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RepositoryUrl, D>
13083        for &RepositoryUrl
13084    {
13085        #[inline]
13086        unsafe fn encode(
13087            self,
13088            encoder: &mut fidl::encoding::Encoder<'_, D>,
13089            offset: usize,
13090            _depth: fidl::encoding::Depth,
13091        ) -> fidl::Result<()> {
13092            encoder.debug_check_bounds::<RepositoryUrl>(offset);
13093            // Delegate to tuple encoding.
13094            fidl::encoding::Encode::<RepositoryUrl, D>::encode(
13095                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
13096                    &self.url,
13097                ),),
13098                encoder,
13099                offset,
13100                _depth,
13101            )
13102        }
13103    }
13104    unsafe impl<
13105            D: fidl::encoding::ResourceDialect,
13106            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
13107        > fidl::encoding::Encode<RepositoryUrl, D> for (T0,)
13108    {
13109        #[inline]
13110        unsafe fn encode(
13111            self,
13112            encoder: &mut fidl::encoding::Encoder<'_, D>,
13113            offset: usize,
13114            depth: fidl::encoding::Depth,
13115        ) -> fidl::Result<()> {
13116            encoder.debug_check_bounds::<RepositoryUrl>(offset);
13117            // Zero out padding regions. There's no need to apply masks
13118            // because the unmasked parts will be overwritten by fields.
13119            // Write the fields.
13120            self.0.encode(encoder, offset + 0, depth)?;
13121            Ok(())
13122        }
13123    }
13124
13125    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepositoryUrl {
13126        #[inline(always)]
13127        fn new_empty() -> Self {
13128            Self { url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
13129        }
13130
13131        #[inline]
13132        unsafe fn decode(
13133            &mut self,
13134            decoder: &mut fidl::encoding::Decoder<'_, D>,
13135            offset: usize,
13136            _depth: fidl::encoding::Depth,
13137        ) -> fidl::Result<()> {
13138            decoder.debug_check_bounds::<Self>(offset);
13139            // Verify that padding bytes are zero.
13140            fidl::decode!(
13141                fidl::encoding::BoundedString<4096>,
13142                D,
13143                &mut self.url,
13144                decoder,
13145                offset + 0,
13146                _depth
13147            )?;
13148            Ok(())
13149        }
13150    }
13151
13152    impl fidl::encoding::ValueTypeMarker for ResolutionContext {
13153        type Borrowed<'a> = &'a Self;
13154        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13155            value
13156        }
13157    }
13158
13159    unsafe impl fidl::encoding::TypeMarker for ResolutionContext {
13160        type Owned = Self;
13161
13162        #[inline(always)]
13163        fn inline_align(_context: fidl::encoding::Context) -> usize {
13164            8
13165        }
13166
13167        #[inline(always)]
13168        fn inline_size(_context: fidl::encoding::Context) -> usize {
13169            16
13170        }
13171    }
13172
13173    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ResolutionContext, D>
13174        for &ResolutionContext
13175    {
13176        #[inline]
13177        unsafe fn encode(
13178            self,
13179            encoder: &mut fidl::encoding::Encoder<'_, D>,
13180            offset: usize,
13181            _depth: fidl::encoding::Depth,
13182        ) -> fidl::Result<()> {
13183            encoder.debug_check_bounds::<ResolutionContext>(offset);
13184            // Delegate to tuple encoding.
13185            fidl::encoding::Encode::<ResolutionContext, D>::encode(
13186                (<fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
13187                    &self.bytes,
13188                ),),
13189                encoder,
13190                offset,
13191                _depth,
13192            )
13193        }
13194    }
13195    unsafe impl<
13196            D: fidl::encoding::ResourceDialect,
13197            T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8192>, D>,
13198        > fidl::encoding::Encode<ResolutionContext, D> for (T0,)
13199    {
13200        #[inline]
13201        unsafe fn encode(
13202            self,
13203            encoder: &mut fidl::encoding::Encoder<'_, D>,
13204            offset: usize,
13205            depth: fidl::encoding::Depth,
13206        ) -> fidl::Result<()> {
13207            encoder.debug_check_bounds::<ResolutionContext>(offset);
13208            // Zero out padding regions. There's no need to apply masks
13209            // because the unmasked parts will be overwritten by fields.
13210            // Write the fields.
13211            self.0.encode(encoder, offset + 0, depth)?;
13212            Ok(())
13213        }
13214    }
13215
13216    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResolutionContext {
13217        #[inline(always)]
13218        fn new_empty() -> Self {
13219            Self { bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D) }
13220        }
13221
13222        #[inline]
13223        unsafe fn decode(
13224            &mut self,
13225            decoder: &mut fidl::encoding::Decoder<'_, D>,
13226            offset: usize,
13227            _depth: fidl::encoding::Depth,
13228        ) -> fidl::Result<()> {
13229            decoder.debug_check_bounds::<Self>(offset);
13230            // Verify that padding bytes are zero.
13231            fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, &mut self.bytes, decoder, offset + 0, _depth)?;
13232            Ok(())
13233        }
13234    }
13235
13236    impl fidl::encoding::ResourceTypeMarker for RetainedPackagesReplaceRequest {
13237        type Borrowed<'a> = &'a mut Self;
13238        fn take_or_borrow<'a>(
13239            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13240        ) -> Self::Borrowed<'a> {
13241            value
13242        }
13243    }
13244
13245    unsafe impl fidl::encoding::TypeMarker for RetainedPackagesReplaceRequest {
13246        type Owned = Self;
13247
13248        #[inline(always)]
13249        fn inline_align(_context: fidl::encoding::Context) -> usize {
13250            4
13251        }
13252
13253        #[inline(always)]
13254        fn inline_size(_context: fidl::encoding::Context) -> usize {
13255            4
13256        }
13257    }
13258
13259    unsafe impl
13260        fidl::encoding::Encode<
13261            RetainedPackagesReplaceRequest,
13262            fidl::encoding::DefaultFuchsiaResourceDialect,
13263        > for &mut RetainedPackagesReplaceRequest
13264    {
13265        #[inline]
13266        unsafe fn encode(
13267            self,
13268            encoder: &mut fidl::encoding::Encoder<
13269                '_,
13270                fidl::encoding::DefaultFuchsiaResourceDialect,
13271            >,
13272            offset: usize,
13273            _depth: fidl::encoding::Depth,
13274        ) -> fidl::Result<()> {
13275            encoder.debug_check_bounds::<RetainedPackagesReplaceRequest>(offset);
13276            // Delegate to tuple encoding.
13277            fidl::encoding::Encode::<RetainedPackagesReplaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13278                (
13279                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
13280                ),
13281                encoder, offset, _depth
13282            )
13283        }
13284    }
13285    unsafe impl<
13286            T0: fidl::encoding::Encode<
13287                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
13288                fidl::encoding::DefaultFuchsiaResourceDialect,
13289            >,
13290        >
13291        fidl::encoding::Encode<
13292            RetainedPackagesReplaceRequest,
13293            fidl::encoding::DefaultFuchsiaResourceDialect,
13294        > for (T0,)
13295    {
13296        #[inline]
13297        unsafe fn encode(
13298            self,
13299            encoder: &mut fidl::encoding::Encoder<
13300                '_,
13301                fidl::encoding::DefaultFuchsiaResourceDialect,
13302            >,
13303            offset: usize,
13304            depth: fidl::encoding::Depth,
13305        ) -> fidl::Result<()> {
13306            encoder.debug_check_bounds::<RetainedPackagesReplaceRequest>(offset);
13307            // Zero out padding regions. There's no need to apply masks
13308            // because the unmasked parts will be overwritten by fields.
13309            // Write the fields.
13310            self.0.encode(encoder, offset + 0, depth)?;
13311            Ok(())
13312        }
13313    }
13314
13315    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13316        for RetainedPackagesReplaceRequest
13317    {
13318        #[inline(always)]
13319        fn new_empty() -> Self {
13320            Self {
13321                iterator: fidl::new_empty!(
13322                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
13323                    fidl::encoding::DefaultFuchsiaResourceDialect
13324                ),
13325            }
13326        }
13327
13328        #[inline]
13329        unsafe fn decode(
13330            &mut self,
13331            decoder: &mut fidl::encoding::Decoder<
13332                '_,
13333                fidl::encoding::DefaultFuchsiaResourceDialect,
13334            >,
13335            offset: usize,
13336            _depth: fidl::encoding::Depth,
13337        ) -> fidl::Result<()> {
13338            decoder.debug_check_bounds::<Self>(offset);
13339            // Verify that padding bytes are zero.
13340            fidl::decode!(
13341                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobIdIteratorMarker>>,
13342                fidl::encoding::DefaultFuchsiaResourceDialect,
13343                &mut self.iterator,
13344                decoder,
13345                offset + 0,
13346                _depth
13347            )?;
13348            Ok(())
13349        }
13350    }
13351
13352    impl CupData {
13353        #[inline(always)]
13354        fn max_ordinal_present(&self) -> u64 {
13355            if let Some(_) = self.signature {
13356                return 5;
13357            }
13358            if let Some(_) = self.response {
13359                return 4;
13360            }
13361            if let Some(_) = self.nonce {
13362                return 3;
13363            }
13364            if let Some(_) = self.key_id {
13365                return 2;
13366            }
13367            if let Some(_) = self.request {
13368                return 1;
13369            }
13370            0
13371        }
13372    }
13373
13374    impl fidl::encoding::ValueTypeMarker for CupData {
13375        type Borrowed<'a> = &'a Self;
13376        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13377            value
13378        }
13379    }
13380
13381    unsafe impl fidl::encoding::TypeMarker for CupData {
13382        type Owned = Self;
13383
13384        #[inline(always)]
13385        fn inline_align(_context: fidl::encoding::Context) -> usize {
13386            8
13387        }
13388
13389        #[inline(always)]
13390        fn inline_size(_context: fidl::encoding::Context) -> usize {
13391            16
13392        }
13393    }
13394
13395    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CupData, D> for &CupData {
13396        unsafe fn encode(
13397            self,
13398            encoder: &mut fidl::encoding::Encoder<'_, D>,
13399            offset: usize,
13400            mut depth: fidl::encoding::Depth,
13401        ) -> fidl::Result<()> {
13402            encoder.debug_check_bounds::<CupData>(offset);
13403            // Vector header
13404            let max_ordinal: u64 = self.max_ordinal_present();
13405            encoder.write_num(max_ordinal, offset);
13406            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13407            // Calling encoder.out_of_line_offset(0) is not allowed.
13408            if max_ordinal == 0 {
13409                return Ok(());
13410            }
13411            depth.increment()?;
13412            let envelope_size = 8;
13413            let bytes_len = max_ordinal as usize * envelope_size;
13414            #[allow(unused_variables)]
13415            let offset = encoder.out_of_line_offset(bytes_len);
13416            let mut _prev_end_offset: usize = 0;
13417            if 1 > max_ordinal {
13418                return Ok(());
13419            }
13420
13421            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13422            // are envelope_size bytes.
13423            let cur_offset: usize = (1 - 1) * envelope_size;
13424
13425            // Zero reserved fields.
13426            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13427
13428            // Safety:
13429            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13430            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13431            //   envelope_size bytes, there is always sufficient room.
13432            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 65536>, D>(
13433                self.request.as_ref().map(
13434                    <fidl::encoding::Vector<u8, 65536> as fidl::encoding::ValueTypeMarker>::borrow,
13435                ),
13436                encoder,
13437                offset + cur_offset,
13438                depth,
13439            )?;
13440
13441            _prev_end_offset = cur_offset + envelope_size;
13442            if 2 > max_ordinal {
13443                return Ok(());
13444            }
13445
13446            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13447            // are envelope_size bytes.
13448            let cur_offset: usize = (2 - 1) * envelope_size;
13449
13450            // Zero reserved fields.
13451            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13452
13453            // Safety:
13454            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13455            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13456            //   envelope_size bytes, there is always sufficient room.
13457            fidl::encoding::encode_in_envelope_optional::<u64, D>(
13458                self.key_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13459                encoder,
13460                offset + cur_offset,
13461                depth,
13462            )?;
13463
13464            _prev_end_offset = cur_offset + envelope_size;
13465            if 3 > max_ordinal {
13466                return Ok(());
13467            }
13468
13469            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13470            // are envelope_size bytes.
13471            let cur_offset: usize = (3 - 1) * envelope_size;
13472
13473            // Zero reserved fields.
13474            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13475
13476            // Safety:
13477            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13478            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13479            //   envelope_size bytes, there is always sufficient room.
13480            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 32>, D>(
13481                self.nonce.as_ref().map(
13482                    <fidl::encoding::Array<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
13483                ),
13484                encoder,
13485                offset + cur_offset,
13486                depth,
13487            )?;
13488
13489            _prev_end_offset = cur_offset + envelope_size;
13490            if 4 > max_ordinal {
13491                return Ok(());
13492            }
13493
13494            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13495            // are envelope_size bytes.
13496            let cur_offset: usize = (4 - 1) * envelope_size;
13497
13498            // Zero reserved fields.
13499            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13500
13501            // Safety:
13502            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13503            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13504            //   envelope_size bytes, there is always sufficient room.
13505            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 65536>, D>(
13506                self.response.as_ref().map(
13507                    <fidl::encoding::Vector<u8, 65536> as fidl::encoding::ValueTypeMarker>::borrow,
13508                ),
13509                encoder,
13510                offset + cur_offset,
13511                depth,
13512            )?;
13513
13514            _prev_end_offset = cur_offset + envelope_size;
13515            if 5 > max_ordinal {
13516                return Ok(());
13517            }
13518
13519            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13520            // are envelope_size bytes.
13521            let cur_offset: usize = (5 - 1) * envelope_size;
13522
13523            // Zero reserved fields.
13524            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13525
13526            // Safety:
13527            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13528            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13529            //   envelope_size bytes, there is always sufficient room.
13530            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 72>, D>(
13531                self.signature.as_ref().map(
13532                    <fidl::encoding::Vector<u8, 72> as fidl::encoding::ValueTypeMarker>::borrow,
13533                ),
13534                encoder,
13535                offset + cur_offset,
13536                depth,
13537            )?;
13538
13539            _prev_end_offset = cur_offset + envelope_size;
13540
13541            Ok(())
13542        }
13543    }
13544
13545    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CupData {
13546        #[inline(always)]
13547        fn new_empty() -> Self {
13548            Self::default()
13549        }
13550
13551        unsafe fn decode(
13552            &mut self,
13553            decoder: &mut fidl::encoding::Decoder<'_, D>,
13554            offset: usize,
13555            mut depth: fidl::encoding::Depth,
13556        ) -> fidl::Result<()> {
13557            decoder.debug_check_bounds::<Self>(offset);
13558            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13559                None => return Err(fidl::Error::NotNullable),
13560                Some(len) => len,
13561            };
13562            // Calling decoder.out_of_line_offset(0) is not allowed.
13563            if len == 0 {
13564                return Ok(());
13565            };
13566            depth.increment()?;
13567            let envelope_size = 8;
13568            let bytes_len = len * envelope_size;
13569            let offset = decoder.out_of_line_offset(bytes_len)?;
13570            // Decode the envelope for each type.
13571            let mut _next_ordinal_to_read = 0;
13572            let mut next_offset = offset;
13573            let end_offset = offset + bytes_len;
13574            _next_ordinal_to_read += 1;
13575            if next_offset >= end_offset {
13576                return Ok(());
13577            }
13578
13579            // Decode unknown envelopes for gaps in ordinals.
13580            while _next_ordinal_to_read < 1 {
13581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13582                _next_ordinal_to_read += 1;
13583                next_offset += envelope_size;
13584            }
13585
13586            let next_out_of_line = decoder.next_out_of_line();
13587            let handles_before = decoder.remaining_handles();
13588            if let Some((inlined, num_bytes, num_handles)) =
13589                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13590            {
13591                let member_inline_size =
13592                    <fidl::encoding::Vector<u8, 65536> as fidl::encoding::TypeMarker>::inline_size(
13593                        decoder.context,
13594                    );
13595                if inlined != (member_inline_size <= 4) {
13596                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13597                }
13598                let inner_offset;
13599                let mut inner_depth = depth.clone();
13600                if inlined {
13601                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13602                    inner_offset = next_offset;
13603                } else {
13604                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13605                    inner_depth.increment()?;
13606                }
13607                let val_ref = self
13608                    .request
13609                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 65536>, D));
13610                fidl::decode!(fidl::encoding::Vector<u8, 65536>, D, val_ref, decoder, inner_offset, inner_depth)?;
13611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13612                {
13613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13614                }
13615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13617                }
13618            }
13619
13620            next_offset += envelope_size;
13621            _next_ordinal_to_read += 1;
13622            if next_offset >= end_offset {
13623                return Ok(());
13624            }
13625
13626            // Decode unknown envelopes for gaps in ordinals.
13627            while _next_ordinal_to_read < 2 {
13628                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13629                _next_ordinal_to_read += 1;
13630                next_offset += envelope_size;
13631            }
13632
13633            let next_out_of_line = decoder.next_out_of_line();
13634            let handles_before = decoder.remaining_handles();
13635            if let Some((inlined, num_bytes, num_handles)) =
13636                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13637            {
13638                let member_inline_size =
13639                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13640                if inlined != (member_inline_size <= 4) {
13641                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13642                }
13643                let inner_offset;
13644                let mut inner_depth = depth.clone();
13645                if inlined {
13646                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13647                    inner_offset = next_offset;
13648                } else {
13649                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13650                    inner_depth.increment()?;
13651                }
13652                let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
13653                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
13654                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13655                {
13656                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13657                }
13658                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13659                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13660                }
13661            }
13662
13663            next_offset += envelope_size;
13664            _next_ordinal_to_read += 1;
13665            if next_offset >= end_offset {
13666                return Ok(());
13667            }
13668
13669            // Decode unknown envelopes for gaps in ordinals.
13670            while _next_ordinal_to_read < 3 {
13671                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13672                _next_ordinal_to_read += 1;
13673                next_offset += envelope_size;
13674            }
13675
13676            let next_out_of_line = decoder.next_out_of_line();
13677            let handles_before = decoder.remaining_handles();
13678            if let Some((inlined, num_bytes, num_handles)) =
13679                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13680            {
13681                let member_inline_size =
13682                    <fidl::encoding::Array<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
13683                        decoder.context,
13684                    );
13685                if inlined != (member_inline_size <= 4) {
13686                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13687                }
13688                let inner_offset;
13689                let mut inner_depth = depth.clone();
13690                if inlined {
13691                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13692                    inner_offset = next_offset;
13693                } else {
13694                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13695                    inner_depth.increment()?;
13696                }
13697                let val_ref = self
13698                    .nonce
13699                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 32>, D));
13700                fidl::decode!(fidl::encoding::Array<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
13701                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13702                {
13703                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13704                }
13705                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13706                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13707                }
13708            }
13709
13710            next_offset += envelope_size;
13711            _next_ordinal_to_read += 1;
13712            if next_offset >= end_offset {
13713                return Ok(());
13714            }
13715
13716            // Decode unknown envelopes for gaps in ordinals.
13717            while _next_ordinal_to_read < 4 {
13718                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13719                _next_ordinal_to_read += 1;
13720                next_offset += envelope_size;
13721            }
13722
13723            let next_out_of_line = decoder.next_out_of_line();
13724            let handles_before = decoder.remaining_handles();
13725            if let Some((inlined, num_bytes, num_handles)) =
13726                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13727            {
13728                let member_inline_size =
13729                    <fidl::encoding::Vector<u8, 65536> as fidl::encoding::TypeMarker>::inline_size(
13730                        decoder.context,
13731                    );
13732                if inlined != (member_inline_size <= 4) {
13733                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13734                }
13735                let inner_offset;
13736                let mut inner_depth = depth.clone();
13737                if inlined {
13738                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13739                    inner_offset = next_offset;
13740                } else {
13741                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13742                    inner_depth.increment()?;
13743                }
13744                let val_ref = self
13745                    .response
13746                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 65536>, D));
13747                fidl::decode!(fidl::encoding::Vector<u8, 65536>, D, val_ref, decoder, inner_offset, inner_depth)?;
13748                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13749                {
13750                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13751                }
13752                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13753                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13754                }
13755            }
13756
13757            next_offset += envelope_size;
13758            _next_ordinal_to_read += 1;
13759            if next_offset >= end_offset {
13760                return Ok(());
13761            }
13762
13763            // Decode unknown envelopes for gaps in ordinals.
13764            while _next_ordinal_to_read < 5 {
13765                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13766                _next_ordinal_to_read += 1;
13767                next_offset += envelope_size;
13768            }
13769
13770            let next_out_of_line = decoder.next_out_of_line();
13771            let handles_before = decoder.remaining_handles();
13772            if let Some((inlined, num_bytes, num_handles)) =
13773                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13774            {
13775                let member_inline_size =
13776                    <fidl::encoding::Vector<u8, 72> as fidl::encoding::TypeMarker>::inline_size(
13777                        decoder.context,
13778                    );
13779                if inlined != (member_inline_size <= 4) {
13780                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13781                }
13782                let inner_offset;
13783                let mut inner_depth = depth.clone();
13784                if inlined {
13785                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13786                    inner_offset = next_offset;
13787                } else {
13788                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13789                    inner_depth.increment()?;
13790                }
13791                let val_ref = self
13792                    .signature
13793                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 72>, D));
13794                fidl::decode!(fidl::encoding::Vector<u8, 72>, D, val_ref, decoder, inner_offset, inner_depth)?;
13795                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13796                {
13797                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13798                }
13799                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13800                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13801                }
13802            }
13803
13804            next_offset += envelope_size;
13805
13806            // Decode the remaining unknown envelopes.
13807            while next_offset < end_offset {
13808                _next_ordinal_to_read += 1;
13809                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13810                next_offset += envelope_size;
13811            }
13812
13813            Ok(())
13814        }
13815    }
13816
13817    impl MirrorConfig {
13818        #[inline(always)]
13819        fn max_ordinal_present(&self) -> u64 {
13820            if let Some(_) = self.blob_mirror_url {
13821                return 4;
13822            }
13823            if let Some(_) = self.subscribe {
13824                return 2;
13825            }
13826            if let Some(_) = self.mirror_url {
13827                return 1;
13828            }
13829            0
13830        }
13831    }
13832
13833    impl fidl::encoding::ValueTypeMarker for MirrorConfig {
13834        type Borrowed<'a> = &'a Self;
13835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
13836            value
13837        }
13838    }
13839
13840    unsafe impl fidl::encoding::TypeMarker for MirrorConfig {
13841        type Owned = Self;
13842
13843        #[inline(always)]
13844        fn inline_align(_context: fidl::encoding::Context) -> usize {
13845            8
13846        }
13847
13848        #[inline(always)]
13849        fn inline_size(_context: fidl::encoding::Context) -> usize {
13850            16
13851        }
13852    }
13853
13854    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MirrorConfig, D>
13855        for &MirrorConfig
13856    {
13857        unsafe fn encode(
13858            self,
13859            encoder: &mut fidl::encoding::Encoder<'_, D>,
13860            offset: usize,
13861            mut depth: fidl::encoding::Depth,
13862        ) -> fidl::Result<()> {
13863            encoder.debug_check_bounds::<MirrorConfig>(offset);
13864            // Vector header
13865            let max_ordinal: u64 = self.max_ordinal_present();
13866            encoder.write_num(max_ordinal, offset);
13867            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13868            // Calling encoder.out_of_line_offset(0) is not allowed.
13869            if max_ordinal == 0 {
13870                return Ok(());
13871            }
13872            depth.increment()?;
13873            let envelope_size = 8;
13874            let bytes_len = max_ordinal as usize * envelope_size;
13875            #[allow(unused_variables)]
13876            let offset = encoder.out_of_line_offset(bytes_len);
13877            let mut _prev_end_offset: usize = 0;
13878            if 1 > max_ordinal {
13879                return Ok(());
13880            }
13881
13882            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13883            // are envelope_size bytes.
13884            let cur_offset: usize = (1 - 1) * envelope_size;
13885
13886            // Zero reserved fields.
13887            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13888
13889            // Safety:
13890            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13891            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13892            //   envelope_size bytes, there is always sufficient room.
13893            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
13894                self.mirror_url.as_ref().map(
13895                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
13896                ),
13897                encoder,
13898                offset + cur_offset,
13899                depth,
13900            )?;
13901
13902            _prev_end_offset = cur_offset + envelope_size;
13903            if 2 > max_ordinal {
13904                return Ok(());
13905            }
13906
13907            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13908            // are envelope_size bytes.
13909            let cur_offset: usize = (2 - 1) * envelope_size;
13910
13911            // Zero reserved fields.
13912            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13913
13914            // Safety:
13915            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13916            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13917            //   envelope_size bytes, there is always sufficient room.
13918            fidl::encoding::encode_in_envelope_optional::<bool, D>(
13919                self.subscribe.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
13920                encoder,
13921                offset + cur_offset,
13922                depth,
13923            )?;
13924
13925            _prev_end_offset = cur_offset + envelope_size;
13926            if 4 > max_ordinal {
13927                return Ok(());
13928            }
13929
13930            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13931            // are envelope_size bytes.
13932            let cur_offset: usize = (4 - 1) * envelope_size;
13933
13934            // Zero reserved fields.
13935            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13936
13937            // Safety:
13938            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13939            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13940            //   envelope_size bytes, there is always sufficient room.
13941            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
13942                self.blob_mirror_url.as_ref().map(
13943                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
13944                ),
13945                encoder,
13946                offset + cur_offset,
13947                depth,
13948            )?;
13949
13950            _prev_end_offset = cur_offset + envelope_size;
13951
13952            Ok(())
13953        }
13954    }
13955
13956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MirrorConfig {
13957        #[inline(always)]
13958        fn new_empty() -> Self {
13959            Self::default()
13960        }
13961
13962        unsafe fn decode(
13963            &mut self,
13964            decoder: &mut fidl::encoding::Decoder<'_, D>,
13965            offset: usize,
13966            mut depth: fidl::encoding::Depth,
13967        ) -> fidl::Result<()> {
13968            decoder.debug_check_bounds::<Self>(offset);
13969            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13970                None => return Err(fidl::Error::NotNullable),
13971                Some(len) => len,
13972            };
13973            // Calling decoder.out_of_line_offset(0) is not allowed.
13974            if len == 0 {
13975                return Ok(());
13976            };
13977            depth.increment()?;
13978            let envelope_size = 8;
13979            let bytes_len = len * envelope_size;
13980            let offset = decoder.out_of_line_offset(bytes_len)?;
13981            // Decode the envelope for each type.
13982            let mut _next_ordinal_to_read = 0;
13983            let mut next_offset = offset;
13984            let end_offset = offset + bytes_len;
13985            _next_ordinal_to_read += 1;
13986            if next_offset >= end_offset {
13987                return Ok(());
13988            }
13989
13990            // Decode unknown envelopes for gaps in ordinals.
13991            while _next_ordinal_to_read < 1 {
13992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13993                _next_ordinal_to_read += 1;
13994                next_offset += envelope_size;
13995            }
13996
13997            let next_out_of_line = decoder.next_out_of_line();
13998            let handles_before = decoder.remaining_handles();
13999            if let Some((inlined, num_bytes, num_handles)) =
14000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14001            {
14002                let member_inline_size =
14003                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14004                        decoder.context,
14005                    );
14006                if inlined != (member_inline_size <= 4) {
14007                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14008                }
14009                let inner_offset;
14010                let mut inner_depth = depth.clone();
14011                if inlined {
14012                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14013                    inner_offset = next_offset;
14014                } else {
14015                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14016                    inner_depth.increment()?;
14017                }
14018                let val_ref = self
14019                    .mirror_url
14020                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
14021                fidl::decode!(
14022                    fidl::encoding::UnboundedString,
14023                    D,
14024                    val_ref,
14025                    decoder,
14026                    inner_offset,
14027                    inner_depth
14028                )?;
14029                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14030                {
14031                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14032                }
14033                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14034                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14035                }
14036            }
14037
14038            next_offset += envelope_size;
14039            _next_ordinal_to_read += 1;
14040            if next_offset >= end_offset {
14041                return Ok(());
14042            }
14043
14044            // Decode unknown envelopes for gaps in ordinals.
14045            while _next_ordinal_to_read < 2 {
14046                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14047                _next_ordinal_to_read += 1;
14048                next_offset += envelope_size;
14049            }
14050
14051            let next_out_of_line = decoder.next_out_of_line();
14052            let handles_before = decoder.remaining_handles();
14053            if let Some((inlined, num_bytes, num_handles)) =
14054                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14055            {
14056                let member_inline_size =
14057                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14058                if inlined != (member_inline_size <= 4) {
14059                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14060                }
14061                let inner_offset;
14062                let mut inner_depth = depth.clone();
14063                if inlined {
14064                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14065                    inner_offset = next_offset;
14066                } else {
14067                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14068                    inner_depth.increment()?;
14069                }
14070                let val_ref = self.subscribe.get_or_insert_with(|| fidl::new_empty!(bool, D));
14071                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
14072                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14073                {
14074                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14075                }
14076                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14077                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14078                }
14079            }
14080
14081            next_offset += envelope_size;
14082            _next_ordinal_to_read += 1;
14083            if next_offset >= end_offset {
14084                return Ok(());
14085            }
14086
14087            // Decode unknown envelopes for gaps in ordinals.
14088            while _next_ordinal_to_read < 4 {
14089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14090                _next_ordinal_to_read += 1;
14091                next_offset += envelope_size;
14092            }
14093
14094            let next_out_of_line = decoder.next_out_of_line();
14095            let handles_before = decoder.remaining_handles();
14096            if let Some((inlined, num_bytes, num_handles)) =
14097                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14098            {
14099                let member_inline_size =
14100                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14101                        decoder.context,
14102                    );
14103                if inlined != (member_inline_size <= 4) {
14104                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14105                }
14106                let inner_offset;
14107                let mut inner_depth = depth.clone();
14108                if inlined {
14109                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14110                    inner_offset = next_offset;
14111                } else {
14112                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14113                    inner_depth.increment()?;
14114                }
14115                let val_ref = self
14116                    .blob_mirror_url
14117                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
14118                fidl::decode!(
14119                    fidl::encoding::UnboundedString,
14120                    D,
14121                    val_ref,
14122                    decoder,
14123                    inner_offset,
14124                    inner_depth
14125                )?;
14126                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14127                {
14128                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14129                }
14130                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14131                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14132                }
14133            }
14134
14135            next_offset += envelope_size;
14136
14137            // Decode the remaining unknown envelopes.
14138            while next_offset < end_offset {
14139                _next_ordinal_to_read += 1;
14140                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14141                next_offset += envelope_size;
14142            }
14143
14144            Ok(())
14145        }
14146    }
14147
14148    impl RepositoryConfig {
14149        #[inline(always)]
14150        fn max_ordinal_present(&self) -> u64 {
14151            if let Some(_) = self.storage_type {
14152                return 8;
14153            }
14154            if let Some(_) = self.use_local_mirror {
14155                return 7;
14156            }
14157            if let Some(_) = self.root_threshold {
14158                return 6;
14159            }
14160            if let Some(_) = self.root_version {
14161                return 5;
14162            }
14163            if let Some(_) = self.mirrors {
14164                return 3;
14165            }
14166            if let Some(_) = self.root_keys {
14167                return 2;
14168            }
14169            if let Some(_) = self.repo_url {
14170                return 1;
14171            }
14172            0
14173        }
14174    }
14175
14176    impl fidl::encoding::ValueTypeMarker for RepositoryConfig {
14177        type Borrowed<'a> = &'a Self;
14178        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14179            value
14180        }
14181    }
14182
14183    unsafe impl fidl::encoding::TypeMarker for RepositoryConfig {
14184        type Owned = Self;
14185
14186        #[inline(always)]
14187        fn inline_align(_context: fidl::encoding::Context) -> usize {
14188            8
14189        }
14190
14191        #[inline(always)]
14192        fn inline_size(_context: fidl::encoding::Context) -> usize {
14193            16
14194        }
14195    }
14196
14197    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RepositoryConfig, D>
14198        for &RepositoryConfig
14199    {
14200        unsafe fn encode(
14201            self,
14202            encoder: &mut fidl::encoding::Encoder<'_, D>,
14203            offset: usize,
14204            mut depth: fidl::encoding::Depth,
14205        ) -> fidl::Result<()> {
14206            encoder.debug_check_bounds::<RepositoryConfig>(offset);
14207            // Vector header
14208            let max_ordinal: u64 = self.max_ordinal_present();
14209            encoder.write_num(max_ordinal, offset);
14210            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14211            // Calling encoder.out_of_line_offset(0) is not allowed.
14212            if max_ordinal == 0 {
14213                return Ok(());
14214            }
14215            depth.increment()?;
14216            let envelope_size = 8;
14217            let bytes_len = max_ordinal as usize * envelope_size;
14218            #[allow(unused_variables)]
14219            let offset = encoder.out_of_line_offset(bytes_len);
14220            let mut _prev_end_offset: usize = 0;
14221            if 1 > max_ordinal {
14222                return Ok(());
14223            }
14224
14225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14226            // are envelope_size bytes.
14227            let cur_offset: usize = (1 - 1) * envelope_size;
14228
14229            // Zero reserved fields.
14230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14231
14232            // Safety:
14233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14235            //   envelope_size bytes, there is always sufficient room.
14236            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
14237                self.repo_url.as_ref().map(
14238                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
14239                ),
14240                encoder,
14241                offset + cur_offset,
14242                depth,
14243            )?;
14244
14245            _prev_end_offset = cur_offset + envelope_size;
14246            if 2 > max_ordinal {
14247                return Ok(());
14248            }
14249
14250            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14251            // are envelope_size bytes.
14252            let cur_offset: usize = (2 - 1) * envelope_size;
14253
14254            // Zero reserved fields.
14255            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14256
14257            // Safety:
14258            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14259            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14260            //   envelope_size bytes, there is always sufficient room.
14261            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<RepositoryKeyConfig>, D>(
14262            self.root_keys.as_ref().map(<fidl::encoding::UnboundedVector<RepositoryKeyConfig> as fidl::encoding::ValueTypeMarker>::borrow),
14263            encoder, offset + cur_offset, depth
14264        )?;
14265
14266            _prev_end_offset = cur_offset + envelope_size;
14267            if 3 > max_ordinal {
14268                return Ok(());
14269            }
14270
14271            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14272            // are envelope_size bytes.
14273            let cur_offset: usize = (3 - 1) * envelope_size;
14274
14275            // Zero reserved fields.
14276            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14277
14278            // Safety:
14279            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14280            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14281            //   envelope_size bytes, there is always sufficient room.
14282            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<MirrorConfig>, D>(
14283            self.mirrors.as_ref().map(<fidl::encoding::UnboundedVector<MirrorConfig> as fidl::encoding::ValueTypeMarker>::borrow),
14284            encoder, offset + cur_offset, depth
14285        )?;
14286
14287            _prev_end_offset = cur_offset + envelope_size;
14288            if 5 > max_ordinal {
14289                return Ok(());
14290            }
14291
14292            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14293            // are envelope_size bytes.
14294            let cur_offset: usize = (5 - 1) * envelope_size;
14295
14296            // Zero reserved fields.
14297            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14298
14299            // Safety:
14300            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14301            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14302            //   envelope_size bytes, there is always sufficient room.
14303            fidl::encoding::encode_in_envelope_optional::<u32, D>(
14304                self.root_version.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
14305                encoder,
14306                offset + cur_offset,
14307                depth,
14308            )?;
14309
14310            _prev_end_offset = cur_offset + envelope_size;
14311            if 6 > max_ordinal {
14312                return Ok(());
14313            }
14314
14315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14316            // are envelope_size bytes.
14317            let cur_offset: usize = (6 - 1) * envelope_size;
14318
14319            // Zero reserved fields.
14320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14321
14322            // Safety:
14323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14325            //   envelope_size bytes, there is always sufficient room.
14326            fidl::encoding::encode_in_envelope_optional::<u32, D>(
14327                self.root_threshold.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
14328                encoder,
14329                offset + cur_offset,
14330                depth,
14331            )?;
14332
14333            _prev_end_offset = cur_offset + envelope_size;
14334            if 7 > max_ordinal {
14335                return Ok(());
14336            }
14337
14338            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14339            // are envelope_size bytes.
14340            let cur_offset: usize = (7 - 1) * envelope_size;
14341
14342            // Zero reserved fields.
14343            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14344
14345            // Safety:
14346            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14347            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14348            //   envelope_size bytes, there is always sufficient room.
14349            fidl::encoding::encode_in_envelope_optional::<bool, D>(
14350                self.use_local_mirror
14351                    .as_ref()
14352                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14353                encoder,
14354                offset + cur_offset,
14355                depth,
14356            )?;
14357
14358            _prev_end_offset = cur_offset + envelope_size;
14359            if 8 > max_ordinal {
14360                return Ok(());
14361            }
14362
14363            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14364            // are envelope_size bytes.
14365            let cur_offset: usize = (8 - 1) * envelope_size;
14366
14367            // Zero reserved fields.
14368            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14369
14370            // Safety:
14371            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14372            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14373            //   envelope_size bytes, there is always sufficient room.
14374            fidl::encoding::encode_in_envelope_optional::<RepositoryStorageType, D>(
14375                self.storage_type
14376                    .as_ref()
14377                    .map(<RepositoryStorageType as fidl::encoding::ValueTypeMarker>::borrow),
14378                encoder,
14379                offset + cur_offset,
14380                depth,
14381            )?;
14382
14383            _prev_end_offset = cur_offset + envelope_size;
14384
14385            Ok(())
14386        }
14387    }
14388
14389    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepositoryConfig {
14390        #[inline(always)]
14391        fn new_empty() -> Self {
14392            Self::default()
14393        }
14394
14395        unsafe fn decode(
14396            &mut self,
14397            decoder: &mut fidl::encoding::Decoder<'_, D>,
14398            offset: usize,
14399            mut depth: fidl::encoding::Depth,
14400        ) -> fidl::Result<()> {
14401            decoder.debug_check_bounds::<Self>(offset);
14402            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14403                None => return Err(fidl::Error::NotNullable),
14404                Some(len) => len,
14405            };
14406            // Calling decoder.out_of_line_offset(0) is not allowed.
14407            if len == 0 {
14408                return Ok(());
14409            };
14410            depth.increment()?;
14411            let envelope_size = 8;
14412            let bytes_len = len * envelope_size;
14413            let offset = decoder.out_of_line_offset(bytes_len)?;
14414            // Decode the envelope for each type.
14415            let mut _next_ordinal_to_read = 0;
14416            let mut next_offset = offset;
14417            let end_offset = offset + bytes_len;
14418            _next_ordinal_to_read += 1;
14419            if next_offset >= end_offset {
14420                return Ok(());
14421            }
14422
14423            // Decode unknown envelopes for gaps in ordinals.
14424            while _next_ordinal_to_read < 1 {
14425                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14426                _next_ordinal_to_read += 1;
14427                next_offset += envelope_size;
14428            }
14429
14430            let next_out_of_line = decoder.next_out_of_line();
14431            let handles_before = decoder.remaining_handles();
14432            if let Some((inlined, num_bytes, num_handles)) =
14433                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14434            {
14435                let member_inline_size =
14436                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14437                        decoder.context,
14438                    );
14439                if inlined != (member_inline_size <= 4) {
14440                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14441                }
14442                let inner_offset;
14443                let mut inner_depth = depth.clone();
14444                if inlined {
14445                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14446                    inner_offset = next_offset;
14447                } else {
14448                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14449                    inner_depth.increment()?;
14450                }
14451                let val_ref = self
14452                    .repo_url
14453                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
14454                fidl::decode!(
14455                    fidl::encoding::UnboundedString,
14456                    D,
14457                    val_ref,
14458                    decoder,
14459                    inner_offset,
14460                    inner_depth
14461                )?;
14462                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14463                {
14464                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14465                }
14466                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14467                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14468                }
14469            }
14470
14471            next_offset += envelope_size;
14472            _next_ordinal_to_read += 1;
14473            if next_offset >= end_offset {
14474                return Ok(());
14475            }
14476
14477            // Decode unknown envelopes for gaps in ordinals.
14478            while _next_ordinal_to_read < 2 {
14479                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14480                _next_ordinal_to_read += 1;
14481                next_offset += envelope_size;
14482            }
14483
14484            let next_out_of_line = decoder.next_out_of_line();
14485            let handles_before = decoder.remaining_handles();
14486            if let Some((inlined, num_bytes, num_handles)) =
14487                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14488            {
14489                let member_inline_size = <fidl::encoding::UnboundedVector<RepositoryKeyConfig> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14490                if inlined != (member_inline_size <= 4) {
14491                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14492                }
14493                let inner_offset;
14494                let mut inner_depth = depth.clone();
14495                if inlined {
14496                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14497                    inner_offset = next_offset;
14498                } else {
14499                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14500                    inner_depth.increment()?;
14501                }
14502                let val_ref = self.root_keys.get_or_insert_with(|| {
14503                    fidl::new_empty!(fidl::encoding::UnboundedVector<RepositoryKeyConfig>, D)
14504                });
14505                fidl::decode!(
14506                    fidl::encoding::UnboundedVector<RepositoryKeyConfig>,
14507                    D,
14508                    val_ref,
14509                    decoder,
14510                    inner_offset,
14511                    inner_depth
14512                )?;
14513                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14514                {
14515                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14516                }
14517                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14518                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14519                }
14520            }
14521
14522            next_offset += envelope_size;
14523            _next_ordinal_to_read += 1;
14524            if next_offset >= end_offset {
14525                return Ok(());
14526            }
14527
14528            // Decode unknown envelopes for gaps in ordinals.
14529            while _next_ordinal_to_read < 3 {
14530                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14531                _next_ordinal_to_read += 1;
14532                next_offset += envelope_size;
14533            }
14534
14535            let next_out_of_line = decoder.next_out_of_line();
14536            let handles_before = decoder.remaining_handles();
14537            if let Some((inlined, num_bytes, num_handles)) =
14538                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14539            {
14540                let member_inline_size = <fidl::encoding::UnboundedVector<MirrorConfig> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14541                if inlined != (member_inline_size <= 4) {
14542                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14543                }
14544                let inner_offset;
14545                let mut inner_depth = depth.clone();
14546                if inlined {
14547                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14548                    inner_offset = next_offset;
14549                } else {
14550                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14551                    inner_depth.increment()?;
14552                }
14553                let val_ref = self.mirrors.get_or_insert_with(|| {
14554                    fidl::new_empty!(fidl::encoding::UnboundedVector<MirrorConfig>, D)
14555                });
14556                fidl::decode!(
14557                    fidl::encoding::UnboundedVector<MirrorConfig>,
14558                    D,
14559                    val_ref,
14560                    decoder,
14561                    inner_offset,
14562                    inner_depth
14563                )?;
14564                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14565                {
14566                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14567                }
14568                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14569                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14570                }
14571            }
14572
14573            next_offset += envelope_size;
14574            _next_ordinal_to_read += 1;
14575            if next_offset >= end_offset {
14576                return Ok(());
14577            }
14578
14579            // Decode unknown envelopes for gaps in ordinals.
14580            while _next_ordinal_to_read < 5 {
14581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14582                _next_ordinal_to_read += 1;
14583                next_offset += envelope_size;
14584            }
14585
14586            let next_out_of_line = decoder.next_out_of_line();
14587            let handles_before = decoder.remaining_handles();
14588            if let Some((inlined, num_bytes, num_handles)) =
14589                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14590            {
14591                let member_inline_size =
14592                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14593                if inlined != (member_inline_size <= 4) {
14594                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14595                }
14596                let inner_offset;
14597                let mut inner_depth = depth.clone();
14598                if inlined {
14599                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14600                    inner_offset = next_offset;
14601                } else {
14602                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14603                    inner_depth.increment()?;
14604                }
14605                let val_ref = self.root_version.get_or_insert_with(|| fidl::new_empty!(u32, D));
14606                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
14607                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14608                {
14609                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14610                }
14611                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14612                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14613                }
14614            }
14615
14616            next_offset += envelope_size;
14617            _next_ordinal_to_read += 1;
14618            if next_offset >= end_offset {
14619                return Ok(());
14620            }
14621
14622            // Decode unknown envelopes for gaps in ordinals.
14623            while _next_ordinal_to_read < 6 {
14624                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14625                _next_ordinal_to_read += 1;
14626                next_offset += envelope_size;
14627            }
14628
14629            let next_out_of_line = decoder.next_out_of_line();
14630            let handles_before = decoder.remaining_handles();
14631            if let Some((inlined, num_bytes, num_handles)) =
14632                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14633            {
14634                let member_inline_size =
14635                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14636                if inlined != (member_inline_size <= 4) {
14637                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14638                }
14639                let inner_offset;
14640                let mut inner_depth = depth.clone();
14641                if inlined {
14642                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14643                    inner_offset = next_offset;
14644                } else {
14645                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14646                    inner_depth.increment()?;
14647                }
14648                let val_ref = self.root_threshold.get_or_insert_with(|| fidl::new_empty!(u32, D));
14649                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
14650                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14651                {
14652                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14653                }
14654                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14655                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14656                }
14657            }
14658
14659            next_offset += envelope_size;
14660            _next_ordinal_to_read += 1;
14661            if next_offset >= end_offset {
14662                return Ok(());
14663            }
14664
14665            // Decode unknown envelopes for gaps in ordinals.
14666            while _next_ordinal_to_read < 7 {
14667                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14668                _next_ordinal_to_read += 1;
14669                next_offset += envelope_size;
14670            }
14671
14672            let next_out_of_line = decoder.next_out_of_line();
14673            let handles_before = decoder.remaining_handles();
14674            if let Some((inlined, num_bytes, num_handles)) =
14675                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14676            {
14677                let member_inline_size =
14678                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14679                if inlined != (member_inline_size <= 4) {
14680                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14681                }
14682                let inner_offset;
14683                let mut inner_depth = depth.clone();
14684                if inlined {
14685                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14686                    inner_offset = next_offset;
14687                } else {
14688                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14689                    inner_depth.increment()?;
14690                }
14691                let val_ref =
14692                    self.use_local_mirror.get_or_insert_with(|| fidl::new_empty!(bool, D));
14693                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
14694                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14695                {
14696                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14697                }
14698                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14699                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14700                }
14701            }
14702
14703            next_offset += envelope_size;
14704            _next_ordinal_to_read += 1;
14705            if next_offset >= end_offset {
14706                return Ok(());
14707            }
14708
14709            // Decode unknown envelopes for gaps in ordinals.
14710            while _next_ordinal_to_read < 8 {
14711                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14712                _next_ordinal_to_read += 1;
14713                next_offset += envelope_size;
14714            }
14715
14716            let next_out_of_line = decoder.next_out_of_line();
14717            let handles_before = decoder.remaining_handles();
14718            if let Some((inlined, num_bytes, num_handles)) =
14719                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14720            {
14721                let member_inline_size =
14722                    <RepositoryStorageType as fidl::encoding::TypeMarker>::inline_size(
14723                        decoder.context,
14724                    );
14725                if inlined != (member_inline_size <= 4) {
14726                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14727                }
14728                let inner_offset;
14729                let mut inner_depth = depth.clone();
14730                if inlined {
14731                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14732                    inner_offset = next_offset;
14733                } else {
14734                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14735                    inner_depth.increment()?;
14736                }
14737                let val_ref = self
14738                    .storage_type
14739                    .get_or_insert_with(|| fidl::new_empty!(RepositoryStorageType, D));
14740                fidl::decode!(
14741                    RepositoryStorageType,
14742                    D,
14743                    val_ref,
14744                    decoder,
14745                    inner_offset,
14746                    inner_depth
14747                )?;
14748                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14749                {
14750                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14751                }
14752                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14753                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14754                }
14755            }
14756
14757            next_offset += envelope_size;
14758
14759            // Decode the remaining unknown envelopes.
14760            while next_offset < end_offset {
14761                _next_ordinal_to_read += 1;
14762                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14763                next_offset += envelope_size;
14764            }
14765
14766            Ok(())
14767        }
14768    }
14769
14770    impl fidl::encoding::ResourceTypeMarker for BlobWriter {
14771        type Borrowed<'a> = &'a mut Self;
14772        fn take_or_borrow<'a>(
14773            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14774        ) -> Self::Borrowed<'a> {
14775            value
14776        }
14777    }
14778
14779    unsafe impl fidl::encoding::TypeMarker for BlobWriter {
14780        type Owned = Self;
14781
14782        #[inline(always)]
14783        fn inline_align(_context: fidl::encoding::Context) -> usize {
14784            8
14785        }
14786
14787        #[inline(always)]
14788        fn inline_size(_context: fidl::encoding::Context) -> usize {
14789            16
14790        }
14791    }
14792
14793    unsafe impl fidl::encoding::Encode<BlobWriter, fidl::encoding::DefaultFuchsiaResourceDialect>
14794        for &mut BlobWriter
14795    {
14796        #[inline]
14797        unsafe fn encode(
14798            self,
14799            encoder: &mut fidl::encoding::Encoder<
14800                '_,
14801                fidl::encoding::DefaultFuchsiaResourceDialect,
14802            >,
14803            offset: usize,
14804            _depth: fidl::encoding::Depth,
14805        ) -> fidl::Result<()> {
14806            encoder.debug_check_bounds::<BlobWriter>(offset);
14807            encoder.write_num::<u64>(self.ordinal(), offset);
14808            match self {
14809                BlobWriter::File(ref mut val) => fidl::encoding::encode_in_envelope::<
14810                    fidl::encoding::Endpoint<
14811                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14812                    >,
14813                    fidl::encoding::DefaultFuchsiaResourceDialect,
14814                >(
14815                    <fidl::encoding::Endpoint<
14816                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14817                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14818                        val
14819                    ),
14820                    encoder,
14821                    offset + 8,
14822                    _depth,
14823                ),
14824                BlobWriter::Writer(ref mut val) => fidl::encoding::encode_in_envelope::<
14825                    fidl::encoding::Endpoint<
14826                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
14827                    >,
14828                    fidl::encoding::DefaultFuchsiaResourceDialect,
14829                >(
14830                    <fidl::encoding::Endpoint<
14831                        fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
14832                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14833                        val
14834                    ),
14835                    encoder,
14836                    offset + 8,
14837                    _depth,
14838                ),
14839            }
14840        }
14841    }
14842
14843    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlobWriter {
14844        #[inline(always)]
14845        fn new_empty() -> Self {
14846            Self::File(fidl::new_empty!(
14847                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
14848                fidl::encoding::DefaultFuchsiaResourceDialect
14849            ))
14850        }
14851
14852        #[inline]
14853        unsafe fn decode(
14854            &mut self,
14855            decoder: &mut fidl::encoding::Decoder<
14856                '_,
14857                fidl::encoding::DefaultFuchsiaResourceDialect,
14858            >,
14859            offset: usize,
14860            mut depth: fidl::encoding::Depth,
14861        ) -> fidl::Result<()> {
14862            decoder.debug_check_bounds::<Self>(offset);
14863            #[allow(unused_variables)]
14864            let next_out_of_line = decoder.next_out_of_line();
14865            let handles_before = decoder.remaining_handles();
14866            let (ordinal, inlined, num_bytes, num_handles) =
14867                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
14868
14869            let member_inline_size = match ordinal {
14870                1 => <fidl::encoding::Endpoint<
14871                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14872                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14873                2 => <fidl::encoding::Endpoint<
14874                    fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
14875                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14876                _ => return Err(fidl::Error::UnknownUnionTag),
14877            };
14878
14879            if inlined != (member_inline_size <= 4) {
14880                return Err(fidl::Error::InvalidInlineBitInEnvelope);
14881            }
14882            let _inner_offset;
14883            if inlined {
14884                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
14885                _inner_offset = offset + 8;
14886            } else {
14887                depth.increment()?;
14888                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14889            }
14890            match ordinal {
14891                1 => {
14892                    #[allow(irrefutable_let_patterns)]
14893                    if let BlobWriter::File(_) = self {
14894                        // Do nothing, read the value into the object
14895                    } else {
14896                        // Initialize `self` to the right variant
14897                        *self = BlobWriter::File(fidl::new_empty!(
14898                            fidl::encoding::Endpoint<
14899                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14900                            >,
14901                            fidl::encoding::DefaultFuchsiaResourceDialect
14902                        ));
14903                    }
14904                    #[allow(irrefutable_let_patterns)]
14905                    if let BlobWriter::File(ref mut val) = self {
14906                        fidl::decode!(
14907                            fidl::encoding::Endpoint<
14908                                fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
14909                            >,
14910                            fidl::encoding::DefaultFuchsiaResourceDialect,
14911                            val,
14912                            decoder,
14913                            _inner_offset,
14914                            depth
14915                        )?;
14916                    } else {
14917                        unreachable!()
14918                    }
14919                }
14920                2 => {
14921                    #[allow(irrefutable_let_patterns)]
14922                    if let BlobWriter::Writer(_) = self {
14923                        // Do nothing, read the value into the object
14924                    } else {
14925                        // Initialize `self` to the right variant
14926                        *self = BlobWriter::Writer(fidl::new_empty!(
14927                            fidl::encoding::Endpoint<
14928                                fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
14929                            >,
14930                            fidl::encoding::DefaultFuchsiaResourceDialect
14931                        ));
14932                    }
14933                    #[allow(irrefutable_let_patterns)]
14934                    if let BlobWriter::Writer(ref mut val) = self {
14935                        fidl::decode!(
14936                            fidl::encoding::Endpoint<
14937                                fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::BlobWriterMarker>,
14938                            >,
14939                            fidl::encoding::DefaultFuchsiaResourceDialect,
14940                            val,
14941                            decoder,
14942                            _inner_offset,
14943                            depth
14944                        )?;
14945                    } else {
14946                        unreachable!()
14947                    }
14948                }
14949                ordinal => panic!("unexpected ordinal {:?}", ordinal),
14950            }
14951            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
14952                return Err(fidl::Error::InvalidNumBytesInEnvelope);
14953            }
14954            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14955                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14956            }
14957            Ok(())
14958        }
14959    }
14960
14961    impl fidl::encoding::ValueTypeMarker for RepositoryKeyConfig {
14962        type Borrowed<'a> = &'a Self;
14963        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
14964            value
14965        }
14966    }
14967
14968    unsafe impl fidl::encoding::TypeMarker for RepositoryKeyConfig {
14969        type Owned = Self;
14970
14971        #[inline(always)]
14972        fn inline_align(_context: fidl::encoding::Context) -> usize {
14973            8
14974        }
14975
14976        #[inline(always)]
14977        fn inline_size(_context: fidl::encoding::Context) -> usize {
14978            16
14979        }
14980    }
14981
14982    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RepositoryKeyConfig, D>
14983        for &RepositoryKeyConfig
14984    {
14985        #[inline]
14986        unsafe fn encode(
14987            self,
14988            encoder: &mut fidl::encoding::Encoder<'_, D>,
14989            offset: usize,
14990            _depth: fidl::encoding::Depth,
14991        ) -> fidl::Result<()> {
14992            encoder.debug_check_bounds::<RepositoryKeyConfig>(offset);
14993            encoder.write_num::<u64>(self.ordinal(), offset);
14994            match self {
14995            RepositoryKeyConfig::Ed25519Key(ref val) => {
14996                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u8>, D>(
14997                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(val),
14998                    encoder, offset + 8, _depth
14999                )
15000            }
15001            RepositoryKeyConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
15002        }
15003        }
15004    }
15005
15006    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepositoryKeyConfig {
15007        #[inline(always)]
15008        fn new_empty() -> Self {
15009            Self::__SourceBreaking { unknown_ordinal: 0 }
15010        }
15011
15012        #[inline]
15013        unsafe fn decode(
15014            &mut self,
15015            decoder: &mut fidl::encoding::Decoder<'_, D>,
15016            offset: usize,
15017            mut depth: fidl::encoding::Depth,
15018        ) -> fidl::Result<()> {
15019            decoder.debug_check_bounds::<Self>(offset);
15020            #[allow(unused_variables)]
15021            let next_out_of_line = decoder.next_out_of_line();
15022            let handles_before = decoder.remaining_handles();
15023            let (ordinal, inlined, num_bytes, num_handles) =
15024                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
15025
15026            let member_inline_size = match ordinal {
15027                1 => {
15028                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(
15029                        decoder.context,
15030                    )
15031                }
15032                0 => return Err(fidl::Error::UnknownUnionTag),
15033                _ => num_bytes as usize,
15034            };
15035
15036            if inlined != (member_inline_size <= 4) {
15037                return Err(fidl::Error::InvalidInlineBitInEnvelope);
15038            }
15039            let _inner_offset;
15040            if inlined {
15041                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
15042                _inner_offset = offset + 8;
15043            } else {
15044                depth.increment()?;
15045                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15046            }
15047            match ordinal {
15048                1 => {
15049                    #[allow(irrefutable_let_patterns)]
15050                    if let RepositoryKeyConfig::Ed25519Key(_) = self {
15051                        // Do nothing, read the value into the object
15052                    } else {
15053                        // Initialize `self` to the right variant
15054                        *self = RepositoryKeyConfig::Ed25519Key(fidl::new_empty!(
15055                            fidl::encoding::UnboundedVector<u8>,
15056                            D
15057                        ));
15058                    }
15059                    #[allow(irrefutable_let_patterns)]
15060                    if let RepositoryKeyConfig::Ed25519Key(ref mut val) = self {
15061                        fidl::decode!(
15062                            fidl::encoding::UnboundedVector<u8>,
15063                            D,
15064                            val,
15065                            decoder,
15066                            _inner_offset,
15067                            depth
15068                        )?;
15069                    } else {
15070                        unreachable!()
15071                    }
15072                }
15073                #[allow(deprecated)]
15074                ordinal => {
15075                    for _ in 0..num_handles {
15076                        decoder.drop_next_handle()?;
15077                    }
15078                    *self = RepositoryKeyConfig::__SourceBreaking { unknown_ordinal: ordinal };
15079                }
15080            }
15081            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
15082                return Err(fidl::Error::InvalidNumBytesInEnvelope);
15083            }
15084            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15085                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15086            }
15087            Ok(())
15088        }
15089    }
15090}