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::Handle {
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 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 let protocol_name = <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
364 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
365 }
366
367 pub fn into_channel(self) -> fidl::Channel {
368 self.client.into_channel()
369 }
370
371 pub fn wait_for_event(
374 &self,
375 deadline: zx::MonotonicInstant,
376 ) -> Result<RebindParentEvent, fidl::Error> {
377 RebindParentEvent::decode(self.client.wait_for_event(deadline)?)
378 }
379
380 pub fn r#add_child(
381 &self,
382 ___deadline: zx::MonotonicInstant,
383 ) -> Result<RebindParentAddChildResult, fidl::Error> {
384 let _response = self.client.send_query::<
385 fidl::encoding::EmptyPayload,
386 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
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 >(
404 (),
405 0x68d3023bfd04c269,
406 fidl::encoding::DynamicFlags::empty(),
407 ___deadline,
408 )?;
409 Ok(_response.map(|x| x))
410 }
411}
412
413#[cfg(target_os = "fuchsia")]
414impl From<RebindParentSynchronousProxy> for zx::Handle {
415 fn from(value: RebindParentSynchronousProxy) -> Self {
416 value.into_channel().into()
417 }
418}
419
420#[cfg(target_os = "fuchsia")]
421impl From<fidl::Channel> for RebindParentSynchronousProxy {
422 fn from(value: fidl::Channel) -> Self {
423 Self::new(value)
424 }
425}
426
427#[cfg(target_os = "fuchsia")]
428impl fidl::endpoints::FromClient for RebindParentSynchronousProxy {
429 type Protocol = RebindParentMarker;
430
431 fn from_client(value: fidl::endpoints::ClientEnd<RebindParentMarker>) -> Self {
432 Self::new(value.into_channel())
433 }
434}
435
436#[derive(Debug, Clone)]
437pub struct RebindParentProxy {
438 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
439}
440
441impl fidl::endpoints::Proxy for RebindParentProxy {
442 type Protocol = RebindParentMarker;
443
444 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
445 Self::new(inner)
446 }
447
448 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
449 self.client.into_channel().map_err(|client| Self { client })
450 }
451
452 fn as_channel(&self) -> &::fidl::AsyncChannel {
453 self.client.as_channel()
454 }
455}
456
457impl RebindParentProxy {
458 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
460 let protocol_name = <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
461 Self { client: fidl::client::Client::new(channel, protocol_name) }
462 }
463
464 pub fn take_event_stream(&self) -> RebindParentEventStream {
470 RebindParentEventStream { event_receiver: self.client.take_event_receiver() }
471 }
472
473 pub fn r#add_child(
474 &self,
475 ) -> fidl::client::QueryResponseFut<
476 RebindParentAddChildResult,
477 fidl::encoding::DefaultFuchsiaResourceDialect,
478 > {
479 RebindParentProxyInterface::r#add_child(self)
480 }
481
482 pub fn r#remove_child(
483 &self,
484 ) -> fidl::client::QueryResponseFut<
485 RebindParentRemoveChildResult,
486 fidl::encoding::DefaultFuchsiaResourceDialect,
487 > {
488 RebindParentProxyInterface::r#remove_child(self)
489 }
490}
491
492impl RebindParentProxyInterface for RebindParentProxy {
493 type AddChildResponseFut = fidl::client::QueryResponseFut<
494 RebindParentAddChildResult,
495 fidl::encoding::DefaultFuchsiaResourceDialect,
496 >;
497 fn r#add_child(&self) -> Self::AddChildResponseFut {
498 fn _decode(
499 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
500 ) -> Result<RebindParentAddChildResult, fidl::Error> {
501 let _response = fidl::client::decode_transaction_body::<
502 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
503 fidl::encoding::DefaultFuchsiaResourceDialect,
504 0x74095dc7e942dea5,
505 >(_buf?)?;
506 Ok(_response.map(|x| x))
507 }
508 self.client
509 .send_query_and_decode::<fidl::encoding::EmptyPayload, RebindParentAddChildResult>(
510 (),
511 0x74095dc7e942dea5,
512 fidl::encoding::DynamicFlags::empty(),
513 _decode,
514 )
515 }
516
517 type RemoveChildResponseFut = fidl::client::QueryResponseFut<
518 RebindParentRemoveChildResult,
519 fidl::encoding::DefaultFuchsiaResourceDialect,
520 >;
521 fn r#remove_child(&self) -> Self::RemoveChildResponseFut {
522 fn _decode(
523 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
524 ) -> Result<RebindParentRemoveChildResult, fidl::Error> {
525 let _response = fidl::client::decode_transaction_body::<
526 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
527 fidl::encoding::DefaultFuchsiaResourceDialect,
528 0x68d3023bfd04c269,
529 >(_buf?)?;
530 Ok(_response.map(|x| x))
531 }
532 self.client
533 .send_query_and_decode::<fidl::encoding::EmptyPayload, RebindParentRemoveChildResult>(
534 (),
535 0x68d3023bfd04c269,
536 fidl::encoding::DynamicFlags::empty(),
537 _decode,
538 )
539 }
540}
541
542pub struct RebindParentEventStream {
543 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
544}
545
546impl std::marker::Unpin for RebindParentEventStream {}
547
548impl futures::stream::FusedStream for RebindParentEventStream {
549 fn is_terminated(&self) -> bool {
550 self.event_receiver.is_terminated()
551 }
552}
553
554impl futures::Stream for RebindParentEventStream {
555 type Item = Result<RebindParentEvent, fidl::Error>;
556
557 fn poll_next(
558 mut self: std::pin::Pin<&mut Self>,
559 cx: &mut std::task::Context<'_>,
560 ) -> std::task::Poll<Option<Self::Item>> {
561 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
562 &mut self.event_receiver,
563 cx
564 )?) {
565 Some(buf) => std::task::Poll::Ready(Some(RebindParentEvent::decode(buf))),
566 None => std::task::Poll::Ready(None),
567 }
568 }
569}
570
571#[derive(Debug)]
572pub enum RebindParentEvent {}
573
574impl RebindParentEvent {
575 fn decode(
577 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
578 ) -> Result<RebindParentEvent, fidl::Error> {
579 let (bytes, _handles) = buf.split_mut();
580 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
581 debug_assert_eq!(tx_header.tx_id, 0);
582 match tx_header.ordinal {
583 _ => Err(fidl::Error::UnknownOrdinal {
584 ordinal: tx_header.ordinal,
585 protocol_name: <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
586 }),
587 }
588 }
589}
590
591pub struct RebindParentRequestStream {
593 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
594 is_terminated: bool,
595}
596
597impl std::marker::Unpin for RebindParentRequestStream {}
598
599impl futures::stream::FusedStream for RebindParentRequestStream {
600 fn is_terminated(&self) -> bool {
601 self.is_terminated
602 }
603}
604
605impl fidl::endpoints::RequestStream for RebindParentRequestStream {
606 type Protocol = RebindParentMarker;
607 type ControlHandle = RebindParentControlHandle;
608
609 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
610 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
611 }
612
613 fn control_handle(&self) -> Self::ControlHandle {
614 RebindParentControlHandle { inner: self.inner.clone() }
615 }
616
617 fn into_inner(
618 self,
619 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
620 {
621 (self.inner, self.is_terminated)
622 }
623
624 fn from_inner(
625 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
626 is_terminated: bool,
627 ) -> Self {
628 Self { inner, is_terminated }
629 }
630}
631
632impl futures::Stream for RebindParentRequestStream {
633 type Item = Result<RebindParentRequest, fidl::Error>;
634
635 fn poll_next(
636 mut self: std::pin::Pin<&mut Self>,
637 cx: &mut std::task::Context<'_>,
638 ) -> std::task::Poll<Option<Self::Item>> {
639 let this = &mut *self;
640 if this.inner.check_shutdown(cx) {
641 this.is_terminated = true;
642 return std::task::Poll::Ready(None);
643 }
644 if this.is_terminated {
645 panic!("polled RebindParentRequestStream after completion");
646 }
647 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
648 |bytes, handles| {
649 match this.inner.channel().read_etc(cx, bytes, handles) {
650 std::task::Poll::Ready(Ok(())) => {}
651 std::task::Poll::Pending => return std::task::Poll::Pending,
652 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
653 this.is_terminated = true;
654 return std::task::Poll::Ready(None);
655 }
656 std::task::Poll::Ready(Err(e)) => {
657 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
658 e.into(),
659 ))))
660 }
661 }
662
663 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
665
666 std::task::Poll::Ready(Some(match header.ordinal {
667 0x74095dc7e942dea5 => {
668 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
669 let mut req = fidl::new_empty!(
670 fidl::encoding::EmptyPayload,
671 fidl::encoding::DefaultFuchsiaResourceDialect
672 );
673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
674 let control_handle =
675 RebindParentControlHandle { inner: this.inner.clone() };
676 Ok(RebindParentRequest::AddChild {
677 responder: RebindParentAddChildResponder {
678 control_handle: std::mem::ManuallyDrop::new(control_handle),
679 tx_id: header.tx_id,
680 },
681 })
682 }
683 0x68d3023bfd04c269 => {
684 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
685 let mut req = fidl::new_empty!(
686 fidl::encoding::EmptyPayload,
687 fidl::encoding::DefaultFuchsiaResourceDialect
688 );
689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
690 let control_handle =
691 RebindParentControlHandle { inner: this.inner.clone() };
692 Ok(RebindParentRequest::RemoveChild {
693 responder: RebindParentRemoveChildResponder {
694 control_handle: std::mem::ManuallyDrop::new(control_handle),
695 tx_id: header.tx_id,
696 },
697 })
698 }
699 _ => Err(fidl::Error::UnknownOrdinal {
700 ordinal: header.ordinal,
701 protocol_name:
702 <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
703 }),
704 }))
705 },
706 )
707 }
708}
709
710#[derive(Debug)]
711pub enum RebindParentRequest {
712 AddChild { responder: RebindParentAddChildResponder },
713 RemoveChild { responder: RebindParentRemoveChildResponder },
714}
715
716impl RebindParentRequest {
717 #[allow(irrefutable_let_patterns)]
718 pub fn into_add_child(self) -> Option<(RebindParentAddChildResponder)> {
719 if let RebindParentRequest::AddChild { responder } = self {
720 Some((responder))
721 } else {
722 None
723 }
724 }
725
726 #[allow(irrefutable_let_patterns)]
727 pub fn into_remove_child(self) -> Option<(RebindParentRemoveChildResponder)> {
728 if let RebindParentRequest::RemoveChild { responder } = self {
729 Some((responder))
730 } else {
731 None
732 }
733 }
734
735 pub fn method_name(&self) -> &'static str {
737 match *self {
738 RebindParentRequest::AddChild { .. } => "add_child",
739 RebindParentRequest::RemoveChild { .. } => "remove_child",
740 }
741 }
742}
743
744#[derive(Debug, Clone)]
745pub struct RebindParentControlHandle {
746 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
747}
748
749impl fidl::endpoints::ControlHandle for RebindParentControlHandle {
750 fn shutdown(&self) {
751 self.inner.shutdown()
752 }
753 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
754 self.inner.shutdown_with_epitaph(status)
755 }
756
757 fn is_closed(&self) -> bool {
758 self.inner.channel().is_closed()
759 }
760 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
761 self.inner.channel().on_closed()
762 }
763
764 #[cfg(target_os = "fuchsia")]
765 fn signal_peer(
766 &self,
767 clear_mask: zx::Signals,
768 set_mask: zx::Signals,
769 ) -> Result<(), zx_status::Status> {
770 use fidl::Peered;
771 self.inner.channel().signal_peer(clear_mask, set_mask)
772 }
773}
774
775impl RebindParentControlHandle {}
776
777#[must_use = "FIDL methods require a response to be sent"]
778#[derive(Debug)]
779pub struct RebindParentAddChildResponder {
780 control_handle: std::mem::ManuallyDrop<RebindParentControlHandle>,
781 tx_id: u32,
782}
783
784impl std::ops::Drop for RebindParentAddChildResponder {
788 fn drop(&mut self) {
789 self.control_handle.shutdown();
790 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
792 }
793}
794
795impl fidl::endpoints::Responder for RebindParentAddChildResponder {
796 type ControlHandle = RebindParentControlHandle;
797
798 fn control_handle(&self) -> &RebindParentControlHandle {
799 &self.control_handle
800 }
801
802 fn drop_without_shutdown(mut self) {
803 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
805 std::mem::forget(self);
807 }
808}
809
810impl RebindParentAddChildResponder {
811 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
815 let _result = self.send_raw(result);
816 if _result.is_err() {
817 self.control_handle.shutdown();
818 }
819 self.drop_without_shutdown();
820 _result
821 }
822
823 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
825 let _result = self.send_raw(result);
826 self.drop_without_shutdown();
827 _result
828 }
829
830 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
831 self.control_handle
832 .inner
833 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
834 result,
835 self.tx_id,
836 0x74095dc7e942dea5,
837 fidl::encoding::DynamicFlags::empty(),
838 )
839 }
840}
841
842#[must_use = "FIDL methods require a response to be sent"]
843#[derive(Debug)]
844pub struct RebindParentRemoveChildResponder {
845 control_handle: std::mem::ManuallyDrop<RebindParentControlHandle>,
846 tx_id: u32,
847}
848
849impl std::ops::Drop for RebindParentRemoveChildResponder {
853 fn drop(&mut self) {
854 self.control_handle.shutdown();
855 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
857 }
858}
859
860impl fidl::endpoints::Responder for RebindParentRemoveChildResponder {
861 type ControlHandle = RebindParentControlHandle;
862
863 fn control_handle(&self) -> &RebindParentControlHandle {
864 &self.control_handle
865 }
866
867 fn drop_without_shutdown(mut self) {
868 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
870 std::mem::forget(self);
872 }
873}
874
875impl RebindParentRemoveChildResponder {
876 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
880 let _result = self.send_raw(result);
881 if _result.is_err() {
882 self.control_handle.shutdown();
883 }
884 self.drop_without_shutdown();
885 _result
886 }
887
888 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
890 let _result = self.send_raw(result);
891 self.drop_without_shutdown();
892 _result
893 }
894
895 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
896 self.control_handle
897 .inner
898 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
899 result,
900 self.tx_id,
901 0x68d3023bfd04c269,
902 fidl::encoding::DynamicFlags::empty(),
903 )
904 }
905}
906
907mod internal {
908 use super::*;
909}