Skip to main content

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