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