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