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