Skip to main content

fidl_fuchsia_fxfs/
fidl_fuchsia_fxfs.rs

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