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 let protocol_name = <RebindChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
55 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
56 }
57
58 pub fn into_channel(self) -> fidl::Channel {
59 self.client.into_channel()
60 }
61
62 pub fn wait_for_event(
65 &self,
66 deadline: zx::MonotonicInstant,
67 ) -> Result<RebindChildEvent, fidl::Error> {
68 RebindChildEvent::decode(self.client.wait_for_event(deadline)?)
69 }
70}
71
72#[cfg(target_os = "fuchsia")]
73impl From<RebindChildSynchronousProxy> for zx::NullableHandle {
74 fn from(value: RebindChildSynchronousProxy) -> Self {
75 value.into_channel().into()
76 }
77}
78
79#[cfg(target_os = "fuchsia")]
80impl From<fidl::Channel> for RebindChildSynchronousProxy {
81 fn from(value: fidl::Channel) -> Self {
82 Self::new(value)
83 }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl fidl::endpoints::FromClient for RebindChildSynchronousProxy {
88 type Protocol = RebindChildMarker;
89
90 fn from_client(value: fidl::endpoints::ClientEnd<RebindChildMarker>) -> Self {
91 Self::new(value.into_channel())
92 }
93}
94
95#[derive(Debug, Clone)]
96pub struct RebindChildProxy {
97 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
98}
99
100impl fidl::endpoints::Proxy for RebindChildProxy {
101 type Protocol = RebindChildMarker;
102
103 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
104 Self::new(inner)
105 }
106
107 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
108 self.client.into_channel().map_err(|client| Self { client })
109 }
110
111 fn as_channel(&self) -> &::fidl::AsyncChannel {
112 self.client.as_channel()
113 }
114}
115
116impl RebindChildProxy {
117 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
119 let protocol_name = <RebindChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
120 Self { client: fidl::client::Client::new(channel, protocol_name) }
121 }
122
123 pub fn take_event_stream(&self) -> RebindChildEventStream {
129 RebindChildEventStream { event_receiver: self.client.take_event_receiver() }
130 }
131}
132
133impl RebindChildProxyInterface for RebindChildProxy {}
134
135pub struct RebindChildEventStream {
136 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl std::marker::Unpin for RebindChildEventStream {}
140
141impl futures::stream::FusedStream for RebindChildEventStream {
142 fn is_terminated(&self) -> bool {
143 self.event_receiver.is_terminated()
144 }
145}
146
147impl futures::Stream for RebindChildEventStream {
148 type Item = Result<RebindChildEvent, fidl::Error>;
149
150 fn poll_next(
151 mut self: std::pin::Pin<&mut Self>,
152 cx: &mut std::task::Context<'_>,
153 ) -> std::task::Poll<Option<Self::Item>> {
154 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
155 &mut self.event_receiver,
156 cx
157 )?) {
158 Some(buf) => std::task::Poll::Ready(Some(RebindChildEvent::decode(buf))),
159 None => std::task::Poll::Ready(None),
160 }
161 }
162}
163
164#[derive(Debug)]
165pub enum RebindChildEvent {}
166
167impl RebindChildEvent {
168 fn decode(
170 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
171 ) -> Result<RebindChildEvent, fidl::Error> {
172 let (bytes, _handles) = buf.split_mut();
173 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
174 debug_assert_eq!(tx_header.tx_id, 0);
175 match tx_header.ordinal {
176 _ => Err(fidl::Error::UnknownOrdinal {
177 ordinal: tx_header.ordinal,
178 protocol_name: <RebindChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
179 }),
180 }
181 }
182}
183
184pub struct RebindChildRequestStream {
186 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
187 is_terminated: bool,
188}
189
190impl std::marker::Unpin for RebindChildRequestStream {}
191
192impl futures::stream::FusedStream for RebindChildRequestStream {
193 fn is_terminated(&self) -> bool {
194 self.is_terminated
195 }
196}
197
198impl fidl::endpoints::RequestStream for RebindChildRequestStream {
199 type Protocol = RebindChildMarker;
200 type ControlHandle = RebindChildControlHandle;
201
202 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
203 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
204 }
205
206 fn control_handle(&self) -> Self::ControlHandle {
207 RebindChildControlHandle { inner: self.inner.clone() }
208 }
209
210 fn into_inner(
211 self,
212 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
213 {
214 (self.inner, self.is_terminated)
215 }
216
217 fn from_inner(
218 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
219 is_terminated: bool,
220 ) -> Self {
221 Self { inner, is_terminated }
222 }
223}
224
225impl futures::Stream for RebindChildRequestStream {
226 type Item = Result<RebindChildRequest, fidl::Error>;
227
228 fn poll_next(
229 mut self: std::pin::Pin<&mut Self>,
230 cx: &mut std::task::Context<'_>,
231 ) -> std::task::Poll<Option<Self::Item>> {
232 let this = &mut *self;
233 if this.inner.check_shutdown(cx) {
234 this.is_terminated = true;
235 return std::task::Poll::Ready(None);
236 }
237 if this.is_terminated {
238 panic!("polled RebindChildRequestStream after completion");
239 }
240 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
241 |bytes, handles| {
242 match this.inner.channel().read_etc(cx, bytes, handles) {
243 std::task::Poll::Ready(Ok(())) => {}
244 std::task::Poll::Pending => return std::task::Poll::Pending,
245 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
246 this.is_terminated = true;
247 return std::task::Poll::Ready(None);
248 }
249 std::task::Poll::Ready(Err(e)) => {
250 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
251 e.into(),
252 ))));
253 }
254 }
255
256 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
258
259 std::task::Poll::Ready(Some(match header.ordinal {
260 _ => Err(fidl::Error::UnknownOrdinal {
261 ordinal: header.ordinal,
262 protocol_name:
263 <RebindChildMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
264 }),
265 }))
266 },
267 )
268 }
269}
270
271#[derive(Debug)]
272pub enum RebindChildRequest {}
273
274impl RebindChildRequest {
275 pub fn method_name(&self) -> &'static str {
277 match *self {}
278 }
279}
280
281#[derive(Debug, Clone)]
282pub struct RebindChildControlHandle {
283 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
284}
285
286impl fidl::endpoints::ControlHandle for RebindChildControlHandle {
287 fn shutdown(&self) {
288 self.inner.shutdown()
289 }
290
291 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
292 self.inner.shutdown_with_epitaph(status)
293 }
294
295 fn is_closed(&self) -> bool {
296 self.inner.channel().is_closed()
297 }
298 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
299 self.inner.channel().on_closed()
300 }
301
302 #[cfg(target_os = "fuchsia")]
303 fn signal_peer(
304 &self,
305 clear_mask: zx::Signals,
306 set_mask: zx::Signals,
307 ) -> Result<(), zx_status::Status> {
308 use fidl::Peered;
309 self.inner.channel().signal_peer(clear_mask, set_mask)
310 }
311}
312
313impl RebindChildControlHandle {}
314
315#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
316pub struct RebindParentMarker;
317
318impl fidl::endpoints::ProtocolMarker for RebindParentMarker {
319 type Proxy = RebindParentProxy;
320 type RequestStream = RebindParentRequestStream;
321 #[cfg(target_os = "fuchsia")]
322 type SynchronousProxy = RebindParentSynchronousProxy;
323
324 const DEBUG_NAME: &'static str = "(anonymous) RebindParent";
325}
326pub type RebindParentAddChildResult = Result<(), i32>;
327pub type RebindParentRemoveChildResult = Result<(), i32>;
328
329pub trait RebindParentProxyInterface: Send + Sync {
330 type AddChildResponseFut: std::future::Future<Output = Result<RebindParentAddChildResult, fidl::Error>>
331 + Send;
332 fn r#add_child(&self) -> Self::AddChildResponseFut;
333 type RemoveChildResponseFut: std::future::Future<Output = Result<RebindParentRemoveChildResult, fidl::Error>>
334 + Send;
335 fn r#remove_child(&self) -> Self::RemoveChildResponseFut;
336}
337#[derive(Debug)]
338#[cfg(target_os = "fuchsia")]
339pub struct RebindParentSynchronousProxy {
340 client: fidl::client::sync::Client,
341}
342
343#[cfg(target_os = "fuchsia")]
344impl fidl::endpoints::SynchronousProxy for RebindParentSynchronousProxy {
345 type Proxy = RebindParentProxy;
346 type Protocol = RebindParentMarker;
347
348 fn from_channel(inner: fidl::Channel) -> Self {
349 Self::new(inner)
350 }
351
352 fn into_channel(self) -> fidl::Channel {
353 self.client.into_channel()
354 }
355
356 fn as_channel(&self) -> &fidl::Channel {
357 self.client.as_channel()
358 }
359}
360
361#[cfg(target_os = "fuchsia")]
362impl RebindParentSynchronousProxy {
363 pub fn new(channel: fidl::Channel) -> Self {
364 let protocol_name = <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
365 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
366 }
367
368 pub fn into_channel(self) -> fidl::Channel {
369 self.client.into_channel()
370 }
371
372 pub fn wait_for_event(
375 &self,
376 deadline: zx::MonotonicInstant,
377 ) -> Result<RebindParentEvent, fidl::Error> {
378 RebindParentEvent::decode(self.client.wait_for_event(deadline)?)
379 }
380
381 pub fn r#add_child(
382 &self,
383 ___deadline: zx::MonotonicInstant,
384 ) -> Result<RebindParentAddChildResult, fidl::Error> {
385 let _response = self.client.send_query::<
386 fidl::encoding::EmptyPayload,
387 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
388 >(
389 (),
390 0x74095dc7e942dea5,
391 fidl::encoding::DynamicFlags::empty(),
392 ___deadline,
393 )?;
394 Ok(_response.map(|x| x))
395 }
396
397 pub fn r#remove_child(
398 &self,
399 ___deadline: zx::MonotonicInstant,
400 ) -> Result<RebindParentRemoveChildResult, fidl::Error> {
401 let _response = self.client.send_query::<
402 fidl::encoding::EmptyPayload,
403 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
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}