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_inspect_deprecated__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct InspectOpenChildRequest {
16 pub child_name: String,
17 pub child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InspectOpenChildRequest {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct InspectMarker;
24
25impl fidl::endpoints::ProtocolMarker for InspectMarker {
26 type Proxy = InspectProxy;
27 type RequestStream = InspectRequestStream;
28 #[cfg(target_os = "fuchsia")]
29 type SynchronousProxy = InspectSynchronousProxy;
30
31 const DEBUG_NAME: &'static str = "fuchsia.inspect.deprecated.Inspect";
32}
33impl fidl::endpoints::DiscoverableProtocolMarker for InspectMarker {}
34
35pub trait InspectProxyInterface: Send + Sync {
36 type ReadDataResponseFut: std::future::Future<Output = Result<Object, fidl::Error>> + Send;
37 fn r#read_data(&self) -> Self::ReadDataResponseFut;
38 type ListChildrenResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
39 + Send;
40 fn r#list_children(&self) -> Self::ListChildrenResponseFut;
41 type OpenChildResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
42 fn r#open_child(
43 &self,
44 child_name: &str,
45 child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
46 ) -> Self::OpenChildResponseFut;
47}
48#[derive(Debug)]
49#[cfg(target_os = "fuchsia")]
50pub struct InspectSynchronousProxy {
51 client: fidl::client::sync::Client,
52}
53
54#[cfg(target_os = "fuchsia")]
55impl fidl::endpoints::SynchronousProxy for InspectSynchronousProxy {
56 type Proxy = InspectProxy;
57 type Protocol = InspectMarker;
58
59 fn from_channel(inner: fidl::Channel) -> Self {
60 Self::new(inner)
61 }
62
63 fn into_channel(self) -> fidl::Channel {
64 self.client.into_channel()
65 }
66
67 fn as_channel(&self) -> &fidl::Channel {
68 self.client.as_channel()
69 }
70}
71
72#[cfg(target_os = "fuchsia")]
73impl InspectSynchronousProxy {
74 pub fn new(channel: fidl::Channel) -> Self {
75 let protocol_name = <InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
76 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
77 }
78
79 pub fn into_channel(self) -> fidl::Channel {
80 self.client.into_channel()
81 }
82
83 pub fn wait_for_event(
86 &self,
87 deadline: zx::MonotonicInstant,
88 ) -> Result<InspectEvent, fidl::Error> {
89 InspectEvent::decode(self.client.wait_for_event(deadline)?)
90 }
91
92 pub fn r#read_data(&self, ___deadline: zx::MonotonicInstant) -> Result<Object, fidl::Error> {
93 let _response =
94 self.client.send_query::<fidl::encoding::EmptyPayload, InspectReadDataResponse>(
95 (),
96 0x1c6778e57fcfa9e1,
97 fidl::encoding::DynamicFlags::empty(),
98 ___deadline,
99 )?;
100 Ok(_response.object)
101 }
102
103 pub fn r#list_children(
104 &self,
105 ___deadline: zx::MonotonicInstant,
106 ) -> Result<Vec<String>, fidl::Error> {
107 let _response =
108 self.client.send_query::<fidl::encoding::EmptyPayload, InspectListChildrenResponse>(
109 (),
110 0x463fdc024dc40611,
111 fidl::encoding::DynamicFlags::empty(),
112 ___deadline,
113 )?;
114 Ok(_response.children_names)
115 }
116
117 pub fn r#open_child(
118 &self,
119 mut child_name: &str,
120 mut child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
121 ___deadline: zx::MonotonicInstant,
122 ) -> Result<bool, fidl::Error> {
123 let _response =
124 self.client.send_query::<InspectOpenChildRequest, InspectOpenChildResponse>(
125 (child_name, child_channel),
126 0x30513125b65c866a,
127 fidl::encoding::DynamicFlags::empty(),
128 ___deadline,
129 )?;
130 Ok(_response.success)
131 }
132}
133
134#[cfg(target_os = "fuchsia")]
135impl From<InspectSynchronousProxy> for zx::Handle {
136 fn from(value: InspectSynchronousProxy) -> Self {
137 value.into_channel().into()
138 }
139}
140
141#[cfg(target_os = "fuchsia")]
142impl From<fidl::Channel> for InspectSynchronousProxy {
143 fn from(value: fidl::Channel) -> Self {
144 Self::new(value)
145 }
146}
147
148#[cfg(target_os = "fuchsia")]
149impl fidl::endpoints::FromClient for InspectSynchronousProxy {
150 type Protocol = InspectMarker;
151
152 fn from_client(value: fidl::endpoints::ClientEnd<InspectMarker>) -> Self {
153 Self::new(value.into_channel())
154 }
155}
156
157#[derive(Debug, Clone)]
158pub struct InspectProxy {
159 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
160}
161
162impl fidl::endpoints::Proxy for InspectProxy {
163 type Protocol = InspectMarker;
164
165 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
166 Self::new(inner)
167 }
168
169 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
170 self.client.into_channel().map_err(|client| Self { client })
171 }
172
173 fn as_channel(&self) -> &::fidl::AsyncChannel {
174 self.client.as_channel()
175 }
176}
177
178impl InspectProxy {
179 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
181 let protocol_name = <InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
182 Self { client: fidl::client::Client::new(channel, protocol_name) }
183 }
184
185 pub fn take_event_stream(&self) -> InspectEventStream {
191 InspectEventStream { event_receiver: self.client.take_event_receiver() }
192 }
193
194 pub fn r#read_data(
195 &self,
196 ) -> fidl::client::QueryResponseFut<Object, fidl::encoding::DefaultFuchsiaResourceDialect> {
197 InspectProxyInterface::r#read_data(self)
198 }
199
200 pub fn r#list_children(
201 &self,
202 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
203 {
204 InspectProxyInterface::r#list_children(self)
205 }
206
207 pub fn r#open_child(
208 &self,
209 mut child_name: &str,
210 mut child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
211 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
212 InspectProxyInterface::r#open_child(self, child_name, child_channel)
213 }
214}
215
216impl InspectProxyInterface for InspectProxy {
217 type ReadDataResponseFut =
218 fidl::client::QueryResponseFut<Object, fidl::encoding::DefaultFuchsiaResourceDialect>;
219 fn r#read_data(&self) -> Self::ReadDataResponseFut {
220 fn _decode(
221 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
222 ) -> Result<Object, fidl::Error> {
223 let _response = fidl::client::decode_transaction_body::<
224 InspectReadDataResponse,
225 fidl::encoding::DefaultFuchsiaResourceDialect,
226 0x1c6778e57fcfa9e1,
227 >(_buf?)?;
228 Ok(_response.object)
229 }
230 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Object>(
231 (),
232 0x1c6778e57fcfa9e1,
233 fidl::encoding::DynamicFlags::empty(),
234 _decode,
235 )
236 }
237
238 type ListChildrenResponseFut =
239 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
240 fn r#list_children(&self) -> Self::ListChildrenResponseFut {
241 fn _decode(
242 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
243 ) -> Result<Vec<String>, fidl::Error> {
244 let _response = fidl::client::decode_transaction_body::<
245 InspectListChildrenResponse,
246 fidl::encoding::DefaultFuchsiaResourceDialect,
247 0x463fdc024dc40611,
248 >(_buf?)?;
249 Ok(_response.children_names)
250 }
251 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
252 (),
253 0x463fdc024dc40611,
254 fidl::encoding::DynamicFlags::empty(),
255 _decode,
256 )
257 }
258
259 type OpenChildResponseFut =
260 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
261 fn r#open_child(
262 &self,
263 mut child_name: &str,
264 mut child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
265 ) -> Self::OpenChildResponseFut {
266 fn _decode(
267 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
268 ) -> Result<bool, fidl::Error> {
269 let _response = fidl::client::decode_transaction_body::<
270 InspectOpenChildResponse,
271 fidl::encoding::DefaultFuchsiaResourceDialect,
272 0x30513125b65c866a,
273 >(_buf?)?;
274 Ok(_response.success)
275 }
276 self.client.send_query_and_decode::<InspectOpenChildRequest, bool>(
277 (child_name, child_channel),
278 0x30513125b65c866a,
279 fidl::encoding::DynamicFlags::empty(),
280 _decode,
281 )
282 }
283}
284
285pub struct InspectEventStream {
286 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
287}
288
289impl std::marker::Unpin for InspectEventStream {}
290
291impl futures::stream::FusedStream for InspectEventStream {
292 fn is_terminated(&self) -> bool {
293 self.event_receiver.is_terminated()
294 }
295}
296
297impl futures::Stream for InspectEventStream {
298 type Item = Result<InspectEvent, fidl::Error>;
299
300 fn poll_next(
301 mut self: std::pin::Pin<&mut Self>,
302 cx: &mut std::task::Context<'_>,
303 ) -> std::task::Poll<Option<Self::Item>> {
304 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
305 &mut self.event_receiver,
306 cx
307 )?) {
308 Some(buf) => std::task::Poll::Ready(Some(InspectEvent::decode(buf))),
309 None => std::task::Poll::Ready(None),
310 }
311 }
312}
313
314#[derive(Debug)]
315pub enum InspectEvent {}
316
317impl InspectEvent {
318 fn decode(
320 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
321 ) -> Result<InspectEvent, fidl::Error> {
322 let (bytes, _handles) = buf.split_mut();
323 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
324 debug_assert_eq!(tx_header.tx_id, 0);
325 match tx_header.ordinal {
326 _ => Err(fidl::Error::UnknownOrdinal {
327 ordinal: tx_header.ordinal,
328 protocol_name: <InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
329 }),
330 }
331 }
332}
333
334pub struct InspectRequestStream {
336 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
337 is_terminated: bool,
338}
339
340impl std::marker::Unpin for InspectRequestStream {}
341
342impl futures::stream::FusedStream for InspectRequestStream {
343 fn is_terminated(&self) -> bool {
344 self.is_terminated
345 }
346}
347
348impl fidl::endpoints::RequestStream for InspectRequestStream {
349 type Protocol = InspectMarker;
350 type ControlHandle = InspectControlHandle;
351
352 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
353 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
354 }
355
356 fn control_handle(&self) -> Self::ControlHandle {
357 InspectControlHandle { inner: self.inner.clone() }
358 }
359
360 fn into_inner(
361 self,
362 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
363 {
364 (self.inner, self.is_terminated)
365 }
366
367 fn from_inner(
368 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
369 is_terminated: bool,
370 ) -> Self {
371 Self { inner, is_terminated }
372 }
373}
374
375impl futures::Stream for InspectRequestStream {
376 type Item = Result<InspectRequest, fidl::Error>;
377
378 fn poll_next(
379 mut self: std::pin::Pin<&mut Self>,
380 cx: &mut std::task::Context<'_>,
381 ) -> std::task::Poll<Option<Self::Item>> {
382 let this = &mut *self;
383 if this.inner.check_shutdown(cx) {
384 this.is_terminated = true;
385 return std::task::Poll::Ready(None);
386 }
387 if this.is_terminated {
388 panic!("polled InspectRequestStream after completion");
389 }
390 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
391 |bytes, handles| {
392 match this.inner.channel().read_etc(cx, bytes, handles) {
393 std::task::Poll::Ready(Ok(())) => {}
394 std::task::Poll::Pending => return std::task::Poll::Pending,
395 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
396 this.is_terminated = true;
397 return std::task::Poll::Ready(None);
398 }
399 std::task::Poll::Ready(Err(e)) => {
400 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
401 e.into(),
402 ))))
403 }
404 }
405
406 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
408
409 std::task::Poll::Ready(Some(match header.ordinal {
410 0x1c6778e57fcfa9e1 => {
411 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
412 let mut req = fidl::new_empty!(
413 fidl::encoding::EmptyPayload,
414 fidl::encoding::DefaultFuchsiaResourceDialect
415 );
416 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
417 let control_handle = InspectControlHandle { inner: this.inner.clone() };
418 Ok(InspectRequest::ReadData {
419 responder: InspectReadDataResponder {
420 control_handle: std::mem::ManuallyDrop::new(control_handle),
421 tx_id: header.tx_id,
422 },
423 })
424 }
425 0x463fdc024dc40611 => {
426 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
427 let mut req = fidl::new_empty!(
428 fidl::encoding::EmptyPayload,
429 fidl::encoding::DefaultFuchsiaResourceDialect
430 );
431 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
432 let control_handle = InspectControlHandle { inner: this.inner.clone() };
433 Ok(InspectRequest::ListChildren {
434 responder: InspectListChildrenResponder {
435 control_handle: std::mem::ManuallyDrop::new(control_handle),
436 tx_id: header.tx_id,
437 },
438 })
439 }
440 0x30513125b65c866a => {
441 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
442 let mut req = fidl::new_empty!(
443 InspectOpenChildRequest,
444 fidl::encoding::DefaultFuchsiaResourceDialect
445 );
446 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectOpenChildRequest>(&header, _body_bytes, handles, &mut req)?;
447 let control_handle = InspectControlHandle { inner: this.inner.clone() };
448 Ok(InspectRequest::OpenChild {
449 child_name: req.child_name,
450 child_channel: req.child_channel,
451
452 responder: InspectOpenChildResponder {
453 control_handle: std::mem::ManuallyDrop::new(control_handle),
454 tx_id: header.tx_id,
455 },
456 })
457 }
458 _ => Err(fidl::Error::UnknownOrdinal {
459 ordinal: header.ordinal,
460 protocol_name:
461 <InspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
462 }),
463 }))
464 },
465 )
466 }
467}
468
469#[derive(Debug)]
470pub enum InspectRequest {
471 ReadData {
472 responder: InspectReadDataResponder,
473 },
474 ListChildren {
475 responder: InspectListChildrenResponder,
476 },
477 OpenChild {
478 child_name: String,
479 child_channel: fidl::endpoints::ServerEnd<InspectMarker>,
480 responder: InspectOpenChildResponder,
481 },
482}
483
484impl InspectRequest {
485 #[allow(irrefutable_let_patterns)]
486 pub fn into_read_data(self) -> Option<(InspectReadDataResponder)> {
487 if let InspectRequest::ReadData { responder } = self {
488 Some((responder))
489 } else {
490 None
491 }
492 }
493
494 #[allow(irrefutable_let_patterns)]
495 pub fn into_list_children(self) -> Option<(InspectListChildrenResponder)> {
496 if let InspectRequest::ListChildren { responder } = self {
497 Some((responder))
498 } else {
499 None
500 }
501 }
502
503 #[allow(irrefutable_let_patterns)]
504 pub fn into_open_child(
505 self,
506 ) -> Option<(String, fidl::endpoints::ServerEnd<InspectMarker>, InspectOpenChildResponder)>
507 {
508 if let InspectRequest::OpenChild { child_name, child_channel, responder } = self {
509 Some((child_name, child_channel, responder))
510 } else {
511 None
512 }
513 }
514
515 pub fn method_name(&self) -> &'static str {
517 match *self {
518 InspectRequest::ReadData { .. } => "read_data",
519 InspectRequest::ListChildren { .. } => "list_children",
520 InspectRequest::OpenChild { .. } => "open_child",
521 }
522 }
523}
524
525#[derive(Debug, Clone)]
526pub struct InspectControlHandle {
527 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
528}
529
530impl fidl::endpoints::ControlHandle for InspectControlHandle {
531 fn shutdown(&self) {
532 self.inner.shutdown()
533 }
534 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
535 self.inner.shutdown_with_epitaph(status)
536 }
537
538 fn is_closed(&self) -> bool {
539 self.inner.channel().is_closed()
540 }
541 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
542 self.inner.channel().on_closed()
543 }
544
545 #[cfg(target_os = "fuchsia")]
546 fn signal_peer(
547 &self,
548 clear_mask: zx::Signals,
549 set_mask: zx::Signals,
550 ) -> Result<(), zx_status::Status> {
551 use fidl::Peered;
552 self.inner.channel().signal_peer(clear_mask, set_mask)
553 }
554}
555
556impl InspectControlHandle {}
557
558#[must_use = "FIDL methods require a response to be sent"]
559#[derive(Debug)]
560pub struct InspectReadDataResponder {
561 control_handle: std::mem::ManuallyDrop<InspectControlHandle>,
562 tx_id: u32,
563}
564
565impl std::ops::Drop for InspectReadDataResponder {
569 fn drop(&mut self) {
570 self.control_handle.shutdown();
571 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
573 }
574}
575
576impl fidl::endpoints::Responder for InspectReadDataResponder {
577 type ControlHandle = InspectControlHandle;
578
579 fn control_handle(&self) -> &InspectControlHandle {
580 &self.control_handle
581 }
582
583 fn drop_without_shutdown(mut self) {
584 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
586 std::mem::forget(self);
588 }
589}
590
591impl InspectReadDataResponder {
592 pub fn send(self, mut object: &Object) -> Result<(), fidl::Error> {
596 let _result = self.send_raw(object);
597 if _result.is_err() {
598 self.control_handle.shutdown();
599 }
600 self.drop_without_shutdown();
601 _result
602 }
603
604 pub fn send_no_shutdown_on_err(self, mut object: &Object) -> Result<(), fidl::Error> {
606 let _result = self.send_raw(object);
607 self.drop_without_shutdown();
608 _result
609 }
610
611 fn send_raw(&self, mut object: &Object) -> Result<(), fidl::Error> {
612 self.control_handle.inner.send::<InspectReadDataResponse>(
613 (object,),
614 self.tx_id,
615 0x1c6778e57fcfa9e1,
616 fidl::encoding::DynamicFlags::empty(),
617 )
618 }
619}
620
621#[must_use = "FIDL methods require a response to be sent"]
622#[derive(Debug)]
623pub struct InspectListChildrenResponder {
624 control_handle: std::mem::ManuallyDrop<InspectControlHandle>,
625 tx_id: u32,
626}
627
628impl std::ops::Drop for InspectListChildrenResponder {
632 fn drop(&mut self) {
633 self.control_handle.shutdown();
634 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
636 }
637}
638
639impl fidl::endpoints::Responder for InspectListChildrenResponder {
640 type ControlHandle = InspectControlHandle;
641
642 fn control_handle(&self) -> &InspectControlHandle {
643 &self.control_handle
644 }
645
646 fn drop_without_shutdown(mut self) {
647 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
649 std::mem::forget(self);
651 }
652}
653
654impl InspectListChildrenResponder {
655 pub fn send(self, mut children_names: &[String]) -> Result<(), fidl::Error> {
659 let _result = self.send_raw(children_names);
660 if _result.is_err() {
661 self.control_handle.shutdown();
662 }
663 self.drop_without_shutdown();
664 _result
665 }
666
667 pub fn send_no_shutdown_on_err(self, mut children_names: &[String]) -> Result<(), fidl::Error> {
669 let _result = self.send_raw(children_names);
670 self.drop_without_shutdown();
671 _result
672 }
673
674 fn send_raw(&self, mut children_names: &[String]) -> Result<(), fidl::Error> {
675 self.control_handle.inner.send::<InspectListChildrenResponse>(
676 (children_names,),
677 self.tx_id,
678 0x463fdc024dc40611,
679 fidl::encoding::DynamicFlags::empty(),
680 )
681 }
682}
683
684#[must_use = "FIDL methods require a response to be sent"]
685#[derive(Debug)]
686pub struct InspectOpenChildResponder {
687 control_handle: std::mem::ManuallyDrop<InspectControlHandle>,
688 tx_id: u32,
689}
690
691impl std::ops::Drop for InspectOpenChildResponder {
695 fn drop(&mut self) {
696 self.control_handle.shutdown();
697 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
699 }
700}
701
702impl fidl::endpoints::Responder for InspectOpenChildResponder {
703 type ControlHandle = InspectControlHandle;
704
705 fn control_handle(&self) -> &InspectControlHandle {
706 &self.control_handle
707 }
708
709 fn drop_without_shutdown(mut self) {
710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
712 std::mem::forget(self);
714 }
715}
716
717impl InspectOpenChildResponder {
718 pub fn send(self, mut success: bool) -> Result<(), fidl::Error> {
722 let _result = self.send_raw(success);
723 if _result.is_err() {
724 self.control_handle.shutdown();
725 }
726 self.drop_without_shutdown();
727 _result
728 }
729
730 pub fn send_no_shutdown_on_err(self, mut success: bool) -> Result<(), fidl::Error> {
732 let _result = self.send_raw(success);
733 self.drop_without_shutdown();
734 _result
735 }
736
737 fn send_raw(&self, mut success: bool) -> Result<(), fidl::Error> {
738 self.control_handle.inner.send::<InspectOpenChildResponse>(
739 (success,),
740 self.tx_id,
741 0x30513125b65c866a,
742 fidl::encoding::DynamicFlags::empty(),
743 )
744 }
745}
746
747mod internal {
748 use super::*;
749
750 impl fidl::encoding::ResourceTypeMarker for InspectOpenChildRequest {
751 type Borrowed<'a> = &'a mut Self;
752 fn take_or_borrow<'a>(
753 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
754 ) -> Self::Borrowed<'a> {
755 value
756 }
757 }
758
759 unsafe impl fidl::encoding::TypeMarker for InspectOpenChildRequest {
760 type Owned = Self;
761
762 #[inline(always)]
763 fn inline_align(_context: fidl::encoding::Context) -> usize {
764 8
765 }
766
767 #[inline(always)]
768 fn inline_size(_context: fidl::encoding::Context) -> usize {
769 24
770 }
771 }
772
773 unsafe impl
774 fidl::encoding::Encode<
775 InspectOpenChildRequest,
776 fidl::encoding::DefaultFuchsiaResourceDialect,
777 > for &mut InspectOpenChildRequest
778 {
779 #[inline]
780 unsafe fn encode(
781 self,
782 encoder: &mut fidl::encoding::Encoder<
783 '_,
784 fidl::encoding::DefaultFuchsiaResourceDialect,
785 >,
786 offset: usize,
787 _depth: fidl::encoding::Depth,
788 ) -> fidl::Result<()> {
789 encoder.debug_check_bounds::<InspectOpenChildRequest>(offset);
790 fidl::encoding::Encode::<InspectOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
792 (
793 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
794 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_channel),
795 ),
796 encoder, offset, _depth
797 )
798 }
799 }
800 unsafe impl<
801 T0: fidl::encoding::Encode<
802 fidl::encoding::UnboundedString,
803 fidl::encoding::DefaultFuchsiaResourceDialect,
804 >,
805 T1: fidl::encoding::Encode<
806 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>>,
807 fidl::encoding::DefaultFuchsiaResourceDialect,
808 >,
809 >
810 fidl::encoding::Encode<
811 InspectOpenChildRequest,
812 fidl::encoding::DefaultFuchsiaResourceDialect,
813 > for (T0, T1)
814 {
815 #[inline]
816 unsafe fn encode(
817 self,
818 encoder: &mut fidl::encoding::Encoder<
819 '_,
820 fidl::encoding::DefaultFuchsiaResourceDialect,
821 >,
822 offset: usize,
823 depth: fidl::encoding::Depth,
824 ) -> fidl::Result<()> {
825 encoder.debug_check_bounds::<InspectOpenChildRequest>(offset);
826 unsafe {
829 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
830 (ptr as *mut u64).write_unaligned(0);
831 }
832 self.0.encode(encoder, offset + 0, depth)?;
834 self.1.encode(encoder, offset + 16, depth)?;
835 Ok(())
836 }
837 }
838
839 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
840 for InspectOpenChildRequest
841 {
842 #[inline(always)]
843 fn new_empty() -> Self {
844 Self {
845 child_name: fidl::new_empty!(
846 fidl::encoding::UnboundedString,
847 fidl::encoding::DefaultFuchsiaResourceDialect
848 ),
849 child_channel: fidl::new_empty!(
850 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>>,
851 fidl::encoding::DefaultFuchsiaResourceDialect
852 ),
853 }
854 }
855
856 #[inline]
857 unsafe fn decode(
858 &mut self,
859 decoder: &mut fidl::encoding::Decoder<
860 '_,
861 fidl::encoding::DefaultFuchsiaResourceDialect,
862 >,
863 offset: usize,
864 _depth: fidl::encoding::Depth,
865 ) -> fidl::Result<()> {
866 decoder.debug_check_bounds::<Self>(offset);
867 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
869 let padval = unsafe { (ptr as *const u64).read_unaligned() };
870 let mask = 0xffffffff00000000u64;
871 let maskedval = padval & mask;
872 if maskedval != 0 {
873 return Err(fidl::Error::NonZeroPadding {
874 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
875 });
876 }
877 fidl::decode!(
878 fidl::encoding::UnboundedString,
879 fidl::encoding::DefaultFuchsiaResourceDialect,
880 &mut self.child_name,
881 decoder,
882 offset + 0,
883 _depth
884 )?;
885 fidl::decode!(
886 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InspectMarker>>,
887 fidl::encoding::DefaultFuchsiaResourceDialect,
888 &mut self.child_channel,
889 decoder,
890 offset + 16,
891 _depth
892 )?;
893 Ok(())
894 }
895 }
896}