Skip to main content

fidl_fuchsia_fxfs/
fidl_fuchsia_fxfs.rs

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