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_storage_ext4_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ServerMountVmoRequest {
16 pub source: fidl::Vmo,
17 pub root: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ServerMountVmoRequest {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct Server_Marker;
24
25impl fidl::endpoints::ProtocolMarker for Server_Marker {
26 type Proxy = Server_Proxy;
27 type RequestStream = Server_RequestStream;
28 #[cfg(target_os = "fuchsia")]
29 type SynchronousProxy = Server_SynchronousProxy;
30
31 const DEBUG_NAME: &'static str = "fuchsia.storage.ext4.Server";
32}
33impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
34
35pub trait Server_ProxyInterface: Send + Sync {
36 type MountVmoResponseFut: std::future::Future<Output = Result<MountVmoResult, fidl::Error>>
37 + Send;
38 fn r#mount_vmo(
39 &self,
40 source: fidl::Vmo,
41 root: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
42 ) -> Self::MountVmoResponseFut;
43}
44#[derive(Debug)]
45#[cfg(target_os = "fuchsia")]
46pub struct Server_SynchronousProxy {
47 client: fidl::client::sync::Client,
48}
49
50#[cfg(target_os = "fuchsia")]
51impl fidl::endpoints::SynchronousProxy for Server_SynchronousProxy {
52 type Proxy = Server_Proxy;
53 type Protocol = Server_Marker;
54
55 fn from_channel(inner: fidl::Channel) -> Self {
56 Self::new(inner)
57 }
58
59 fn into_channel(self) -> fidl::Channel {
60 self.client.into_channel()
61 }
62
63 fn as_channel(&self) -> &fidl::Channel {
64 self.client.as_channel()
65 }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl Server_SynchronousProxy {
70 pub fn new(channel: fidl::Channel) -> Self {
71 let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
72 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
73 }
74
75 pub fn into_channel(self) -> fidl::Channel {
76 self.client.into_channel()
77 }
78
79 pub fn wait_for_event(
82 &self,
83 deadline: zx::MonotonicInstant,
84 ) -> Result<Server_Event, fidl::Error> {
85 Server_Event::decode(self.client.wait_for_event(deadline)?)
86 }
87
88 pub fn r#mount_vmo(
102 &self,
103 mut source: fidl::Vmo,
104 mut root: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
105 ___deadline: zx::MonotonicInstant,
106 ) -> Result<MountVmoResult, fidl::Error> {
107 let _response = self.client.send_query::<ServerMountVmoRequest, ServerMountVmoResponse>(
108 (source, root),
109 0x191360124db7f6a6,
110 fidl::encoding::DynamicFlags::empty(),
111 ___deadline,
112 )?;
113 Ok(_response.result)
114 }
115}
116
117#[derive(Debug, Clone)]
118pub struct Server_Proxy {
119 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
120}
121
122impl fidl::endpoints::Proxy for Server_Proxy {
123 type Protocol = Server_Marker;
124
125 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
126 Self::new(inner)
127 }
128
129 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
130 self.client.into_channel().map_err(|client| Self { client })
131 }
132
133 fn as_channel(&self) -> &::fidl::AsyncChannel {
134 self.client.as_channel()
135 }
136}
137
138impl Server_Proxy {
139 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
141 let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
142 Self { client: fidl::client::Client::new(channel, protocol_name) }
143 }
144
145 pub fn take_event_stream(&self) -> Server_EventStream {
151 Server_EventStream { event_receiver: self.client.take_event_receiver() }
152 }
153
154 pub fn r#mount_vmo(
168 &self,
169 mut source: fidl::Vmo,
170 mut root: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
171 ) -> fidl::client::QueryResponseFut<MountVmoResult, fidl::encoding::DefaultFuchsiaResourceDialect>
172 {
173 Server_ProxyInterface::r#mount_vmo(self, source, root)
174 }
175}
176
177impl Server_ProxyInterface for Server_Proxy {
178 type MountVmoResponseFut = fidl::client::QueryResponseFut<
179 MountVmoResult,
180 fidl::encoding::DefaultFuchsiaResourceDialect,
181 >;
182 fn r#mount_vmo(
183 &self,
184 mut source: fidl::Vmo,
185 mut root: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
186 ) -> Self::MountVmoResponseFut {
187 fn _decode(
188 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
189 ) -> Result<MountVmoResult, fidl::Error> {
190 let _response = fidl::client::decode_transaction_body::<
191 ServerMountVmoResponse,
192 fidl::encoding::DefaultFuchsiaResourceDialect,
193 0x191360124db7f6a6,
194 >(_buf?)?;
195 Ok(_response.result)
196 }
197 self.client.send_query_and_decode::<ServerMountVmoRequest, MountVmoResult>(
198 (source, root),
199 0x191360124db7f6a6,
200 fidl::encoding::DynamicFlags::empty(),
201 _decode,
202 )
203 }
204}
205
206pub struct Server_EventStream {
207 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
208}
209
210impl std::marker::Unpin for Server_EventStream {}
211
212impl futures::stream::FusedStream for Server_EventStream {
213 fn is_terminated(&self) -> bool {
214 self.event_receiver.is_terminated()
215 }
216}
217
218impl futures::Stream for Server_EventStream {
219 type Item = Result<Server_Event, fidl::Error>;
220
221 fn poll_next(
222 mut self: std::pin::Pin<&mut Self>,
223 cx: &mut std::task::Context<'_>,
224 ) -> std::task::Poll<Option<Self::Item>> {
225 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
226 &mut self.event_receiver,
227 cx
228 )?) {
229 Some(buf) => std::task::Poll::Ready(Some(Server_Event::decode(buf))),
230 None => std::task::Poll::Ready(None),
231 }
232 }
233}
234
235#[derive(Debug)]
236pub enum Server_Event {}
237
238impl Server_Event {
239 fn decode(
241 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
242 ) -> Result<Server_Event, fidl::Error> {
243 let (bytes, _handles) = buf.split_mut();
244 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
245 debug_assert_eq!(tx_header.tx_id, 0);
246 match tx_header.ordinal {
247 _ => Err(fidl::Error::UnknownOrdinal {
248 ordinal: tx_header.ordinal,
249 protocol_name: <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
250 }),
251 }
252 }
253}
254
255pub struct Server_RequestStream {
257 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
258 is_terminated: bool,
259}
260
261impl std::marker::Unpin for Server_RequestStream {}
262
263impl futures::stream::FusedStream for Server_RequestStream {
264 fn is_terminated(&self) -> bool {
265 self.is_terminated
266 }
267}
268
269impl fidl::endpoints::RequestStream for Server_RequestStream {
270 type Protocol = Server_Marker;
271 type ControlHandle = Server_ControlHandle;
272
273 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
274 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
275 }
276
277 fn control_handle(&self) -> Self::ControlHandle {
278 Server_ControlHandle { inner: self.inner.clone() }
279 }
280
281 fn into_inner(
282 self,
283 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
284 {
285 (self.inner, self.is_terminated)
286 }
287
288 fn from_inner(
289 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
290 is_terminated: bool,
291 ) -> Self {
292 Self { inner, is_terminated }
293 }
294}
295
296impl futures::Stream for Server_RequestStream {
297 type Item = Result<Server_Request, fidl::Error>;
298
299 fn poll_next(
300 mut self: std::pin::Pin<&mut Self>,
301 cx: &mut std::task::Context<'_>,
302 ) -> std::task::Poll<Option<Self::Item>> {
303 let this = &mut *self;
304 if this.inner.check_shutdown(cx) {
305 this.is_terminated = true;
306 return std::task::Poll::Ready(None);
307 }
308 if this.is_terminated {
309 panic!("polled Server_RequestStream after completion");
310 }
311 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
312 |bytes, handles| {
313 match this.inner.channel().read_etc(cx, bytes, handles) {
314 std::task::Poll::Ready(Ok(())) => {}
315 std::task::Poll::Pending => return std::task::Poll::Pending,
316 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
317 this.is_terminated = true;
318 return std::task::Poll::Ready(None);
319 }
320 std::task::Poll::Ready(Err(e)) => {
321 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
322 e.into(),
323 ))))
324 }
325 }
326
327 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
329
330 std::task::Poll::Ready(Some(match header.ordinal {
331 0x191360124db7f6a6 => {
332 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
333 let mut req = fidl::new_empty!(
334 ServerMountVmoRequest,
335 fidl::encoding::DefaultFuchsiaResourceDialect
336 );
337 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerMountVmoRequest>(&header, _body_bytes, handles, &mut req)?;
338 let control_handle = Server_ControlHandle { inner: this.inner.clone() };
339 Ok(Server_Request::MountVmo {
340 source: req.source,
341 root: req.root,
342
343 responder: Server_MountVmoResponder {
344 control_handle: std::mem::ManuallyDrop::new(control_handle),
345 tx_id: header.tx_id,
346 },
347 })
348 }
349 _ => Err(fidl::Error::UnknownOrdinal {
350 ordinal: header.ordinal,
351 protocol_name:
352 <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
353 }),
354 }))
355 },
356 )
357 }
358}
359
360#[derive(Debug)]
361pub enum Server_Request {
362 MountVmo {
376 source: fidl::Vmo,
377 root: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
378 responder: Server_MountVmoResponder,
379 },
380}
381
382impl Server_Request {
383 #[allow(irrefutable_let_patterns)]
384 pub fn into_mount_vmo(
385 self,
386 ) -> Option<(
387 fidl::Vmo,
388 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
389 Server_MountVmoResponder,
390 )> {
391 if let Server_Request::MountVmo { source, root, responder } = self {
392 Some((source, root, responder))
393 } else {
394 None
395 }
396 }
397
398 pub fn method_name(&self) -> &'static str {
400 match *self {
401 Server_Request::MountVmo { .. } => "mount_vmo",
402 }
403 }
404}
405
406#[derive(Debug, Clone)]
407pub struct Server_ControlHandle {
408 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
409}
410
411impl fidl::endpoints::ControlHandle for Server_ControlHandle {
412 fn shutdown(&self) {
413 self.inner.shutdown()
414 }
415 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
416 self.inner.shutdown_with_epitaph(status)
417 }
418
419 fn is_closed(&self) -> bool {
420 self.inner.channel().is_closed()
421 }
422 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
423 self.inner.channel().on_closed()
424 }
425
426 #[cfg(target_os = "fuchsia")]
427 fn signal_peer(
428 &self,
429 clear_mask: zx::Signals,
430 set_mask: zx::Signals,
431 ) -> Result<(), zx_status::Status> {
432 use fidl::Peered;
433 self.inner.channel().signal_peer(clear_mask, set_mask)
434 }
435}
436
437impl Server_ControlHandle {}
438
439#[must_use = "FIDL methods require a response to be sent"]
440#[derive(Debug)]
441pub struct Server_MountVmoResponder {
442 control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
443 tx_id: u32,
444}
445
446impl std::ops::Drop for Server_MountVmoResponder {
450 fn drop(&mut self) {
451 self.control_handle.shutdown();
452 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
454 }
455}
456
457impl fidl::endpoints::Responder for Server_MountVmoResponder {
458 type ControlHandle = Server_ControlHandle;
459
460 fn control_handle(&self) -> &Server_ControlHandle {
461 &self.control_handle
462 }
463
464 fn drop_without_shutdown(mut self) {
465 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
467 std::mem::forget(self);
469 }
470}
471
472impl Server_MountVmoResponder {
473 pub fn send(self, mut result: &MountVmoResult) -> Result<(), fidl::Error> {
477 let _result = self.send_raw(result);
478 if _result.is_err() {
479 self.control_handle.shutdown();
480 }
481 self.drop_without_shutdown();
482 _result
483 }
484
485 pub fn send_no_shutdown_on_err(self, mut result: &MountVmoResult) -> Result<(), fidl::Error> {
487 let _result = self.send_raw(result);
488 self.drop_without_shutdown();
489 _result
490 }
491
492 fn send_raw(&self, mut result: &MountVmoResult) -> Result<(), fidl::Error> {
493 self.control_handle.inner.send::<ServerMountVmoResponse>(
494 (result,),
495 self.tx_id,
496 0x191360124db7f6a6,
497 fidl::encoding::DynamicFlags::empty(),
498 )
499 }
500}
501
502#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
503pub struct ServiceMarker;
504
505#[cfg(target_os = "fuchsia")]
506impl fidl::endpoints::ServiceMarker for ServiceMarker {
507 type Proxy = ServiceProxy;
508 type Request = ServiceRequest;
509 const SERVICE_NAME: &'static str = "fuchsia.storage.ext4.Service";
510}
511
512#[cfg(target_os = "fuchsia")]
515pub enum ServiceRequest {
516 Server(Server_RequestStream),
519}
520
521#[cfg(target_os = "fuchsia")]
522impl fidl::endpoints::ServiceRequest for ServiceRequest {
523 type Service = ServiceMarker;
524
525 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
526 match name {
527 "server" => Self::Server(
528 <Server_RequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
529 ),
530 _ => panic!("no such member protocol name for service Service"),
531 }
532 }
533
534 fn member_names() -> &'static [&'static str] {
535 &["server"]
536 }
537}
538#[cfg(target_os = "fuchsia")]
539pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
540
541#[cfg(target_os = "fuchsia")]
542impl fidl::endpoints::ServiceProxy for ServiceProxy {
543 type Service = ServiceMarker;
544
545 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
546 Self(opener)
547 }
548}
549
550#[cfg(target_os = "fuchsia")]
551impl ServiceProxy {
552 pub fn connect_to_server(&self) -> Result<Server_Proxy, fidl::Error> {
555 let (proxy, server_end) = fidl::endpoints::create_proxy::<Server_Marker>();
556 self.connect_channel_to_server(server_end)?;
557 Ok(proxy)
558 }
559
560 pub fn connect_to_server_sync(&self) -> Result<Server_SynchronousProxy, fidl::Error> {
563 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<Server_Marker>();
564 self.connect_channel_to_server(server_end)?;
565 Ok(proxy)
566 }
567
568 pub fn connect_channel_to_server(
571 &self,
572 server_end: fidl::endpoints::ServerEnd<Server_Marker>,
573 ) -> Result<(), fidl::Error> {
574 self.0.open_member("server", server_end.into_channel())
575 }
576
577 pub fn instance_name(&self) -> &str {
578 self.0.instance_name()
579 }
580}
581
582mod internal {
583 use super::*;
584
585 impl fidl::encoding::ResourceTypeMarker for ServerMountVmoRequest {
586 type Borrowed<'a> = &'a mut Self;
587 fn take_or_borrow<'a>(
588 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
589 ) -> Self::Borrowed<'a> {
590 value
591 }
592 }
593
594 unsafe impl fidl::encoding::TypeMarker for ServerMountVmoRequest {
595 type Owned = Self;
596
597 #[inline(always)]
598 fn inline_align(_context: fidl::encoding::Context) -> usize {
599 4
600 }
601
602 #[inline(always)]
603 fn inline_size(_context: fidl::encoding::Context) -> usize {
604 8
605 }
606 }
607
608 unsafe impl
609 fidl::encoding::Encode<ServerMountVmoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
610 for &mut ServerMountVmoRequest
611 {
612 #[inline]
613 unsafe fn encode(
614 self,
615 encoder: &mut fidl::encoding::Encoder<
616 '_,
617 fidl::encoding::DefaultFuchsiaResourceDialect,
618 >,
619 offset: usize,
620 _depth: fidl::encoding::Depth,
621 ) -> fidl::Result<()> {
622 encoder.debug_check_bounds::<ServerMountVmoRequest>(offset);
623 fidl::encoding::Encode::<
625 ServerMountVmoRequest,
626 fidl::encoding::DefaultFuchsiaResourceDialect,
627 >::encode(
628 (
629 <fidl::encoding::HandleType<
630 fidl::Vmo,
631 { fidl::ObjectType::VMO.into_raw() },
632 2147483648,
633 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
634 &mut self.source
635 ),
636 <fidl::encoding::Endpoint<
637 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
638 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
639 &mut self.root
640 ),
641 ),
642 encoder,
643 offset,
644 _depth,
645 )
646 }
647 }
648 unsafe impl<
649 T0: fidl::encoding::Encode<
650 fidl::encoding::HandleType<
651 fidl::Vmo,
652 { fidl::ObjectType::VMO.into_raw() },
653 2147483648,
654 >,
655 fidl::encoding::DefaultFuchsiaResourceDialect,
656 >,
657 T1: fidl::encoding::Encode<
658 fidl::encoding::Endpoint<
659 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
660 >,
661 fidl::encoding::DefaultFuchsiaResourceDialect,
662 >,
663 >
664 fidl::encoding::Encode<ServerMountVmoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
665 for (T0, T1)
666 {
667 #[inline]
668 unsafe fn encode(
669 self,
670 encoder: &mut fidl::encoding::Encoder<
671 '_,
672 fidl::encoding::DefaultFuchsiaResourceDialect,
673 >,
674 offset: usize,
675 depth: fidl::encoding::Depth,
676 ) -> fidl::Result<()> {
677 encoder.debug_check_bounds::<ServerMountVmoRequest>(offset);
678 self.0.encode(encoder, offset + 0, depth)?;
682 self.1.encode(encoder, offset + 4, depth)?;
683 Ok(())
684 }
685 }
686
687 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
688 for ServerMountVmoRequest
689 {
690 #[inline(always)]
691 fn new_empty() -> Self {
692 Self {
693 source: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
694 root: fidl::new_empty!(
695 fidl::encoding::Endpoint<
696 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
697 >,
698 fidl::encoding::DefaultFuchsiaResourceDialect
699 ),
700 }
701 }
702
703 #[inline]
704 unsafe fn decode(
705 &mut self,
706 decoder: &mut fidl::encoding::Decoder<
707 '_,
708 fidl::encoding::DefaultFuchsiaResourceDialect,
709 >,
710 offset: usize,
711 _depth: fidl::encoding::Depth,
712 ) -> fidl::Result<()> {
713 decoder.debug_check_bounds::<Self>(offset);
714 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.source, decoder, offset + 0, _depth)?;
716 fidl::decode!(
717 fidl::encoding::Endpoint<
718 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
719 >,
720 fidl::encoding::DefaultFuchsiaResourceDialect,
721 &mut self.root,
722 decoder,
723 offset + 4,
724 _depth
725 )?;
726 Ok(())
727 }
728 }
729}