Skip to main content

fdomain_fuchsia_fxfs/
fdomain_fuchsia_fxfs.rs

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