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