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_fvm__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ResetMarker;
16
17impl fidl::endpoints::ProtocolMarker for ResetMarker {
18 type Proxy = ResetProxy;
19 type RequestStream = ResetRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = ResetSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.fvm.Reset";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for ResetMarker {}
26pub type ResetShredEncryptedVolumesResult = Result<(), i32>;
27
28pub trait ResetProxyInterface: Send + Sync {
29 type ShredEncryptedVolumesResponseFut: std::future::Future<Output = Result<ResetShredEncryptedVolumesResult, fidl::Error>>
30 + Send;
31 fn r#shred_encrypted_volumes(&self) -> Self::ShredEncryptedVolumesResponseFut;
32}
33#[derive(Debug)]
34#[cfg(target_os = "fuchsia")]
35pub struct ResetSynchronousProxy {
36 client: fidl::client::sync::Client,
37}
38
39#[cfg(target_os = "fuchsia")]
40impl fidl::endpoints::SynchronousProxy for ResetSynchronousProxy {
41 type Proxy = ResetProxy;
42 type Protocol = ResetMarker;
43
44 fn from_channel(inner: fidl::Channel) -> Self {
45 Self::new(inner)
46 }
47
48 fn into_channel(self) -> fidl::Channel {
49 self.client.into_channel()
50 }
51
52 fn as_channel(&self) -> &fidl::Channel {
53 self.client.as_channel()
54 }
55}
56
57#[cfg(target_os = "fuchsia")]
58impl ResetSynchronousProxy {
59 pub fn new(channel: fidl::Channel) -> Self {
60 let protocol_name = <ResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
61 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
62 }
63
64 pub fn into_channel(self) -> fidl::Channel {
65 self.client.into_channel()
66 }
67
68 pub fn wait_for_event(
71 &self,
72 deadline: zx::MonotonicInstant,
73 ) -> Result<ResetEvent, fidl::Error> {
74 ResetEvent::decode(self.client.wait_for_event(deadline)?)
75 }
76
77 pub fn r#shred_encrypted_volumes(
84 &self,
85 ___deadline: zx::MonotonicInstant,
86 ) -> Result<ResetShredEncryptedVolumesResult, fidl::Error> {
87 let _response = self.client.send_query::<
88 fidl::encoding::EmptyPayload,
89 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
90 >(
91 (),
92 0x3b29035e93ea529c,
93 fidl::encoding::DynamicFlags::empty(),
94 ___deadline,
95 )?;
96 Ok(_response.map(|x| x))
97 }
98}
99
100#[cfg(target_os = "fuchsia")]
101impl From<ResetSynchronousProxy> for zx::Handle {
102 fn from(value: ResetSynchronousProxy) -> Self {
103 value.into_channel().into()
104 }
105}
106
107#[cfg(target_os = "fuchsia")]
108impl From<fidl::Channel> for ResetSynchronousProxy {
109 fn from(value: fidl::Channel) -> Self {
110 Self::new(value)
111 }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl fidl::endpoints::FromClient for ResetSynchronousProxy {
116 type Protocol = ResetMarker;
117
118 fn from_client(value: fidl::endpoints::ClientEnd<ResetMarker>) -> Self {
119 Self::new(value.into_channel())
120 }
121}
122
123#[derive(Debug, Clone)]
124pub struct ResetProxy {
125 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
126}
127
128impl fidl::endpoints::Proxy for ResetProxy {
129 type Protocol = ResetMarker;
130
131 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
132 Self::new(inner)
133 }
134
135 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
136 self.client.into_channel().map_err(|client| Self { client })
137 }
138
139 fn as_channel(&self) -> &::fidl::AsyncChannel {
140 self.client.as_channel()
141 }
142}
143
144impl ResetProxy {
145 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
147 let protocol_name = <ResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
148 Self { client: fidl::client::Client::new(channel, protocol_name) }
149 }
150
151 pub fn take_event_stream(&self) -> ResetEventStream {
157 ResetEventStream { event_receiver: self.client.take_event_receiver() }
158 }
159
160 pub fn r#shred_encrypted_volumes(
167 &self,
168 ) -> fidl::client::QueryResponseFut<
169 ResetShredEncryptedVolumesResult,
170 fidl::encoding::DefaultFuchsiaResourceDialect,
171 > {
172 ResetProxyInterface::r#shred_encrypted_volumes(self)
173 }
174}
175
176impl ResetProxyInterface for ResetProxy {
177 type ShredEncryptedVolumesResponseFut = fidl::client::QueryResponseFut<
178 ResetShredEncryptedVolumesResult,
179 fidl::encoding::DefaultFuchsiaResourceDialect,
180 >;
181 fn r#shred_encrypted_volumes(&self) -> Self::ShredEncryptedVolumesResponseFut {
182 fn _decode(
183 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
184 ) -> Result<ResetShredEncryptedVolumesResult, fidl::Error> {
185 let _response = fidl::client::decode_transaction_body::<
186 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
187 fidl::encoding::DefaultFuchsiaResourceDialect,
188 0x3b29035e93ea529c,
189 >(_buf?)?;
190 Ok(_response.map(|x| x))
191 }
192 self.client.send_query_and_decode::<
193 fidl::encoding::EmptyPayload,
194 ResetShredEncryptedVolumesResult,
195 >(
196 (),
197 0x3b29035e93ea529c,
198 fidl::encoding::DynamicFlags::empty(),
199 _decode,
200 )
201 }
202}
203
204pub struct ResetEventStream {
205 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
206}
207
208impl std::marker::Unpin for ResetEventStream {}
209
210impl futures::stream::FusedStream for ResetEventStream {
211 fn is_terminated(&self) -> bool {
212 self.event_receiver.is_terminated()
213 }
214}
215
216impl futures::Stream for ResetEventStream {
217 type Item = Result<ResetEvent, fidl::Error>;
218
219 fn poll_next(
220 mut self: std::pin::Pin<&mut Self>,
221 cx: &mut std::task::Context<'_>,
222 ) -> std::task::Poll<Option<Self::Item>> {
223 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
224 &mut self.event_receiver,
225 cx
226 )?) {
227 Some(buf) => std::task::Poll::Ready(Some(ResetEvent::decode(buf))),
228 None => std::task::Poll::Ready(None),
229 }
230 }
231}
232
233#[derive(Debug)]
234pub enum ResetEvent {}
235
236impl ResetEvent {
237 fn decode(
239 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
240 ) -> Result<ResetEvent, fidl::Error> {
241 let (bytes, _handles) = buf.split_mut();
242 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
243 debug_assert_eq!(tx_header.tx_id, 0);
244 match tx_header.ordinal {
245 _ => Err(fidl::Error::UnknownOrdinal {
246 ordinal: tx_header.ordinal,
247 protocol_name: <ResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
248 }),
249 }
250 }
251}
252
253pub struct ResetRequestStream {
255 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
256 is_terminated: bool,
257}
258
259impl std::marker::Unpin for ResetRequestStream {}
260
261impl futures::stream::FusedStream for ResetRequestStream {
262 fn is_terminated(&self) -> bool {
263 self.is_terminated
264 }
265}
266
267impl fidl::endpoints::RequestStream for ResetRequestStream {
268 type Protocol = ResetMarker;
269 type ControlHandle = ResetControlHandle;
270
271 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
272 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
273 }
274
275 fn control_handle(&self) -> Self::ControlHandle {
276 ResetControlHandle { inner: self.inner.clone() }
277 }
278
279 fn into_inner(
280 self,
281 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
282 {
283 (self.inner, self.is_terminated)
284 }
285
286 fn from_inner(
287 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
288 is_terminated: bool,
289 ) -> Self {
290 Self { inner, is_terminated }
291 }
292}
293
294impl futures::Stream for ResetRequestStream {
295 type Item = Result<ResetRequest, fidl::Error>;
296
297 fn poll_next(
298 mut self: std::pin::Pin<&mut Self>,
299 cx: &mut std::task::Context<'_>,
300 ) -> std::task::Poll<Option<Self::Item>> {
301 let this = &mut *self;
302 if this.inner.check_shutdown(cx) {
303 this.is_terminated = true;
304 return std::task::Poll::Ready(None);
305 }
306 if this.is_terminated {
307 panic!("polled ResetRequestStream after completion");
308 }
309 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
310 |bytes, handles| {
311 match this.inner.channel().read_etc(cx, bytes, handles) {
312 std::task::Poll::Ready(Ok(())) => {}
313 std::task::Poll::Pending => return std::task::Poll::Pending,
314 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
315 this.is_terminated = true;
316 return std::task::Poll::Ready(None);
317 }
318 std::task::Poll::Ready(Err(e)) => {
319 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
320 e.into(),
321 ))))
322 }
323 }
324
325 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
327
328 std::task::Poll::Ready(Some(match header.ordinal {
329 0x3b29035e93ea529c => {
330 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
331 let mut req = fidl::new_empty!(
332 fidl::encoding::EmptyPayload,
333 fidl::encoding::DefaultFuchsiaResourceDialect
334 );
335 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
336 let control_handle = ResetControlHandle { inner: this.inner.clone() };
337 Ok(ResetRequest::ShredEncryptedVolumes {
338 responder: ResetShredEncryptedVolumesResponder {
339 control_handle: std::mem::ManuallyDrop::new(control_handle),
340 tx_id: header.tx_id,
341 },
342 })
343 }
344 _ => Err(fidl::Error::UnknownOrdinal {
345 ordinal: header.ordinal,
346 protocol_name: <ResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
347 }),
348 }))
349 },
350 )
351 }
352}
353
354#[derive(Debug)]
356pub enum ResetRequest {
357 ShredEncryptedVolumes { responder: ResetShredEncryptedVolumesResponder },
364}
365
366impl ResetRequest {
367 #[allow(irrefutable_let_patterns)]
368 pub fn into_shred_encrypted_volumes(self) -> Option<(ResetShredEncryptedVolumesResponder)> {
369 if let ResetRequest::ShredEncryptedVolumes { responder } = self {
370 Some((responder))
371 } else {
372 None
373 }
374 }
375
376 pub fn method_name(&self) -> &'static str {
378 match *self {
379 ResetRequest::ShredEncryptedVolumes { .. } => "shred_encrypted_volumes",
380 }
381 }
382}
383
384#[derive(Debug, Clone)]
385pub struct ResetControlHandle {
386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
387}
388
389impl fidl::endpoints::ControlHandle for ResetControlHandle {
390 fn shutdown(&self) {
391 self.inner.shutdown()
392 }
393 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
394 self.inner.shutdown_with_epitaph(status)
395 }
396
397 fn is_closed(&self) -> bool {
398 self.inner.channel().is_closed()
399 }
400 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
401 self.inner.channel().on_closed()
402 }
403
404 #[cfg(target_os = "fuchsia")]
405 fn signal_peer(
406 &self,
407 clear_mask: zx::Signals,
408 set_mask: zx::Signals,
409 ) -> Result<(), zx_status::Status> {
410 use fidl::Peered;
411 self.inner.channel().signal_peer(clear_mask, set_mask)
412 }
413}
414
415impl ResetControlHandle {}
416
417#[must_use = "FIDL methods require a response to be sent"]
418#[derive(Debug)]
419pub struct ResetShredEncryptedVolumesResponder {
420 control_handle: std::mem::ManuallyDrop<ResetControlHandle>,
421 tx_id: u32,
422}
423
424impl std::ops::Drop for ResetShredEncryptedVolumesResponder {
428 fn drop(&mut self) {
429 self.control_handle.shutdown();
430 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
432 }
433}
434
435impl fidl::endpoints::Responder for ResetShredEncryptedVolumesResponder {
436 type ControlHandle = ResetControlHandle;
437
438 fn control_handle(&self) -> &ResetControlHandle {
439 &self.control_handle
440 }
441
442 fn drop_without_shutdown(mut self) {
443 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
445 std::mem::forget(self);
447 }
448}
449
450impl ResetShredEncryptedVolumesResponder {
451 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
455 let _result = self.send_raw(result);
456 if _result.is_err() {
457 self.control_handle.shutdown();
458 }
459 self.drop_without_shutdown();
460 _result
461 }
462
463 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
465 let _result = self.send_raw(result);
466 self.drop_without_shutdown();
467 _result
468 }
469
470 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
471 self.control_handle
472 .inner
473 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
474 result,
475 self.tx_id,
476 0x3b29035e93ea529c,
477 fidl::encoding::DynamicFlags::empty(),
478 )
479 }
480}
481
482mod internal {
483 use super::*;
484}