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 RebindChildControlHandle {
286 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
287 self.inner.shutdown_with_epitaph(status.into())
288 }
289}
290
291impl fidl::endpoints::ControlHandle for RebindChildControlHandle {
292 fn shutdown(&self) {
293 self.inner.shutdown()
294 }
295
296 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
297 self.inner.shutdown_with_epitaph(status)
298 }
299
300 fn is_closed(&self) -> bool {
301 self.inner.channel().is_closed()
302 }
303 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
304 self.inner.channel().on_closed()
305 }
306
307 #[cfg(target_os = "fuchsia")]
308 fn signal_peer(
309 &self,
310 clear_mask: zx::Signals,
311 set_mask: zx::Signals,
312 ) -> Result<(), zx_status::Status> {
313 use fidl::Peered;
314 self.inner.channel().signal_peer(clear_mask, set_mask)
315 }
316}
317
318impl RebindChildControlHandle {}
319
320#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
321pub struct RebindParentMarker;
322
323impl fidl::endpoints::ProtocolMarker for RebindParentMarker {
324 type Proxy = RebindParentProxy;
325 type RequestStream = RebindParentRequestStream;
326 #[cfg(target_os = "fuchsia")]
327 type SynchronousProxy = RebindParentSynchronousProxy;
328
329 const DEBUG_NAME: &'static str = "(anonymous) RebindParent";
330}
331pub type RebindParentAddChildResult = Result<(), i32>;
332pub type RebindParentRemoveChildResult = Result<(), i32>;
333
334pub trait RebindParentProxyInterface: Send + Sync {
335 type AddChildResponseFut: std::future::Future<Output = Result<RebindParentAddChildResult, fidl::Error>>
336 + Send;
337 fn r#add_child(&self) -> Self::AddChildResponseFut;
338 type RemoveChildResponseFut: std::future::Future<Output = Result<RebindParentRemoveChildResult, fidl::Error>>
339 + Send;
340 fn r#remove_child(&self) -> Self::RemoveChildResponseFut;
341}
342#[derive(Debug)]
343#[cfg(target_os = "fuchsia")]
344pub struct RebindParentSynchronousProxy {
345 client: fidl::client::sync::Client,
346}
347
348#[cfg(target_os = "fuchsia")]
349impl fidl::endpoints::SynchronousProxy for RebindParentSynchronousProxy {
350 type Proxy = RebindParentProxy;
351 type Protocol = RebindParentMarker;
352
353 fn from_channel(inner: fidl::Channel) -> Self {
354 Self::new(inner)
355 }
356
357 fn into_channel(self) -> fidl::Channel {
358 self.client.into_channel()
359 }
360
361 fn as_channel(&self) -> &fidl::Channel {
362 self.client.as_channel()
363 }
364}
365
366#[cfg(target_os = "fuchsia")]
367impl RebindParentSynchronousProxy {
368 pub fn new(channel: fidl::Channel) -> Self {
369 Self { client: fidl::client::sync::Client::new(channel) }
370 }
371
372 pub fn into_channel(self) -> fidl::Channel {
373 self.client.into_channel()
374 }
375
376 pub fn wait_for_event(
379 &self,
380 deadline: zx::MonotonicInstant,
381 ) -> Result<RebindParentEvent, fidl::Error> {
382 RebindParentEvent::decode(self.client.wait_for_event::<RebindParentMarker>(deadline)?)
383 }
384
385 pub fn r#add_child(
386 &self,
387 ___deadline: zx::MonotonicInstant,
388 ) -> Result<RebindParentAddChildResult, fidl::Error> {
389 let _response = self.client.send_query::<
390 fidl::encoding::EmptyPayload,
391 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
392 RebindParentMarker,
393 >(
394 (),
395 0x74095dc7e942dea5,
396 fidl::encoding::DynamicFlags::empty(),
397 ___deadline,
398 )?;
399 Ok(_response.map(|x| x))
400 }
401
402 pub fn r#remove_child(
403 &self,
404 ___deadline: zx::MonotonicInstant,
405 ) -> Result<RebindParentRemoveChildResult, fidl::Error> {
406 let _response = self.client.send_query::<
407 fidl::encoding::EmptyPayload,
408 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
409 RebindParentMarker,
410 >(
411 (),
412 0x68d3023bfd04c269,
413 fidl::encoding::DynamicFlags::empty(),
414 ___deadline,
415 )?;
416 Ok(_response.map(|x| x))
417 }
418}
419
420#[cfg(target_os = "fuchsia")]
421impl From<RebindParentSynchronousProxy> for zx::NullableHandle {
422 fn from(value: RebindParentSynchronousProxy) -> Self {
423 value.into_channel().into()
424 }
425}
426
427#[cfg(target_os = "fuchsia")]
428impl From<fidl::Channel> for RebindParentSynchronousProxy {
429 fn from(value: fidl::Channel) -> Self {
430 Self::new(value)
431 }
432}
433
434#[cfg(target_os = "fuchsia")]
435impl fidl::endpoints::FromClient for RebindParentSynchronousProxy {
436 type Protocol = RebindParentMarker;
437
438 fn from_client(value: fidl::endpoints::ClientEnd<RebindParentMarker>) -> Self {
439 Self::new(value.into_channel())
440 }
441}
442
443#[derive(Debug, Clone)]
444pub struct RebindParentProxy {
445 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
446}
447
448impl fidl::endpoints::Proxy for RebindParentProxy {
449 type Protocol = RebindParentMarker;
450
451 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
452 Self::new(inner)
453 }
454
455 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
456 self.client.into_channel().map_err(|client| Self { client })
457 }
458
459 fn as_channel(&self) -> &::fidl::AsyncChannel {
460 self.client.as_channel()
461 }
462}
463
464impl RebindParentProxy {
465 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
467 let protocol_name = <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
468 Self { client: fidl::client::Client::new(channel, protocol_name) }
469 }
470
471 pub fn take_event_stream(&self) -> RebindParentEventStream {
477 RebindParentEventStream { event_receiver: self.client.take_event_receiver() }
478 }
479
480 pub fn r#add_child(
481 &self,
482 ) -> fidl::client::QueryResponseFut<
483 RebindParentAddChildResult,
484 fidl::encoding::DefaultFuchsiaResourceDialect,
485 > {
486 RebindParentProxyInterface::r#add_child(self)
487 }
488
489 pub fn r#remove_child(
490 &self,
491 ) -> fidl::client::QueryResponseFut<
492 RebindParentRemoveChildResult,
493 fidl::encoding::DefaultFuchsiaResourceDialect,
494 > {
495 RebindParentProxyInterface::r#remove_child(self)
496 }
497}
498
499impl RebindParentProxyInterface for RebindParentProxy {
500 type AddChildResponseFut = fidl::client::QueryResponseFut<
501 RebindParentAddChildResult,
502 fidl::encoding::DefaultFuchsiaResourceDialect,
503 >;
504 fn r#add_child(&self) -> Self::AddChildResponseFut {
505 fn _decode(
506 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
507 ) -> Result<RebindParentAddChildResult, fidl::Error> {
508 let _response = fidl::client::decode_transaction_body::<
509 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
510 fidl::encoding::DefaultFuchsiaResourceDialect,
511 0x74095dc7e942dea5,
512 >(_buf?)?;
513 Ok(_response.map(|x| x))
514 }
515 self.client
516 .send_query_and_decode::<fidl::encoding::EmptyPayload, RebindParentAddChildResult>(
517 (),
518 0x74095dc7e942dea5,
519 fidl::encoding::DynamicFlags::empty(),
520 _decode,
521 )
522 }
523
524 type RemoveChildResponseFut = fidl::client::QueryResponseFut<
525 RebindParentRemoveChildResult,
526 fidl::encoding::DefaultFuchsiaResourceDialect,
527 >;
528 fn r#remove_child(&self) -> Self::RemoveChildResponseFut {
529 fn _decode(
530 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
531 ) -> Result<RebindParentRemoveChildResult, fidl::Error> {
532 let _response = fidl::client::decode_transaction_body::<
533 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
534 fidl::encoding::DefaultFuchsiaResourceDialect,
535 0x68d3023bfd04c269,
536 >(_buf?)?;
537 Ok(_response.map(|x| x))
538 }
539 self.client
540 .send_query_and_decode::<fidl::encoding::EmptyPayload, RebindParentRemoveChildResult>(
541 (),
542 0x68d3023bfd04c269,
543 fidl::encoding::DynamicFlags::empty(),
544 _decode,
545 )
546 }
547}
548
549pub struct RebindParentEventStream {
550 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
551}
552
553impl std::marker::Unpin for RebindParentEventStream {}
554
555impl futures::stream::FusedStream for RebindParentEventStream {
556 fn is_terminated(&self) -> bool {
557 self.event_receiver.is_terminated()
558 }
559}
560
561impl futures::Stream for RebindParentEventStream {
562 type Item = Result<RebindParentEvent, fidl::Error>;
563
564 fn poll_next(
565 mut self: std::pin::Pin<&mut Self>,
566 cx: &mut std::task::Context<'_>,
567 ) -> std::task::Poll<Option<Self::Item>> {
568 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
569 &mut self.event_receiver,
570 cx
571 )?) {
572 Some(buf) => std::task::Poll::Ready(Some(RebindParentEvent::decode(buf))),
573 None => std::task::Poll::Ready(None),
574 }
575 }
576}
577
578#[derive(Debug)]
579pub enum RebindParentEvent {}
580
581impl RebindParentEvent {
582 fn decode(
584 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
585 ) -> Result<RebindParentEvent, fidl::Error> {
586 let (bytes, _handles) = buf.split_mut();
587 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
588 debug_assert_eq!(tx_header.tx_id, 0);
589 match tx_header.ordinal {
590 _ => Err(fidl::Error::UnknownOrdinal {
591 ordinal: tx_header.ordinal,
592 protocol_name: <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
593 }),
594 }
595 }
596}
597
598pub struct RebindParentRequestStream {
600 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
601 is_terminated: bool,
602}
603
604impl std::marker::Unpin for RebindParentRequestStream {}
605
606impl futures::stream::FusedStream for RebindParentRequestStream {
607 fn is_terminated(&self) -> bool {
608 self.is_terminated
609 }
610}
611
612impl fidl::endpoints::RequestStream for RebindParentRequestStream {
613 type Protocol = RebindParentMarker;
614 type ControlHandle = RebindParentControlHandle;
615
616 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
617 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
618 }
619
620 fn control_handle(&self) -> Self::ControlHandle {
621 RebindParentControlHandle { inner: self.inner.clone() }
622 }
623
624 fn into_inner(
625 self,
626 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
627 {
628 (self.inner, self.is_terminated)
629 }
630
631 fn from_inner(
632 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
633 is_terminated: bool,
634 ) -> Self {
635 Self { inner, is_terminated }
636 }
637}
638
639impl futures::Stream for RebindParentRequestStream {
640 type Item = Result<RebindParentRequest, fidl::Error>;
641
642 fn poll_next(
643 mut self: std::pin::Pin<&mut Self>,
644 cx: &mut std::task::Context<'_>,
645 ) -> std::task::Poll<Option<Self::Item>> {
646 let this = &mut *self;
647 if this.inner.check_shutdown(cx) {
648 this.is_terminated = true;
649 return std::task::Poll::Ready(None);
650 }
651 if this.is_terminated {
652 panic!("polled RebindParentRequestStream after completion");
653 }
654 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
655 |bytes, handles| {
656 match this.inner.channel().read_etc(cx, bytes, handles) {
657 std::task::Poll::Ready(Ok(())) => {}
658 std::task::Poll::Pending => return std::task::Poll::Pending,
659 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
660 this.is_terminated = true;
661 return std::task::Poll::Ready(None);
662 }
663 std::task::Poll::Ready(Err(e)) => {
664 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
665 e.into(),
666 ))));
667 }
668 }
669
670 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
672
673 std::task::Poll::Ready(Some(match header.ordinal {
674 0x74095dc7e942dea5 => {
675 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
676 let mut req = fidl::new_empty!(
677 fidl::encoding::EmptyPayload,
678 fidl::encoding::DefaultFuchsiaResourceDialect
679 );
680 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
681 let control_handle =
682 RebindParentControlHandle { inner: this.inner.clone() };
683 Ok(RebindParentRequest::AddChild {
684 responder: RebindParentAddChildResponder {
685 control_handle: std::mem::ManuallyDrop::new(control_handle),
686 tx_id: header.tx_id,
687 },
688 })
689 }
690 0x68d3023bfd04c269 => {
691 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
692 let mut req = fidl::new_empty!(
693 fidl::encoding::EmptyPayload,
694 fidl::encoding::DefaultFuchsiaResourceDialect
695 );
696 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
697 let control_handle =
698 RebindParentControlHandle { inner: this.inner.clone() };
699 Ok(RebindParentRequest::RemoveChild {
700 responder: RebindParentRemoveChildResponder {
701 control_handle: std::mem::ManuallyDrop::new(control_handle),
702 tx_id: header.tx_id,
703 },
704 })
705 }
706 _ => Err(fidl::Error::UnknownOrdinal {
707 ordinal: header.ordinal,
708 protocol_name:
709 <RebindParentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
710 }),
711 }))
712 },
713 )
714 }
715}
716
717#[derive(Debug)]
718pub enum RebindParentRequest {
719 AddChild { responder: RebindParentAddChildResponder },
720 RemoveChild { responder: RebindParentRemoveChildResponder },
721}
722
723impl RebindParentRequest {
724 #[allow(irrefutable_let_patterns)]
725 pub fn into_add_child(self) -> Option<(RebindParentAddChildResponder)> {
726 if let RebindParentRequest::AddChild { responder } = self {
727 Some((responder))
728 } else {
729 None
730 }
731 }
732
733 #[allow(irrefutable_let_patterns)]
734 pub fn into_remove_child(self) -> Option<(RebindParentRemoveChildResponder)> {
735 if let RebindParentRequest::RemoveChild { responder } = self {
736 Some((responder))
737 } else {
738 None
739 }
740 }
741
742 pub fn method_name(&self) -> &'static str {
744 match *self {
745 RebindParentRequest::AddChild { .. } => "add_child",
746 RebindParentRequest::RemoveChild { .. } => "remove_child",
747 }
748 }
749}
750
751#[derive(Debug, Clone)]
752pub struct RebindParentControlHandle {
753 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
754}
755
756impl RebindParentControlHandle {
757 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
758 self.inner.shutdown_with_epitaph(status.into())
759 }
760}
761
762impl fidl::endpoints::ControlHandle for RebindParentControlHandle {
763 fn shutdown(&self) {
764 self.inner.shutdown()
765 }
766
767 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
768 self.inner.shutdown_with_epitaph(status)
769 }
770
771 fn is_closed(&self) -> bool {
772 self.inner.channel().is_closed()
773 }
774 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
775 self.inner.channel().on_closed()
776 }
777
778 #[cfg(target_os = "fuchsia")]
779 fn signal_peer(
780 &self,
781 clear_mask: zx::Signals,
782 set_mask: zx::Signals,
783 ) -> Result<(), zx_status::Status> {
784 use fidl::Peered;
785 self.inner.channel().signal_peer(clear_mask, set_mask)
786 }
787}
788
789impl RebindParentControlHandle {}
790
791#[must_use = "FIDL methods require a response to be sent"]
792#[derive(Debug)]
793pub struct RebindParentAddChildResponder {
794 control_handle: std::mem::ManuallyDrop<RebindParentControlHandle>,
795 tx_id: u32,
796}
797
798impl std::ops::Drop for RebindParentAddChildResponder {
802 fn drop(&mut self) {
803 self.control_handle.shutdown();
804 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
806 }
807}
808
809impl fidl::endpoints::Responder for RebindParentAddChildResponder {
810 type ControlHandle = RebindParentControlHandle;
811
812 fn control_handle(&self) -> &RebindParentControlHandle {
813 &self.control_handle
814 }
815
816 fn drop_without_shutdown(mut self) {
817 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
819 std::mem::forget(self);
821 }
822}
823
824impl RebindParentAddChildResponder {
825 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
829 let _result = self.send_raw(result);
830 if _result.is_err() {
831 self.control_handle.shutdown();
832 }
833 self.drop_without_shutdown();
834 _result
835 }
836
837 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
839 let _result = self.send_raw(result);
840 self.drop_without_shutdown();
841 _result
842 }
843
844 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
845 self.control_handle
846 .inner
847 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
848 result,
849 self.tx_id,
850 0x74095dc7e942dea5,
851 fidl::encoding::DynamicFlags::empty(),
852 )
853 }
854}
855
856#[must_use = "FIDL methods require a response to be sent"]
857#[derive(Debug)]
858pub struct RebindParentRemoveChildResponder {
859 control_handle: std::mem::ManuallyDrop<RebindParentControlHandle>,
860 tx_id: u32,
861}
862
863impl std::ops::Drop for RebindParentRemoveChildResponder {
867 fn drop(&mut self) {
868 self.control_handle.shutdown();
869 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
871 }
872}
873
874impl fidl::endpoints::Responder for RebindParentRemoveChildResponder {
875 type ControlHandle = RebindParentControlHandle;
876
877 fn control_handle(&self) -> &RebindParentControlHandle {
878 &self.control_handle
879 }
880
881 fn drop_without_shutdown(mut self) {
882 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
884 std::mem::forget(self);
886 }
887}
888
889impl RebindParentRemoveChildResponder {
890 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
894 let _result = self.send_raw(result);
895 if _result.is_err() {
896 self.control_handle.shutdown();
897 }
898 self.drop_without_shutdown();
899 _result
900 }
901
902 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
904 let _result = self.send_raw(result);
905 self.drop_without_shutdown();
906 _result
907 }
908
909 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
910 self.control_handle
911 .inner
912 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
913 result,
914 self.tx_id,
915 0x68d3023bfd04c269,
916 fidl::encoding::DynamicFlags::empty(),
917 )
918 }
919}
920
921mod internal {
922 use super::*;
923}