1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_fxfs__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct BlobCreatorCreateResponse {
16 pub writer: fidl::endpoints::ClientEnd<BlobWriterMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlobCreatorCreateResponse {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct BlobReaderGetVmoResponse {
23 pub vmo: fidl::Vmo,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlobReaderGetVmoResponse {}
27
28#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct BlobWriterGetVmoResponse {
30 pub vmo: fidl::Vmo,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlobWriterGetVmoResponse {}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct FileBackedVolumeProviderOpenRequest {
37 pub parent_directory_token: fidl::NullableHandle,
38 pub name: String,
39 pub server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for FileBackedVolumeProviderOpenRequest
44{
45}
46
47#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
48pub struct BlobCreatorMarker;
49
50impl fidl::endpoints::ProtocolMarker for BlobCreatorMarker {
51 type Proxy = BlobCreatorProxy;
52 type RequestStream = BlobCreatorRequestStream;
53 #[cfg(target_os = "fuchsia")]
54 type SynchronousProxy = BlobCreatorSynchronousProxy;
55
56 const DEBUG_NAME: &'static str = "fuchsia.fxfs.BlobCreator";
57}
58impl fidl::endpoints::DiscoverableProtocolMarker for BlobCreatorMarker {}
59pub type BlobCreatorCreateResult =
60 Result<fidl::endpoints::ClientEnd<BlobWriterMarker>, CreateBlobError>;
61pub type BlobCreatorNeedsOverwriteResult = Result<bool, i32>;
62
63pub trait BlobCreatorProxyInterface: Send + Sync {
64 type CreateResponseFut: std::future::Future<Output = Result<BlobCreatorCreateResult, fidl::Error>>
65 + Send;
66 fn r#create(&self, hash: &[u8; 32], allow_existing: bool) -> Self::CreateResponseFut;
67 type NeedsOverwriteResponseFut: std::future::Future<Output = Result<BlobCreatorNeedsOverwriteResult, fidl::Error>>
68 + Send;
69 fn r#needs_overwrite(&self, blob_hash: &[u8; 32]) -> Self::NeedsOverwriteResponseFut;
70}
71#[derive(Debug)]
72#[cfg(target_os = "fuchsia")]
73pub struct BlobCreatorSynchronousProxy {
74 client: fidl::client::sync::Client,
75}
76
77#[cfg(target_os = "fuchsia")]
78impl fidl::endpoints::SynchronousProxy for BlobCreatorSynchronousProxy {
79 type Proxy = BlobCreatorProxy;
80 type Protocol = BlobCreatorMarker;
81
82 fn from_channel(inner: fidl::Channel) -> Self {
83 Self::new(inner)
84 }
85
86 fn into_channel(self) -> fidl::Channel {
87 self.client.into_channel()
88 }
89
90 fn as_channel(&self) -> &fidl::Channel {
91 self.client.as_channel()
92 }
93}
94
95#[cfg(target_os = "fuchsia")]
96impl BlobCreatorSynchronousProxy {
97 pub fn new(channel: fidl::Channel) -> Self {
98 let protocol_name = <BlobCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
99 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
100 }
101
102 pub fn into_channel(self) -> fidl::Channel {
103 self.client.into_channel()
104 }
105
106 pub fn wait_for_event(
109 &self,
110 deadline: zx::MonotonicInstant,
111 ) -> Result<BlobCreatorEvent, fidl::Error> {
112 BlobCreatorEvent::decode(self.client.wait_for_event(deadline)?)
113 }
114
115 pub fn r#create(
123 &self,
124 mut hash: &[u8; 32],
125 mut allow_existing: bool,
126 ___deadline: zx::MonotonicInstant,
127 ) -> Result<BlobCreatorCreateResult, fidl::Error> {
128 let _response = self.client.send_query::<
129 BlobCreatorCreateRequest,
130 fidl::encoding::ResultType<BlobCreatorCreateResponse, CreateBlobError>,
131 >(
132 (hash, allow_existing,),
133 0x4288fe720cca70d7,
134 fidl::encoding::DynamicFlags::empty(),
135 ___deadline,
136 )?;
137 Ok(_response.map(|x| x.writer))
138 }
139
140 pub fn r#needs_overwrite(
143 &self,
144 mut blob_hash: &[u8; 32],
145 ___deadline: zx::MonotonicInstant,
146 ) -> Result<BlobCreatorNeedsOverwriteResult, fidl::Error> {
147 let _response = self.client.send_query::<
148 BlobCreatorNeedsOverwriteRequest,
149 fidl::encoding::ResultType<BlobCreatorNeedsOverwriteResponse, i32>,
150 >(
151 (blob_hash,),
152 0x512e347a6be3e426,
153 fidl::encoding::DynamicFlags::empty(),
154 ___deadline,
155 )?;
156 Ok(_response.map(|x| x.needs_overwrite))
157 }
158}
159
160#[cfg(target_os = "fuchsia")]
161impl From<BlobCreatorSynchronousProxy> for zx::NullableHandle {
162 fn from(value: BlobCreatorSynchronousProxy) -> Self {
163 value.into_channel().into()
164 }
165}
166
167#[cfg(target_os = "fuchsia")]
168impl From<fidl::Channel> for BlobCreatorSynchronousProxy {
169 fn from(value: fidl::Channel) -> Self {
170 Self::new(value)
171 }
172}
173
174#[cfg(target_os = "fuchsia")]
175impl fidl::endpoints::FromClient for BlobCreatorSynchronousProxy {
176 type Protocol = BlobCreatorMarker;
177
178 fn from_client(value: fidl::endpoints::ClientEnd<BlobCreatorMarker>) -> Self {
179 Self::new(value.into_channel())
180 }
181}
182
183#[derive(Debug, Clone)]
184pub struct BlobCreatorProxy {
185 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
186}
187
188impl fidl::endpoints::Proxy for BlobCreatorProxy {
189 type Protocol = BlobCreatorMarker;
190
191 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
192 Self::new(inner)
193 }
194
195 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
196 self.client.into_channel().map_err(|client| Self { client })
197 }
198
199 fn as_channel(&self) -> &::fidl::AsyncChannel {
200 self.client.as_channel()
201 }
202}
203
204impl BlobCreatorProxy {
205 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
207 let protocol_name = <BlobCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
208 Self { client: fidl::client::Client::new(channel, protocol_name) }
209 }
210
211 pub fn take_event_stream(&self) -> BlobCreatorEventStream {
217 BlobCreatorEventStream { event_receiver: self.client.take_event_receiver() }
218 }
219
220 pub fn r#create(
228 &self,
229 mut hash: &[u8; 32],
230 mut allow_existing: bool,
231 ) -> fidl::client::QueryResponseFut<
232 BlobCreatorCreateResult,
233 fidl::encoding::DefaultFuchsiaResourceDialect,
234 > {
235 BlobCreatorProxyInterface::r#create(self, hash, allow_existing)
236 }
237
238 pub fn r#needs_overwrite(
241 &self,
242 mut blob_hash: &[u8; 32],
243 ) -> fidl::client::QueryResponseFut<
244 BlobCreatorNeedsOverwriteResult,
245 fidl::encoding::DefaultFuchsiaResourceDialect,
246 > {
247 BlobCreatorProxyInterface::r#needs_overwrite(self, blob_hash)
248 }
249}
250
251impl BlobCreatorProxyInterface for BlobCreatorProxy {
252 type CreateResponseFut = fidl::client::QueryResponseFut<
253 BlobCreatorCreateResult,
254 fidl::encoding::DefaultFuchsiaResourceDialect,
255 >;
256 fn r#create(&self, mut hash: &[u8; 32], mut allow_existing: bool) -> Self::CreateResponseFut {
257 fn _decode(
258 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
259 ) -> Result<BlobCreatorCreateResult, fidl::Error> {
260 let _response = fidl::client::decode_transaction_body::<
261 fidl::encoding::ResultType<BlobCreatorCreateResponse, CreateBlobError>,
262 fidl::encoding::DefaultFuchsiaResourceDialect,
263 0x4288fe720cca70d7,
264 >(_buf?)?;
265 Ok(_response.map(|x| x.writer))
266 }
267 self.client.send_query_and_decode::<BlobCreatorCreateRequest, BlobCreatorCreateResult>(
268 (hash, allow_existing),
269 0x4288fe720cca70d7,
270 fidl::encoding::DynamicFlags::empty(),
271 _decode,
272 )
273 }
274
275 type NeedsOverwriteResponseFut = fidl::client::QueryResponseFut<
276 BlobCreatorNeedsOverwriteResult,
277 fidl::encoding::DefaultFuchsiaResourceDialect,
278 >;
279 fn r#needs_overwrite(&self, mut blob_hash: &[u8; 32]) -> Self::NeedsOverwriteResponseFut {
280 fn _decode(
281 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
282 ) -> Result<BlobCreatorNeedsOverwriteResult, fidl::Error> {
283 let _response = fidl::client::decode_transaction_body::<
284 fidl::encoding::ResultType<BlobCreatorNeedsOverwriteResponse, i32>,
285 fidl::encoding::DefaultFuchsiaResourceDialect,
286 0x512e347a6be3e426,
287 >(_buf?)?;
288 Ok(_response.map(|x| x.needs_overwrite))
289 }
290 self.client.send_query_and_decode::<
291 BlobCreatorNeedsOverwriteRequest,
292 BlobCreatorNeedsOverwriteResult,
293 >(
294 (blob_hash,),
295 0x512e347a6be3e426,
296 fidl::encoding::DynamicFlags::empty(),
297 _decode,
298 )
299 }
300}
301
302pub struct BlobCreatorEventStream {
303 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
304}
305
306impl std::marker::Unpin for BlobCreatorEventStream {}
307
308impl futures::stream::FusedStream for BlobCreatorEventStream {
309 fn is_terminated(&self) -> bool {
310 self.event_receiver.is_terminated()
311 }
312}
313
314impl futures::Stream for BlobCreatorEventStream {
315 type Item = Result<BlobCreatorEvent, fidl::Error>;
316
317 fn poll_next(
318 mut self: std::pin::Pin<&mut Self>,
319 cx: &mut std::task::Context<'_>,
320 ) -> std::task::Poll<Option<Self::Item>> {
321 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
322 &mut self.event_receiver,
323 cx
324 )?) {
325 Some(buf) => std::task::Poll::Ready(Some(BlobCreatorEvent::decode(buf))),
326 None => std::task::Poll::Ready(None),
327 }
328 }
329}
330
331#[derive(Debug)]
332pub enum BlobCreatorEvent {}
333
334impl BlobCreatorEvent {
335 fn decode(
337 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
338 ) -> Result<BlobCreatorEvent, fidl::Error> {
339 let (bytes, _handles) = buf.split_mut();
340 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
341 debug_assert_eq!(tx_header.tx_id, 0);
342 match tx_header.ordinal {
343 _ => Err(fidl::Error::UnknownOrdinal {
344 ordinal: tx_header.ordinal,
345 protocol_name: <BlobCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
346 }),
347 }
348 }
349}
350
351pub struct BlobCreatorRequestStream {
353 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
354 is_terminated: bool,
355}
356
357impl std::marker::Unpin for BlobCreatorRequestStream {}
358
359impl futures::stream::FusedStream for BlobCreatorRequestStream {
360 fn is_terminated(&self) -> bool {
361 self.is_terminated
362 }
363}
364
365impl fidl::endpoints::RequestStream for BlobCreatorRequestStream {
366 type Protocol = BlobCreatorMarker;
367 type ControlHandle = BlobCreatorControlHandle;
368
369 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
370 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
371 }
372
373 fn control_handle(&self) -> Self::ControlHandle {
374 BlobCreatorControlHandle { inner: self.inner.clone() }
375 }
376
377 fn into_inner(
378 self,
379 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
380 {
381 (self.inner, self.is_terminated)
382 }
383
384 fn from_inner(
385 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
386 is_terminated: bool,
387 ) -> Self {
388 Self { inner, is_terminated }
389 }
390}
391
392impl futures::Stream for BlobCreatorRequestStream {
393 type Item = Result<BlobCreatorRequest, fidl::Error>;
394
395 fn poll_next(
396 mut self: std::pin::Pin<&mut Self>,
397 cx: &mut std::task::Context<'_>,
398 ) -> std::task::Poll<Option<Self::Item>> {
399 let this = &mut *self;
400 if this.inner.check_shutdown(cx) {
401 this.is_terminated = true;
402 return std::task::Poll::Ready(None);
403 }
404 if this.is_terminated {
405 panic!("polled BlobCreatorRequestStream after completion");
406 }
407 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
408 |bytes, handles| {
409 match this.inner.channel().read_etc(cx, bytes, handles) {
410 std::task::Poll::Ready(Ok(())) => {}
411 std::task::Poll::Pending => return std::task::Poll::Pending,
412 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
413 this.is_terminated = true;
414 return std::task::Poll::Ready(None);
415 }
416 std::task::Poll::Ready(Err(e)) => {
417 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
418 e.into(),
419 ))));
420 }
421 }
422
423 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
425
426 std::task::Poll::Ready(Some(match header.ordinal {
427 0x4288fe720cca70d7 => {
428 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
429 let mut req = fidl::new_empty!(
430 BlobCreatorCreateRequest,
431 fidl::encoding::DefaultFuchsiaResourceDialect
432 );
433 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlobCreatorCreateRequest>(&header, _body_bytes, handles, &mut req)?;
434 let control_handle = BlobCreatorControlHandle { inner: this.inner.clone() };
435 Ok(BlobCreatorRequest::Create {
436 hash: req.hash,
437 allow_existing: req.allow_existing,
438
439 responder: BlobCreatorCreateResponder {
440 control_handle: std::mem::ManuallyDrop::new(control_handle),
441 tx_id: header.tx_id,
442 },
443 })
444 }
445 0x512e347a6be3e426 => {
446 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
447 let mut req = fidl::new_empty!(
448 BlobCreatorNeedsOverwriteRequest,
449 fidl::encoding::DefaultFuchsiaResourceDialect
450 );
451 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlobCreatorNeedsOverwriteRequest>(&header, _body_bytes, handles, &mut req)?;
452 let control_handle = BlobCreatorControlHandle { inner: this.inner.clone() };
453 Ok(BlobCreatorRequest::NeedsOverwrite {
454 blob_hash: req.blob_hash,
455
456 responder: BlobCreatorNeedsOverwriteResponder {
457 control_handle: std::mem::ManuallyDrop::new(control_handle),
458 tx_id: header.tx_id,
459 },
460 })
461 }
462 _ => Err(fidl::Error::UnknownOrdinal {
463 ordinal: header.ordinal,
464 protocol_name:
465 <BlobCreatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
466 }),
467 }))
468 },
469 )
470 }
471}
472
473#[derive(Debug)]
474pub enum BlobCreatorRequest {
475 Create { hash: [u8; 32], allow_existing: bool, responder: BlobCreatorCreateResponder },
483 NeedsOverwrite { blob_hash: [u8; 32], responder: BlobCreatorNeedsOverwriteResponder },
486}
487
488impl BlobCreatorRequest {
489 #[allow(irrefutable_let_patterns)]
490 pub fn into_create(self) -> Option<([u8; 32], bool, BlobCreatorCreateResponder)> {
491 if let BlobCreatorRequest::Create { hash, allow_existing, responder } = self {
492 Some((hash, allow_existing, responder))
493 } else {
494 None
495 }
496 }
497
498 #[allow(irrefutable_let_patterns)]
499 pub fn into_needs_overwrite(self) -> Option<([u8; 32], BlobCreatorNeedsOverwriteResponder)> {
500 if let BlobCreatorRequest::NeedsOverwrite { blob_hash, responder } = self {
501 Some((blob_hash, responder))
502 } else {
503 None
504 }
505 }
506
507 pub fn method_name(&self) -> &'static str {
509 match *self {
510 BlobCreatorRequest::Create { .. } => "create",
511 BlobCreatorRequest::NeedsOverwrite { .. } => "needs_overwrite",
512 }
513 }
514}
515
516#[derive(Debug, Clone)]
517pub struct BlobCreatorControlHandle {
518 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
519}
520
521impl fidl::endpoints::ControlHandle for BlobCreatorControlHandle {
522 fn shutdown(&self) {
523 self.inner.shutdown()
524 }
525
526 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
527 self.inner.shutdown_with_epitaph(status)
528 }
529
530 fn is_closed(&self) -> bool {
531 self.inner.channel().is_closed()
532 }
533 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
534 self.inner.channel().on_closed()
535 }
536
537 #[cfg(target_os = "fuchsia")]
538 fn signal_peer(
539 &self,
540 clear_mask: zx::Signals,
541 set_mask: zx::Signals,
542 ) -> Result<(), zx_status::Status> {
543 use fidl::Peered;
544 self.inner.channel().signal_peer(clear_mask, set_mask)
545 }
546}
547
548impl BlobCreatorControlHandle {}
549
550#[must_use = "FIDL methods require a response to be sent"]
551#[derive(Debug)]
552pub struct BlobCreatorCreateResponder {
553 control_handle: std::mem::ManuallyDrop<BlobCreatorControlHandle>,
554 tx_id: u32,
555}
556
557impl std::ops::Drop for BlobCreatorCreateResponder {
561 fn drop(&mut self) {
562 self.control_handle.shutdown();
563 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
565 }
566}
567
568impl fidl::endpoints::Responder for BlobCreatorCreateResponder {
569 type ControlHandle = BlobCreatorControlHandle;
570
571 fn control_handle(&self) -> &BlobCreatorControlHandle {
572 &self.control_handle
573 }
574
575 fn drop_without_shutdown(mut self) {
576 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
578 std::mem::forget(self);
580 }
581}
582
583impl BlobCreatorCreateResponder {
584 pub fn send(
588 self,
589 mut result: Result<fidl::endpoints::ClientEnd<BlobWriterMarker>, CreateBlobError>,
590 ) -> Result<(), fidl::Error> {
591 let _result = self.send_raw(result);
592 if _result.is_err() {
593 self.control_handle.shutdown();
594 }
595 self.drop_without_shutdown();
596 _result
597 }
598
599 pub fn send_no_shutdown_on_err(
601 self,
602 mut result: Result<fidl::endpoints::ClientEnd<BlobWriterMarker>, CreateBlobError>,
603 ) -> Result<(), fidl::Error> {
604 let _result = self.send_raw(result);
605 self.drop_without_shutdown();
606 _result
607 }
608
609 fn send_raw(
610 &self,
611 mut result: Result<fidl::endpoints::ClientEnd<BlobWriterMarker>, CreateBlobError>,
612 ) -> Result<(), fidl::Error> {
613 self.control_handle.inner.send::<fidl::encoding::ResultType<
614 BlobCreatorCreateResponse,
615 CreateBlobError,
616 >>(
617 result.map(|writer| (writer,)),
618 self.tx_id,
619 0x4288fe720cca70d7,
620 fidl::encoding::DynamicFlags::empty(),
621 )
622 }
623}
624
625#[must_use = "FIDL methods require a response to be sent"]
626#[derive(Debug)]
627pub struct BlobCreatorNeedsOverwriteResponder {
628 control_handle: std::mem::ManuallyDrop<BlobCreatorControlHandle>,
629 tx_id: u32,
630}
631
632impl std::ops::Drop for BlobCreatorNeedsOverwriteResponder {
636 fn drop(&mut self) {
637 self.control_handle.shutdown();
638 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
640 }
641}
642
643impl fidl::endpoints::Responder for BlobCreatorNeedsOverwriteResponder {
644 type ControlHandle = BlobCreatorControlHandle;
645
646 fn control_handle(&self) -> &BlobCreatorControlHandle {
647 &self.control_handle
648 }
649
650 fn drop_without_shutdown(mut self) {
651 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
653 std::mem::forget(self);
655 }
656}
657
658impl BlobCreatorNeedsOverwriteResponder {
659 pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
663 let _result = self.send_raw(result);
664 if _result.is_err() {
665 self.control_handle.shutdown();
666 }
667 self.drop_without_shutdown();
668 _result
669 }
670
671 pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
673 let _result = self.send_raw(result);
674 self.drop_without_shutdown();
675 _result
676 }
677
678 fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
679 self.control_handle
680 .inner
681 .send::<fidl::encoding::ResultType<BlobCreatorNeedsOverwriteResponse, i32>>(
682 result.map(|needs_overwrite| (needs_overwrite,)),
683 self.tx_id,
684 0x512e347a6be3e426,
685 fidl::encoding::DynamicFlags::empty(),
686 )
687 }
688}
689
690#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
691pub struct BlobReaderMarker;
692
693impl fidl::endpoints::ProtocolMarker for BlobReaderMarker {
694 type Proxy = BlobReaderProxy;
695 type RequestStream = BlobReaderRequestStream;
696 #[cfg(target_os = "fuchsia")]
697 type SynchronousProxy = BlobReaderSynchronousProxy;
698
699 const DEBUG_NAME: &'static str = "fuchsia.fxfs.BlobReader";
700}
701impl fidl::endpoints::DiscoverableProtocolMarker for BlobReaderMarker {}
702pub type BlobReaderGetVmoResult = Result<fidl::Vmo, i32>;
703
704pub trait BlobReaderProxyInterface: Send + Sync {
705 type GetVmoResponseFut: std::future::Future<Output = Result<BlobReaderGetVmoResult, fidl::Error>>
706 + Send;
707 fn r#get_vmo(&self, blob_hash: &[u8; 32]) -> Self::GetVmoResponseFut;
708}
709#[derive(Debug)]
710#[cfg(target_os = "fuchsia")]
711pub struct BlobReaderSynchronousProxy {
712 client: fidl::client::sync::Client,
713}
714
715#[cfg(target_os = "fuchsia")]
716impl fidl::endpoints::SynchronousProxy for BlobReaderSynchronousProxy {
717 type Proxy = BlobReaderProxy;
718 type Protocol = BlobReaderMarker;
719
720 fn from_channel(inner: fidl::Channel) -> Self {
721 Self::new(inner)
722 }
723
724 fn into_channel(self) -> fidl::Channel {
725 self.client.into_channel()
726 }
727
728 fn as_channel(&self) -> &fidl::Channel {
729 self.client.as_channel()
730 }
731}
732
733#[cfg(target_os = "fuchsia")]
734impl BlobReaderSynchronousProxy {
735 pub fn new(channel: fidl::Channel) -> Self {
736 let protocol_name = <BlobReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
737 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
738 }
739
740 pub fn into_channel(self) -> fidl::Channel {
741 self.client.into_channel()
742 }
743
744 pub fn wait_for_event(
747 &self,
748 deadline: zx::MonotonicInstant,
749 ) -> Result<BlobReaderEvent, fidl::Error> {
750 BlobReaderEvent::decode(self.client.wait_for_event(deadline)?)
751 }
752
753 pub fn r#get_vmo(
755 &self,
756 mut blob_hash: &[u8; 32],
757 ___deadline: zx::MonotonicInstant,
758 ) -> Result<BlobReaderGetVmoResult, fidl::Error> {
759 let _response = self.client.send_query::<
760 BlobReaderGetVmoRequest,
761 fidl::encoding::ResultType<BlobReaderGetVmoResponse, i32>,
762 >(
763 (blob_hash,),
764 0x2fa72823ef7f11f4,
765 fidl::encoding::DynamicFlags::empty(),
766 ___deadline,
767 )?;
768 Ok(_response.map(|x| x.vmo))
769 }
770}
771
772#[cfg(target_os = "fuchsia")]
773impl From<BlobReaderSynchronousProxy> for zx::NullableHandle {
774 fn from(value: BlobReaderSynchronousProxy) -> Self {
775 value.into_channel().into()
776 }
777}
778
779#[cfg(target_os = "fuchsia")]
780impl From<fidl::Channel> for BlobReaderSynchronousProxy {
781 fn from(value: fidl::Channel) -> Self {
782 Self::new(value)
783 }
784}
785
786#[cfg(target_os = "fuchsia")]
787impl fidl::endpoints::FromClient for BlobReaderSynchronousProxy {
788 type Protocol = BlobReaderMarker;
789
790 fn from_client(value: fidl::endpoints::ClientEnd<BlobReaderMarker>) -> Self {
791 Self::new(value.into_channel())
792 }
793}
794
795#[derive(Debug, Clone)]
796pub struct BlobReaderProxy {
797 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
798}
799
800impl fidl::endpoints::Proxy for BlobReaderProxy {
801 type Protocol = BlobReaderMarker;
802
803 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
804 Self::new(inner)
805 }
806
807 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
808 self.client.into_channel().map_err(|client| Self { client })
809 }
810
811 fn as_channel(&self) -> &::fidl::AsyncChannel {
812 self.client.as_channel()
813 }
814}
815
816impl BlobReaderProxy {
817 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
819 let protocol_name = <BlobReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
820 Self { client: fidl::client::Client::new(channel, protocol_name) }
821 }
822
823 pub fn take_event_stream(&self) -> BlobReaderEventStream {
829 BlobReaderEventStream { event_receiver: self.client.take_event_receiver() }
830 }
831
832 pub fn r#get_vmo(
834 &self,
835 mut blob_hash: &[u8; 32],
836 ) -> fidl::client::QueryResponseFut<
837 BlobReaderGetVmoResult,
838 fidl::encoding::DefaultFuchsiaResourceDialect,
839 > {
840 BlobReaderProxyInterface::r#get_vmo(self, blob_hash)
841 }
842}
843
844impl BlobReaderProxyInterface for BlobReaderProxy {
845 type GetVmoResponseFut = fidl::client::QueryResponseFut<
846 BlobReaderGetVmoResult,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 >;
849 fn r#get_vmo(&self, mut blob_hash: &[u8; 32]) -> Self::GetVmoResponseFut {
850 fn _decode(
851 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
852 ) -> Result<BlobReaderGetVmoResult, fidl::Error> {
853 let _response = fidl::client::decode_transaction_body::<
854 fidl::encoding::ResultType<BlobReaderGetVmoResponse, i32>,
855 fidl::encoding::DefaultFuchsiaResourceDialect,
856 0x2fa72823ef7f11f4,
857 >(_buf?)?;
858 Ok(_response.map(|x| x.vmo))
859 }
860 self.client.send_query_and_decode::<BlobReaderGetVmoRequest, BlobReaderGetVmoResult>(
861 (blob_hash,),
862 0x2fa72823ef7f11f4,
863 fidl::encoding::DynamicFlags::empty(),
864 _decode,
865 )
866 }
867}
868
869pub struct BlobReaderEventStream {
870 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
871}
872
873impl std::marker::Unpin for BlobReaderEventStream {}
874
875impl futures::stream::FusedStream for BlobReaderEventStream {
876 fn is_terminated(&self) -> bool {
877 self.event_receiver.is_terminated()
878 }
879}
880
881impl futures::Stream for BlobReaderEventStream {
882 type Item = Result<BlobReaderEvent, fidl::Error>;
883
884 fn poll_next(
885 mut self: std::pin::Pin<&mut Self>,
886 cx: &mut std::task::Context<'_>,
887 ) -> std::task::Poll<Option<Self::Item>> {
888 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
889 &mut self.event_receiver,
890 cx
891 )?) {
892 Some(buf) => std::task::Poll::Ready(Some(BlobReaderEvent::decode(buf))),
893 None => std::task::Poll::Ready(None),
894 }
895 }
896}
897
898#[derive(Debug)]
899pub enum BlobReaderEvent {}
900
901impl BlobReaderEvent {
902 fn decode(
904 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
905 ) -> Result<BlobReaderEvent, fidl::Error> {
906 let (bytes, _handles) = buf.split_mut();
907 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
908 debug_assert_eq!(tx_header.tx_id, 0);
909 match tx_header.ordinal {
910 _ => Err(fidl::Error::UnknownOrdinal {
911 ordinal: tx_header.ordinal,
912 protocol_name: <BlobReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
913 }),
914 }
915 }
916}
917
918pub struct BlobReaderRequestStream {
920 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
921 is_terminated: bool,
922}
923
924impl std::marker::Unpin for BlobReaderRequestStream {}
925
926impl futures::stream::FusedStream for BlobReaderRequestStream {
927 fn is_terminated(&self) -> bool {
928 self.is_terminated
929 }
930}
931
932impl fidl::endpoints::RequestStream for BlobReaderRequestStream {
933 type Protocol = BlobReaderMarker;
934 type ControlHandle = BlobReaderControlHandle;
935
936 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
937 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
938 }
939
940 fn control_handle(&self) -> Self::ControlHandle {
941 BlobReaderControlHandle { inner: self.inner.clone() }
942 }
943
944 fn into_inner(
945 self,
946 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
947 {
948 (self.inner, self.is_terminated)
949 }
950
951 fn from_inner(
952 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
953 is_terminated: bool,
954 ) -> Self {
955 Self { inner, is_terminated }
956 }
957}
958
959impl futures::Stream for BlobReaderRequestStream {
960 type Item = Result<BlobReaderRequest, fidl::Error>;
961
962 fn poll_next(
963 mut self: std::pin::Pin<&mut Self>,
964 cx: &mut std::task::Context<'_>,
965 ) -> std::task::Poll<Option<Self::Item>> {
966 let this = &mut *self;
967 if this.inner.check_shutdown(cx) {
968 this.is_terminated = true;
969 return std::task::Poll::Ready(None);
970 }
971 if this.is_terminated {
972 panic!("polled BlobReaderRequestStream after completion");
973 }
974 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
975 |bytes, handles| {
976 match this.inner.channel().read_etc(cx, bytes, handles) {
977 std::task::Poll::Ready(Ok(())) => {}
978 std::task::Poll::Pending => return std::task::Poll::Pending,
979 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
980 this.is_terminated = true;
981 return std::task::Poll::Ready(None);
982 }
983 std::task::Poll::Ready(Err(e)) => {
984 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
985 e.into(),
986 ))));
987 }
988 }
989
990 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
992
993 std::task::Poll::Ready(Some(match header.ordinal {
994 0x2fa72823ef7f11f4 => {
995 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
996 let mut req = fidl::new_empty!(
997 BlobReaderGetVmoRequest,
998 fidl::encoding::DefaultFuchsiaResourceDialect
999 );
1000 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlobReaderGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
1001 let control_handle = BlobReaderControlHandle { inner: this.inner.clone() };
1002 Ok(BlobReaderRequest::GetVmo {
1003 blob_hash: req.blob_hash,
1004
1005 responder: BlobReaderGetVmoResponder {
1006 control_handle: std::mem::ManuallyDrop::new(control_handle),
1007 tx_id: header.tx_id,
1008 },
1009 })
1010 }
1011 _ => Err(fidl::Error::UnknownOrdinal {
1012 ordinal: header.ordinal,
1013 protocol_name:
1014 <BlobReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1015 }),
1016 }))
1017 },
1018 )
1019 }
1020}
1021
1022#[derive(Debug)]
1023pub enum BlobReaderRequest {
1024 GetVmo { blob_hash: [u8; 32], responder: BlobReaderGetVmoResponder },
1026}
1027
1028impl BlobReaderRequest {
1029 #[allow(irrefutable_let_patterns)]
1030 pub fn into_get_vmo(self) -> Option<([u8; 32], BlobReaderGetVmoResponder)> {
1031 if let BlobReaderRequest::GetVmo { blob_hash, responder } = self {
1032 Some((blob_hash, responder))
1033 } else {
1034 None
1035 }
1036 }
1037
1038 pub fn method_name(&self) -> &'static str {
1040 match *self {
1041 BlobReaderRequest::GetVmo { .. } => "get_vmo",
1042 }
1043 }
1044}
1045
1046#[derive(Debug, Clone)]
1047pub struct BlobReaderControlHandle {
1048 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1049}
1050
1051impl fidl::endpoints::ControlHandle for BlobReaderControlHandle {
1052 fn shutdown(&self) {
1053 self.inner.shutdown()
1054 }
1055
1056 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1057 self.inner.shutdown_with_epitaph(status)
1058 }
1059
1060 fn is_closed(&self) -> bool {
1061 self.inner.channel().is_closed()
1062 }
1063 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1064 self.inner.channel().on_closed()
1065 }
1066
1067 #[cfg(target_os = "fuchsia")]
1068 fn signal_peer(
1069 &self,
1070 clear_mask: zx::Signals,
1071 set_mask: zx::Signals,
1072 ) -> Result<(), zx_status::Status> {
1073 use fidl::Peered;
1074 self.inner.channel().signal_peer(clear_mask, set_mask)
1075 }
1076}
1077
1078impl BlobReaderControlHandle {}
1079
1080#[must_use = "FIDL methods require a response to be sent"]
1081#[derive(Debug)]
1082pub struct BlobReaderGetVmoResponder {
1083 control_handle: std::mem::ManuallyDrop<BlobReaderControlHandle>,
1084 tx_id: u32,
1085}
1086
1087impl std::ops::Drop for BlobReaderGetVmoResponder {
1091 fn drop(&mut self) {
1092 self.control_handle.shutdown();
1093 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1095 }
1096}
1097
1098impl fidl::endpoints::Responder for BlobReaderGetVmoResponder {
1099 type ControlHandle = BlobReaderControlHandle;
1100
1101 fn control_handle(&self) -> &BlobReaderControlHandle {
1102 &self.control_handle
1103 }
1104
1105 fn drop_without_shutdown(mut self) {
1106 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1108 std::mem::forget(self);
1110 }
1111}
1112
1113impl BlobReaderGetVmoResponder {
1114 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1118 let _result = self.send_raw(result);
1119 if _result.is_err() {
1120 self.control_handle.shutdown();
1121 }
1122 self.drop_without_shutdown();
1123 _result
1124 }
1125
1126 pub fn send_no_shutdown_on_err(
1128 self,
1129 mut result: Result<fidl::Vmo, i32>,
1130 ) -> Result<(), fidl::Error> {
1131 let _result = self.send_raw(result);
1132 self.drop_without_shutdown();
1133 _result
1134 }
1135
1136 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1137 self.control_handle.inner.send::<fidl::encoding::ResultType<BlobReaderGetVmoResponse, i32>>(
1138 result.map(|vmo| (vmo,)),
1139 self.tx_id,
1140 0x2fa72823ef7f11f4,
1141 fidl::encoding::DynamicFlags::empty(),
1142 )
1143 }
1144}
1145
1146#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1147pub struct BlobWriterMarker;
1148
1149impl fidl::endpoints::ProtocolMarker for BlobWriterMarker {
1150 type Proxy = BlobWriterProxy;
1151 type RequestStream = BlobWriterRequestStream;
1152 #[cfg(target_os = "fuchsia")]
1153 type SynchronousProxy = BlobWriterSynchronousProxy;
1154
1155 const DEBUG_NAME: &'static str = "(anonymous) BlobWriter";
1156}
1157pub type BlobWriterGetVmoResult = Result<fidl::Vmo, i32>;
1158pub type BlobWriterBytesReadyResult = Result<(), i32>;
1159
1160pub trait BlobWriterProxyInterface: Send + Sync {
1161 type GetVmoResponseFut: std::future::Future<Output = Result<BlobWriterGetVmoResult, fidl::Error>>
1162 + Send;
1163 fn r#get_vmo(&self, size: u64) -> Self::GetVmoResponseFut;
1164 type BytesReadyResponseFut: std::future::Future<Output = Result<BlobWriterBytesReadyResult, fidl::Error>>
1165 + Send;
1166 fn r#bytes_ready(&self, bytes_written: u64) -> Self::BytesReadyResponseFut;
1167}
1168#[derive(Debug)]
1169#[cfg(target_os = "fuchsia")]
1170pub struct BlobWriterSynchronousProxy {
1171 client: fidl::client::sync::Client,
1172}
1173
1174#[cfg(target_os = "fuchsia")]
1175impl fidl::endpoints::SynchronousProxy for BlobWriterSynchronousProxy {
1176 type Proxy = BlobWriterProxy;
1177 type Protocol = BlobWriterMarker;
1178
1179 fn from_channel(inner: fidl::Channel) -> Self {
1180 Self::new(inner)
1181 }
1182
1183 fn into_channel(self) -> fidl::Channel {
1184 self.client.into_channel()
1185 }
1186
1187 fn as_channel(&self) -> &fidl::Channel {
1188 self.client.as_channel()
1189 }
1190}
1191
1192#[cfg(target_os = "fuchsia")]
1193impl BlobWriterSynchronousProxy {
1194 pub fn new(channel: fidl::Channel) -> Self {
1195 let protocol_name = <BlobWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1196 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1197 }
1198
1199 pub fn into_channel(self) -> fidl::Channel {
1200 self.client.into_channel()
1201 }
1202
1203 pub fn wait_for_event(
1206 &self,
1207 deadline: zx::MonotonicInstant,
1208 ) -> Result<BlobWriterEvent, fidl::Error> {
1209 BlobWriterEvent::decode(self.client.wait_for_event(deadline)?)
1210 }
1211
1212 pub fn r#get_vmo(
1224 &self,
1225 mut size: u64,
1226 ___deadline: zx::MonotonicInstant,
1227 ) -> Result<BlobWriterGetVmoResult, fidl::Error> {
1228 let _response = self.client.send_query::<
1229 BlobWriterGetVmoRequest,
1230 fidl::encoding::ResultType<BlobWriterGetVmoResponse, i32>,
1231 >(
1232 (size,),
1233 0x50c8988b12b6f893,
1234 fidl::encoding::DynamicFlags::empty(),
1235 ___deadline,
1236 )?;
1237 Ok(_response.map(|x| x.vmo))
1238 }
1239
1240 pub fn r#bytes_ready(
1244 &self,
1245 mut bytes_written: u64,
1246 ___deadline: zx::MonotonicInstant,
1247 ) -> Result<BlobWriterBytesReadyResult, fidl::Error> {
1248 let _response = self.client.send_query::<
1249 BlobWriterBytesReadyRequest,
1250 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1251 >(
1252 (bytes_written,),
1253 0x7b308b473606c573,
1254 fidl::encoding::DynamicFlags::empty(),
1255 ___deadline,
1256 )?;
1257 Ok(_response.map(|x| x))
1258 }
1259}
1260
1261#[cfg(target_os = "fuchsia")]
1262impl From<BlobWriterSynchronousProxy> for zx::NullableHandle {
1263 fn from(value: BlobWriterSynchronousProxy) -> Self {
1264 value.into_channel().into()
1265 }
1266}
1267
1268#[cfg(target_os = "fuchsia")]
1269impl From<fidl::Channel> for BlobWriterSynchronousProxy {
1270 fn from(value: fidl::Channel) -> Self {
1271 Self::new(value)
1272 }
1273}
1274
1275#[cfg(target_os = "fuchsia")]
1276impl fidl::endpoints::FromClient for BlobWriterSynchronousProxy {
1277 type Protocol = BlobWriterMarker;
1278
1279 fn from_client(value: fidl::endpoints::ClientEnd<BlobWriterMarker>) -> Self {
1280 Self::new(value.into_channel())
1281 }
1282}
1283
1284#[derive(Debug, Clone)]
1285pub struct BlobWriterProxy {
1286 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1287}
1288
1289impl fidl::endpoints::Proxy for BlobWriterProxy {
1290 type Protocol = BlobWriterMarker;
1291
1292 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1293 Self::new(inner)
1294 }
1295
1296 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1297 self.client.into_channel().map_err(|client| Self { client })
1298 }
1299
1300 fn as_channel(&self) -> &::fidl::AsyncChannel {
1301 self.client.as_channel()
1302 }
1303}
1304
1305impl BlobWriterProxy {
1306 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1308 let protocol_name = <BlobWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1309 Self { client: fidl::client::Client::new(channel, protocol_name) }
1310 }
1311
1312 pub fn take_event_stream(&self) -> BlobWriterEventStream {
1318 BlobWriterEventStream { event_receiver: self.client.take_event_receiver() }
1319 }
1320
1321 pub fn r#get_vmo(
1333 &self,
1334 mut size: u64,
1335 ) -> fidl::client::QueryResponseFut<
1336 BlobWriterGetVmoResult,
1337 fidl::encoding::DefaultFuchsiaResourceDialect,
1338 > {
1339 BlobWriterProxyInterface::r#get_vmo(self, size)
1340 }
1341
1342 pub fn r#bytes_ready(
1346 &self,
1347 mut bytes_written: u64,
1348 ) -> fidl::client::QueryResponseFut<
1349 BlobWriterBytesReadyResult,
1350 fidl::encoding::DefaultFuchsiaResourceDialect,
1351 > {
1352 BlobWriterProxyInterface::r#bytes_ready(self, bytes_written)
1353 }
1354}
1355
1356impl BlobWriterProxyInterface for BlobWriterProxy {
1357 type GetVmoResponseFut = fidl::client::QueryResponseFut<
1358 BlobWriterGetVmoResult,
1359 fidl::encoding::DefaultFuchsiaResourceDialect,
1360 >;
1361 fn r#get_vmo(&self, mut size: u64) -> Self::GetVmoResponseFut {
1362 fn _decode(
1363 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1364 ) -> Result<BlobWriterGetVmoResult, fidl::Error> {
1365 let _response = fidl::client::decode_transaction_body::<
1366 fidl::encoding::ResultType<BlobWriterGetVmoResponse, i32>,
1367 fidl::encoding::DefaultFuchsiaResourceDialect,
1368 0x50c8988b12b6f893,
1369 >(_buf?)?;
1370 Ok(_response.map(|x| x.vmo))
1371 }
1372 self.client.send_query_and_decode::<BlobWriterGetVmoRequest, BlobWriterGetVmoResult>(
1373 (size,),
1374 0x50c8988b12b6f893,
1375 fidl::encoding::DynamicFlags::empty(),
1376 _decode,
1377 )
1378 }
1379
1380 type BytesReadyResponseFut = fidl::client::QueryResponseFut<
1381 BlobWriterBytesReadyResult,
1382 fidl::encoding::DefaultFuchsiaResourceDialect,
1383 >;
1384 fn r#bytes_ready(&self, mut bytes_written: u64) -> Self::BytesReadyResponseFut {
1385 fn _decode(
1386 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1387 ) -> Result<BlobWriterBytesReadyResult, fidl::Error> {
1388 let _response = fidl::client::decode_transaction_body::<
1389 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1390 fidl::encoding::DefaultFuchsiaResourceDialect,
1391 0x7b308b473606c573,
1392 >(_buf?)?;
1393 Ok(_response.map(|x| x))
1394 }
1395 self.client
1396 .send_query_and_decode::<BlobWriterBytesReadyRequest, BlobWriterBytesReadyResult>(
1397 (bytes_written,),
1398 0x7b308b473606c573,
1399 fidl::encoding::DynamicFlags::empty(),
1400 _decode,
1401 )
1402 }
1403}
1404
1405pub struct BlobWriterEventStream {
1406 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1407}
1408
1409impl std::marker::Unpin for BlobWriterEventStream {}
1410
1411impl futures::stream::FusedStream for BlobWriterEventStream {
1412 fn is_terminated(&self) -> bool {
1413 self.event_receiver.is_terminated()
1414 }
1415}
1416
1417impl futures::Stream for BlobWriterEventStream {
1418 type Item = Result<BlobWriterEvent, fidl::Error>;
1419
1420 fn poll_next(
1421 mut self: std::pin::Pin<&mut Self>,
1422 cx: &mut std::task::Context<'_>,
1423 ) -> std::task::Poll<Option<Self::Item>> {
1424 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1425 &mut self.event_receiver,
1426 cx
1427 )?) {
1428 Some(buf) => std::task::Poll::Ready(Some(BlobWriterEvent::decode(buf))),
1429 None => std::task::Poll::Ready(None),
1430 }
1431 }
1432}
1433
1434#[derive(Debug)]
1435pub enum BlobWriterEvent {}
1436
1437impl BlobWriterEvent {
1438 fn decode(
1440 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1441 ) -> Result<BlobWriterEvent, fidl::Error> {
1442 let (bytes, _handles) = buf.split_mut();
1443 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1444 debug_assert_eq!(tx_header.tx_id, 0);
1445 match tx_header.ordinal {
1446 _ => Err(fidl::Error::UnknownOrdinal {
1447 ordinal: tx_header.ordinal,
1448 protocol_name: <BlobWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1449 }),
1450 }
1451 }
1452}
1453
1454pub struct BlobWriterRequestStream {
1456 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1457 is_terminated: bool,
1458}
1459
1460impl std::marker::Unpin for BlobWriterRequestStream {}
1461
1462impl futures::stream::FusedStream for BlobWriterRequestStream {
1463 fn is_terminated(&self) -> bool {
1464 self.is_terminated
1465 }
1466}
1467
1468impl fidl::endpoints::RequestStream for BlobWriterRequestStream {
1469 type Protocol = BlobWriterMarker;
1470 type ControlHandle = BlobWriterControlHandle;
1471
1472 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1473 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1474 }
1475
1476 fn control_handle(&self) -> Self::ControlHandle {
1477 BlobWriterControlHandle { inner: self.inner.clone() }
1478 }
1479
1480 fn into_inner(
1481 self,
1482 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1483 {
1484 (self.inner, self.is_terminated)
1485 }
1486
1487 fn from_inner(
1488 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1489 is_terminated: bool,
1490 ) -> Self {
1491 Self { inner, is_terminated }
1492 }
1493}
1494
1495impl futures::Stream for BlobWriterRequestStream {
1496 type Item = Result<BlobWriterRequest, fidl::Error>;
1497
1498 fn poll_next(
1499 mut self: std::pin::Pin<&mut Self>,
1500 cx: &mut std::task::Context<'_>,
1501 ) -> std::task::Poll<Option<Self::Item>> {
1502 let this = &mut *self;
1503 if this.inner.check_shutdown(cx) {
1504 this.is_terminated = true;
1505 return std::task::Poll::Ready(None);
1506 }
1507 if this.is_terminated {
1508 panic!("polled BlobWriterRequestStream after completion");
1509 }
1510 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1511 |bytes, handles| {
1512 match this.inner.channel().read_etc(cx, bytes, handles) {
1513 std::task::Poll::Ready(Ok(())) => {}
1514 std::task::Poll::Pending => return std::task::Poll::Pending,
1515 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1516 this.is_terminated = true;
1517 return std::task::Poll::Ready(None);
1518 }
1519 std::task::Poll::Ready(Err(e)) => {
1520 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1521 e.into(),
1522 ))));
1523 }
1524 }
1525
1526 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1528
1529 std::task::Poll::Ready(Some(match header.ordinal {
1530 0x50c8988b12b6f893 => {
1531 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1532 let mut req = fidl::new_empty!(
1533 BlobWriterGetVmoRequest,
1534 fidl::encoding::DefaultFuchsiaResourceDialect
1535 );
1536 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlobWriterGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
1537 let control_handle = BlobWriterControlHandle { inner: this.inner.clone() };
1538 Ok(BlobWriterRequest::GetVmo {
1539 size: req.size,
1540
1541 responder: BlobWriterGetVmoResponder {
1542 control_handle: std::mem::ManuallyDrop::new(control_handle),
1543 tx_id: header.tx_id,
1544 },
1545 })
1546 }
1547 0x7b308b473606c573 => {
1548 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1549 let mut req = fidl::new_empty!(
1550 BlobWriterBytesReadyRequest,
1551 fidl::encoding::DefaultFuchsiaResourceDialect
1552 );
1553 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BlobWriterBytesReadyRequest>(&header, _body_bytes, handles, &mut req)?;
1554 let control_handle = BlobWriterControlHandle { inner: this.inner.clone() };
1555 Ok(BlobWriterRequest::BytesReady {
1556 bytes_written: req.bytes_written,
1557
1558 responder: BlobWriterBytesReadyResponder {
1559 control_handle: std::mem::ManuallyDrop::new(control_handle),
1560 tx_id: header.tx_id,
1561 },
1562 })
1563 }
1564 _ => Err(fidl::Error::UnknownOrdinal {
1565 ordinal: header.ordinal,
1566 protocol_name:
1567 <BlobWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1568 }),
1569 }))
1570 },
1571 )
1572 }
1573}
1574
1575#[derive(Debug)]
1576pub enum BlobWriterRequest {
1577 GetVmo { size: u64, responder: BlobWriterGetVmoResponder },
1589 BytesReady { bytes_written: u64, responder: BlobWriterBytesReadyResponder },
1593}
1594
1595impl BlobWriterRequest {
1596 #[allow(irrefutable_let_patterns)]
1597 pub fn into_get_vmo(self) -> Option<(u64, BlobWriterGetVmoResponder)> {
1598 if let BlobWriterRequest::GetVmo { size, responder } = self {
1599 Some((size, responder))
1600 } else {
1601 None
1602 }
1603 }
1604
1605 #[allow(irrefutable_let_patterns)]
1606 pub fn into_bytes_ready(self) -> Option<(u64, BlobWriterBytesReadyResponder)> {
1607 if let BlobWriterRequest::BytesReady { bytes_written, responder } = self {
1608 Some((bytes_written, responder))
1609 } else {
1610 None
1611 }
1612 }
1613
1614 pub fn method_name(&self) -> &'static str {
1616 match *self {
1617 BlobWriterRequest::GetVmo { .. } => "get_vmo",
1618 BlobWriterRequest::BytesReady { .. } => "bytes_ready",
1619 }
1620 }
1621}
1622
1623#[derive(Debug, Clone)]
1624pub struct BlobWriterControlHandle {
1625 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1626}
1627
1628impl fidl::endpoints::ControlHandle for BlobWriterControlHandle {
1629 fn shutdown(&self) {
1630 self.inner.shutdown()
1631 }
1632
1633 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1634 self.inner.shutdown_with_epitaph(status)
1635 }
1636
1637 fn is_closed(&self) -> bool {
1638 self.inner.channel().is_closed()
1639 }
1640 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1641 self.inner.channel().on_closed()
1642 }
1643
1644 #[cfg(target_os = "fuchsia")]
1645 fn signal_peer(
1646 &self,
1647 clear_mask: zx::Signals,
1648 set_mask: zx::Signals,
1649 ) -> Result<(), zx_status::Status> {
1650 use fidl::Peered;
1651 self.inner.channel().signal_peer(clear_mask, set_mask)
1652 }
1653}
1654
1655impl BlobWriterControlHandle {}
1656
1657#[must_use = "FIDL methods require a response to be sent"]
1658#[derive(Debug)]
1659pub struct BlobWriterGetVmoResponder {
1660 control_handle: std::mem::ManuallyDrop<BlobWriterControlHandle>,
1661 tx_id: u32,
1662}
1663
1664impl std::ops::Drop for BlobWriterGetVmoResponder {
1668 fn drop(&mut self) {
1669 self.control_handle.shutdown();
1670 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1672 }
1673}
1674
1675impl fidl::endpoints::Responder for BlobWriterGetVmoResponder {
1676 type ControlHandle = BlobWriterControlHandle;
1677
1678 fn control_handle(&self) -> &BlobWriterControlHandle {
1679 &self.control_handle
1680 }
1681
1682 fn drop_without_shutdown(mut self) {
1683 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1685 std::mem::forget(self);
1687 }
1688}
1689
1690impl BlobWriterGetVmoResponder {
1691 pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1695 let _result = self.send_raw(result);
1696 if _result.is_err() {
1697 self.control_handle.shutdown();
1698 }
1699 self.drop_without_shutdown();
1700 _result
1701 }
1702
1703 pub fn send_no_shutdown_on_err(
1705 self,
1706 mut result: Result<fidl::Vmo, i32>,
1707 ) -> Result<(), fidl::Error> {
1708 let _result = self.send_raw(result);
1709 self.drop_without_shutdown();
1710 _result
1711 }
1712
1713 fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
1714 self.control_handle.inner.send::<fidl::encoding::ResultType<BlobWriterGetVmoResponse, i32>>(
1715 result.map(|vmo| (vmo,)),
1716 self.tx_id,
1717 0x50c8988b12b6f893,
1718 fidl::encoding::DynamicFlags::empty(),
1719 )
1720 }
1721}
1722
1723#[must_use = "FIDL methods require a response to be sent"]
1724#[derive(Debug)]
1725pub struct BlobWriterBytesReadyResponder {
1726 control_handle: std::mem::ManuallyDrop<BlobWriterControlHandle>,
1727 tx_id: u32,
1728}
1729
1730impl std::ops::Drop for BlobWriterBytesReadyResponder {
1734 fn drop(&mut self) {
1735 self.control_handle.shutdown();
1736 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1738 }
1739}
1740
1741impl fidl::endpoints::Responder for BlobWriterBytesReadyResponder {
1742 type ControlHandle = BlobWriterControlHandle;
1743
1744 fn control_handle(&self) -> &BlobWriterControlHandle {
1745 &self.control_handle
1746 }
1747
1748 fn drop_without_shutdown(mut self) {
1749 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1751 std::mem::forget(self);
1753 }
1754}
1755
1756impl BlobWriterBytesReadyResponder {
1757 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1761 let _result = self.send_raw(result);
1762 if _result.is_err() {
1763 self.control_handle.shutdown();
1764 }
1765 self.drop_without_shutdown();
1766 _result
1767 }
1768
1769 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1771 let _result = self.send_raw(result);
1772 self.drop_without_shutdown();
1773 _result
1774 }
1775
1776 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1777 self.control_handle
1778 .inner
1779 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1780 result,
1781 self.tx_id,
1782 0x7b308b473606c573,
1783 fidl::encoding::DynamicFlags::empty(),
1784 )
1785 }
1786}
1787
1788#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1789pub struct CryptMarker;
1790
1791impl fidl::endpoints::ProtocolMarker for CryptMarker {
1792 type Proxy = CryptProxy;
1793 type RequestStream = CryptRequestStream;
1794 #[cfg(target_os = "fuchsia")]
1795 type SynchronousProxy = CryptSynchronousProxy;
1796
1797 const DEBUG_NAME: &'static str = "fuchsia.fxfs.Crypt";
1798}
1799impl fidl::endpoints::DiscoverableProtocolMarker for CryptMarker {}
1800pub type CryptCreateKeyResult = Result<([u8; 16], Vec<u8>, Vec<u8>), i32>;
1801pub type CryptCreateKeyWithIdResult = Result<(WrappedKey, Vec<u8>), i32>;
1802pub type CryptUnwrapKeyResult = Result<Vec<u8>, i32>;
1803
1804pub trait CryptProxyInterface: Send + Sync {
1805 type CreateKeyResponseFut: std::future::Future<Output = Result<CryptCreateKeyResult, fidl::Error>>
1806 + Send;
1807 fn r#create_key(&self, owner: u64, purpose: KeyPurpose) -> Self::CreateKeyResponseFut;
1808 type CreateKeyWithIdResponseFut: std::future::Future<Output = Result<CryptCreateKeyWithIdResult, fidl::Error>>
1809 + Send;
1810 fn r#create_key_with_id(
1811 &self,
1812 owner: u64,
1813 wrapping_key_id: &[u8; 16],
1814 object_type: ObjectType,
1815 ) -> Self::CreateKeyWithIdResponseFut;
1816 type UnwrapKeyResponseFut: std::future::Future<Output = Result<CryptUnwrapKeyResult, fidl::Error>>
1817 + Send;
1818 fn r#unwrap_key(&self, owner: u64, wrapped_key: &WrappedKey) -> Self::UnwrapKeyResponseFut;
1819}
1820#[derive(Debug)]
1821#[cfg(target_os = "fuchsia")]
1822pub struct CryptSynchronousProxy {
1823 client: fidl::client::sync::Client,
1824}
1825
1826#[cfg(target_os = "fuchsia")]
1827impl fidl::endpoints::SynchronousProxy for CryptSynchronousProxy {
1828 type Proxy = CryptProxy;
1829 type Protocol = CryptMarker;
1830
1831 fn from_channel(inner: fidl::Channel) -> Self {
1832 Self::new(inner)
1833 }
1834
1835 fn into_channel(self) -> fidl::Channel {
1836 self.client.into_channel()
1837 }
1838
1839 fn as_channel(&self) -> &fidl::Channel {
1840 self.client.as_channel()
1841 }
1842}
1843
1844#[cfg(target_os = "fuchsia")]
1845impl CryptSynchronousProxy {
1846 pub fn new(channel: fidl::Channel) -> Self {
1847 let protocol_name = <CryptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1848 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1849 }
1850
1851 pub fn into_channel(self) -> fidl::Channel {
1852 self.client.into_channel()
1853 }
1854
1855 pub fn wait_for_event(
1858 &self,
1859 deadline: zx::MonotonicInstant,
1860 ) -> Result<CryptEvent, fidl::Error> {
1861 CryptEvent::decode(self.client.wait_for_event(deadline)?)
1862 }
1863
1864 pub fn r#create_key(
1870 &self,
1871 mut owner: u64,
1872 mut purpose: KeyPurpose,
1873 ___deadline: zx::MonotonicInstant,
1874 ) -> Result<CryptCreateKeyResult, fidl::Error> {
1875 let _response = self.client.send_query::<
1876 CryptCreateKeyRequest,
1877 fidl::encoding::ResultType<CryptCreateKeyResponse, i32>,
1878 >(
1879 (owner, purpose,),
1880 0x6ec69b3aee7fdbba,
1881 fidl::encoding::DynamicFlags::empty(),
1882 ___deadline,
1883 )?;
1884 Ok(_response.map(|x| (x.wrapping_key_id, x.wrapped_key, x.unwrapped_key)))
1885 }
1886
1887 pub fn r#create_key_with_id(
1891 &self,
1892 mut owner: u64,
1893 mut wrapping_key_id: &[u8; 16],
1894 mut object_type: ObjectType,
1895 ___deadline: zx::MonotonicInstant,
1896 ) -> Result<CryptCreateKeyWithIdResult, fidl::Error> {
1897 let _response = self.client.send_query::<
1898 CryptCreateKeyWithIdRequest,
1899 fidl::encoding::ResultType<CryptCreateKeyWithIdResponse, i32>,
1900 >(
1901 (owner, wrapping_key_id, object_type,),
1902 0x21e8076688700b50,
1903 fidl::encoding::DynamicFlags::empty(),
1904 ___deadline,
1905 )?;
1906 Ok(_response.map(|x| (x.wrapped_key, x.unwrapped_key)))
1907 }
1908
1909 pub fn r#unwrap_key(
1918 &self,
1919 mut owner: u64,
1920 mut wrapped_key: &WrappedKey,
1921 ___deadline: zx::MonotonicInstant,
1922 ) -> Result<CryptUnwrapKeyResult, fidl::Error> {
1923 let _response = self.client.send_query::<
1924 CryptUnwrapKeyRequest,
1925 fidl::encoding::ResultType<CryptUnwrapKeyResponse, i32>,
1926 >(
1927 (owner, wrapped_key,),
1928 0x6ec34e2b64d46be9,
1929 fidl::encoding::DynamicFlags::empty(),
1930 ___deadline,
1931 )?;
1932 Ok(_response.map(|x| x.unwrapped_key))
1933 }
1934}
1935
1936#[cfg(target_os = "fuchsia")]
1937impl From<CryptSynchronousProxy> for zx::NullableHandle {
1938 fn from(value: CryptSynchronousProxy) -> Self {
1939 value.into_channel().into()
1940 }
1941}
1942
1943#[cfg(target_os = "fuchsia")]
1944impl From<fidl::Channel> for CryptSynchronousProxy {
1945 fn from(value: fidl::Channel) -> Self {
1946 Self::new(value)
1947 }
1948}
1949
1950#[cfg(target_os = "fuchsia")]
1951impl fidl::endpoints::FromClient for CryptSynchronousProxy {
1952 type Protocol = CryptMarker;
1953
1954 fn from_client(value: fidl::endpoints::ClientEnd<CryptMarker>) -> Self {
1955 Self::new(value.into_channel())
1956 }
1957}
1958
1959#[derive(Debug, Clone)]
1960pub struct CryptProxy {
1961 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1962}
1963
1964impl fidl::endpoints::Proxy for CryptProxy {
1965 type Protocol = CryptMarker;
1966
1967 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1968 Self::new(inner)
1969 }
1970
1971 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1972 self.client.into_channel().map_err(|client| Self { client })
1973 }
1974
1975 fn as_channel(&self) -> &::fidl::AsyncChannel {
1976 self.client.as_channel()
1977 }
1978}
1979
1980impl CryptProxy {
1981 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1983 let protocol_name = <CryptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1984 Self { client: fidl::client::Client::new(channel, protocol_name) }
1985 }
1986
1987 pub fn take_event_stream(&self) -> CryptEventStream {
1993 CryptEventStream { event_receiver: self.client.take_event_receiver() }
1994 }
1995
1996 pub fn r#create_key(
2002 &self,
2003 mut owner: u64,
2004 mut purpose: KeyPurpose,
2005 ) -> fidl::client::QueryResponseFut<
2006 CryptCreateKeyResult,
2007 fidl::encoding::DefaultFuchsiaResourceDialect,
2008 > {
2009 CryptProxyInterface::r#create_key(self, owner, purpose)
2010 }
2011
2012 pub fn r#create_key_with_id(
2016 &self,
2017 mut owner: u64,
2018 mut wrapping_key_id: &[u8; 16],
2019 mut object_type: ObjectType,
2020 ) -> fidl::client::QueryResponseFut<
2021 CryptCreateKeyWithIdResult,
2022 fidl::encoding::DefaultFuchsiaResourceDialect,
2023 > {
2024 CryptProxyInterface::r#create_key_with_id(self, owner, wrapping_key_id, object_type)
2025 }
2026
2027 pub fn r#unwrap_key(
2036 &self,
2037 mut owner: u64,
2038 mut wrapped_key: &WrappedKey,
2039 ) -> fidl::client::QueryResponseFut<
2040 CryptUnwrapKeyResult,
2041 fidl::encoding::DefaultFuchsiaResourceDialect,
2042 > {
2043 CryptProxyInterface::r#unwrap_key(self, owner, wrapped_key)
2044 }
2045}
2046
2047impl CryptProxyInterface for CryptProxy {
2048 type CreateKeyResponseFut = fidl::client::QueryResponseFut<
2049 CryptCreateKeyResult,
2050 fidl::encoding::DefaultFuchsiaResourceDialect,
2051 >;
2052 fn r#create_key(&self, mut owner: u64, mut purpose: KeyPurpose) -> Self::CreateKeyResponseFut {
2053 fn _decode(
2054 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2055 ) -> Result<CryptCreateKeyResult, fidl::Error> {
2056 let _response = fidl::client::decode_transaction_body::<
2057 fidl::encoding::ResultType<CryptCreateKeyResponse, i32>,
2058 fidl::encoding::DefaultFuchsiaResourceDialect,
2059 0x6ec69b3aee7fdbba,
2060 >(_buf?)?;
2061 Ok(_response.map(|x| (x.wrapping_key_id, x.wrapped_key, x.unwrapped_key)))
2062 }
2063 self.client.send_query_and_decode::<CryptCreateKeyRequest, CryptCreateKeyResult>(
2064 (owner, purpose),
2065 0x6ec69b3aee7fdbba,
2066 fidl::encoding::DynamicFlags::empty(),
2067 _decode,
2068 )
2069 }
2070
2071 type CreateKeyWithIdResponseFut = fidl::client::QueryResponseFut<
2072 CryptCreateKeyWithIdResult,
2073 fidl::encoding::DefaultFuchsiaResourceDialect,
2074 >;
2075 fn r#create_key_with_id(
2076 &self,
2077 mut owner: u64,
2078 mut wrapping_key_id: &[u8; 16],
2079 mut object_type: ObjectType,
2080 ) -> Self::CreateKeyWithIdResponseFut {
2081 fn _decode(
2082 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2083 ) -> Result<CryptCreateKeyWithIdResult, fidl::Error> {
2084 let _response = fidl::client::decode_transaction_body::<
2085 fidl::encoding::ResultType<CryptCreateKeyWithIdResponse, i32>,
2086 fidl::encoding::DefaultFuchsiaResourceDialect,
2087 0x21e8076688700b50,
2088 >(_buf?)?;
2089 Ok(_response.map(|x| (x.wrapped_key, x.unwrapped_key)))
2090 }
2091 self.client
2092 .send_query_and_decode::<CryptCreateKeyWithIdRequest, CryptCreateKeyWithIdResult>(
2093 (owner, wrapping_key_id, object_type),
2094 0x21e8076688700b50,
2095 fidl::encoding::DynamicFlags::empty(),
2096 _decode,
2097 )
2098 }
2099
2100 type UnwrapKeyResponseFut = fidl::client::QueryResponseFut<
2101 CryptUnwrapKeyResult,
2102 fidl::encoding::DefaultFuchsiaResourceDialect,
2103 >;
2104 fn r#unwrap_key(
2105 &self,
2106 mut owner: u64,
2107 mut wrapped_key: &WrappedKey,
2108 ) -> Self::UnwrapKeyResponseFut {
2109 fn _decode(
2110 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2111 ) -> Result<CryptUnwrapKeyResult, fidl::Error> {
2112 let _response = fidl::client::decode_transaction_body::<
2113 fidl::encoding::ResultType<CryptUnwrapKeyResponse, i32>,
2114 fidl::encoding::DefaultFuchsiaResourceDialect,
2115 0x6ec34e2b64d46be9,
2116 >(_buf?)?;
2117 Ok(_response.map(|x| x.unwrapped_key))
2118 }
2119 self.client.send_query_and_decode::<CryptUnwrapKeyRequest, CryptUnwrapKeyResult>(
2120 (owner, wrapped_key),
2121 0x6ec34e2b64d46be9,
2122 fidl::encoding::DynamicFlags::empty(),
2123 _decode,
2124 )
2125 }
2126}
2127
2128pub struct CryptEventStream {
2129 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2130}
2131
2132impl std::marker::Unpin for CryptEventStream {}
2133
2134impl futures::stream::FusedStream for CryptEventStream {
2135 fn is_terminated(&self) -> bool {
2136 self.event_receiver.is_terminated()
2137 }
2138}
2139
2140impl futures::Stream for CryptEventStream {
2141 type Item = Result<CryptEvent, fidl::Error>;
2142
2143 fn poll_next(
2144 mut self: std::pin::Pin<&mut Self>,
2145 cx: &mut std::task::Context<'_>,
2146 ) -> std::task::Poll<Option<Self::Item>> {
2147 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2148 &mut self.event_receiver,
2149 cx
2150 )?) {
2151 Some(buf) => std::task::Poll::Ready(Some(CryptEvent::decode(buf))),
2152 None => std::task::Poll::Ready(None),
2153 }
2154 }
2155}
2156
2157#[derive(Debug)]
2158pub enum CryptEvent {}
2159
2160impl CryptEvent {
2161 fn decode(
2163 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2164 ) -> Result<CryptEvent, fidl::Error> {
2165 let (bytes, _handles) = buf.split_mut();
2166 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2167 debug_assert_eq!(tx_header.tx_id, 0);
2168 match tx_header.ordinal {
2169 _ => Err(fidl::Error::UnknownOrdinal {
2170 ordinal: tx_header.ordinal,
2171 protocol_name: <CryptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2172 }),
2173 }
2174 }
2175}
2176
2177pub struct CryptRequestStream {
2179 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2180 is_terminated: bool,
2181}
2182
2183impl std::marker::Unpin for CryptRequestStream {}
2184
2185impl futures::stream::FusedStream for CryptRequestStream {
2186 fn is_terminated(&self) -> bool {
2187 self.is_terminated
2188 }
2189}
2190
2191impl fidl::endpoints::RequestStream for CryptRequestStream {
2192 type Protocol = CryptMarker;
2193 type ControlHandle = CryptControlHandle;
2194
2195 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2196 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2197 }
2198
2199 fn control_handle(&self) -> Self::ControlHandle {
2200 CryptControlHandle { inner: self.inner.clone() }
2201 }
2202
2203 fn into_inner(
2204 self,
2205 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2206 {
2207 (self.inner, self.is_terminated)
2208 }
2209
2210 fn from_inner(
2211 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2212 is_terminated: bool,
2213 ) -> Self {
2214 Self { inner, is_terminated }
2215 }
2216}
2217
2218impl futures::Stream for CryptRequestStream {
2219 type Item = Result<CryptRequest, fidl::Error>;
2220
2221 fn poll_next(
2222 mut self: std::pin::Pin<&mut Self>,
2223 cx: &mut std::task::Context<'_>,
2224 ) -> std::task::Poll<Option<Self::Item>> {
2225 let this = &mut *self;
2226 if this.inner.check_shutdown(cx) {
2227 this.is_terminated = true;
2228 return std::task::Poll::Ready(None);
2229 }
2230 if this.is_terminated {
2231 panic!("polled CryptRequestStream after completion");
2232 }
2233 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2234 |bytes, handles| {
2235 match this.inner.channel().read_etc(cx, bytes, handles) {
2236 std::task::Poll::Ready(Ok(())) => {}
2237 std::task::Poll::Pending => return std::task::Poll::Pending,
2238 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2239 this.is_terminated = true;
2240 return std::task::Poll::Ready(None);
2241 }
2242 std::task::Poll::Ready(Err(e)) => {
2243 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2244 e.into(),
2245 ))));
2246 }
2247 }
2248
2249 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2251
2252 std::task::Poll::Ready(Some(match header.ordinal {
2253 0x6ec69b3aee7fdbba => {
2254 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2255 let mut req = fidl::new_empty!(
2256 CryptCreateKeyRequest,
2257 fidl::encoding::DefaultFuchsiaResourceDialect
2258 );
2259 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CryptCreateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2260 let control_handle = CryptControlHandle { inner: this.inner.clone() };
2261 Ok(CryptRequest::CreateKey {
2262 owner: req.owner,
2263 purpose: req.purpose,
2264
2265 responder: CryptCreateKeyResponder {
2266 control_handle: std::mem::ManuallyDrop::new(control_handle),
2267 tx_id: header.tx_id,
2268 },
2269 })
2270 }
2271 0x21e8076688700b50 => {
2272 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2273 let mut req = fidl::new_empty!(
2274 CryptCreateKeyWithIdRequest,
2275 fidl::encoding::DefaultFuchsiaResourceDialect
2276 );
2277 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CryptCreateKeyWithIdRequest>(&header, _body_bytes, handles, &mut req)?;
2278 let control_handle = CryptControlHandle { inner: this.inner.clone() };
2279 Ok(CryptRequest::CreateKeyWithId {
2280 owner: req.owner,
2281 wrapping_key_id: req.wrapping_key_id,
2282 object_type: req.object_type,
2283
2284 responder: CryptCreateKeyWithIdResponder {
2285 control_handle: std::mem::ManuallyDrop::new(control_handle),
2286 tx_id: header.tx_id,
2287 },
2288 })
2289 }
2290 0x6ec34e2b64d46be9 => {
2291 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2292 let mut req = fidl::new_empty!(
2293 CryptUnwrapKeyRequest,
2294 fidl::encoding::DefaultFuchsiaResourceDialect
2295 );
2296 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CryptUnwrapKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2297 let control_handle = CryptControlHandle { inner: this.inner.clone() };
2298 Ok(CryptRequest::UnwrapKey {
2299 owner: req.owner,
2300 wrapped_key: req.wrapped_key,
2301
2302 responder: CryptUnwrapKeyResponder {
2303 control_handle: std::mem::ManuallyDrop::new(control_handle),
2304 tx_id: header.tx_id,
2305 },
2306 })
2307 }
2308 _ => Err(fidl::Error::UnknownOrdinal {
2309 ordinal: header.ordinal,
2310 protocol_name: <CryptMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2311 }),
2312 }))
2313 },
2314 )
2315 }
2316}
2317
2318#[derive(Debug)]
2319pub enum CryptRequest {
2320 CreateKey { owner: u64, purpose: KeyPurpose, responder: CryptCreateKeyResponder },
2326 CreateKeyWithId {
2330 owner: u64,
2331 wrapping_key_id: [u8; 16],
2332 object_type: ObjectType,
2333 responder: CryptCreateKeyWithIdResponder,
2334 },
2335 UnwrapKey { owner: u64, wrapped_key: WrappedKey, responder: CryptUnwrapKeyResponder },
2344}
2345
2346impl CryptRequest {
2347 #[allow(irrefutable_let_patterns)]
2348 pub fn into_create_key(self) -> Option<(u64, KeyPurpose, CryptCreateKeyResponder)> {
2349 if let CryptRequest::CreateKey { owner, purpose, responder } = self {
2350 Some((owner, purpose, responder))
2351 } else {
2352 None
2353 }
2354 }
2355
2356 #[allow(irrefutable_let_patterns)]
2357 pub fn into_create_key_with_id(
2358 self,
2359 ) -> Option<(u64, [u8; 16], ObjectType, CryptCreateKeyWithIdResponder)> {
2360 if let CryptRequest::CreateKeyWithId { owner, wrapping_key_id, object_type, responder } =
2361 self
2362 {
2363 Some((owner, wrapping_key_id, object_type, responder))
2364 } else {
2365 None
2366 }
2367 }
2368
2369 #[allow(irrefutable_let_patterns)]
2370 pub fn into_unwrap_key(self) -> Option<(u64, WrappedKey, CryptUnwrapKeyResponder)> {
2371 if let CryptRequest::UnwrapKey { owner, wrapped_key, responder } = self {
2372 Some((owner, wrapped_key, responder))
2373 } else {
2374 None
2375 }
2376 }
2377
2378 pub fn method_name(&self) -> &'static str {
2380 match *self {
2381 CryptRequest::CreateKey { .. } => "create_key",
2382 CryptRequest::CreateKeyWithId { .. } => "create_key_with_id",
2383 CryptRequest::UnwrapKey { .. } => "unwrap_key",
2384 }
2385 }
2386}
2387
2388#[derive(Debug, Clone)]
2389pub struct CryptControlHandle {
2390 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2391}
2392
2393impl fidl::endpoints::ControlHandle for CryptControlHandle {
2394 fn shutdown(&self) {
2395 self.inner.shutdown()
2396 }
2397
2398 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2399 self.inner.shutdown_with_epitaph(status)
2400 }
2401
2402 fn is_closed(&self) -> bool {
2403 self.inner.channel().is_closed()
2404 }
2405 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2406 self.inner.channel().on_closed()
2407 }
2408
2409 #[cfg(target_os = "fuchsia")]
2410 fn signal_peer(
2411 &self,
2412 clear_mask: zx::Signals,
2413 set_mask: zx::Signals,
2414 ) -> Result<(), zx_status::Status> {
2415 use fidl::Peered;
2416 self.inner.channel().signal_peer(clear_mask, set_mask)
2417 }
2418}
2419
2420impl CryptControlHandle {}
2421
2422#[must_use = "FIDL methods require a response to be sent"]
2423#[derive(Debug)]
2424pub struct CryptCreateKeyResponder {
2425 control_handle: std::mem::ManuallyDrop<CryptControlHandle>,
2426 tx_id: u32,
2427}
2428
2429impl std::ops::Drop for CryptCreateKeyResponder {
2433 fn drop(&mut self) {
2434 self.control_handle.shutdown();
2435 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2437 }
2438}
2439
2440impl fidl::endpoints::Responder for CryptCreateKeyResponder {
2441 type ControlHandle = CryptControlHandle;
2442
2443 fn control_handle(&self) -> &CryptControlHandle {
2444 &self.control_handle
2445 }
2446
2447 fn drop_without_shutdown(mut self) {
2448 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2450 std::mem::forget(self);
2452 }
2453}
2454
2455impl CryptCreateKeyResponder {
2456 pub fn send(
2460 self,
2461 mut result: Result<(&[u8; 16], &[u8], &[u8]), i32>,
2462 ) -> Result<(), fidl::Error> {
2463 let _result = self.send_raw(result);
2464 if _result.is_err() {
2465 self.control_handle.shutdown();
2466 }
2467 self.drop_without_shutdown();
2468 _result
2469 }
2470
2471 pub fn send_no_shutdown_on_err(
2473 self,
2474 mut result: Result<(&[u8; 16], &[u8], &[u8]), i32>,
2475 ) -> Result<(), fidl::Error> {
2476 let _result = self.send_raw(result);
2477 self.drop_without_shutdown();
2478 _result
2479 }
2480
2481 fn send_raw(
2482 &self,
2483 mut result: Result<(&[u8; 16], &[u8], &[u8]), i32>,
2484 ) -> Result<(), fidl::Error> {
2485 self.control_handle.inner.send::<fidl::encoding::ResultType<CryptCreateKeyResponse, i32>>(
2486 result,
2487 self.tx_id,
2488 0x6ec69b3aee7fdbba,
2489 fidl::encoding::DynamicFlags::empty(),
2490 )
2491 }
2492}
2493
2494#[must_use = "FIDL methods require a response to be sent"]
2495#[derive(Debug)]
2496pub struct CryptCreateKeyWithIdResponder {
2497 control_handle: std::mem::ManuallyDrop<CryptControlHandle>,
2498 tx_id: u32,
2499}
2500
2501impl std::ops::Drop for CryptCreateKeyWithIdResponder {
2505 fn drop(&mut self) {
2506 self.control_handle.shutdown();
2507 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2509 }
2510}
2511
2512impl fidl::endpoints::Responder for CryptCreateKeyWithIdResponder {
2513 type ControlHandle = CryptControlHandle;
2514
2515 fn control_handle(&self) -> &CryptControlHandle {
2516 &self.control_handle
2517 }
2518
2519 fn drop_without_shutdown(mut self) {
2520 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2522 std::mem::forget(self);
2524 }
2525}
2526
2527impl CryptCreateKeyWithIdResponder {
2528 pub fn send(self, mut result: Result<(&WrappedKey, &[u8]), i32>) -> Result<(), fidl::Error> {
2532 let _result = self.send_raw(result);
2533 if _result.is_err() {
2534 self.control_handle.shutdown();
2535 }
2536 self.drop_without_shutdown();
2537 _result
2538 }
2539
2540 pub fn send_no_shutdown_on_err(
2542 self,
2543 mut result: Result<(&WrappedKey, &[u8]), i32>,
2544 ) -> Result<(), fidl::Error> {
2545 let _result = self.send_raw(result);
2546 self.drop_without_shutdown();
2547 _result
2548 }
2549
2550 fn send_raw(&self, mut result: Result<(&WrappedKey, &[u8]), i32>) -> Result<(), fidl::Error> {
2551 self.control_handle
2552 .inner
2553 .send::<fidl::encoding::ResultType<CryptCreateKeyWithIdResponse, i32>>(
2554 result,
2555 self.tx_id,
2556 0x21e8076688700b50,
2557 fidl::encoding::DynamicFlags::empty(),
2558 )
2559 }
2560}
2561
2562#[must_use = "FIDL methods require a response to be sent"]
2563#[derive(Debug)]
2564pub struct CryptUnwrapKeyResponder {
2565 control_handle: std::mem::ManuallyDrop<CryptControlHandle>,
2566 tx_id: u32,
2567}
2568
2569impl std::ops::Drop for CryptUnwrapKeyResponder {
2573 fn drop(&mut self) {
2574 self.control_handle.shutdown();
2575 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2577 }
2578}
2579
2580impl fidl::endpoints::Responder for CryptUnwrapKeyResponder {
2581 type ControlHandle = CryptControlHandle;
2582
2583 fn control_handle(&self) -> &CryptControlHandle {
2584 &self.control_handle
2585 }
2586
2587 fn drop_without_shutdown(mut self) {
2588 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2590 std::mem::forget(self);
2592 }
2593}
2594
2595impl CryptUnwrapKeyResponder {
2596 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2600 let _result = self.send_raw(result);
2601 if _result.is_err() {
2602 self.control_handle.shutdown();
2603 }
2604 self.drop_without_shutdown();
2605 _result
2606 }
2607
2608 pub fn send_no_shutdown_on_err(
2610 self,
2611 mut result: Result<&[u8], i32>,
2612 ) -> Result<(), fidl::Error> {
2613 let _result = self.send_raw(result);
2614 self.drop_without_shutdown();
2615 _result
2616 }
2617
2618 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2619 self.control_handle.inner.send::<fidl::encoding::ResultType<CryptUnwrapKeyResponse, i32>>(
2620 result.map(|unwrapped_key| (unwrapped_key,)),
2621 self.tx_id,
2622 0x6ec34e2b64d46be9,
2623 fidl::encoding::DynamicFlags::empty(),
2624 )
2625 }
2626}
2627
2628#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2629pub struct CryptManagementMarker;
2630
2631impl fidl::endpoints::ProtocolMarker for CryptManagementMarker {
2632 type Proxy = CryptManagementProxy;
2633 type RequestStream = CryptManagementRequestStream;
2634 #[cfg(target_os = "fuchsia")]
2635 type SynchronousProxy = CryptManagementSynchronousProxy;
2636
2637 const DEBUG_NAME: &'static str = "fuchsia.fxfs.CryptManagement";
2638}
2639impl fidl::endpoints::DiscoverableProtocolMarker for CryptManagementMarker {}
2640pub type CryptManagementAddWrappingKeyResult = Result<(), i32>;
2641pub type CryptManagementSetActiveKeyResult = Result<(), i32>;
2642pub type CryptManagementForgetWrappingKeyResult = Result<(), i32>;
2643
2644pub trait CryptManagementProxyInterface: Send + Sync {
2645 type AddWrappingKeyResponseFut: std::future::Future<Output = Result<CryptManagementAddWrappingKeyResult, fidl::Error>>
2646 + Send;
2647 fn r#add_wrapping_key(
2648 &self,
2649 wrapping_key_id: &[u8; 16],
2650 key: &[u8],
2651 ) -> Self::AddWrappingKeyResponseFut;
2652 type SetActiveKeyResponseFut: std::future::Future<Output = Result<CryptManagementSetActiveKeyResult, fidl::Error>>
2653 + Send;
2654 fn r#set_active_key(
2655 &self,
2656 purpose: KeyPurpose,
2657 wrapping_key_id: &[u8; 16],
2658 ) -> Self::SetActiveKeyResponseFut;
2659 type ForgetWrappingKeyResponseFut: std::future::Future<Output = Result<CryptManagementForgetWrappingKeyResult, fidl::Error>>
2660 + Send;
2661 fn r#forget_wrapping_key(
2662 &self,
2663 wrapping_key_id: &[u8; 16],
2664 ) -> Self::ForgetWrappingKeyResponseFut;
2665}
2666#[derive(Debug)]
2667#[cfg(target_os = "fuchsia")]
2668pub struct CryptManagementSynchronousProxy {
2669 client: fidl::client::sync::Client,
2670}
2671
2672#[cfg(target_os = "fuchsia")]
2673impl fidl::endpoints::SynchronousProxy for CryptManagementSynchronousProxy {
2674 type Proxy = CryptManagementProxy;
2675 type Protocol = CryptManagementMarker;
2676
2677 fn from_channel(inner: fidl::Channel) -> Self {
2678 Self::new(inner)
2679 }
2680
2681 fn into_channel(self) -> fidl::Channel {
2682 self.client.into_channel()
2683 }
2684
2685 fn as_channel(&self) -> &fidl::Channel {
2686 self.client.as_channel()
2687 }
2688}
2689
2690#[cfg(target_os = "fuchsia")]
2691impl CryptManagementSynchronousProxy {
2692 pub fn new(channel: fidl::Channel) -> Self {
2693 let protocol_name = <CryptManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2694 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2695 }
2696
2697 pub fn into_channel(self) -> fidl::Channel {
2698 self.client.into_channel()
2699 }
2700
2701 pub fn wait_for_event(
2704 &self,
2705 deadline: zx::MonotonicInstant,
2706 ) -> Result<CryptManagementEvent, fidl::Error> {
2707 CryptManagementEvent::decode(self.client.wait_for_event(deadline)?)
2708 }
2709
2710 pub fn r#add_wrapping_key(
2714 &self,
2715 mut wrapping_key_id: &[u8; 16],
2716 mut key: &[u8],
2717 ___deadline: zx::MonotonicInstant,
2718 ) -> Result<CryptManagementAddWrappingKeyResult, fidl::Error> {
2719 let _response = self.client.send_query::<
2720 CryptManagementAddWrappingKeyRequest,
2721 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2722 >(
2723 (wrapping_key_id, key,),
2724 0x59a5076762318bf,
2725 fidl::encoding::DynamicFlags::empty(),
2726 ___deadline,
2727 )?;
2728 Ok(_response.map(|x| x))
2729 }
2730
2731 pub fn r#set_active_key(
2734 &self,
2735 mut purpose: KeyPurpose,
2736 mut wrapping_key_id: &[u8; 16],
2737 ___deadline: zx::MonotonicInstant,
2738 ) -> Result<CryptManagementSetActiveKeyResult, fidl::Error> {
2739 let _response = self.client.send_query::<
2740 CryptManagementSetActiveKeyRequest,
2741 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2742 >(
2743 (purpose, wrapping_key_id,),
2744 0x5e81d600442f2872,
2745 fidl::encoding::DynamicFlags::empty(),
2746 ___deadline,
2747 )?;
2748 Ok(_response.map(|x| x))
2749 }
2750
2751 pub fn r#forget_wrapping_key(
2755 &self,
2756 mut wrapping_key_id: &[u8; 16],
2757 ___deadline: zx::MonotonicInstant,
2758 ) -> Result<CryptManagementForgetWrappingKeyResult, fidl::Error> {
2759 let _response = self.client.send_query::<
2760 CryptManagementForgetWrappingKeyRequest,
2761 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2762 >(
2763 (wrapping_key_id,),
2764 0x436d6d27696dfcf4,
2765 fidl::encoding::DynamicFlags::empty(),
2766 ___deadline,
2767 )?;
2768 Ok(_response.map(|x| x))
2769 }
2770}
2771
2772#[cfg(target_os = "fuchsia")]
2773impl From<CryptManagementSynchronousProxy> for zx::NullableHandle {
2774 fn from(value: CryptManagementSynchronousProxy) -> Self {
2775 value.into_channel().into()
2776 }
2777}
2778
2779#[cfg(target_os = "fuchsia")]
2780impl From<fidl::Channel> for CryptManagementSynchronousProxy {
2781 fn from(value: fidl::Channel) -> Self {
2782 Self::new(value)
2783 }
2784}
2785
2786#[cfg(target_os = "fuchsia")]
2787impl fidl::endpoints::FromClient for CryptManagementSynchronousProxy {
2788 type Protocol = CryptManagementMarker;
2789
2790 fn from_client(value: fidl::endpoints::ClientEnd<CryptManagementMarker>) -> Self {
2791 Self::new(value.into_channel())
2792 }
2793}
2794
2795#[derive(Debug, Clone)]
2796pub struct CryptManagementProxy {
2797 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2798}
2799
2800impl fidl::endpoints::Proxy for CryptManagementProxy {
2801 type Protocol = CryptManagementMarker;
2802
2803 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2804 Self::new(inner)
2805 }
2806
2807 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2808 self.client.into_channel().map_err(|client| Self { client })
2809 }
2810
2811 fn as_channel(&self) -> &::fidl::AsyncChannel {
2812 self.client.as_channel()
2813 }
2814}
2815
2816impl CryptManagementProxy {
2817 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2819 let protocol_name = <CryptManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2820 Self { client: fidl::client::Client::new(channel, protocol_name) }
2821 }
2822
2823 pub fn take_event_stream(&self) -> CryptManagementEventStream {
2829 CryptManagementEventStream { event_receiver: self.client.take_event_receiver() }
2830 }
2831
2832 pub fn r#add_wrapping_key(
2836 &self,
2837 mut wrapping_key_id: &[u8; 16],
2838 mut key: &[u8],
2839 ) -> fidl::client::QueryResponseFut<
2840 CryptManagementAddWrappingKeyResult,
2841 fidl::encoding::DefaultFuchsiaResourceDialect,
2842 > {
2843 CryptManagementProxyInterface::r#add_wrapping_key(self, wrapping_key_id, key)
2844 }
2845
2846 pub fn r#set_active_key(
2849 &self,
2850 mut purpose: KeyPurpose,
2851 mut wrapping_key_id: &[u8; 16],
2852 ) -> fidl::client::QueryResponseFut<
2853 CryptManagementSetActiveKeyResult,
2854 fidl::encoding::DefaultFuchsiaResourceDialect,
2855 > {
2856 CryptManagementProxyInterface::r#set_active_key(self, purpose, wrapping_key_id)
2857 }
2858
2859 pub fn r#forget_wrapping_key(
2863 &self,
2864 mut wrapping_key_id: &[u8; 16],
2865 ) -> fidl::client::QueryResponseFut<
2866 CryptManagementForgetWrappingKeyResult,
2867 fidl::encoding::DefaultFuchsiaResourceDialect,
2868 > {
2869 CryptManagementProxyInterface::r#forget_wrapping_key(self, wrapping_key_id)
2870 }
2871}
2872
2873impl CryptManagementProxyInterface for CryptManagementProxy {
2874 type AddWrappingKeyResponseFut = fidl::client::QueryResponseFut<
2875 CryptManagementAddWrappingKeyResult,
2876 fidl::encoding::DefaultFuchsiaResourceDialect,
2877 >;
2878 fn r#add_wrapping_key(
2879 &self,
2880 mut wrapping_key_id: &[u8; 16],
2881 mut key: &[u8],
2882 ) -> Self::AddWrappingKeyResponseFut {
2883 fn _decode(
2884 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2885 ) -> Result<CryptManagementAddWrappingKeyResult, fidl::Error> {
2886 let _response = fidl::client::decode_transaction_body::<
2887 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2888 fidl::encoding::DefaultFuchsiaResourceDialect,
2889 0x59a5076762318bf,
2890 >(_buf?)?;
2891 Ok(_response.map(|x| x))
2892 }
2893 self.client.send_query_and_decode::<
2894 CryptManagementAddWrappingKeyRequest,
2895 CryptManagementAddWrappingKeyResult,
2896 >(
2897 (wrapping_key_id, key,),
2898 0x59a5076762318bf,
2899 fidl::encoding::DynamicFlags::empty(),
2900 _decode,
2901 )
2902 }
2903
2904 type SetActiveKeyResponseFut = fidl::client::QueryResponseFut<
2905 CryptManagementSetActiveKeyResult,
2906 fidl::encoding::DefaultFuchsiaResourceDialect,
2907 >;
2908 fn r#set_active_key(
2909 &self,
2910 mut purpose: KeyPurpose,
2911 mut wrapping_key_id: &[u8; 16],
2912 ) -> Self::SetActiveKeyResponseFut {
2913 fn _decode(
2914 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2915 ) -> Result<CryptManagementSetActiveKeyResult, fidl::Error> {
2916 let _response = fidl::client::decode_transaction_body::<
2917 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2918 fidl::encoding::DefaultFuchsiaResourceDialect,
2919 0x5e81d600442f2872,
2920 >(_buf?)?;
2921 Ok(_response.map(|x| x))
2922 }
2923 self.client.send_query_and_decode::<
2924 CryptManagementSetActiveKeyRequest,
2925 CryptManagementSetActiveKeyResult,
2926 >(
2927 (purpose, wrapping_key_id,),
2928 0x5e81d600442f2872,
2929 fidl::encoding::DynamicFlags::empty(),
2930 _decode,
2931 )
2932 }
2933
2934 type ForgetWrappingKeyResponseFut = fidl::client::QueryResponseFut<
2935 CryptManagementForgetWrappingKeyResult,
2936 fidl::encoding::DefaultFuchsiaResourceDialect,
2937 >;
2938 fn r#forget_wrapping_key(
2939 &self,
2940 mut wrapping_key_id: &[u8; 16],
2941 ) -> Self::ForgetWrappingKeyResponseFut {
2942 fn _decode(
2943 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2944 ) -> Result<CryptManagementForgetWrappingKeyResult, fidl::Error> {
2945 let _response = fidl::client::decode_transaction_body::<
2946 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2947 fidl::encoding::DefaultFuchsiaResourceDialect,
2948 0x436d6d27696dfcf4,
2949 >(_buf?)?;
2950 Ok(_response.map(|x| x))
2951 }
2952 self.client.send_query_and_decode::<
2953 CryptManagementForgetWrappingKeyRequest,
2954 CryptManagementForgetWrappingKeyResult,
2955 >(
2956 (wrapping_key_id,),
2957 0x436d6d27696dfcf4,
2958 fidl::encoding::DynamicFlags::empty(),
2959 _decode,
2960 )
2961 }
2962}
2963
2964pub struct CryptManagementEventStream {
2965 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2966}
2967
2968impl std::marker::Unpin for CryptManagementEventStream {}
2969
2970impl futures::stream::FusedStream for CryptManagementEventStream {
2971 fn is_terminated(&self) -> bool {
2972 self.event_receiver.is_terminated()
2973 }
2974}
2975
2976impl futures::Stream for CryptManagementEventStream {
2977 type Item = Result<CryptManagementEvent, fidl::Error>;
2978
2979 fn poll_next(
2980 mut self: std::pin::Pin<&mut Self>,
2981 cx: &mut std::task::Context<'_>,
2982 ) -> std::task::Poll<Option<Self::Item>> {
2983 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2984 &mut self.event_receiver,
2985 cx
2986 )?) {
2987 Some(buf) => std::task::Poll::Ready(Some(CryptManagementEvent::decode(buf))),
2988 None => std::task::Poll::Ready(None),
2989 }
2990 }
2991}
2992
2993#[derive(Debug)]
2994pub enum CryptManagementEvent {}
2995
2996impl CryptManagementEvent {
2997 fn decode(
2999 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3000 ) -> Result<CryptManagementEvent, fidl::Error> {
3001 let (bytes, _handles) = buf.split_mut();
3002 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3003 debug_assert_eq!(tx_header.tx_id, 0);
3004 match tx_header.ordinal {
3005 _ => Err(fidl::Error::UnknownOrdinal {
3006 ordinal: tx_header.ordinal,
3007 protocol_name:
3008 <CryptManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3009 }),
3010 }
3011 }
3012}
3013
3014pub struct CryptManagementRequestStream {
3016 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3017 is_terminated: bool,
3018}
3019
3020impl std::marker::Unpin for CryptManagementRequestStream {}
3021
3022impl futures::stream::FusedStream for CryptManagementRequestStream {
3023 fn is_terminated(&self) -> bool {
3024 self.is_terminated
3025 }
3026}
3027
3028impl fidl::endpoints::RequestStream for CryptManagementRequestStream {
3029 type Protocol = CryptManagementMarker;
3030 type ControlHandle = CryptManagementControlHandle;
3031
3032 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3033 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3034 }
3035
3036 fn control_handle(&self) -> Self::ControlHandle {
3037 CryptManagementControlHandle { inner: self.inner.clone() }
3038 }
3039
3040 fn into_inner(
3041 self,
3042 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3043 {
3044 (self.inner, self.is_terminated)
3045 }
3046
3047 fn from_inner(
3048 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3049 is_terminated: bool,
3050 ) -> Self {
3051 Self { inner, is_terminated }
3052 }
3053}
3054
3055impl futures::Stream for CryptManagementRequestStream {
3056 type Item = Result<CryptManagementRequest, fidl::Error>;
3057
3058 fn poll_next(
3059 mut self: std::pin::Pin<&mut Self>,
3060 cx: &mut std::task::Context<'_>,
3061 ) -> std::task::Poll<Option<Self::Item>> {
3062 let this = &mut *self;
3063 if this.inner.check_shutdown(cx) {
3064 this.is_terminated = true;
3065 return std::task::Poll::Ready(None);
3066 }
3067 if this.is_terminated {
3068 panic!("polled CryptManagementRequestStream after completion");
3069 }
3070 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3071 |bytes, handles| {
3072 match this.inner.channel().read_etc(cx, bytes, handles) {
3073 std::task::Poll::Ready(Ok(())) => {}
3074 std::task::Poll::Pending => return std::task::Poll::Pending,
3075 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3076 this.is_terminated = true;
3077 return std::task::Poll::Ready(None);
3078 }
3079 std::task::Poll::Ready(Err(e)) => {
3080 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3081 e.into(),
3082 ))));
3083 }
3084 }
3085
3086 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3088
3089 std::task::Poll::Ready(Some(match header.ordinal {
3090 0x59a5076762318bf => {
3091 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3092 let mut req = fidl::new_empty!(
3093 CryptManagementAddWrappingKeyRequest,
3094 fidl::encoding::DefaultFuchsiaResourceDialect
3095 );
3096 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CryptManagementAddWrappingKeyRequest>(&header, _body_bytes, handles, &mut req)?;
3097 let control_handle =
3098 CryptManagementControlHandle { inner: this.inner.clone() };
3099 Ok(CryptManagementRequest::AddWrappingKey {
3100 wrapping_key_id: req.wrapping_key_id,
3101 key: req.key,
3102
3103 responder: CryptManagementAddWrappingKeyResponder {
3104 control_handle: std::mem::ManuallyDrop::new(control_handle),
3105 tx_id: header.tx_id,
3106 },
3107 })
3108 }
3109 0x5e81d600442f2872 => {
3110 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3111 let mut req = fidl::new_empty!(
3112 CryptManagementSetActiveKeyRequest,
3113 fidl::encoding::DefaultFuchsiaResourceDialect
3114 );
3115 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CryptManagementSetActiveKeyRequest>(&header, _body_bytes, handles, &mut req)?;
3116 let control_handle =
3117 CryptManagementControlHandle { inner: this.inner.clone() };
3118 Ok(CryptManagementRequest::SetActiveKey {
3119 purpose: req.purpose,
3120 wrapping_key_id: req.wrapping_key_id,
3121
3122 responder: CryptManagementSetActiveKeyResponder {
3123 control_handle: std::mem::ManuallyDrop::new(control_handle),
3124 tx_id: header.tx_id,
3125 },
3126 })
3127 }
3128 0x436d6d27696dfcf4 => {
3129 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3130 let mut req = fidl::new_empty!(
3131 CryptManagementForgetWrappingKeyRequest,
3132 fidl::encoding::DefaultFuchsiaResourceDialect
3133 );
3134 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CryptManagementForgetWrappingKeyRequest>(&header, _body_bytes, handles, &mut req)?;
3135 let control_handle =
3136 CryptManagementControlHandle { inner: this.inner.clone() };
3137 Ok(CryptManagementRequest::ForgetWrappingKey {
3138 wrapping_key_id: req.wrapping_key_id,
3139
3140 responder: CryptManagementForgetWrappingKeyResponder {
3141 control_handle: std::mem::ManuallyDrop::new(control_handle),
3142 tx_id: header.tx_id,
3143 },
3144 })
3145 }
3146 _ => Err(fidl::Error::UnknownOrdinal {
3147 ordinal: header.ordinal,
3148 protocol_name:
3149 <CryptManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3150 }),
3151 }))
3152 },
3153 )
3154 }
3155}
3156
3157#[derive(Debug)]
3158pub enum CryptManagementRequest {
3159 AddWrappingKey {
3163 wrapping_key_id: [u8; 16],
3164 key: Vec<u8>,
3165 responder: CryptManagementAddWrappingKeyResponder,
3166 },
3167 SetActiveKey {
3170 purpose: KeyPurpose,
3171 wrapping_key_id: [u8; 16],
3172 responder: CryptManagementSetActiveKeyResponder,
3173 },
3174 ForgetWrappingKey {
3178 wrapping_key_id: [u8; 16],
3179 responder: CryptManagementForgetWrappingKeyResponder,
3180 },
3181}
3182
3183impl CryptManagementRequest {
3184 #[allow(irrefutable_let_patterns)]
3185 pub fn into_add_wrapping_key(
3186 self,
3187 ) -> Option<([u8; 16], Vec<u8>, CryptManagementAddWrappingKeyResponder)> {
3188 if let CryptManagementRequest::AddWrappingKey { wrapping_key_id, key, responder } = self {
3189 Some((wrapping_key_id, key, responder))
3190 } else {
3191 None
3192 }
3193 }
3194
3195 #[allow(irrefutable_let_patterns)]
3196 pub fn into_set_active_key(
3197 self,
3198 ) -> Option<(KeyPurpose, [u8; 16], CryptManagementSetActiveKeyResponder)> {
3199 if let CryptManagementRequest::SetActiveKey { purpose, wrapping_key_id, responder } = self {
3200 Some((purpose, wrapping_key_id, responder))
3201 } else {
3202 None
3203 }
3204 }
3205
3206 #[allow(irrefutable_let_patterns)]
3207 pub fn into_forget_wrapping_key(
3208 self,
3209 ) -> Option<([u8; 16], CryptManagementForgetWrappingKeyResponder)> {
3210 if let CryptManagementRequest::ForgetWrappingKey { wrapping_key_id, responder } = self {
3211 Some((wrapping_key_id, responder))
3212 } else {
3213 None
3214 }
3215 }
3216
3217 pub fn method_name(&self) -> &'static str {
3219 match *self {
3220 CryptManagementRequest::AddWrappingKey { .. } => "add_wrapping_key",
3221 CryptManagementRequest::SetActiveKey { .. } => "set_active_key",
3222 CryptManagementRequest::ForgetWrappingKey { .. } => "forget_wrapping_key",
3223 }
3224 }
3225}
3226
3227#[derive(Debug, Clone)]
3228pub struct CryptManagementControlHandle {
3229 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3230}
3231
3232impl fidl::endpoints::ControlHandle for CryptManagementControlHandle {
3233 fn shutdown(&self) {
3234 self.inner.shutdown()
3235 }
3236
3237 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3238 self.inner.shutdown_with_epitaph(status)
3239 }
3240
3241 fn is_closed(&self) -> bool {
3242 self.inner.channel().is_closed()
3243 }
3244 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3245 self.inner.channel().on_closed()
3246 }
3247
3248 #[cfg(target_os = "fuchsia")]
3249 fn signal_peer(
3250 &self,
3251 clear_mask: zx::Signals,
3252 set_mask: zx::Signals,
3253 ) -> Result<(), zx_status::Status> {
3254 use fidl::Peered;
3255 self.inner.channel().signal_peer(clear_mask, set_mask)
3256 }
3257}
3258
3259impl CryptManagementControlHandle {}
3260
3261#[must_use = "FIDL methods require a response to be sent"]
3262#[derive(Debug)]
3263pub struct CryptManagementAddWrappingKeyResponder {
3264 control_handle: std::mem::ManuallyDrop<CryptManagementControlHandle>,
3265 tx_id: u32,
3266}
3267
3268impl std::ops::Drop for CryptManagementAddWrappingKeyResponder {
3272 fn drop(&mut self) {
3273 self.control_handle.shutdown();
3274 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3276 }
3277}
3278
3279impl fidl::endpoints::Responder for CryptManagementAddWrappingKeyResponder {
3280 type ControlHandle = CryptManagementControlHandle;
3281
3282 fn control_handle(&self) -> &CryptManagementControlHandle {
3283 &self.control_handle
3284 }
3285
3286 fn drop_without_shutdown(mut self) {
3287 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3289 std::mem::forget(self);
3291 }
3292}
3293
3294impl CryptManagementAddWrappingKeyResponder {
3295 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3299 let _result = self.send_raw(result);
3300 if _result.is_err() {
3301 self.control_handle.shutdown();
3302 }
3303 self.drop_without_shutdown();
3304 _result
3305 }
3306
3307 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3309 let _result = self.send_raw(result);
3310 self.drop_without_shutdown();
3311 _result
3312 }
3313
3314 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3315 self.control_handle
3316 .inner
3317 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3318 result,
3319 self.tx_id,
3320 0x59a5076762318bf,
3321 fidl::encoding::DynamicFlags::empty(),
3322 )
3323 }
3324}
3325
3326#[must_use = "FIDL methods require a response to be sent"]
3327#[derive(Debug)]
3328pub struct CryptManagementSetActiveKeyResponder {
3329 control_handle: std::mem::ManuallyDrop<CryptManagementControlHandle>,
3330 tx_id: u32,
3331}
3332
3333impl std::ops::Drop for CryptManagementSetActiveKeyResponder {
3337 fn drop(&mut self) {
3338 self.control_handle.shutdown();
3339 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3341 }
3342}
3343
3344impl fidl::endpoints::Responder for CryptManagementSetActiveKeyResponder {
3345 type ControlHandle = CryptManagementControlHandle;
3346
3347 fn control_handle(&self) -> &CryptManagementControlHandle {
3348 &self.control_handle
3349 }
3350
3351 fn drop_without_shutdown(mut self) {
3352 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3354 std::mem::forget(self);
3356 }
3357}
3358
3359impl CryptManagementSetActiveKeyResponder {
3360 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3364 let _result = self.send_raw(result);
3365 if _result.is_err() {
3366 self.control_handle.shutdown();
3367 }
3368 self.drop_without_shutdown();
3369 _result
3370 }
3371
3372 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3374 let _result = self.send_raw(result);
3375 self.drop_without_shutdown();
3376 _result
3377 }
3378
3379 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3380 self.control_handle
3381 .inner
3382 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3383 result,
3384 self.tx_id,
3385 0x5e81d600442f2872,
3386 fidl::encoding::DynamicFlags::empty(),
3387 )
3388 }
3389}
3390
3391#[must_use = "FIDL methods require a response to be sent"]
3392#[derive(Debug)]
3393pub struct CryptManagementForgetWrappingKeyResponder {
3394 control_handle: std::mem::ManuallyDrop<CryptManagementControlHandle>,
3395 tx_id: u32,
3396}
3397
3398impl std::ops::Drop for CryptManagementForgetWrappingKeyResponder {
3402 fn drop(&mut self) {
3403 self.control_handle.shutdown();
3404 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3406 }
3407}
3408
3409impl fidl::endpoints::Responder for CryptManagementForgetWrappingKeyResponder {
3410 type ControlHandle = CryptManagementControlHandle;
3411
3412 fn control_handle(&self) -> &CryptManagementControlHandle {
3413 &self.control_handle
3414 }
3415
3416 fn drop_without_shutdown(mut self) {
3417 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3419 std::mem::forget(self);
3421 }
3422}
3423
3424impl CryptManagementForgetWrappingKeyResponder {
3425 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3429 let _result = self.send_raw(result);
3430 if _result.is_err() {
3431 self.control_handle.shutdown();
3432 }
3433 self.drop_without_shutdown();
3434 _result
3435 }
3436
3437 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3439 let _result = self.send_raw(result);
3440 self.drop_without_shutdown();
3441 _result
3442 }
3443
3444 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3445 self.control_handle
3446 .inner
3447 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3448 result,
3449 self.tx_id,
3450 0x436d6d27696dfcf4,
3451 fidl::encoding::DynamicFlags::empty(),
3452 )
3453 }
3454}
3455
3456#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3457pub struct DebugMarker;
3458
3459impl fidl::endpoints::ProtocolMarker for DebugMarker {
3460 type Proxy = DebugProxy;
3461 type RequestStream = DebugRequestStream;
3462 #[cfg(target_os = "fuchsia")]
3463 type SynchronousProxy = DebugSynchronousProxy;
3464
3465 const DEBUG_NAME: &'static str = "fuchsia.fxfs.Debug";
3466}
3467impl fidl::endpoints::DiscoverableProtocolMarker for DebugMarker {}
3468pub type DebugCompactResult = Result<(), i32>;
3469pub type DebugDeleteProfileResult = Result<(), i32>;
3470pub type DebugStopProfileTasksResult = Result<(), i32>;
3471
3472pub trait DebugProxyInterface: Send + Sync {
3473 type CompactResponseFut: std::future::Future<Output = Result<DebugCompactResult, fidl::Error>>
3474 + Send;
3475 fn r#compact(&self) -> Self::CompactResponseFut;
3476 type DeleteProfileResponseFut: std::future::Future<Output = Result<DebugDeleteProfileResult, fidl::Error>>
3477 + Send;
3478 fn r#delete_profile(&self, volume: &str, profile: &str) -> Self::DeleteProfileResponseFut;
3479 type StopProfileTasksResponseFut: std::future::Future<Output = Result<DebugStopProfileTasksResult, fidl::Error>>
3480 + Send;
3481 fn r#stop_profile_tasks(&self) -> Self::StopProfileTasksResponseFut;
3482}
3483#[derive(Debug)]
3484#[cfg(target_os = "fuchsia")]
3485pub struct DebugSynchronousProxy {
3486 client: fidl::client::sync::Client,
3487}
3488
3489#[cfg(target_os = "fuchsia")]
3490impl fidl::endpoints::SynchronousProxy for DebugSynchronousProxy {
3491 type Proxy = DebugProxy;
3492 type Protocol = DebugMarker;
3493
3494 fn from_channel(inner: fidl::Channel) -> Self {
3495 Self::new(inner)
3496 }
3497
3498 fn into_channel(self) -> fidl::Channel {
3499 self.client.into_channel()
3500 }
3501
3502 fn as_channel(&self) -> &fidl::Channel {
3503 self.client.as_channel()
3504 }
3505}
3506
3507#[cfg(target_os = "fuchsia")]
3508impl DebugSynchronousProxy {
3509 pub fn new(channel: fidl::Channel) -> Self {
3510 let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3511 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3512 }
3513
3514 pub fn into_channel(self) -> fidl::Channel {
3515 self.client.into_channel()
3516 }
3517
3518 pub fn wait_for_event(
3521 &self,
3522 deadline: zx::MonotonicInstant,
3523 ) -> Result<DebugEvent, fidl::Error> {
3524 DebugEvent::decode(self.client.wait_for_event(deadline)?)
3525 }
3526
3527 pub fn r#compact(
3529 &self,
3530 ___deadline: zx::MonotonicInstant,
3531 ) -> Result<DebugCompactResult, fidl::Error> {
3532 let _response = self.client.send_query::<
3533 fidl::encoding::EmptyPayload,
3534 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3535 >(
3536 (),
3537 0x6553eb197306e489,
3538 fidl::encoding::DynamicFlags::empty(),
3539 ___deadline,
3540 )?;
3541 Ok(_response.map(|x| x))
3542 }
3543
3544 pub fn r#delete_profile(
3547 &self,
3548 mut volume: &str,
3549 mut profile: &str,
3550 ___deadline: zx::MonotonicInstant,
3551 ) -> Result<DebugDeleteProfileResult, fidl::Error> {
3552 let _response = self.client.send_query::<
3553 DebugDeleteProfileRequest,
3554 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3555 >(
3556 (volume, profile,),
3557 0x54d9d4c9cf300a1e,
3558 fidl::encoding::DynamicFlags::empty(),
3559 ___deadline,
3560 )?;
3561 Ok(_response.map(|x| x))
3562 }
3563
3564 pub fn r#stop_profile_tasks(
3567 &self,
3568 ___deadline: zx::MonotonicInstant,
3569 ) -> Result<DebugStopProfileTasksResult, fidl::Error> {
3570 let _response = self.client.send_query::<
3571 fidl::encoding::EmptyPayload,
3572 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3573 >(
3574 (),
3575 0x1657b945dd629177,
3576 fidl::encoding::DynamicFlags::empty(),
3577 ___deadline,
3578 )?;
3579 Ok(_response.map(|x| x))
3580 }
3581}
3582
3583#[cfg(target_os = "fuchsia")]
3584impl From<DebugSynchronousProxy> for zx::NullableHandle {
3585 fn from(value: DebugSynchronousProxy) -> Self {
3586 value.into_channel().into()
3587 }
3588}
3589
3590#[cfg(target_os = "fuchsia")]
3591impl From<fidl::Channel> for DebugSynchronousProxy {
3592 fn from(value: fidl::Channel) -> Self {
3593 Self::new(value)
3594 }
3595}
3596
3597#[cfg(target_os = "fuchsia")]
3598impl fidl::endpoints::FromClient for DebugSynchronousProxy {
3599 type Protocol = DebugMarker;
3600
3601 fn from_client(value: fidl::endpoints::ClientEnd<DebugMarker>) -> Self {
3602 Self::new(value.into_channel())
3603 }
3604}
3605
3606#[derive(Debug, Clone)]
3607pub struct DebugProxy {
3608 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3609}
3610
3611impl fidl::endpoints::Proxy for DebugProxy {
3612 type Protocol = DebugMarker;
3613
3614 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3615 Self::new(inner)
3616 }
3617
3618 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3619 self.client.into_channel().map_err(|client| Self { client })
3620 }
3621
3622 fn as_channel(&self) -> &::fidl::AsyncChannel {
3623 self.client.as_channel()
3624 }
3625}
3626
3627impl DebugProxy {
3628 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3630 let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3631 Self { client: fidl::client::Client::new(channel, protocol_name) }
3632 }
3633
3634 pub fn take_event_stream(&self) -> DebugEventStream {
3640 DebugEventStream { event_receiver: self.client.take_event_receiver() }
3641 }
3642
3643 pub fn r#compact(
3645 &self,
3646 ) -> fidl::client::QueryResponseFut<
3647 DebugCompactResult,
3648 fidl::encoding::DefaultFuchsiaResourceDialect,
3649 > {
3650 DebugProxyInterface::r#compact(self)
3651 }
3652
3653 pub fn r#delete_profile(
3656 &self,
3657 mut volume: &str,
3658 mut profile: &str,
3659 ) -> fidl::client::QueryResponseFut<
3660 DebugDeleteProfileResult,
3661 fidl::encoding::DefaultFuchsiaResourceDialect,
3662 > {
3663 DebugProxyInterface::r#delete_profile(self, volume, profile)
3664 }
3665
3666 pub fn r#stop_profile_tasks(
3669 &self,
3670 ) -> fidl::client::QueryResponseFut<
3671 DebugStopProfileTasksResult,
3672 fidl::encoding::DefaultFuchsiaResourceDialect,
3673 > {
3674 DebugProxyInterface::r#stop_profile_tasks(self)
3675 }
3676}
3677
3678impl DebugProxyInterface for DebugProxy {
3679 type CompactResponseFut = fidl::client::QueryResponseFut<
3680 DebugCompactResult,
3681 fidl::encoding::DefaultFuchsiaResourceDialect,
3682 >;
3683 fn r#compact(&self) -> Self::CompactResponseFut {
3684 fn _decode(
3685 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3686 ) -> Result<DebugCompactResult, fidl::Error> {
3687 let _response = fidl::client::decode_transaction_body::<
3688 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3689 fidl::encoding::DefaultFuchsiaResourceDialect,
3690 0x6553eb197306e489,
3691 >(_buf?)?;
3692 Ok(_response.map(|x| x))
3693 }
3694 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DebugCompactResult>(
3695 (),
3696 0x6553eb197306e489,
3697 fidl::encoding::DynamicFlags::empty(),
3698 _decode,
3699 )
3700 }
3701
3702 type DeleteProfileResponseFut = fidl::client::QueryResponseFut<
3703 DebugDeleteProfileResult,
3704 fidl::encoding::DefaultFuchsiaResourceDialect,
3705 >;
3706 fn r#delete_profile(
3707 &self,
3708 mut volume: &str,
3709 mut profile: &str,
3710 ) -> Self::DeleteProfileResponseFut {
3711 fn _decode(
3712 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3713 ) -> Result<DebugDeleteProfileResult, fidl::Error> {
3714 let _response = fidl::client::decode_transaction_body::<
3715 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3716 fidl::encoding::DefaultFuchsiaResourceDialect,
3717 0x54d9d4c9cf300a1e,
3718 >(_buf?)?;
3719 Ok(_response.map(|x| x))
3720 }
3721 self.client.send_query_and_decode::<DebugDeleteProfileRequest, DebugDeleteProfileResult>(
3722 (volume, profile),
3723 0x54d9d4c9cf300a1e,
3724 fidl::encoding::DynamicFlags::empty(),
3725 _decode,
3726 )
3727 }
3728
3729 type StopProfileTasksResponseFut = fidl::client::QueryResponseFut<
3730 DebugStopProfileTasksResult,
3731 fidl::encoding::DefaultFuchsiaResourceDialect,
3732 >;
3733 fn r#stop_profile_tasks(&self) -> Self::StopProfileTasksResponseFut {
3734 fn _decode(
3735 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3736 ) -> Result<DebugStopProfileTasksResult, fidl::Error> {
3737 let _response = fidl::client::decode_transaction_body::<
3738 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3739 fidl::encoding::DefaultFuchsiaResourceDialect,
3740 0x1657b945dd629177,
3741 >(_buf?)?;
3742 Ok(_response.map(|x| x))
3743 }
3744 self.client
3745 .send_query_and_decode::<fidl::encoding::EmptyPayload, DebugStopProfileTasksResult>(
3746 (),
3747 0x1657b945dd629177,
3748 fidl::encoding::DynamicFlags::empty(),
3749 _decode,
3750 )
3751 }
3752}
3753
3754pub struct DebugEventStream {
3755 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3756}
3757
3758impl std::marker::Unpin for DebugEventStream {}
3759
3760impl futures::stream::FusedStream for DebugEventStream {
3761 fn is_terminated(&self) -> bool {
3762 self.event_receiver.is_terminated()
3763 }
3764}
3765
3766impl futures::Stream for DebugEventStream {
3767 type Item = Result<DebugEvent, fidl::Error>;
3768
3769 fn poll_next(
3770 mut self: std::pin::Pin<&mut Self>,
3771 cx: &mut std::task::Context<'_>,
3772 ) -> std::task::Poll<Option<Self::Item>> {
3773 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3774 &mut self.event_receiver,
3775 cx
3776 )?) {
3777 Some(buf) => std::task::Poll::Ready(Some(DebugEvent::decode(buf))),
3778 None => std::task::Poll::Ready(None),
3779 }
3780 }
3781}
3782
3783#[derive(Debug)]
3784pub enum DebugEvent {}
3785
3786impl DebugEvent {
3787 fn decode(
3789 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3790 ) -> Result<DebugEvent, fidl::Error> {
3791 let (bytes, _handles) = buf.split_mut();
3792 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3793 debug_assert_eq!(tx_header.tx_id, 0);
3794 match tx_header.ordinal {
3795 _ => Err(fidl::Error::UnknownOrdinal {
3796 ordinal: tx_header.ordinal,
3797 protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3798 }),
3799 }
3800 }
3801}
3802
3803pub struct DebugRequestStream {
3805 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3806 is_terminated: bool,
3807}
3808
3809impl std::marker::Unpin for DebugRequestStream {}
3810
3811impl futures::stream::FusedStream for DebugRequestStream {
3812 fn is_terminated(&self) -> bool {
3813 self.is_terminated
3814 }
3815}
3816
3817impl fidl::endpoints::RequestStream for DebugRequestStream {
3818 type Protocol = DebugMarker;
3819 type ControlHandle = DebugControlHandle;
3820
3821 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3822 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3823 }
3824
3825 fn control_handle(&self) -> Self::ControlHandle {
3826 DebugControlHandle { inner: self.inner.clone() }
3827 }
3828
3829 fn into_inner(
3830 self,
3831 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3832 {
3833 (self.inner, self.is_terminated)
3834 }
3835
3836 fn from_inner(
3837 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3838 is_terminated: bool,
3839 ) -> Self {
3840 Self { inner, is_terminated }
3841 }
3842}
3843
3844impl futures::Stream for DebugRequestStream {
3845 type Item = Result<DebugRequest, fidl::Error>;
3846
3847 fn poll_next(
3848 mut self: std::pin::Pin<&mut Self>,
3849 cx: &mut std::task::Context<'_>,
3850 ) -> std::task::Poll<Option<Self::Item>> {
3851 let this = &mut *self;
3852 if this.inner.check_shutdown(cx) {
3853 this.is_terminated = true;
3854 return std::task::Poll::Ready(None);
3855 }
3856 if this.is_terminated {
3857 panic!("polled DebugRequestStream after completion");
3858 }
3859 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3860 |bytes, handles| {
3861 match this.inner.channel().read_etc(cx, bytes, handles) {
3862 std::task::Poll::Ready(Ok(())) => {}
3863 std::task::Poll::Pending => return std::task::Poll::Pending,
3864 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3865 this.is_terminated = true;
3866 return std::task::Poll::Ready(None);
3867 }
3868 std::task::Poll::Ready(Err(e)) => {
3869 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3870 e.into(),
3871 ))));
3872 }
3873 }
3874
3875 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3877
3878 std::task::Poll::Ready(Some(match header.ordinal {
3879 0x6553eb197306e489 => {
3880 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3881 let mut req = fidl::new_empty!(
3882 fidl::encoding::EmptyPayload,
3883 fidl::encoding::DefaultFuchsiaResourceDialect
3884 );
3885 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3886 let control_handle = DebugControlHandle { inner: this.inner.clone() };
3887 Ok(DebugRequest::Compact {
3888 responder: DebugCompactResponder {
3889 control_handle: std::mem::ManuallyDrop::new(control_handle),
3890 tx_id: header.tx_id,
3891 },
3892 })
3893 }
3894 0x54d9d4c9cf300a1e => {
3895 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3896 let mut req = fidl::new_empty!(
3897 DebugDeleteProfileRequest,
3898 fidl::encoding::DefaultFuchsiaResourceDialect
3899 );
3900 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugDeleteProfileRequest>(&header, _body_bytes, handles, &mut req)?;
3901 let control_handle = DebugControlHandle { inner: this.inner.clone() };
3902 Ok(DebugRequest::DeleteProfile {
3903 volume: req.volume,
3904 profile: req.profile,
3905
3906 responder: DebugDeleteProfileResponder {
3907 control_handle: std::mem::ManuallyDrop::new(control_handle),
3908 tx_id: header.tx_id,
3909 },
3910 })
3911 }
3912 0x1657b945dd629177 => {
3913 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3914 let mut req = fidl::new_empty!(
3915 fidl::encoding::EmptyPayload,
3916 fidl::encoding::DefaultFuchsiaResourceDialect
3917 );
3918 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3919 let control_handle = DebugControlHandle { inner: this.inner.clone() };
3920 Ok(DebugRequest::StopProfileTasks {
3921 responder: DebugStopProfileTasksResponder {
3922 control_handle: std::mem::ManuallyDrop::new(control_handle),
3923 tx_id: header.tx_id,
3924 },
3925 })
3926 }
3927 _ => Err(fidl::Error::UnknownOrdinal {
3928 ordinal: header.ordinal,
3929 protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3930 }),
3931 }))
3932 },
3933 )
3934 }
3935}
3936
3937#[derive(Debug)]
3940pub enum DebugRequest {
3941 Compact { responder: DebugCompactResponder },
3943 DeleteProfile { volume: String, profile: String, responder: DebugDeleteProfileResponder },
3946 StopProfileTasks { responder: DebugStopProfileTasksResponder },
3949}
3950
3951impl DebugRequest {
3952 #[allow(irrefutable_let_patterns)]
3953 pub fn into_compact(self) -> Option<(DebugCompactResponder)> {
3954 if let DebugRequest::Compact { responder } = self { Some((responder)) } else { None }
3955 }
3956
3957 #[allow(irrefutable_let_patterns)]
3958 pub fn into_delete_profile(self) -> Option<(String, String, DebugDeleteProfileResponder)> {
3959 if let DebugRequest::DeleteProfile { volume, profile, responder } = self {
3960 Some((volume, profile, responder))
3961 } else {
3962 None
3963 }
3964 }
3965
3966 #[allow(irrefutable_let_patterns)]
3967 pub fn into_stop_profile_tasks(self) -> Option<(DebugStopProfileTasksResponder)> {
3968 if let DebugRequest::StopProfileTasks { responder } = self {
3969 Some((responder))
3970 } else {
3971 None
3972 }
3973 }
3974
3975 pub fn method_name(&self) -> &'static str {
3977 match *self {
3978 DebugRequest::Compact { .. } => "compact",
3979 DebugRequest::DeleteProfile { .. } => "delete_profile",
3980 DebugRequest::StopProfileTasks { .. } => "stop_profile_tasks",
3981 }
3982 }
3983}
3984
3985#[derive(Debug, Clone)]
3986pub struct DebugControlHandle {
3987 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3988}
3989
3990impl fidl::endpoints::ControlHandle for DebugControlHandle {
3991 fn shutdown(&self) {
3992 self.inner.shutdown()
3993 }
3994
3995 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3996 self.inner.shutdown_with_epitaph(status)
3997 }
3998
3999 fn is_closed(&self) -> bool {
4000 self.inner.channel().is_closed()
4001 }
4002 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4003 self.inner.channel().on_closed()
4004 }
4005
4006 #[cfg(target_os = "fuchsia")]
4007 fn signal_peer(
4008 &self,
4009 clear_mask: zx::Signals,
4010 set_mask: zx::Signals,
4011 ) -> Result<(), zx_status::Status> {
4012 use fidl::Peered;
4013 self.inner.channel().signal_peer(clear_mask, set_mask)
4014 }
4015}
4016
4017impl DebugControlHandle {}
4018
4019#[must_use = "FIDL methods require a response to be sent"]
4020#[derive(Debug)]
4021pub struct DebugCompactResponder {
4022 control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
4023 tx_id: u32,
4024}
4025
4026impl std::ops::Drop for DebugCompactResponder {
4030 fn drop(&mut self) {
4031 self.control_handle.shutdown();
4032 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4034 }
4035}
4036
4037impl fidl::endpoints::Responder for DebugCompactResponder {
4038 type ControlHandle = DebugControlHandle;
4039
4040 fn control_handle(&self) -> &DebugControlHandle {
4041 &self.control_handle
4042 }
4043
4044 fn drop_without_shutdown(mut self) {
4045 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4047 std::mem::forget(self);
4049 }
4050}
4051
4052impl DebugCompactResponder {
4053 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4057 let _result = self.send_raw(result);
4058 if _result.is_err() {
4059 self.control_handle.shutdown();
4060 }
4061 self.drop_without_shutdown();
4062 _result
4063 }
4064
4065 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4067 let _result = self.send_raw(result);
4068 self.drop_without_shutdown();
4069 _result
4070 }
4071
4072 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4073 self.control_handle
4074 .inner
4075 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4076 result,
4077 self.tx_id,
4078 0x6553eb197306e489,
4079 fidl::encoding::DynamicFlags::empty(),
4080 )
4081 }
4082}
4083
4084#[must_use = "FIDL methods require a response to be sent"]
4085#[derive(Debug)]
4086pub struct DebugDeleteProfileResponder {
4087 control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
4088 tx_id: u32,
4089}
4090
4091impl std::ops::Drop for DebugDeleteProfileResponder {
4095 fn drop(&mut self) {
4096 self.control_handle.shutdown();
4097 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4099 }
4100}
4101
4102impl fidl::endpoints::Responder for DebugDeleteProfileResponder {
4103 type ControlHandle = DebugControlHandle;
4104
4105 fn control_handle(&self) -> &DebugControlHandle {
4106 &self.control_handle
4107 }
4108
4109 fn drop_without_shutdown(mut self) {
4110 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4112 std::mem::forget(self);
4114 }
4115}
4116
4117impl DebugDeleteProfileResponder {
4118 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4122 let _result = self.send_raw(result);
4123 if _result.is_err() {
4124 self.control_handle.shutdown();
4125 }
4126 self.drop_without_shutdown();
4127 _result
4128 }
4129
4130 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4132 let _result = self.send_raw(result);
4133 self.drop_without_shutdown();
4134 _result
4135 }
4136
4137 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4138 self.control_handle
4139 .inner
4140 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4141 result,
4142 self.tx_id,
4143 0x54d9d4c9cf300a1e,
4144 fidl::encoding::DynamicFlags::empty(),
4145 )
4146 }
4147}
4148
4149#[must_use = "FIDL methods require a response to be sent"]
4150#[derive(Debug)]
4151pub struct DebugStopProfileTasksResponder {
4152 control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
4153 tx_id: u32,
4154}
4155
4156impl std::ops::Drop for DebugStopProfileTasksResponder {
4160 fn drop(&mut self) {
4161 self.control_handle.shutdown();
4162 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4164 }
4165}
4166
4167impl fidl::endpoints::Responder for DebugStopProfileTasksResponder {
4168 type ControlHandle = DebugControlHandle;
4169
4170 fn control_handle(&self) -> &DebugControlHandle {
4171 &self.control_handle
4172 }
4173
4174 fn drop_without_shutdown(mut self) {
4175 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4177 std::mem::forget(self);
4179 }
4180}
4181
4182impl DebugStopProfileTasksResponder {
4183 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4187 let _result = self.send_raw(result);
4188 if _result.is_err() {
4189 self.control_handle.shutdown();
4190 }
4191 self.drop_without_shutdown();
4192 _result
4193 }
4194
4195 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4197 let _result = self.send_raw(result);
4198 self.drop_without_shutdown();
4199 _result
4200 }
4201
4202 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4203 self.control_handle
4204 .inner
4205 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4206 result,
4207 self.tx_id,
4208 0x1657b945dd629177,
4209 fidl::encoding::DynamicFlags::empty(),
4210 )
4211 }
4212}
4213
4214#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4215pub struct FileBackedVolumeProviderMarker;
4216
4217impl fidl::endpoints::ProtocolMarker for FileBackedVolumeProviderMarker {
4218 type Proxy = FileBackedVolumeProviderProxy;
4219 type RequestStream = FileBackedVolumeProviderRequestStream;
4220 #[cfg(target_os = "fuchsia")]
4221 type SynchronousProxy = FileBackedVolumeProviderSynchronousProxy;
4222
4223 const DEBUG_NAME: &'static str = "fuchsia.fxfs.FileBackedVolumeProvider";
4224}
4225impl fidl::endpoints::DiscoverableProtocolMarker for FileBackedVolumeProviderMarker {}
4226
4227pub trait FileBackedVolumeProviderProxyInterface: Send + Sync {
4228 fn r#open(
4229 &self,
4230 parent_directory_token: fidl::NullableHandle,
4231 name: &str,
4232 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
4233 ) -> Result<(), fidl::Error>;
4234}
4235#[derive(Debug)]
4236#[cfg(target_os = "fuchsia")]
4237pub struct FileBackedVolumeProviderSynchronousProxy {
4238 client: fidl::client::sync::Client,
4239}
4240
4241#[cfg(target_os = "fuchsia")]
4242impl fidl::endpoints::SynchronousProxy for FileBackedVolumeProviderSynchronousProxy {
4243 type Proxy = FileBackedVolumeProviderProxy;
4244 type Protocol = FileBackedVolumeProviderMarker;
4245
4246 fn from_channel(inner: fidl::Channel) -> Self {
4247 Self::new(inner)
4248 }
4249
4250 fn into_channel(self) -> fidl::Channel {
4251 self.client.into_channel()
4252 }
4253
4254 fn as_channel(&self) -> &fidl::Channel {
4255 self.client.as_channel()
4256 }
4257}
4258
4259#[cfg(target_os = "fuchsia")]
4260impl FileBackedVolumeProviderSynchronousProxy {
4261 pub fn new(channel: fidl::Channel) -> Self {
4262 let protocol_name =
4263 <FileBackedVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4264 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4265 }
4266
4267 pub fn into_channel(self) -> fidl::Channel {
4268 self.client.into_channel()
4269 }
4270
4271 pub fn wait_for_event(
4274 &self,
4275 deadline: zx::MonotonicInstant,
4276 ) -> Result<FileBackedVolumeProviderEvent, fidl::Error> {
4277 FileBackedVolumeProviderEvent::decode(self.client.wait_for_event(deadline)?)
4278 }
4279
4280 pub fn r#open(
4294 &self,
4295 mut parent_directory_token: fidl::NullableHandle,
4296 mut name: &str,
4297 mut server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
4298 ) -> Result<(), fidl::Error> {
4299 self.client.send::<FileBackedVolumeProviderOpenRequest>(
4300 (parent_directory_token, name, server_end),
4301 0x67120b9fc9f319ee,
4302 fidl::encoding::DynamicFlags::empty(),
4303 )
4304 }
4305}
4306
4307#[cfg(target_os = "fuchsia")]
4308impl From<FileBackedVolumeProviderSynchronousProxy> for zx::NullableHandle {
4309 fn from(value: FileBackedVolumeProviderSynchronousProxy) -> Self {
4310 value.into_channel().into()
4311 }
4312}
4313
4314#[cfg(target_os = "fuchsia")]
4315impl From<fidl::Channel> for FileBackedVolumeProviderSynchronousProxy {
4316 fn from(value: fidl::Channel) -> Self {
4317 Self::new(value)
4318 }
4319}
4320
4321#[cfg(target_os = "fuchsia")]
4322impl fidl::endpoints::FromClient for FileBackedVolumeProviderSynchronousProxy {
4323 type Protocol = FileBackedVolumeProviderMarker;
4324
4325 fn from_client(value: fidl::endpoints::ClientEnd<FileBackedVolumeProviderMarker>) -> Self {
4326 Self::new(value.into_channel())
4327 }
4328}
4329
4330#[derive(Debug, Clone)]
4331pub struct FileBackedVolumeProviderProxy {
4332 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4333}
4334
4335impl fidl::endpoints::Proxy for FileBackedVolumeProviderProxy {
4336 type Protocol = FileBackedVolumeProviderMarker;
4337
4338 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4339 Self::new(inner)
4340 }
4341
4342 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4343 self.client.into_channel().map_err(|client| Self { client })
4344 }
4345
4346 fn as_channel(&self) -> &::fidl::AsyncChannel {
4347 self.client.as_channel()
4348 }
4349}
4350
4351impl FileBackedVolumeProviderProxy {
4352 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4354 let protocol_name =
4355 <FileBackedVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4356 Self { client: fidl::client::Client::new(channel, protocol_name) }
4357 }
4358
4359 pub fn take_event_stream(&self) -> FileBackedVolumeProviderEventStream {
4365 FileBackedVolumeProviderEventStream { event_receiver: self.client.take_event_receiver() }
4366 }
4367
4368 pub fn r#open(
4382 &self,
4383 mut parent_directory_token: fidl::NullableHandle,
4384 mut name: &str,
4385 mut server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
4386 ) -> Result<(), fidl::Error> {
4387 FileBackedVolumeProviderProxyInterface::r#open(
4388 self,
4389 parent_directory_token,
4390 name,
4391 server_end,
4392 )
4393 }
4394}
4395
4396impl FileBackedVolumeProviderProxyInterface for FileBackedVolumeProviderProxy {
4397 fn r#open(
4398 &self,
4399 mut parent_directory_token: fidl::NullableHandle,
4400 mut name: &str,
4401 mut server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
4402 ) -> Result<(), fidl::Error> {
4403 self.client.send::<FileBackedVolumeProviderOpenRequest>(
4404 (parent_directory_token, name, server_end),
4405 0x67120b9fc9f319ee,
4406 fidl::encoding::DynamicFlags::empty(),
4407 )
4408 }
4409}
4410
4411pub struct FileBackedVolumeProviderEventStream {
4412 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4413}
4414
4415impl std::marker::Unpin for FileBackedVolumeProviderEventStream {}
4416
4417impl futures::stream::FusedStream for FileBackedVolumeProviderEventStream {
4418 fn is_terminated(&self) -> bool {
4419 self.event_receiver.is_terminated()
4420 }
4421}
4422
4423impl futures::Stream for FileBackedVolumeProviderEventStream {
4424 type Item = Result<FileBackedVolumeProviderEvent, fidl::Error>;
4425
4426 fn poll_next(
4427 mut self: std::pin::Pin<&mut Self>,
4428 cx: &mut std::task::Context<'_>,
4429 ) -> std::task::Poll<Option<Self::Item>> {
4430 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4431 &mut self.event_receiver,
4432 cx
4433 )?) {
4434 Some(buf) => std::task::Poll::Ready(Some(FileBackedVolumeProviderEvent::decode(buf))),
4435 None => std::task::Poll::Ready(None),
4436 }
4437 }
4438}
4439
4440#[derive(Debug)]
4441pub enum FileBackedVolumeProviderEvent {}
4442
4443impl FileBackedVolumeProviderEvent {
4444 fn decode(
4446 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4447 ) -> Result<FileBackedVolumeProviderEvent, fidl::Error> {
4448 let (bytes, _handles) = buf.split_mut();
4449 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4450 debug_assert_eq!(tx_header.tx_id, 0);
4451 match tx_header.ordinal {
4452 _ => Err(fidl::Error::UnknownOrdinal {
4453 ordinal: tx_header.ordinal,
4454 protocol_name:
4455 <FileBackedVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4456 }),
4457 }
4458 }
4459}
4460
4461pub struct FileBackedVolumeProviderRequestStream {
4463 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4464 is_terminated: bool,
4465}
4466
4467impl std::marker::Unpin for FileBackedVolumeProviderRequestStream {}
4468
4469impl futures::stream::FusedStream for FileBackedVolumeProviderRequestStream {
4470 fn is_terminated(&self) -> bool {
4471 self.is_terminated
4472 }
4473}
4474
4475impl fidl::endpoints::RequestStream for FileBackedVolumeProviderRequestStream {
4476 type Protocol = FileBackedVolumeProviderMarker;
4477 type ControlHandle = FileBackedVolumeProviderControlHandle;
4478
4479 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4480 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4481 }
4482
4483 fn control_handle(&self) -> Self::ControlHandle {
4484 FileBackedVolumeProviderControlHandle { inner: self.inner.clone() }
4485 }
4486
4487 fn into_inner(
4488 self,
4489 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4490 {
4491 (self.inner, self.is_terminated)
4492 }
4493
4494 fn from_inner(
4495 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4496 is_terminated: bool,
4497 ) -> Self {
4498 Self { inner, is_terminated }
4499 }
4500}
4501
4502impl futures::Stream for FileBackedVolumeProviderRequestStream {
4503 type Item = Result<FileBackedVolumeProviderRequest, fidl::Error>;
4504
4505 fn poll_next(
4506 mut self: std::pin::Pin<&mut Self>,
4507 cx: &mut std::task::Context<'_>,
4508 ) -> std::task::Poll<Option<Self::Item>> {
4509 let this = &mut *self;
4510 if this.inner.check_shutdown(cx) {
4511 this.is_terminated = true;
4512 return std::task::Poll::Ready(None);
4513 }
4514 if this.is_terminated {
4515 panic!("polled FileBackedVolumeProviderRequestStream after completion");
4516 }
4517 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4518 |bytes, handles| {
4519 match this.inner.channel().read_etc(cx, bytes, handles) {
4520 std::task::Poll::Ready(Ok(())) => {}
4521 std::task::Poll::Pending => return std::task::Poll::Pending,
4522 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4523 this.is_terminated = true;
4524 return std::task::Poll::Ready(None);
4525 }
4526 std::task::Poll::Ready(Err(e)) => {
4527 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4528 e.into(),
4529 ))));
4530 }
4531 }
4532
4533 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4535
4536 std::task::Poll::Ready(Some(match header.ordinal {
4537 0x67120b9fc9f319ee => {
4538 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4539 let mut req = fidl::new_empty!(FileBackedVolumeProviderOpenRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4540 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FileBackedVolumeProviderOpenRequest>(&header, _body_bytes, handles, &mut req)?;
4541 let control_handle = FileBackedVolumeProviderControlHandle {
4542 inner: this.inner.clone(),
4543 };
4544 Ok(FileBackedVolumeProviderRequest::Open {parent_directory_token: req.parent_directory_token,
4545name: req.name,
4546server_end: req.server_end,
4547
4548 control_handle,
4549 })
4550 }
4551 _ => Err(fidl::Error::UnknownOrdinal {
4552 ordinal: header.ordinal,
4553 protocol_name: <FileBackedVolumeProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4554 }),
4555 }))
4556 },
4557 )
4558 }
4559}
4560
4561#[derive(Debug)]
4563pub enum FileBackedVolumeProviderRequest {
4564 Open {
4578 parent_directory_token: fidl::NullableHandle,
4579 name: String,
4580 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
4581 control_handle: FileBackedVolumeProviderControlHandle,
4582 },
4583}
4584
4585impl FileBackedVolumeProviderRequest {
4586 #[allow(irrefutable_let_patterns)]
4587 pub fn into_open(
4588 self,
4589 ) -> Option<(
4590 fidl::NullableHandle,
4591 String,
4592 fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
4593 FileBackedVolumeProviderControlHandle,
4594 )> {
4595 if let FileBackedVolumeProviderRequest::Open {
4596 parent_directory_token,
4597 name,
4598 server_end,
4599 control_handle,
4600 } = self
4601 {
4602 Some((parent_directory_token, name, server_end, control_handle))
4603 } else {
4604 None
4605 }
4606 }
4607
4608 pub fn method_name(&self) -> &'static str {
4610 match *self {
4611 FileBackedVolumeProviderRequest::Open { .. } => "open",
4612 }
4613 }
4614}
4615
4616#[derive(Debug, Clone)]
4617pub struct FileBackedVolumeProviderControlHandle {
4618 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4619}
4620
4621impl fidl::endpoints::ControlHandle for FileBackedVolumeProviderControlHandle {
4622 fn shutdown(&self) {
4623 self.inner.shutdown()
4624 }
4625
4626 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4627 self.inner.shutdown_with_epitaph(status)
4628 }
4629
4630 fn is_closed(&self) -> bool {
4631 self.inner.channel().is_closed()
4632 }
4633 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4634 self.inner.channel().on_closed()
4635 }
4636
4637 #[cfg(target_os = "fuchsia")]
4638 fn signal_peer(
4639 &self,
4640 clear_mask: zx::Signals,
4641 set_mask: zx::Signals,
4642 ) -> Result<(), zx_status::Status> {
4643 use fidl::Peered;
4644 self.inner.channel().signal_peer(clear_mask, set_mask)
4645 }
4646}
4647
4648impl FileBackedVolumeProviderControlHandle {}
4649
4650#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4651pub struct ProjectIdMarker;
4652
4653impl fidl::endpoints::ProtocolMarker for ProjectIdMarker {
4654 type Proxy = ProjectIdProxy;
4655 type RequestStream = ProjectIdRequestStream;
4656 #[cfg(target_os = "fuchsia")]
4657 type SynchronousProxy = ProjectIdSynchronousProxy;
4658
4659 const DEBUG_NAME: &'static str = "fuchsia.fxfs.ProjectId";
4660}
4661impl fidl::endpoints::DiscoverableProtocolMarker for ProjectIdMarker {}
4662pub type ProjectIdSetLimitResult = Result<(), i32>;
4663pub type ProjectIdClearResult = Result<(), i32>;
4664pub type ProjectIdSetForNodeResult = Result<(), i32>;
4665pub type ProjectIdGetForNodeResult = Result<u64, i32>;
4666pub type ProjectIdClearForNodeResult = Result<(), i32>;
4667pub type ProjectIdListResult = Result<(Vec<u64>, Option<Box<ProjectIterToken>>), i32>;
4668pub type ProjectIdInfoResult = Result<(BytesAndNodes, BytesAndNodes), i32>;
4669
4670pub trait ProjectIdProxyInterface: Send + Sync {
4671 type SetLimitResponseFut: std::future::Future<Output = Result<ProjectIdSetLimitResult, fidl::Error>>
4672 + Send;
4673 fn r#set_limit(&self, project_id: u64, bytes: u64, nodes: u64) -> Self::SetLimitResponseFut;
4674 type ClearResponseFut: std::future::Future<Output = Result<ProjectIdClearResult, fidl::Error>>
4675 + Send;
4676 fn r#clear(&self, project_id: u64) -> Self::ClearResponseFut;
4677 type SetForNodeResponseFut: std::future::Future<Output = Result<ProjectIdSetForNodeResult, fidl::Error>>
4678 + Send;
4679 fn r#set_for_node(&self, node_id: u64, project_id: u64) -> Self::SetForNodeResponseFut;
4680 type GetForNodeResponseFut: std::future::Future<Output = Result<ProjectIdGetForNodeResult, fidl::Error>>
4681 + Send;
4682 fn r#get_for_node(&self, node_id: u64) -> Self::GetForNodeResponseFut;
4683 type ClearForNodeResponseFut: std::future::Future<Output = Result<ProjectIdClearForNodeResult, fidl::Error>>
4684 + Send;
4685 fn r#clear_for_node(&self, node_id: u64) -> Self::ClearForNodeResponseFut;
4686 type ListResponseFut: std::future::Future<Output = Result<ProjectIdListResult, fidl::Error>>
4687 + Send;
4688 fn r#list(&self, token: Option<&ProjectIterToken>) -> Self::ListResponseFut;
4689 type InfoResponseFut: std::future::Future<Output = Result<ProjectIdInfoResult, fidl::Error>>
4690 + Send;
4691 fn r#info(&self, project_id: u64) -> Self::InfoResponseFut;
4692}
4693#[derive(Debug)]
4694#[cfg(target_os = "fuchsia")]
4695pub struct ProjectIdSynchronousProxy {
4696 client: fidl::client::sync::Client,
4697}
4698
4699#[cfg(target_os = "fuchsia")]
4700impl fidl::endpoints::SynchronousProxy for ProjectIdSynchronousProxy {
4701 type Proxy = ProjectIdProxy;
4702 type Protocol = ProjectIdMarker;
4703
4704 fn from_channel(inner: fidl::Channel) -> Self {
4705 Self::new(inner)
4706 }
4707
4708 fn into_channel(self) -> fidl::Channel {
4709 self.client.into_channel()
4710 }
4711
4712 fn as_channel(&self) -> &fidl::Channel {
4713 self.client.as_channel()
4714 }
4715}
4716
4717#[cfg(target_os = "fuchsia")]
4718impl ProjectIdSynchronousProxy {
4719 pub fn new(channel: fidl::Channel) -> Self {
4720 let protocol_name = <ProjectIdMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4721 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4722 }
4723
4724 pub fn into_channel(self) -> fidl::Channel {
4725 self.client.into_channel()
4726 }
4727
4728 pub fn wait_for_event(
4731 &self,
4732 deadline: zx::MonotonicInstant,
4733 ) -> Result<ProjectIdEvent, fidl::Error> {
4734 ProjectIdEvent::decode(self.client.wait_for_event(deadline)?)
4735 }
4736
4737 pub fn r#set_limit(
4741 &self,
4742 mut project_id: u64,
4743 mut bytes: u64,
4744 mut nodes: u64,
4745 ___deadline: zx::MonotonicInstant,
4746 ) -> Result<ProjectIdSetLimitResult, fidl::Error> {
4747 let _response = self.client.send_query::<
4748 ProjectIdSetLimitRequest,
4749 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4750 >(
4751 (project_id, bytes, nodes,),
4752 0x20b0fc1e0413876f,
4753 fidl::encoding::DynamicFlags::empty(),
4754 ___deadline,
4755 )?;
4756 Ok(_response.map(|x| x))
4757 }
4758
4759 pub fn r#clear(
4763 &self,
4764 mut project_id: u64,
4765 ___deadline: zx::MonotonicInstant,
4766 ) -> Result<ProjectIdClearResult, fidl::Error> {
4767 let _response = self.client.send_query::<
4768 ProjectIdClearRequest,
4769 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4770 >(
4771 (project_id,),
4772 0x165b5f1e707863c1,
4773 fidl::encoding::DynamicFlags::empty(),
4774 ___deadline,
4775 )?;
4776 Ok(_response.map(|x| x))
4777 }
4778
4779 pub fn r#set_for_node(
4782 &self,
4783 mut node_id: u64,
4784 mut project_id: u64,
4785 ___deadline: zx::MonotonicInstant,
4786 ) -> Result<ProjectIdSetForNodeResult, fidl::Error> {
4787 let _response = self.client.send_query::<
4788 ProjectIdSetForNodeRequest,
4789 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4790 >(
4791 (node_id, project_id,),
4792 0x4d7a8442dc58324c,
4793 fidl::encoding::DynamicFlags::empty(),
4794 ___deadline,
4795 )?;
4796 Ok(_response.map(|x| x))
4797 }
4798
4799 pub fn r#get_for_node(
4803 &self,
4804 mut node_id: u64,
4805 ___deadline: zx::MonotonicInstant,
4806 ) -> Result<ProjectIdGetForNodeResult, fidl::Error> {
4807 let _response = self.client.send_query::<
4808 ProjectIdGetForNodeRequest,
4809 fidl::encoding::ResultType<ProjectIdGetForNodeResponse, i32>,
4810 >(
4811 (node_id,),
4812 0x644073bdf2542573,
4813 fidl::encoding::DynamicFlags::empty(),
4814 ___deadline,
4815 )?;
4816 Ok(_response.map(|x| x.project_id))
4817 }
4818
4819 pub fn r#clear_for_node(
4823 &self,
4824 mut node_id: u64,
4825 ___deadline: zx::MonotonicInstant,
4826 ) -> Result<ProjectIdClearForNodeResult, fidl::Error> {
4827 let _response = self.client.send_query::<
4828 ProjectIdClearForNodeRequest,
4829 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4830 >(
4831 (node_id,),
4832 0x3f2ca287bbfe6a62,
4833 fidl::encoding::DynamicFlags::empty(),
4834 ___deadline,
4835 )?;
4836 Ok(_response.map(|x| x))
4837 }
4838
4839 pub fn r#list(
4844 &self,
4845 mut token: Option<&ProjectIterToken>,
4846 ___deadline: zx::MonotonicInstant,
4847 ) -> Result<ProjectIdListResult, fidl::Error> {
4848 let _response = self.client.send_query::<
4849 ProjectIdListRequest,
4850 fidl::encoding::ResultType<ProjectIdListResponse, i32>,
4851 >(
4852 (token,),
4853 0x5505f95a36d522cc,
4854 fidl::encoding::DynamicFlags::empty(),
4855 ___deadline,
4856 )?;
4857 Ok(_response.map(|x| (x.entries, x.next_token)))
4858 }
4859
4860 pub fn r#info(
4863 &self,
4864 mut project_id: u64,
4865 ___deadline: zx::MonotonicInstant,
4866 ) -> Result<ProjectIdInfoResult, fidl::Error> {
4867 let _response = self.client.send_query::<
4868 ProjectIdInfoRequest,
4869 fidl::encoding::ResultType<ProjectIdInfoResponse, i32>,
4870 >(
4871 (project_id,),
4872 0x51b47743c9e2d1ab,
4873 fidl::encoding::DynamicFlags::empty(),
4874 ___deadline,
4875 )?;
4876 Ok(_response.map(|x| (x.limit, x.usage)))
4877 }
4878}
4879
4880#[cfg(target_os = "fuchsia")]
4881impl From<ProjectIdSynchronousProxy> for zx::NullableHandle {
4882 fn from(value: ProjectIdSynchronousProxy) -> Self {
4883 value.into_channel().into()
4884 }
4885}
4886
4887#[cfg(target_os = "fuchsia")]
4888impl From<fidl::Channel> for ProjectIdSynchronousProxy {
4889 fn from(value: fidl::Channel) -> Self {
4890 Self::new(value)
4891 }
4892}
4893
4894#[cfg(target_os = "fuchsia")]
4895impl fidl::endpoints::FromClient for ProjectIdSynchronousProxy {
4896 type Protocol = ProjectIdMarker;
4897
4898 fn from_client(value: fidl::endpoints::ClientEnd<ProjectIdMarker>) -> Self {
4899 Self::new(value.into_channel())
4900 }
4901}
4902
4903#[derive(Debug, Clone)]
4904pub struct ProjectIdProxy {
4905 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4906}
4907
4908impl fidl::endpoints::Proxy for ProjectIdProxy {
4909 type Protocol = ProjectIdMarker;
4910
4911 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4912 Self::new(inner)
4913 }
4914
4915 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4916 self.client.into_channel().map_err(|client| Self { client })
4917 }
4918
4919 fn as_channel(&self) -> &::fidl::AsyncChannel {
4920 self.client.as_channel()
4921 }
4922}
4923
4924impl ProjectIdProxy {
4925 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4927 let protocol_name = <ProjectIdMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4928 Self { client: fidl::client::Client::new(channel, protocol_name) }
4929 }
4930
4931 pub fn take_event_stream(&self) -> ProjectIdEventStream {
4937 ProjectIdEventStream { event_receiver: self.client.take_event_receiver() }
4938 }
4939
4940 pub fn r#set_limit(
4944 &self,
4945 mut project_id: u64,
4946 mut bytes: u64,
4947 mut nodes: u64,
4948 ) -> fidl::client::QueryResponseFut<
4949 ProjectIdSetLimitResult,
4950 fidl::encoding::DefaultFuchsiaResourceDialect,
4951 > {
4952 ProjectIdProxyInterface::r#set_limit(self, project_id, bytes, nodes)
4953 }
4954
4955 pub fn r#clear(
4959 &self,
4960 mut project_id: u64,
4961 ) -> fidl::client::QueryResponseFut<
4962 ProjectIdClearResult,
4963 fidl::encoding::DefaultFuchsiaResourceDialect,
4964 > {
4965 ProjectIdProxyInterface::r#clear(self, project_id)
4966 }
4967
4968 pub fn r#set_for_node(
4971 &self,
4972 mut node_id: u64,
4973 mut project_id: u64,
4974 ) -> fidl::client::QueryResponseFut<
4975 ProjectIdSetForNodeResult,
4976 fidl::encoding::DefaultFuchsiaResourceDialect,
4977 > {
4978 ProjectIdProxyInterface::r#set_for_node(self, node_id, project_id)
4979 }
4980
4981 pub fn r#get_for_node(
4985 &self,
4986 mut node_id: u64,
4987 ) -> fidl::client::QueryResponseFut<
4988 ProjectIdGetForNodeResult,
4989 fidl::encoding::DefaultFuchsiaResourceDialect,
4990 > {
4991 ProjectIdProxyInterface::r#get_for_node(self, node_id)
4992 }
4993
4994 pub fn r#clear_for_node(
4998 &self,
4999 mut node_id: u64,
5000 ) -> fidl::client::QueryResponseFut<
5001 ProjectIdClearForNodeResult,
5002 fidl::encoding::DefaultFuchsiaResourceDialect,
5003 > {
5004 ProjectIdProxyInterface::r#clear_for_node(self, node_id)
5005 }
5006
5007 pub fn r#list(
5012 &self,
5013 mut token: Option<&ProjectIterToken>,
5014 ) -> fidl::client::QueryResponseFut<
5015 ProjectIdListResult,
5016 fidl::encoding::DefaultFuchsiaResourceDialect,
5017 > {
5018 ProjectIdProxyInterface::r#list(self, token)
5019 }
5020
5021 pub fn r#info(
5024 &self,
5025 mut project_id: u64,
5026 ) -> fidl::client::QueryResponseFut<
5027 ProjectIdInfoResult,
5028 fidl::encoding::DefaultFuchsiaResourceDialect,
5029 > {
5030 ProjectIdProxyInterface::r#info(self, project_id)
5031 }
5032}
5033
5034impl ProjectIdProxyInterface for ProjectIdProxy {
5035 type SetLimitResponseFut = fidl::client::QueryResponseFut<
5036 ProjectIdSetLimitResult,
5037 fidl::encoding::DefaultFuchsiaResourceDialect,
5038 >;
5039 fn r#set_limit(
5040 &self,
5041 mut project_id: u64,
5042 mut bytes: u64,
5043 mut nodes: u64,
5044 ) -> Self::SetLimitResponseFut {
5045 fn _decode(
5046 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5047 ) -> Result<ProjectIdSetLimitResult, fidl::Error> {
5048 let _response = fidl::client::decode_transaction_body::<
5049 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5050 fidl::encoding::DefaultFuchsiaResourceDialect,
5051 0x20b0fc1e0413876f,
5052 >(_buf?)?;
5053 Ok(_response.map(|x| x))
5054 }
5055 self.client.send_query_and_decode::<ProjectIdSetLimitRequest, ProjectIdSetLimitResult>(
5056 (project_id, bytes, nodes),
5057 0x20b0fc1e0413876f,
5058 fidl::encoding::DynamicFlags::empty(),
5059 _decode,
5060 )
5061 }
5062
5063 type ClearResponseFut = fidl::client::QueryResponseFut<
5064 ProjectIdClearResult,
5065 fidl::encoding::DefaultFuchsiaResourceDialect,
5066 >;
5067 fn r#clear(&self, mut project_id: u64) -> Self::ClearResponseFut {
5068 fn _decode(
5069 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5070 ) -> Result<ProjectIdClearResult, fidl::Error> {
5071 let _response = fidl::client::decode_transaction_body::<
5072 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5073 fidl::encoding::DefaultFuchsiaResourceDialect,
5074 0x165b5f1e707863c1,
5075 >(_buf?)?;
5076 Ok(_response.map(|x| x))
5077 }
5078 self.client.send_query_and_decode::<ProjectIdClearRequest, ProjectIdClearResult>(
5079 (project_id,),
5080 0x165b5f1e707863c1,
5081 fidl::encoding::DynamicFlags::empty(),
5082 _decode,
5083 )
5084 }
5085
5086 type SetForNodeResponseFut = fidl::client::QueryResponseFut<
5087 ProjectIdSetForNodeResult,
5088 fidl::encoding::DefaultFuchsiaResourceDialect,
5089 >;
5090 fn r#set_for_node(&self, mut node_id: u64, mut project_id: u64) -> Self::SetForNodeResponseFut {
5091 fn _decode(
5092 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5093 ) -> Result<ProjectIdSetForNodeResult, fidl::Error> {
5094 let _response = fidl::client::decode_transaction_body::<
5095 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5096 fidl::encoding::DefaultFuchsiaResourceDialect,
5097 0x4d7a8442dc58324c,
5098 >(_buf?)?;
5099 Ok(_response.map(|x| x))
5100 }
5101 self.client.send_query_and_decode::<ProjectIdSetForNodeRequest, ProjectIdSetForNodeResult>(
5102 (node_id, project_id),
5103 0x4d7a8442dc58324c,
5104 fidl::encoding::DynamicFlags::empty(),
5105 _decode,
5106 )
5107 }
5108
5109 type GetForNodeResponseFut = fidl::client::QueryResponseFut<
5110 ProjectIdGetForNodeResult,
5111 fidl::encoding::DefaultFuchsiaResourceDialect,
5112 >;
5113 fn r#get_for_node(&self, mut node_id: u64) -> Self::GetForNodeResponseFut {
5114 fn _decode(
5115 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5116 ) -> Result<ProjectIdGetForNodeResult, fidl::Error> {
5117 let _response = fidl::client::decode_transaction_body::<
5118 fidl::encoding::ResultType<ProjectIdGetForNodeResponse, i32>,
5119 fidl::encoding::DefaultFuchsiaResourceDialect,
5120 0x644073bdf2542573,
5121 >(_buf?)?;
5122 Ok(_response.map(|x| x.project_id))
5123 }
5124 self.client.send_query_and_decode::<ProjectIdGetForNodeRequest, ProjectIdGetForNodeResult>(
5125 (node_id,),
5126 0x644073bdf2542573,
5127 fidl::encoding::DynamicFlags::empty(),
5128 _decode,
5129 )
5130 }
5131
5132 type ClearForNodeResponseFut = fidl::client::QueryResponseFut<
5133 ProjectIdClearForNodeResult,
5134 fidl::encoding::DefaultFuchsiaResourceDialect,
5135 >;
5136 fn r#clear_for_node(&self, mut node_id: u64) -> Self::ClearForNodeResponseFut {
5137 fn _decode(
5138 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5139 ) -> Result<ProjectIdClearForNodeResult, fidl::Error> {
5140 let _response = fidl::client::decode_transaction_body::<
5141 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5142 fidl::encoding::DefaultFuchsiaResourceDialect,
5143 0x3f2ca287bbfe6a62,
5144 >(_buf?)?;
5145 Ok(_response.map(|x| x))
5146 }
5147 self.client
5148 .send_query_and_decode::<ProjectIdClearForNodeRequest, ProjectIdClearForNodeResult>(
5149 (node_id,),
5150 0x3f2ca287bbfe6a62,
5151 fidl::encoding::DynamicFlags::empty(),
5152 _decode,
5153 )
5154 }
5155
5156 type ListResponseFut = fidl::client::QueryResponseFut<
5157 ProjectIdListResult,
5158 fidl::encoding::DefaultFuchsiaResourceDialect,
5159 >;
5160 fn r#list(&self, mut token: Option<&ProjectIterToken>) -> Self::ListResponseFut {
5161 fn _decode(
5162 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5163 ) -> Result<ProjectIdListResult, fidl::Error> {
5164 let _response = fidl::client::decode_transaction_body::<
5165 fidl::encoding::ResultType<ProjectIdListResponse, i32>,
5166 fidl::encoding::DefaultFuchsiaResourceDialect,
5167 0x5505f95a36d522cc,
5168 >(_buf?)?;
5169 Ok(_response.map(|x| (x.entries, x.next_token)))
5170 }
5171 self.client.send_query_and_decode::<ProjectIdListRequest, ProjectIdListResult>(
5172 (token,),
5173 0x5505f95a36d522cc,
5174 fidl::encoding::DynamicFlags::empty(),
5175 _decode,
5176 )
5177 }
5178
5179 type InfoResponseFut = fidl::client::QueryResponseFut<
5180 ProjectIdInfoResult,
5181 fidl::encoding::DefaultFuchsiaResourceDialect,
5182 >;
5183 fn r#info(&self, mut project_id: u64) -> Self::InfoResponseFut {
5184 fn _decode(
5185 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5186 ) -> Result<ProjectIdInfoResult, fidl::Error> {
5187 let _response = fidl::client::decode_transaction_body::<
5188 fidl::encoding::ResultType<ProjectIdInfoResponse, i32>,
5189 fidl::encoding::DefaultFuchsiaResourceDialect,
5190 0x51b47743c9e2d1ab,
5191 >(_buf?)?;
5192 Ok(_response.map(|x| (x.limit, x.usage)))
5193 }
5194 self.client.send_query_and_decode::<ProjectIdInfoRequest, ProjectIdInfoResult>(
5195 (project_id,),
5196 0x51b47743c9e2d1ab,
5197 fidl::encoding::DynamicFlags::empty(),
5198 _decode,
5199 )
5200 }
5201}
5202
5203pub struct ProjectIdEventStream {
5204 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5205}
5206
5207impl std::marker::Unpin for ProjectIdEventStream {}
5208
5209impl futures::stream::FusedStream for ProjectIdEventStream {
5210 fn is_terminated(&self) -> bool {
5211 self.event_receiver.is_terminated()
5212 }
5213}
5214
5215impl futures::Stream for ProjectIdEventStream {
5216 type Item = Result<ProjectIdEvent, fidl::Error>;
5217
5218 fn poll_next(
5219 mut self: std::pin::Pin<&mut Self>,
5220 cx: &mut std::task::Context<'_>,
5221 ) -> std::task::Poll<Option<Self::Item>> {
5222 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5223 &mut self.event_receiver,
5224 cx
5225 )?) {
5226 Some(buf) => std::task::Poll::Ready(Some(ProjectIdEvent::decode(buf))),
5227 None => std::task::Poll::Ready(None),
5228 }
5229 }
5230}
5231
5232#[derive(Debug)]
5233pub enum ProjectIdEvent {}
5234
5235impl ProjectIdEvent {
5236 fn decode(
5238 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5239 ) -> Result<ProjectIdEvent, fidl::Error> {
5240 let (bytes, _handles) = buf.split_mut();
5241 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5242 debug_assert_eq!(tx_header.tx_id, 0);
5243 match tx_header.ordinal {
5244 _ => Err(fidl::Error::UnknownOrdinal {
5245 ordinal: tx_header.ordinal,
5246 protocol_name: <ProjectIdMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5247 }),
5248 }
5249 }
5250}
5251
5252pub struct ProjectIdRequestStream {
5254 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5255 is_terminated: bool,
5256}
5257
5258impl std::marker::Unpin for ProjectIdRequestStream {}
5259
5260impl futures::stream::FusedStream for ProjectIdRequestStream {
5261 fn is_terminated(&self) -> bool {
5262 self.is_terminated
5263 }
5264}
5265
5266impl fidl::endpoints::RequestStream for ProjectIdRequestStream {
5267 type Protocol = ProjectIdMarker;
5268 type ControlHandle = ProjectIdControlHandle;
5269
5270 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5271 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5272 }
5273
5274 fn control_handle(&self) -> Self::ControlHandle {
5275 ProjectIdControlHandle { inner: self.inner.clone() }
5276 }
5277
5278 fn into_inner(
5279 self,
5280 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5281 {
5282 (self.inner, self.is_terminated)
5283 }
5284
5285 fn from_inner(
5286 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5287 is_terminated: bool,
5288 ) -> Self {
5289 Self { inner, is_terminated }
5290 }
5291}
5292
5293impl futures::Stream for ProjectIdRequestStream {
5294 type Item = Result<ProjectIdRequest, fidl::Error>;
5295
5296 fn poll_next(
5297 mut self: std::pin::Pin<&mut Self>,
5298 cx: &mut std::task::Context<'_>,
5299 ) -> std::task::Poll<Option<Self::Item>> {
5300 let this = &mut *self;
5301 if this.inner.check_shutdown(cx) {
5302 this.is_terminated = true;
5303 return std::task::Poll::Ready(None);
5304 }
5305 if this.is_terminated {
5306 panic!("polled ProjectIdRequestStream after completion");
5307 }
5308 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5309 |bytes, handles| {
5310 match this.inner.channel().read_etc(cx, bytes, handles) {
5311 std::task::Poll::Ready(Ok(())) => {}
5312 std::task::Poll::Pending => return std::task::Poll::Pending,
5313 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5314 this.is_terminated = true;
5315 return std::task::Poll::Ready(None);
5316 }
5317 std::task::Poll::Ready(Err(e)) => {
5318 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5319 e.into(),
5320 ))));
5321 }
5322 }
5323
5324 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5326
5327 std::task::Poll::Ready(Some(match header.ordinal {
5328 0x20b0fc1e0413876f => {
5329 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5330 let mut req = fidl::new_empty!(
5331 ProjectIdSetLimitRequest,
5332 fidl::encoding::DefaultFuchsiaResourceDialect
5333 );
5334 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdSetLimitRequest>(&header, _body_bytes, handles, &mut req)?;
5335 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5336 Ok(ProjectIdRequest::SetLimit {
5337 project_id: req.project_id,
5338 bytes: req.bytes,
5339 nodes: req.nodes,
5340
5341 responder: ProjectIdSetLimitResponder {
5342 control_handle: std::mem::ManuallyDrop::new(control_handle),
5343 tx_id: header.tx_id,
5344 },
5345 })
5346 }
5347 0x165b5f1e707863c1 => {
5348 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5349 let mut req = fidl::new_empty!(
5350 ProjectIdClearRequest,
5351 fidl::encoding::DefaultFuchsiaResourceDialect
5352 );
5353 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdClearRequest>(&header, _body_bytes, handles, &mut req)?;
5354 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5355 Ok(ProjectIdRequest::Clear {
5356 project_id: req.project_id,
5357
5358 responder: ProjectIdClearResponder {
5359 control_handle: std::mem::ManuallyDrop::new(control_handle),
5360 tx_id: header.tx_id,
5361 },
5362 })
5363 }
5364 0x4d7a8442dc58324c => {
5365 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5366 let mut req = fidl::new_empty!(
5367 ProjectIdSetForNodeRequest,
5368 fidl::encoding::DefaultFuchsiaResourceDialect
5369 );
5370 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdSetForNodeRequest>(&header, _body_bytes, handles, &mut req)?;
5371 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5372 Ok(ProjectIdRequest::SetForNode {
5373 node_id: req.node_id,
5374 project_id: req.project_id,
5375
5376 responder: ProjectIdSetForNodeResponder {
5377 control_handle: std::mem::ManuallyDrop::new(control_handle),
5378 tx_id: header.tx_id,
5379 },
5380 })
5381 }
5382 0x644073bdf2542573 => {
5383 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5384 let mut req = fidl::new_empty!(
5385 ProjectIdGetForNodeRequest,
5386 fidl::encoding::DefaultFuchsiaResourceDialect
5387 );
5388 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdGetForNodeRequest>(&header, _body_bytes, handles, &mut req)?;
5389 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5390 Ok(ProjectIdRequest::GetForNode {
5391 node_id: req.node_id,
5392
5393 responder: ProjectIdGetForNodeResponder {
5394 control_handle: std::mem::ManuallyDrop::new(control_handle),
5395 tx_id: header.tx_id,
5396 },
5397 })
5398 }
5399 0x3f2ca287bbfe6a62 => {
5400 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5401 let mut req = fidl::new_empty!(
5402 ProjectIdClearForNodeRequest,
5403 fidl::encoding::DefaultFuchsiaResourceDialect
5404 );
5405 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdClearForNodeRequest>(&header, _body_bytes, handles, &mut req)?;
5406 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5407 Ok(ProjectIdRequest::ClearForNode {
5408 node_id: req.node_id,
5409
5410 responder: ProjectIdClearForNodeResponder {
5411 control_handle: std::mem::ManuallyDrop::new(control_handle),
5412 tx_id: header.tx_id,
5413 },
5414 })
5415 }
5416 0x5505f95a36d522cc => {
5417 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5418 let mut req = fidl::new_empty!(
5419 ProjectIdListRequest,
5420 fidl::encoding::DefaultFuchsiaResourceDialect
5421 );
5422 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdListRequest>(&header, _body_bytes, handles, &mut req)?;
5423 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5424 Ok(ProjectIdRequest::List {
5425 token: req.token,
5426
5427 responder: ProjectIdListResponder {
5428 control_handle: std::mem::ManuallyDrop::new(control_handle),
5429 tx_id: header.tx_id,
5430 },
5431 })
5432 }
5433 0x51b47743c9e2d1ab => {
5434 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5435 let mut req = fidl::new_empty!(
5436 ProjectIdInfoRequest,
5437 fidl::encoding::DefaultFuchsiaResourceDialect
5438 );
5439 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProjectIdInfoRequest>(&header, _body_bytes, handles, &mut req)?;
5440 let control_handle = ProjectIdControlHandle { inner: this.inner.clone() };
5441 Ok(ProjectIdRequest::Info {
5442 project_id: req.project_id,
5443
5444 responder: ProjectIdInfoResponder {
5445 control_handle: std::mem::ManuallyDrop::new(control_handle),
5446 tx_id: header.tx_id,
5447 },
5448 })
5449 }
5450 _ => Err(fidl::Error::UnknownOrdinal {
5451 ordinal: header.ordinal,
5452 protocol_name:
5453 <ProjectIdMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5454 }),
5455 }))
5456 },
5457 )
5458 }
5459}
5460
5461#[derive(Debug)]
5462pub enum ProjectIdRequest {
5463 SetLimit { project_id: u64, bytes: u64, nodes: u64, responder: ProjectIdSetLimitResponder },
5467 Clear { project_id: u64, responder: ProjectIdClearResponder },
5471 SetForNode { node_id: u64, project_id: u64, responder: ProjectIdSetForNodeResponder },
5474 GetForNode { node_id: u64, responder: ProjectIdGetForNodeResponder },
5478 ClearForNode { node_id: u64, responder: ProjectIdClearForNodeResponder },
5482 List { token: Option<Box<ProjectIterToken>>, responder: ProjectIdListResponder },
5487 Info { project_id: u64, responder: ProjectIdInfoResponder },
5490}
5491
5492impl ProjectIdRequest {
5493 #[allow(irrefutable_let_patterns)]
5494 pub fn into_set_limit(self) -> Option<(u64, u64, u64, ProjectIdSetLimitResponder)> {
5495 if let ProjectIdRequest::SetLimit { project_id, bytes, nodes, responder } = self {
5496 Some((project_id, bytes, nodes, responder))
5497 } else {
5498 None
5499 }
5500 }
5501
5502 #[allow(irrefutable_let_patterns)]
5503 pub fn into_clear(self) -> Option<(u64, ProjectIdClearResponder)> {
5504 if let ProjectIdRequest::Clear { project_id, responder } = self {
5505 Some((project_id, responder))
5506 } else {
5507 None
5508 }
5509 }
5510
5511 #[allow(irrefutable_let_patterns)]
5512 pub fn into_set_for_node(self) -> Option<(u64, u64, ProjectIdSetForNodeResponder)> {
5513 if let ProjectIdRequest::SetForNode { node_id, project_id, responder } = self {
5514 Some((node_id, project_id, responder))
5515 } else {
5516 None
5517 }
5518 }
5519
5520 #[allow(irrefutable_let_patterns)]
5521 pub fn into_get_for_node(self) -> Option<(u64, ProjectIdGetForNodeResponder)> {
5522 if let ProjectIdRequest::GetForNode { node_id, responder } = self {
5523 Some((node_id, responder))
5524 } else {
5525 None
5526 }
5527 }
5528
5529 #[allow(irrefutable_let_patterns)]
5530 pub fn into_clear_for_node(self) -> Option<(u64, ProjectIdClearForNodeResponder)> {
5531 if let ProjectIdRequest::ClearForNode { node_id, responder } = self {
5532 Some((node_id, responder))
5533 } else {
5534 None
5535 }
5536 }
5537
5538 #[allow(irrefutable_let_patterns)]
5539 pub fn into_list(self) -> Option<(Option<Box<ProjectIterToken>>, ProjectIdListResponder)> {
5540 if let ProjectIdRequest::List { token, responder } = self {
5541 Some((token, responder))
5542 } else {
5543 None
5544 }
5545 }
5546
5547 #[allow(irrefutable_let_patterns)]
5548 pub fn into_info(self) -> Option<(u64, ProjectIdInfoResponder)> {
5549 if let ProjectIdRequest::Info { project_id, responder } = self {
5550 Some((project_id, responder))
5551 } else {
5552 None
5553 }
5554 }
5555
5556 pub fn method_name(&self) -> &'static str {
5558 match *self {
5559 ProjectIdRequest::SetLimit { .. } => "set_limit",
5560 ProjectIdRequest::Clear { .. } => "clear",
5561 ProjectIdRequest::SetForNode { .. } => "set_for_node",
5562 ProjectIdRequest::GetForNode { .. } => "get_for_node",
5563 ProjectIdRequest::ClearForNode { .. } => "clear_for_node",
5564 ProjectIdRequest::List { .. } => "list",
5565 ProjectIdRequest::Info { .. } => "info",
5566 }
5567 }
5568}
5569
5570#[derive(Debug, Clone)]
5571pub struct ProjectIdControlHandle {
5572 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5573}
5574
5575impl fidl::endpoints::ControlHandle for ProjectIdControlHandle {
5576 fn shutdown(&self) {
5577 self.inner.shutdown()
5578 }
5579
5580 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5581 self.inner.shutdown_with_epitaph(status)
5582 }
5583
5584 fn is_closed(&self) -> bool {
5585 self.inner.channel().is_closed()
5586 }
5587 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5588 self.inner.channel().on_closed()
5589 }
5590
5591 #[cfg(target_os = "fuchsia")]
5592 fn signal_peer(
5593 &self,
5594 clear_mask: zx::Signals,
5595 set_mask: zx::Signals,
5596 ) -> Result<(), zx_status::Status> {
5597 use fidl::Peered;
5598 self.inner.channel().signal_peer(clear_mask, set_mask)
5599 }
5600}
5601
5602impl ProjectIdControlHandle {}
5603
5604#[must_use = "FIDL methods require a response to be sent"]
5605#[derive(Debug)]
5606pub struct ProjectIdSetLimitResponder {
5607 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
5608 tx_id: u32,
5609}
5610
5611impl std::ops::Drop for ProjectIdSetLimitResponder {
5615 fn drop(&mut self) {
5616 self.control_handle.shutdown();
5617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5619 }
5620}
5621
5622impl fidl::endpoints::Responder for ProjectIdSetLimitResponder {
5623 type ControlHandle = ProjectIdControlHandle;
5624
5625 fn control_handle(&self) -> &ProjectIdControlHandle {
5626 &self.control_handle
5627 }
5628
5629 fn drop_without_shutdown(mut self) {
5630 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5632 std::mem::forget(self);
5634 }
5635}
5636
5637impl ProjectIdSetLimitResponder {
5638 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5642 let _result = self.send_raw(result);
5643 if _result.is_err() {
5644 self.control_handle.shutdown();
5645 }
5646 self.drop_without_shutdown();
5647 _result
5648 }
5649
5650 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5652 let _result = self.send_raw(result);
5653 self.drop_without_shutdown();
5654 _result
5655 }
5656
5657 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5658 self.control_handle
5659 .inner
5660 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5661 result,
5662 self.tx_id,
5663 0x20b0fc1e0413876f,
5664 fidl::encoding::DynamicFlags::empty(),
5665 )
5666 }
5667}
5668
5669#[must_use = "FIDL methods require a response to be sent"]
5670#[derive(Debug)]
5671pub struct ProjectIdClearResponder {
5672 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
5673 tx_id: u32,
5674}
5675
5676impl std::ops::Drop for ProjectIdClearResponder {
5680 fn drop(&mut self) {
5681 self.control_handle.shutdown();
5682 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5684 }
5685}
5686
5687impl fidl::endpoints::Responder for ProjectIdClearResponder {
5688 type ControlHandle = ProjectIdControlHandle;
5689
5690 fn control_handle(&self) -> &ProjectIdControlHandle {
5691 &self.control_handle
5692 }
5693
5694 fn drop_without_shutdown(mut self) {
5695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5697 std::mem::forget(self);
5699 }
5700}
5701
5702impl ProjectIdClearResponder {
5703 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5707 let _result = self.send_raw(result);
5708 if _result.is_err() {
5709 self.control_handle.shutdown();
5710 }
5711 self.drop_without_shutdown();
5712 _result
5713 }
5714
5715 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5717 let _result = self.send_raw(result);
5718 self.drop_without_shutdown();
5719 _result
5720 }
5721
5722 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5723 self.control_handle
5724 .inner
5725 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5726 result,
5727 self.tx_id,
5728 0x165b5f1e707863c1,
5729 fidl::encoding::DynamicFlags::empty(),
5730 )
5731 }
5732}
5733
5734#[must_use = "FIDL methods require a response to be sent"]
5735#[derive(Debug)]
5736pub struct ProjectIdSetForNodeResponder {
5737 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
5738 tx_id: u32,
5739}
5740
5741impl std::ops::Drop for ProjectIdSetForNodeResponder {
5745 fn drop(&mut self) {
5746 self.control_handle.shutdown();
5747 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5749 }
5750}
5751
5752impl fidl::endpoints::Responder for ProjectIdSetForNodeResponder {
5753 type ControlHandle = ProjectIdControlHandle;
5754
5755 fn control_handle(&self) -> &ProjectIdControlHandle {
5756 &self.control_handle
5757 }
5758
5759 fn drop_without_shutdown(mut self) {
5760 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5762 std::mem::forget(self);
5764 }
5765}
5766
5767impl ProjectIdSetForNodeResponder {
5768 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5772 let _result = self.send_raw(result);
5773 if _result.is_err() {
5774 self.control_handle.shutdown();
5775 }
5776 self.drop_without_shutdown();
5777 _result
5778 }
5779
5780 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5782 let _result = self.send_raw(result);
5783 self.drop_without_shutdown();
5784 _result
5785 }
5786
5787 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5788 self.control_handle
5789 .inner
5790 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5791 result,
5792 self.tx_id,
5793 0x4d7a8442dc58324c,
5794 fidl::encoding::DynamicFlags::empty(),
5795 )
5796 }
5797}
5798
5799#[must_use = "FIDL methods require a response to be sent"]
5800#[derive(Debug)]
5801pub struct ProjectIdGetForNodeResponder {
5802 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
5803 tx_id: u32,
5804}
5805
5806impl std::ops::Drop for ProjectIdGetForNodeResponder {
5810 fn drop(&mut self) {
5811 self.control_handle.shutdown();
5812 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5814 }
5815}
5816
5817impl fidl::endpoints::Responder for ProjectIdGetForNodeResponder {
5818 type ControlHandle = ProjectIdControlHandle;
5819
5820 fn control_handle(&self) -> &ProjectIdControlHandle {
5821 &self.control_handle
5822 }
5823
5824 fn drop_without_shutdown(mut self) {
5825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5827 std::mem::forget(self);
5829 }
5830}
5831
5832impl ProjectIdGetForNodeResponder {
5833 pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
5837 let _result = self.send_raw(result);
5838 if _result.is_err() {
5839 self.control_handle.shutdown();
5840 }
5841 self.drop_without_shutdown();
5842 _result
5843 }
5844
5845 pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
5847 let _result = self.send_raw(result);
5848 self.drop_without_shutdown();
5849 _result
5850 }
5851
5852 fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
5853 self.control_handle
5854 .inner
5855 .send::<fidl::encoding::ResultType<ProjectIdGetForNodeResponse, i32>>(
5856 result.map(|project_id| (project_id,)),
5857 self.tx_id,
5858 0x644073bdf2542573,
5859 fidl::encoding::DynamicFlags::empty(),
5860 )
5861 }
5862}
5863
5864#[must_use = "FIDL methods require a response to be sent"]
5865#[derive(Debug)]
5866pub struct ProjectIdClearForNodeResponder {
5867 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
5868 tx_id: u32,
5869}
5870
5871impl std::ops::Drop for ProjectIdClearForNodeResponder {
5875 fn drop(&mut self) {
5876 self.control_handle.shutdown();
5877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5879 }
5880}
5881
5882impl fidl::endpoints::Responder for ProjectIdClearForNodeResponder {
5883 type ControlHandle = ProjectIdControlHandle;
5884
5885 fn control_handle(&self) -> &ProjectIdControlHandle {
5886 &self.control_handle
5887 }
5888
5889 fn drop_without_shutdown(mut self) {
5890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5892 std::mem::forget(self);
5894 }
5895}
5896
5897impl ProjectIdClearForNodeResponder {
5898 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5902 let _result = self.send_raw(result);
5903 if _result.is_err() {
5904 self.control_handle.shutdown();
5905 }
5906 self.drop_without_shutdown();
5907 _result
5908 }
5909
5910 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5912 let _result = self.send_raw(result);
5913 self.drop_without_shutdown();
5914 _result
5915 }
5916
5917 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5918 self.control_handle
5919 .inner
5920 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
5921 result,
5922 self.tx_id,
5923 0x3f2ca287bbfe6a62,
5924 fidl::encoding::DynamicFlags::empty(),
5925 )
5926 }
5927}
5928
5929#[must_use = "FIDL methods require a response to be sent"]
5930#[derive(Debug)]
5931pub struct ProjectIdListResponder {
5932 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
5933 tx_id: u32,
5934}
5935
5936impl std::ops::Drop for ProjectIdListResponder {
5940 fn drop(&mut self) {
5941 self.control_handle.shutdown();
5942 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5944 }
5945}
5946
5947impl fidl::endpoints::Responder for ProjectIdListResponder {
5948 type ControlHandle = ProjectIdControlHandle;
5949
5950 fn control_handle(&self) -> &ProjectIdControlHandle {
5951 &self.control_handle
5952 }
5953
5954 fn drop_without_shutdown(mut self) {
5955 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5957 std::mem::forget(self);
5959 }
5960}
5961
5962impl ProjectIdListResponder {
5963 pub fn send(
5967 self,
5968 mut result: Result<(&[u64], Option<&ProjectIterToken>), i32>,
5969 ) -> Result<(), fidl::Error> {
5970 let _result = self.send_raw(result);
5971 if _result.is_err() {
5972 self.control_handle.shutdown();
5973 }
5974 self.drop_without_shutdown();
5975 _result
5976 }
5977
5978 pub fn send_no_shutdown_on_err(
5980 self,
5981 mut result: Result<(&[u64], Option<&ProjectIterToken>), i32>,
5982 ) -> Result<(), fidl::Error> {
5983 let _result = self.send_raw(result);
5984 self.drop_without_shutdown();
5985 _result
5986 }
5987
5988 fn send_raw(
5989 &self,
5990 mut result: Result<(&[u64], Option<&ProjectIterToken>), i32>,
5991 ) -> Result<(), fidl::Error> {
5992 self.control_handle.inner.send::<fidl::encoding::ResultType<ProjectIdListResponse, i32>>(
5993 result,
5994 self.tx_id,
5995 0x5505f95a36d522cc,
5996 fidl::encoding::DynamicFlags::empty(),
5997 )
5998 }
5999}
6000
6001#[must_use = "FIDL methods require a response to be sent"]
6002#[derive(Debug)]
6003pub struct ProjectIdInfoResponder {
6004 control_handle: std::mem::ManuallyDrop<ProjectIdControlHandle>,
6005 tx_id: u32,
6006}
6007
6008impl std::ops::Drop for ProjectIdInfoResponder {
6012 fn drop(&mut self) {
6013 self.control_handle.shutdown();
6014 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6016 }
6017}
6018
6019impl fidl::endpoints::Responder for ProjectIdInfoResponder {
6020 type ControlHandle = ProjectIdControlHandle;
6021
6022 fn control_handle(&self) -> &ProjectIdControlHandle {
6023 &self.control_handle
6024 }
6025
6026 fn drop_without_shutdown(mut self) {
6027 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6029 std::mem::forget(self);
6031 }
6032}
6033
6034impl ProjectIdInfoResponder {
6035 pub fn send(
6039 self,
6040 mut result: Result<(&BytesAndNodes, &BytesAndNodes), i32>,
6041 ) -> Result<(), fidl::Error> {
6042 let _result = self.send_raw(result);
6043 if _result.is_err() {
6044 self.control_handle.shutdown();
6045 }
6046 self.drop_without_shutdown();
6047 _result
6048 }
6049
6050 pub fn send_no_shutdown_on_err(
6052 self,
6053 mut result: Result<(&BytesAndNodes, &BytesAndNodes), i32>,
6054 ) -> Result<(), fidl::Error> {
6055 let _result = self.send_raw(result);
6056 self.drop_without_shutdown();
6057 _result
6058 }
6059
6060 fn send_raw(
6061 &self,
6062 mut result: Result<(&BytesAndNodes, &BytesAndNodes), i32>,
6063 ) -> Result<(), fidl::Error> {
6064 self.control_handle.inner.send::<fidl::encoding::ResultType<ProjectIdInfoResponse, i32>>(
6065 result,
6066 self.tx_id,
6067 0x51b47743c9e2d1ab,
6068 fidl::encoding::DynamicFlags::empty(),
6069 )
6070 }
6071}
6072
6073#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6074pub struct VolumeInstallerMarker;
6075
6076impl fidl::endpoints::ProtocolMarker for VolumeInstallerMarker {
6077 type Proxy = VolumeInstallerProxy;
6078 type RequestStream = VolumeInstallerRequestStream;
6079 #[cfg(target_os = "fuchsia")]
6080 type SynchronousProxy = VolumeInstallerSynchronousProxy;
6081
6082 const DEBUG_NAME: &'static str = "fuchsia.fxfs.VolumeInstaller";
6083}
6084impl fidl::endpoints::DiscoverableProtocolMarker for VolumeInstallerMarker {}
6085pub type VolumeInstallerInstallResult = Result<(), i32>;
6086
6087pub trait VolumeInstallerProxyInterface: Send + Sync {
6088 type InstallResponseFut: std::future::Future<Output = Result<VolumeInstallerInstallResult, fidl::Error>>
6089 + Send;
6090 fn r#install(&self, src: &str, image_file: &str, dst: &str) -> Self::InstallResponseFut;
6091}
6092#[derive(Debug)]
6093#[cfg(target_os = "fuchsia")]
6094pub struct VolumeInstallerSynchronousProxy {
6095 client: fidl::client::sync::Client,
6096}
6097
6098#[cfg(target_os = "fuchsia")]
6099impl fidl::endpoints::SynchronousProxy for VolumeInstallerSynchronousProxy {
6100 type Proxy = VolumeInstallerProxy;
6101 type Protocol = VolumeInstallerMarker;
6102
6103 fn from_channel(inner: fidl::Channel) -> Self {
6104 Self::new(inner)
6105 }
6106
6107 fn into_channel(self) -> fidl::Channel {
6108 self.client.into_channel()
6109 }
6110
6111 fn as_channel(&self) -> &fidl::Channel {
6112 self.client.as_channel()
6113 }
6114}
6115
6116#[cfg(target_os = "fuchsia")]
6117impl VolumeInstallerSynchronousProxy {
6118 pub fn new(channel: fidl::Channel) -> Self {
6119 let protocol_name = <VolumeInstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6120 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6121 }
6122
6123 pub fn into_channel(self) -> fidl::Channel {
6124 self.client.into_channel()
6125 }
6126
6127 pub fn wait_for_event(
6130 &self,
6131 deadline: zx::MonotonicInstant,
6132 ) -> Result<VolumeInstallerEvent, fidl::Error> {
6133 VolumeInstallerEvent::decode(self.client.wait_for_event(deadline)?)
6134 }
6135
6136 pub fn r#install(
6143 &self,
6144 mut src: &str,
6145 mut image_file: &str,
6146 mut dst: &str,
6147 ___deadline: zx::MonotonicInstant,
6148 ) -> Result<VolumeInstallerInstallResult, fidl::Error> {
6149 let _response = self.client.send_query::<
6150 VolumeInstallerInstallRequest,
6151 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6152 >(
6153 (src, image_file, dst,),
6154 0x4c340be8a504ee1c,
6155 fidl::encoding::DynamicFlags::empty(),
6156 ___deadline,
6157 )?;
6158 Ok(_response.map(|x| x))
6159 }
6160}
6161
6162#[cfg(target_os = "fuchsia")]
6163impl From<VolumeInstallerSynchronousProxy> for zx::NullableHandle {
6164 fn from(value: VolumeInstallerSynchronousProxy) -> Self {
6165 value.into_channel().into()
6166 }
6167}
6168
6169#[cfg(target_os = "fuchsia")]
6170impl From<fidl::Channel> for VolumeInstallerSynchronousProxy {
6171 fn from(value: fidl::Channel) -> Self {
6172 Self::new(value)
6173 }
6174}
6175
6176#[cfg(target_os = "fuchsia")]
6177impl fidl::endpoints::FromClient for VolumeInstallerSynchronousProxy {
6178 type Protocol = VolumeInstallerMarker;
6179
6180 fn from_client(value: fidl::endpoints::ClientEnd<VolumeInstallerMarker>) -> Self {
6181 Self::new(value.into_channel())
6182 }
6183}
6184
6185#[derive(Debug, Clone)]
6186pub struct VolumeInstallerProxy {
6187 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6188}
6189
6190impl fidl::endpoints::Proxy for VolumeInstallerProxy {
6191 type Protocol = VolumeInstallerMarker;
6192
6193 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6194 Self::new(inner)
6195 }
6196
6197 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6198 self.client.into_channel().map_err(|client| Self { client })
6199 }
6200
6201 fn as_channel(&self) -> &::fidl::AsyncChannel {
6202 self.client.as_channel()
6203 }
6204}
6205
6206impl VolumeInstallerProxy {
6207 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6209 let protocol_name = <VolumeInstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6210 Self { client: fidl::client::Client::new(channel, protocol_name) }
6211 }
6212
6213 pub fn take_event_stream(&self) -> VolumeInstallerEventStream {
6219 VolumeInstallerEventStream { event_receiver: self.client.take_event_receiver() }
6220 }
6221
6222 pub fn r#install(
6229 &self,
6230 mut src: &str,
6231 mut image_file: &str,
6232 mut dst: &str,
6233 ) -> fidl::client::QueryResponseFut<
6234 VolumeInstallerInstallResult,
6235 fidl::encoding::DefaultFuchsiaResourceDialect,
6236 > {
6237 VolumeInstallerProxyInterface::r#install(self, src, image_file, dst)
6238 }
6239}
6240
6241impl VolumeInstallerProxyInterface for VolumeInstallerProxy {
6242 type InstallResponseFut = fidl::client::QueryResponseFut<
6243 VolumeInstallerInstallResult,
6244 fidl::encoding::DefaultFuchsiaResourceDialect,
6245 >;
6246 fn r#install(
6247 &self,
6248 mut src: &str,
6249 mut image_file: &str,
6250 mut dst: &str,
6251 ) -> Self::InstallResponseFut {
6252 fn _decode(
6253 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6254 ) -> Result<VolumeInstallerInstallResult, fidl::Error> {
6255 let _response = fidl::client::decode_transaction_body::<
6256 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6257 fidl::encoding::DefaultFuchsiaResourceDialect,
6258 0x4c340be8a504ee1c,
6259 >(_buf?)?;
6260 Ok(_response.map(|x| x))
6261 }
6262 self.client
6263 .send_query_and_decode::<VolumeInstallerInstallRequest, VolumeInstallerInstallResult>(
6264 (src, image_file, dst),
6265 0x4c340be8a504ee1c,
6266 fidl::encoding::DynamicFlags::empty(),
6267 _decode,
6268 )
6269 }
6270}
6271
6272pub struct VolumeInstallerEventStream {
6273 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6274}
6275
6276impl std::marker::Unpin for VolumeInstallerEventStream {}
6277
6278impl futures::stream::FusedStream for VolumeInstallerEventStream {
6279 fn is_terminated(&self) -> bool {
6280 self.event_receiver.is_terminated()
6281 }
6282}
6283
6284impl futures::Stream for VolumeInstallerEventStream {
6285 type Item = Result<VolumeInstallerEvent, fidl::Error>;
6286
6287 fn poll_next(
6288 mut self: std::pin::Pin<&mut Self>,
6289 cx: &mut std::task::Context<'_>,
6290 ) -> std::task::Poll<Option<Self::Item>> {
6291 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6292 &mut self.event_receiver,
6293 cx
6294 )?) {
6295 Some(buf) => std::task::Poll::Ready(Some(VolumeInstallerEvent::decode(buf))),
6296 None => std::task::Poll::Ready(None),
6297 }
6298 }
6299}
6300
6301#[derive(Debug)]
6302pub enum VolumeInstallerEvent {}
6303
6304impl VolumeInstallerEvent {
6305 fn decode(
6307 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6308 ) -> Result<VolumeInstallerEvent, fidl::Error> {
6309 let (bytes, _handles) = buf.split_mut();
6310 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6311 debug_assert_eq!(tx_header.tx_id, 0);
6312 match tx_header.ordinal {
6313 _ => Err(fidl::Error::UnknownOrdinal {
6314 ordinal: tx_header.ordinal,
6315 protocol_name:
6316 <VolumeInstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6317 }),
6318 }
6319 }
6320}
6321
6322pub struct VolumeInstallerRequestStream {
6324 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6325 is_terminated: bool,
6326}
6327
6328impl std::marker::Unpin for VolumeInstallerRequestStream {}
6329
6330impl futures::stream::FusedStream for VolumeInstallerRequestStream {
6331 fn is_terminated(&self) -> bool {
6332 self.is_terminated
6333 }
6334}
6335
6336impl fidl::endpoints::RequestStream for VolumeInstallerRequestStream {
6337 type Protocol = VolumeInstallerMarker;
6338 type ControlHandle = VolumeInstallerControlHandle;
6339
6340 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6341 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6342 }
6343
6344 fn control_handle(&self) -> Self::ControlHandle {
6345 VolumeInstallerControlHandle { inner: self.inner.clone() }
6346 }
6347
6348 fn into_inner(
6349 self,
6350 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6351 {
6352 (self.inner, self.is_terminated)
6353 }
6354
6355 fn from_inner(
6356 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6357 is_terminated: bool,
6358 ) -> Self {
6359 Self { inner, is_terminated }
6360 }
6361}
6362
6363impl futures::Stream for VolumeInstallerRequestStream {
6364 type Item = Result<VolumeInstallerRequest, fidl::Error>;
6365
6366 fn poll_next(
6367 mut self: std::pin::Pin<&mut Self>,
6368 cx: &mut std::task::Context<'_>,
6369 ) -> std::task::Poll<Option<Self::Item>> {
6370 let this = &mut *self;
6371 if this.inner.check_shutdown(cx) {
6372 this.is_terminated = true;
6373 return std::task::Poll::Ready(None);
6374 }
6375 if this.is_terminated {
6376 panic!("polled VolumeInstallerRequestStream after completion");
6377 }
6378 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6379 |bytes, handles| {
6380 match this.inner.channel().read_etc(cx, bytes, handles) {
6381 std::task::Poll::Ready(Ok(())) => {}
6382 std::task::Poll::Pending => return std::task::Poll::Pending,
6383 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6384 this.is_terminated = true;
6385 return std::task::Poll::Ready(None);
6386 }
6387 std::task::Poll::Ready(Err(e)) => {
6388 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6389 e.into(),
6390 ))));
6391 }
6392 }
6393
6394 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6396
6397 std::task::Poll::Ready(Some(match header.ordinal {
6398 0x4c340be8a504ee1c => {
6399 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6400 let mut req = fidl::new_empty!(
6401 VolumeInstallerInstallRequest,
6402 fidl::encoding::DefaultFuchsiaResourceDialect
6403 );
6404 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeInstallerInstallRequest>(&header, _body_bytes, handles, &mut req)?;
6405 let control_handle =
6406 VolumeInstallerControlHandle { inner: this.inner.clone() };
6407 Ok(VolumeInstallerRequest::Install {
6408 src: req.src,
6409 image_file: req.image_file,
6410 dst: req.dst,
6411
6412 responder: VolumeInstallerInstallResponder {
6413 control_handle: std::mem::ManuallyDrop::new(control_handle),
6414 tx_id: header.tx_id,
6415 },
6416 })
6417 }
6418 _ => Err(fidl::Error::UnknownOrdinal {
6419 ordinal: header.ordinal,
6420 protocol_name:
6421 <VolumeInstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6422 }),
6423 }))
6424 },
6425 )
6426 }
6427}
6428
6429#[derive(Debug)]
6431pub enum VolumeInstallerRequest {
6432 Install {
6439 src: String,
6440 image_file: String,
6441 dst: String,
6442 responder: VolumeInstallerInstallResponder,
6443 },
6444}
6445
6446impl VolumeInstallerRequest {
6447 #[allow(irrefutable_let_patterns)]
6448 pub fn into_install(self) -> Option<(String, String, String, VolumeInstallerInstallResponder)> {
6449 if let VolumeInstallerRequest::Install { src, image_file, dst, responder } = self {
6450 Some((src, image_file, dst, responder))
6451 } else {
6452 None
6453 }
6454 }
6455
6456 pub fn method_name(&self) -> &'static str {
6458 match *self {
6459 VolumeInstallerRequest::Install { .. } => "install",
6460 }
6461 }
6462}
6463
6464#[derive(Debug, Clone)]
6465pub struct VolumeInstallerControlHandle {
6466 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6467}
6468
6469impl fidl::endpoints::ControlHandle for VolumeInstallerControlHandle {
6470 fn shutdown(&self) {
6471 self.inner.shutdown()
6472 }
6473
6474 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6475 self.inner.shutdown_with_epitaph(status)
6476 }
6477
6478 fn is_closed(&self) -> bool {
6479 self.inner.channel().is_closed()
6480 }
6481 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6482 self.inner.channel().on_closed()
6483 }
6484
6485 #[cfg(target_os = "fuchsia")]
6486 fn signal_peer(
6487 &self,
6488 clear_mask: zx::Signals,
6489 set_mask: zx::Signals,
6490 ) -> Result<(), zx_status::Status> {
6491 use fidl::Peered;
6492 self.inner.channel().signal_peer(clear_mask, set_mask)
6493 }
6494}
6495
6496impl VolumeInstallerControlHandle {}
6497
6498#[must_use = "FIDL methods require a response to be sent"]
6499#[derive(Debug)]
6500pub struct VolumeInstallerInstallResponder {
6501 control_handle: std::mem::ManuallyDrop<VolumeInstallerControlHandle>,
6502 tx_id: u32,
6503}
6504
6505impl std::ops::Drop for VolumeInstallerInstallResponder {
6509 fn drop(&mut self) {
6510 self.control_handle.shutdown();
6511 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6513 }
6514}
6515
6516impl fidl::endpoints::Responder for VolumeInstallerInstallResponder {
6517 type ControlHandle = VolumeInstallerControlHandle;
6518
6519 fn control_handle(&self) -> &VolumeInstallerControlHandle {
6520 &self.control_handle
6521 }
6522
6523 fn drop_without_shutdown(mut self) {
6524 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6526 std::mem::forget(self);
6528 }
6529}
6530
6531impl VolumeInstallerInstallResponder {
6532 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6536 let _result = self.send_raw(result);
6537 if _result.is_err() {
6538 self.control_handle.shutdown();
6539 }
6540 self.drop_without_shutdown();
6541 _result
6542 }
6543
6544 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6546 let _result = self.send_raw(result);
6547 self.drop_without_shutdown();
6548 _result
6549 }
6550
6551 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6552 self.control_handle
6553 .inner
6554 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6555 result,
6556 self.tx_id,
6557 0x4c340be8a504ee1c,
6558 fidl::encoding::DynamicFlags::empty(),
6559 )
6560 }
6561}
6562
6563mod internal {
6564 use super::*;
6565
6566 impl fidl::encoding::ResourceTypeMarker for BlobCreatorCreateResponse {
6567 type Borrowed<'a> = &'a mut Self;
6568 fn take_or_borrow<'a>(
6569 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6570 ) -> Self::Borrowed<'a> {
6571 value
6572 }
6573 }
6574
6575 unsafe impl fidl::encoding::TypeMarker for BlobCreatorCreateResponse {
6576 type Owned = Self;
6577
6578 #[inline(always)]
6579 fn inline_align(_context: fidl::encoding::Context) -> usize {
6580 4
6581 }
6582
6583 #[inline(always)]
6584 fn inline_size(_context: fidl::encoding::Context) -> usize {
6585 4
6586 }
6587 }
6588
6589 unsafe impl
6590 fidl::encoding::Encode<
6591 BlobCreatorCreateResponse,
6592 fidl::encoding::DefaultFuchsiaResourceDialect,
6593 > for &mut BlobCreatorCreateResponse
6594 {
6595 #[inline]
6596 unsafe fn encode(
6597 self,
6598 encoder: &mut fidl::encoding::Encoder<
6599 '_,
6600 fidl::encoding::DefaultFuchsiaResourceDialect,
6601 >,
6602 offset: usize,
6603 _depth: fidl::encoding::Depth,
6604 ) -> fidl::Result<()> {
6605 encoder.debug_check_bounds::<BlobCreatorCreateResponse>(offset);
6606 fidl::encoding::Encode::<BlobCreatorCreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6608 (
6609 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobWriterMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
6610 ),
6611 encoder, offset, _depth
6612 )
6613 }
6614 }
6615 unsafe impl<
6616 T0: fidl::encoding::Encode<
6617 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobWriterMarker>>,
6618 fidl::encoding::DefaultFuchsiaResourceDialect,
6619 >,
6620 >
6621 fidl::encoding::Encode<
6622 BlobCreatorCreateResponse,
6623 fidl::encoding::DefaultFuchsiaResourceDialect,
6624 > for (T0,)
6625 {
6626 #[inline]
6627 unsafe fn encode(
6628 self,
6629 encoder: &mut fidl::encoding::Encoder<
6630 '_,
6631 fidl::encoding::DefaultFuchsiaResourceDialect,
6632 >,
6633 offset: usize,
6634 depth: fidl::encoding::Depth,
6635 ) -> fidl::Result<()> {
6636 encoder.debug_check_bounds::<BlobCreatorCreateResponse>(offset);
6637 self.0.encode(encoder, offset + 0, depth)?;
6641 Ok(())
6642 }
6643 }
6644
6645 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6646 for BlobCreatorCreateResponse
6647 {
6648 #[inline(always)]
6649 fn new_empty() -> Self {
6650 Self {
6651 writer: fidl::new_empty!(
6652 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobWriterMarker>>,
6653 fidl::encoding::DefaultFuchsiaResourceDialect
6654 ),
6655 }
6656 }
6657
6658 #[inline]
6659 unsafe fn decode(
6660 &mut self,
6661 decoder: &mut fidl::encoding::Decoder<
6662 '_,
6663 fidl::encoding::DefaultFuchsiaResourceDialect,
6664 >,
6665 offset: usize,
6666 _depth: fidl::encoding::Depth,
6667 ) -> fidl::Result<()> {
6668 decoder.debug_check_bounds::<Self>(offset);
6669 fidl::decode!(
6671 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BlobWriterMarker>>,
6672 fidl::encoding::DefaultFuchsiaResourceDialect,
6673 &mut self.writer,
6674 decoder,
6675 offset + 0,
6676 _depth
6677 )?;
6678 Ok(())
6679 }
6680 }
6681
6682 impl fidl::encoding::ResourceTypeMarker for BlobReaderGetVmoResponse {
6683 type Borrowed<'a> = &'a mut Self;
6684 fn take_or_borrow<'a>(
6685 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6686 ) -> Self::Borrowed<'a> {
6687 value
6688 }
6689 }
6690
6691 unsafe impl fidl::encoding::TypeMarker for BlobReaderGetVmoResponse {
6692 type Owned = Self;
6693
6694 #[inline(always)]
6695 fn inline_align(_context: fidl::encoding::Context) -> usize {
6696 4
6697 }
6698
6699 #[inline(always)]
6700 fn inline_size(_context: fidl::encoding::Context) -> usize {
6701 4
6702 }
6703 }
6704
6705 unsafe impl
6706 fidl::encoding::Encode<
6707 BlobReaderGetVmoResponse,
6708 fidl::encoding::DefaultFuchsiaResourceDialect,
6709 > for &mut BlobReaderGetVmoResponse
6710 {
6711 #[inline]
6712 unsafe fn encode(
6713 self,
6714 encoder: &mut fidl::encoding::Encoder<
6715 '_,
6716 fidl::encoding::DefaultFuchsiaResourceDialect,
6717 >,
6718 offset: usize,
6719 _depth: fidl::encoding::Depth,
6720 ) -> fidl::Result<()> {
6721 encoder.debug_check_bounds::<BlobReaderGetVmoResponse>(offset);
6722 fidl::encoding::Encode::<
6724 BlobReaderGetVmoResponse,
6725 fidl::encoding::DefaultFuchsiaResourceDialect,
6726 >::encode(
6727 (<fidl::encoding::HandleType<
6728 fidl::Vmo,
6729 { fidl::ObjectType::VMO.into_raw() },
6730 2147483648,
6731 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6732 &mut self.vmo
6733 ),),
6734 encoder,
6735 offset,
6736 _depth,
6737 )
6738 }
6739 }
6740 unsafe impl<
6741 T0: fidl::encoding::Encode<
6742 fidl::encoding::HandleType<
6743 fidl::Vmo,
6744 { fidl::ObjectType::VMO.into_raw() },
6745 2147483648,
6746 >,
6747 fidl::encoding::DefaultFuchsiaResourceDialect,
6748 >,
6749 >
6750 fidl::encoding::Encode<
6751 BlobReaderGetVmoResponse,
6752 fidl::encoding::DefaultFuchsiaResourceDialect,
6753 > for (T0,)
6754 {
6755 #[inline]
6756 unsafe fn encode(
6757 self,
6758 encoder: &mut fidl::encoding::Encoder<
6759 '_,
6760 fidl::encoding::DefaultFuchsiaResourceDialect,
6761 >,
6762 offset: usize,
6763 depth: fidl::encoding::Depth,
6764 ) -> fidl::Result<()> {
6765 encoder.debug_check_bounds::<BlobReaderGetVmoResponse>(offset);
6766 self.0.encode(encoder, offset + 0, depth)?;
6770 Ok(())
6771 }
6772 }
6773
6774 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6775 for BlobReaderGetVmoResponse
6776 {
6777 #[inline(always)]
6778 fn new_empty() -> Self {
6779 Self {
6780 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6781 }
6782 }
6783
6784 #[inline]
6785 unsafe fn decode(
6786 &mut self,
6787 decoder: &mut fidl::encoding::Decoder<
6788 '_,
6789 fidl::encoding::DefaultFuchsiaResourceDialect,
6790 >,
6791 offset: usize,
6792 _depth: fidl::encoding::Depth,
6793 ) -> fidl::Result<()> {
6794 decoder.debug_check_bounds::<Self>(offset);
6795 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
6797 Ok(())
6798 }
6799 }
6800
6801 impl fidl::encoding::ResourceTypeMarker for BlobWriterGetVmoResponse {
6802 type Borrowed<'a> = &'a mut Self;
6803 fn take_or_borrow<'a>(
6804 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6805 ) -> Self::Borrowed<'a> {
6806 value
6807 }
6808 }
6809
6810 unsafe impl fidl::encoding::TypeMarker for BlobWriterGetVmoResponse {
6811 type Owned = Self;
6812
6813 #[inline(always)]
6814 fn inline_align(_context: fidl::encoding::Context) -> usize {
6815 4
6816 }
6817
6818 #[inline(always)]
6819 fn inline_size(_context: fidl::encoding::Context) -> usize {
6820 4
6821 }
6822 }
6823
6824 unsafe impl
6825 fidl::encoding::Encode<
6826 BlobWriterGetVmoResponse,
6827 fidl::encoding::DefaultFuchsiaResourceDialect,
6828 > for &mut BlobWriterGetVmoResponse
6829 {
6830 #[inline]
6831 unsafe fn encode(
6832 self,
6833 encoder: &mut fidl::encoding::Encoder<
6834 '_,
6835 fidl::encoding::DefaultFuchsiaResourceDialect,
6836 >,
6837 offset: usize,
6838 _depth: fidl::encoding::Depth,
6839 ) -> fidl::Result<()> {
6840 encoder.debug_check_bounds::<BlobWriterGetVmoResponse>(offset);
6841 fidl::encoding::Encode::<
6843 BlobWriterGetVmoResponse,
6844 fidl::encoding::DefaultFuchsiaResourceDialect,
6845 >::encode(
6846 (<fidl::encoding::HandleType<
6847 fidl::Vmo,
6848 { fidl::ObjectType::VMO.into_raw() },
6849 2147483648,
6850 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6851 &mut self.vmo
6852 ),),
6853 encoder,
6854 offset,
6855 _depth,
6856 )
6857 }
6858 }
6859 unsafe impl<
6860 T0: fidl::encoding::Encode<
6861 fidl::encoding::HandleType<
6862 fidl::Vmo,
6863 { fidl::ObjectType::VMO.into_raw() },
6864 2147483648,
6865 >,
6866 fidl::encoding::DefaultFuchsiaResourceDialect,
6867 >,
6868 >
6869 fidl::encoding::Encode<
6870 BlobWriterGetVmoResponse,
6871 fidl::encoding::DefaultFuchsiaResourceDialect,
6872 > for (T0,)
6873 {
6874 #[inline]
6875 unsafe fn encode(
6876 self,
6877 encoder: &mut fidl::encoding::Encoder<
6878 '_,
6879 fidl::encoding::DefaultFuchsiaResourceDialect,
6880 >,
6881 offset: usize,
6882 depth: fidl::encoding::Depth,
6883 ) -> fidl::Result<()> {
6884 encoder.debug_check_bounds::<BlobWriterGetVmoResponse>(offset);
6885 self.0.encode(encoder, offset + 0, depth)?;
6889 Ok(())
6890 }
6891 }
6892
6893 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6894 for BlobWriterGetVmoResponse
6895 {
6896 #[inline(always)]
6897 fn new_empty() -> Self {
6898 Self {
6899 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
6900 }
6901 }
6902
6903 #[inline]
6904 unsafe fn decode(
6905 &mut self,
6906 decoder: &mut fidl::encoding::Decoder<
6907 '_,
6908 fidl::encoding::DefaultFuchsiaResourceDialect,
6909 >,
6910 offset: usize,
6911 _depth: fidl::encoding::Depth,
6912 ) -> fidl::Result<()> {
6913 decoder.debug_check_bounds::<Self>(offset);
6914 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
6916 Ok(())
6917 }
6918 }
6919
6920 impl fidl::encoding::ResourceTypeMarker for FileBackedVolumeProviderOpenRequest {
6921 type Borrowed<'a> = &'a mut Self;
6922 fn take_or_borrow<'a>(
6923 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6924 ) -> Self::Borrowed<'a> {
6925 value
6926 }
6927 }
6928
6929 unsafe impl fidl::encoding::TypeMarker for FileBackedVolumeProviderOpenRequest {
6930 type Owned = Self;
6931
6932 #[inline(always)]
6933 fn inline_align(_context: fidl::encoding::Context) -> usize {
6934 8
6935 }
6936
6937 #[inline(always)]
6938 fn inline_size(_context: fidl::encoding::Context) -> usize {
6939 32
6940 }
6941 }
6942
6943 unsafe impl
6944 fidl::encoding::Encode<
6945 FileBackedVolumeProviderOpenRequest,
6946 fidl::encoding::DefaultFuchsiaResourceDialect,
6947 > for &mut FileBackedVolumeProviderOpenRequest
6948 {
6949 #[inline]
6950 unsafe fn encode(
6951 self,
6952 encoder: &mut fidl::encoding::Encoder<
6953 '_,
6954 fidl::encoding::DefaultFuchsiaResourceDialect,
6955 >,
6956 offset: usize,
6957 _depth: fidl::encoding::Depth,
6958 ) -> fidl::Result<()> {
6959 encoder.debug_check_bounds::<FileBackedVolumeProviderOpenRequest>(offset);
6960 fidl::encoding::Encode::<
6962 FileBackedVolumeProviderOpenRequest,
6963 fidl::encoding::DefaultFuchsiaResourceDialect,
6964 >::encode(
6965 (
6966 <fidl::encoding::HandleType<
6967 fidl::NullableHandle,
6968 { fidl::ObjectType::NONE.into_raw() },
6969 2147483648,
6970 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6971 &mut self.parent_directory_token,
6972 ),
6973 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
6974 &self.name,
6975 ),
6976 <fidl::encoding::Endpoint<
6977 fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
6978 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6979 &mut self.server_end
6980 ),
6981 ),
6982 encoder,
6983 offset,
6984 _depth,
6985 )
6986 }
6987 }
6988 unsafe impl<
6989 T0: fidl::encoding::Encode<
6990 fidl::encoding::HandleType<
6991 fidl::NullableHandle,
6992 { fidl::ObjectType::NONE.into_raw() },
6993 2147483648,
6994 >,
6995 fidl::encoding::DefaultFuchsiaResourceDialect,
6996 >,
6997 T1: fidl::encoding::Encode<
6998 fidl::encoding::BoundedString<255>,
6999 fidl::encoding::DefaultFuchsiaResourceDialect,
7000 >,
7001 T2: fidl::encoding::Encode<
7002 fidl::encoding::Endpoint<
7003 fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
7004 >,
7005 fidl::encoding::DefaultFuchsiaResourceDialect,
7006 >,
7007 >
7008 fidl::encoding::Encode<
7009 FileBackedVolumeProviderOpenRequest,
7010 fidl::encoding::DefaultFuchsiaResourceDialect,
7011 > for (T0, T1, T2)
7012 {
7013 #[inline]
7014 unsafe fn encode(
7015 self,
7016 encoder: &mut fidl::encoding::Encoder<
7017 '_,
7018 fidl::encoding::DefaultFuchsiaResourceDialect,
7019 >,
7020 offset: usize,
7021 depth: fidl::encoding::Depth,
7022 ) -> fidl::Result<()> {
7023 encoder.debug_check_bounds::<FileBackedVolumeProviderOpenRequest>(offset);
7024 unsafe {
7027 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7028 (ptr as *mut u64).write_unaligned(0);
7029 }
7030 unsafe {
7031 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
7032 (ptr as *mut u64).write_unaligned(0);
7033 }
7034 self.0.encode(encoder, offset + 0, depth)?;
7036 self.1.encode(encoder, offset + 8, depth)?;
7037 self.2.encode(encoder, offset + 24, depth)?;
7038 Ok(())
7039 }
7040 }
7041
7042 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7043 for FileBackedVolumeProviderOpenRequest
7044 {
7045 #[inline(always)]
7046 fn new_empty() -> Self {
7047 Self {
7048 parent_directory_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
7049 name: fidl::new_empty!(
7050 fidl::encoding::BoundedString<255>,
7051 fidl::encoding::DefaultFuchsiaResourceDialect
7052 ),
7053 server_end: fidl::new_empty!(
7054 fidl::encoding::Endpoint<
7055 fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
7056 >,
7057 fidl::encoding::DefaultFuchsiaResourceDialect
7058 ),
7059 }
7060 }
7061
7062 #[inline]
7063 unsafe fn decode(
7064 &mut self,
7065 decoder: &mut fidl::encoding::Decoder<
7066 '_,
7067 fidl::encoding::DefaultFuchsiaResourceDialect,
7068 >,
7069 offset: usize,
7070 _depth: fidl::encoding::Depth,
7071 ) -> fidl::Result<()> {
7072 decoder.debug_check_bounds::<Self>(offset);
7073 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7075 let padval = unsafe { (ptr as *const u64).read_unaligned() };
7076 let mask = 0xffffffff00000000u64;
7077 let maskedval = padval & mask;
7078 if maskedval != 0 {
7079 return Err(fidl::Error::NonZeroPadding {
7080 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7081 });
7082 }
7083 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
7084 let padval = unsafe { (ptr as *const u64).read_unaligned() };
7085 let mask = 0xffffffff00000000u64;
7086 let maskedval = padval & mask;
7087 if maskedval != 0 {
7088 return Err(fidl::Error::NonZeroPadding {
7089 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
7090 });
7091 }
7092 fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.parent_directory_token, decoder, offset + 0, _depth)?;
7093 fidl::decode!(
7094 fidl::encoding::BoundedString<255>,
7095 fidl::encoding::DefaultFuchsiaResourceDialect,
7096 &mut self.name,
7097 decoder,
7098 offset + 8,
7099 _depth
7100 )?;
7101 fidl::decode!(
7102 fidl::encoding::Endpoint<
7103 fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
7104 >,
7105 fidl::encoding::DefaultFuchsiaResourceDialect,
7106 &mut self.server_end,
7107 decoder,
7108 offset + 24,
7109 _depth
7110 )?;
7111 Ok(())
7112 }
7113 }
7114}