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