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_stresstest_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ActorGetActionsResponse {
16 pub iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ActorGetActionsResponse {}
20
21#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
22pub struct ActionIteratorMarker;
23
24impl fidl::endpoints::ProtocolMarker for ActionIteratorMarker {
25 type Proxy = ActionIteratorProxy;
26 type RequestStream = ActionIteratorRequestStream;
27 #[cfg(target_os = "fuchsia")]
28 type SynchronousProxy = ActionIteratorSynchronousProxy;
29
30 const DEBUG_NAME: &'static str = "(anonymous) ActionIterator";
31}
32
33pub trait ActionIteratorProxyInterface: Send + Sync {
34 type GetNextResponseFut: std::future::Future<Output = Result<Vec<Action>, fidl::Error>> + Send;
35 fn r#get_next(&self) -> Self::GetNextResponseFut;
36}
37#[derive(Debug)]
38#[cfg(target_os = "fuchsia")]
39pub struct ActionIteratorSynchronousProxy {
40 client: fidl::client::sync::Client,
41}
42
43#[cfg(target_os = "fuchsia")]
44impl fidl::endpoints::SynchronousProxy for ActionIteratorSynchronousProxy {
45 type Proxy = ActionIteratorProxy;
46 type Protocol = ActionIteratorMarker;
47
48 fn from_channel(inner: fidl::Channel) -> Self {
49 Self::new(inner)
50 }
51
52 fn into_channel(self) -> fidl::Channel {
53 self.client.into_channel()
54 }
55
56 fn as_channel(&self) -> &fidl::Channel {
57 self.client.as_channel()
58 }
59}
60
61#[cfg(target_os = "fuchsia")]
62impl ActionIteratorSynchronousProxy {
63 pub fn new(channel: fidl::Channel) -> Self {
64 Self { client: fidl::client::sync::Client::new(channel) }
65 }
66
67 pub fn into_channel(self) -> fidl::Channel {
68 self.client.into_channel()
69 }
70
71 pub fn wait_for_event(
74 &self,
75 deadline: zx::MonotonicInstant,
76 ) -> Result<ActionIteratorEvent, fidl::Error> {
77 ActionIteratorEvent::decode(self.client.wait_for_event::<ActionIteratorMarker>(deadline)?)
78 }
79
80 pub fn r#get_next(
83 &self,
84 ___deadline: zx::MonotonicInstant,
85 ) -> Result<Vec<Action>, fidl::Error> {
86 let _response = self.client.send_query::<
87 fidl::encoding::EmptyPayload,
88 ActionIteratorGetNextResponse,
89 ActionIteratorMarker,
90 >(
91 (),
92 0x3a6cfa20518e766a,
93 fidl::encoding::DynamicFlags::empty(),
94 ___deadline,
95 )?;
96 Ok(_response.actions)
97 }
98}
99
100#[cfg(target_os = "fuchsia")]
101impl From<ActionIteratorSynchronousProxy> for zx::NullableHandle {
102 fn from(value: ActionIteratorSynchronousProxy) -> Self {
103 value.into_channel().into()
104 }
105}
106
107#[cfg(target_os = "fuchsia")]
108impl From<fidl::Channel> for ActionIteratorSynchronousProxy {
109 fn from(value: fidl::Channel) -> Self {
110 Self::new(value)
111 }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl fidl::endpoints::FromClient for ActionIteratorSynchronousProxy {
116 type Protocol = ActionIteratorMarker;
117
118 fn from_client(value: fidl::endpoints::ClientEnd<ActionIteratorMarker>) -> Self {
119 Self::new(value.into_channel())
120 }
121}
122
123#[derive(Debug, Clone)]
124pub struct ActionIteratorProxy {
125 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
126}
127
128impl fidl::endpoints::Proxy for ActionIteratorProxy {
129 type Protocol = ActionIteratorMarker;
130
131 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
132 Self::new(inner)
133 }
134
135 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
136 self.client.into_channel().map_err(|client| Self { client })
137 }
138
139 fn as_channel(&self) -> &::fidl::AsyncChannel {
140 self.client.as_channel()
141 }
142}
143
144impl ActionIteratorProxy {
145 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
147 let protocol_name = <ActionIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
148 Self { client: fidl::client::Client::new(channel, protocol_name) }
149 }
150
151 pub fn take_event_stream(&self) -> ActionIteratorEventStream {
157 ActionIteratorEventStream { event_receiver: self.client.take_event_receiver() }
158 }
159
160 pub fn r#get_next(
163 &self,
164 ) -> fidl::client::QueryResponseFut<Vec<Action>, fidl::encoding::DefaultFuchsiaResourceDialect>
165 {
166 ActionIteratorProxyInterface::r#get_next(self)
167 }
168}
169
170impl ActionIteratorProxyInterface for ActionIteratorProxy {
171 type GetNextResponseFut =
172 fidl::client::QueryResponseFut<Vec<Action>, fidl::encoding::DefaultFuchsiaResourceDialect>;
173 fn r#get_next(&self) -> Self::GetNextResponseFut {
174 fn _decode(
175 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
176 ) -> Result<Vec<Action>, fidl::Error> {
177 let _response = fidl::client::decode_transaction_body::<
178 ActionIteratorGetNextResponse,
179 fidl::encoding::DefaultFuchsiaResourceDialect,
180 0x3a6cfa20518e766a,
181 >(_buf?)?;
182 Ok(_response.actions)
183 }
184 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Action>>(
185 (),
186 0x3a6cfa20518e766a,
187 fidl::encoding::DynamicFlags::empty(),
188 _decode,
189 )
190 }
191}
192
193pub struct ActionIteratorEventStream {
194 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
195}
196
197impl std::marker::Unpin for ActionIteratorEventStream {}
198
199impl futures::stream::FusedStream for ActionIteratorEventStream {
200 fn is_terminated(&self) -> bool {
201 self.event_receiver.is_terminated()
202 }
203}
204
205impl futures::Stream for ActionIteratorEventStream {
206 type Item = Result<ActionIteratorEvent, fidl::Error>;
207
208 fn poll_next(
209 mut self: std::pin::Pin<&mut Self>,
210 cx: &mut std::task::Context<'_>,
211 ) -> std::task::Poll<Option<Self::Item>> {
212 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
213 &mut self.event_receiver,
214 cx
215 )?) {
216 Some(buf) => std::task::Poll::Ready(Some(ActionIteratorEvent::decode(buf))),
217 None => std::task::Poll::Ready(None),
218 }
219 }
220}
221
222#[derive(Debug)]
223pub enum ActionIteratorEvent {}
224
225impl ActionIteratorEvent {
226 fn decode(
228 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
229 ) -> Result<ActionIteratorEvent, fidl::Error> {
230 let (bytes, _handles) = buf.split_mut();
231 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
232 debug_assert_eq!(tx_header.tx_id, 0);
233 match tx_header.ordinal {
234 _ => Err(fidl::Error::UnknownOrdinal {
235 ordinal: tx_header.ordinal,
236 protocol_name:
237 <ActionIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
238 }),
239 }
240 }
241}
242
243pub struct ActionIteratorRequestStream {
245 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
246 is_terminated: bool,
247}
248
249impl std::marker::Unpin for ActionIteratorRequestStream {}
250
251impl futures::stream::FusedStream for ActionIteratorRequestStream {
252 fn is_terminated(&self) -> bool {
253 self.is_terminated
254 }
255}
256
257impl fidl::endpoints::RequestStream for ActionIteratorRequestStream {
258 type Protocol = ActionIteratorMarker;
259 type ControlHandle = ActionIteratorControlHandle;
260
261 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
262 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
263 }
264
265 fn control_handle(&self) -> Self::ControlHandle {
266 ActionIteratorControlHandle { inner: self.inner.clone() }
267 }
268
269 fn into_inner(
270 self,
271 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
272 {
273 (self.inner, self.is_terminated)
274 }
275
276 fn from_inner(
277 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
278 is_terminated: bool,
279 ) -> Self {
280 Self { inner, is_terminated }
281 }
282}
283
284impl futures::Stream for ActionIteratorRequestStream {
285 type Item = Result<ActionIteratorRequest, fidl::Error>;
286
287 fn poll_next(
288 mut self: std::pin::Pin<&mut Self>,
289 cx: &mut std::task::Context<'_>,
290 ) -> std::task::Poll<Option<Self::Item>> {
291 let this = &mut *self;
292 if this.inner.check_shutdown(cx) {
293 this.is_terminated = true;
294 return std::task::Poll::Ready(None);
295 }
296 if this.is_terminated {
297 panic!("polled ActionIteratorRequestStream after completion");
298 }
299 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
300 |bytes, handles| {
301 match this.inner.channel().read_etc(cx, bytes, handles) {
302 std::task::Poll::Ready(Ok(())) => {}
303 std::task::Poll::Pending => return std::task::Poll::Pending,
304 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
305 this.is_terminated = true;
306 return std::task::Poll::Ready(None);
307 }
308 std::task::Poll::Ready(Err(e)) => {
309 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
310 e.into(),
311 ))));
312 }
313 }
314
315 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
317
318 std::task::Poll::Ready(Some(match header.ordinal {
319 0x3a6cfa20518e766a => {
320 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
321 let mut req = fidl::new_empty!(
322 fidl::encoding::EmptyPayload,
323 fidl::encoding::DefaultFuchsiaResourceDialect
324 );
325 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
326 let control_handle =
327 ActionIteratorControlHandle { inner: this.inner.clone() };
328 Ok(ActionIteratorRequest::GetNext {
329 responder: ActionIteratorGetNextResponder {
330 control_handle: std::mem::ManuallyDrop::new(control_handle),
331 tx_id: header.tx_id,
332 },
333 })
334 }
335 _ => Err(fidl::Error::UnknownOrdinal {
336 ordinal: header.ordinal,
337 protocol_name:
338 <ActionIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
339 }),
340 }))
341 },
342 )
343 }
344}
345
346#[derive(Debug)]
348pub enum ActionIteratorRequest {
349 GetNext { responder: ActionIteratorGetNextResponder },
352}
353
354impl ActionIteratorRequest {
355 #[allow(irrefutable_let_patterns)]
356 pub fn into_get_next(self) -> Option<(ActionIteratorGetNextResponder)> {
357 if let ActionIteratorRequest::GetNext { responder } = self {
358 Some((responder))
359 } else {
360 None
361 }
362 }
363
364 pub fn method_name(&self) -> &'static str {
366 match *self {
367 ActionIteratorRequest::GetNext { .. } => "get_next",
368 }
369 }
370}
371
372#[derive(Debug, Clone)]
373pub struct ActionIteratorControlHandle {
374 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
375}
376
377impl ActionIteratorControlHandle {
378 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
379 self.inner.shutdown_with_epitaph(status.into())
380 }
381}
382
383impl fidl::endpoints::ControlHandle for ActionIteratorControlHandle {
384 fn shutdown(&self) {
385 self.inner.shutdown()
386 }
387
388 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
389 self.inner.shutdown_with_epitaph(status)
390 }
391
392 fn is_closed(&self) -> bool {
393 self.inner.channel().is_closed()
394 }
395 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
396 self.inner.channel().on_closed()
397 }
398
399 #[cfg(target_os = "fuchsia")]
400 fn signal_peer(
401 &self,
402 clear_mask: zx::Signals,
403 set_mask: zx::Signals,
404 ) -> Result<(), zx_status::Status> {
405 use fidl::Peered;
406 self.inner.channel().signal_peer(clear_mask, set_mask)
407 }
408}
409
410impl ActionIteratorControlHandle {}
411
412#[must_use = "FIDL methods require a response to be sent"]
413#[derive(Debug)]
414pub struct ActionIteratorGetNextResponder {
415 control_handle: std::mem::ManuallyDrop<ActionIteratorControlHandle>,
416 tx_id: u32,
417}
418
419impl std::ops::Drop for ActionIteratorGetNextResponder {
423 fn drop(&mut self) {
424 self.control_handle.shutdown();
425 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
427 }
428}
429
430impl fidl::endpoints::Responder for ActionIteratorGetNextResponder {
431 type ControlHandle = ActionIteratorControlHandle;
432
433 fn control_handle(&self) -> &ActionIteratorControlHandle {
434 &self.control_handle
435 }
436
437 fn drop_without_shutdown(mut self) {
438 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
440 std::mem::forget(self);
442 }
443}
444
445impl ActionIteratorGetNextResponder {
446 pub fn send(self, mut actions: &[Action]) -> Result<(), fidl::Error> {
450 let _result = self.send_raw(actions);
451 if _result.is_err() {
452 self.control_handle.shutdown();
453 }
454 self.drop_without_shutdown();
455 _result
456 }
457
458 pub fn send_no_shutdown_on_err(self, mut actions: &[Action]) -> Result<(), fidl::Error> {
460 let _result = self.send_raw(actions);
461 self.drop_without_shutdown();
462 _result
463 }
464
465 fn send_raw(&self, mut actions: &[Action]) -> Result<(), fidl::Error> {
466 self.control_handle.inner.send::<ActionIteratorGetNextResponse>(
467 (actions,),
468 self.tx_id,
469 0x3a6cfa20518e766a,
470 fidl::encoding::DynamicFlags::empty(),
471 )
472 }
473}
474
475#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
476pub struct ActorMarker;
477
478impl fidl::endpoints::ProtocolMarker for ActorMarker {
479 type Proxy = ActorProxy;
480 type RequestStream = ActorRequestStream;
481 #[cfg(target_os = "fuchsia")]
482 type SynchronousProxy = ActorSynchronousProxy;
483
484 const DEBUG_NAME: &'static str = "fuchsia.stresstest.Actor";
485}
486impl fidl::endpoints::DiscoverableProtocolMarker for ActorMarker {}
487
488pub trait ActorProxyInterface: Send + Sync {
489 type GetActionsResponseFut: std::future::Future<
490 Output = Result<fidl::endpoints::ClientEnd<ActionIteratorMarker>, fidl::Error>,
491 > + Send;
492 fn r#get_actions(&self) -> Self::GetActionsResponseFut;
493 type RunResponseFut: std::future::Future<Output = Result<Option<Box<Error>>, fidl::Error>>
494 + Send;
495 fn r#run(&self, action_name: &str, seed: u64) -> Self::RunResponseFut;
496}
497#[derive(Debug)]
498#[cfg(target_os = "fuchsia")]
499pub struct ActorSynchronousProxy {
500 client: fidl::client::sync::Client,
501}
502
503#[cfg(target_os = "fuchsia")]
504impl fidl::endpoints::SynchronousProxy for ActorSynchronousProxy {
505 type Proxy = ActorProxy;
506 type Protocol = ActorMarker;
507
508 fn from_channel(inner: fidl::Channel) -> Self {
509 Self::new(inner)
510 }
511
512 fn into_channel(self) -> fidl::Channel {
513 self.client.into_channel()
514 }
515
516 fn as_channel(&self) -> &fidl::Channel {
517 self.client.as_channel()
518 }
519}
520
521#[cfg(target_os = "fuchsia")]
522impl ActorSynchronousProxy {
523 pub fn new(channel: fidl::Channel) -> Self {
524 Self { client: fidl::client::sync::Client::new(channel) }
525 }
526
527 pub fn into_channel(self) -> fidl::Channel {
528 self.client.into_channel()
529 }
530
531 pub fn wait_for_event(
534 &self,
535 deadline: zx::MonotonicInstant,
536 ) -> Result<ActorEvent, fidl::Error> {
537 ActorEvent::decode(self.client.wait_for_event::<ActorMarker>(deadline)?)
538 }
539
540 pub fn r#get_actions(
542 &self,
543 ___deadline: zx::MonotonicInstant,
544 ) -> Result<fidl::endpoints::ClientEnd<ActionIteratorMarker>, fidl::Error> {
545 let _response = self
546 .client
547 .send_query::<fidl::encoding::EmptyPayload, ActorGetActionsResponse, ActorMarker>(
548 (),
549 0x21b890f66d9d9cff,
550 fidl::encoding::DynamicFlags::empty(),
551 ___deadline,
552 )?;
553 Ok(_response.iterator)
554 }
555
556 pub fn r#run(
559 &self,
560 mut action_name: &str,
561 mut seed: u64,
562 ___deadline: zx::MonotonicInstant,
563 ) -> Result<Option<Box<Error>>, fidl::Error> {
564 let _response = self.client.send_query::<ActorRunRequest, ActorRunResponse, ActorMarker>(
565 (action_name, seed),
566 0x28a8ff83256eef02,
567 fidl::encoding::DynamicFlags::empty(),
568 ___deadline,
569 )?;
570 Ok(_response.error)
571 }
572}
573
574#[cfg(target_os = "fuchsia")]
575impl From<ActorSynchronousProxy> for zx::NullableHandle {
576 fn from(value: ActorSynchronousProxy) -> Self {
577 value.into_channel().into()
578 }
579}
580
581#[cfg(target_os = "fuchsia")]
582impl From<fidl::Channel> for ActorSynchronousProxy {
583 fn from(value: fidl::Channel) -> Self {
584 Self::new(value)
585 }
586}
587
588#[cfg(target_os = "fuchsia")]
589impl fidl::endpoints::FromClient for ActorSynchronousProxy {
590 type Protocol = ActorMarker;
591
592 fn from_client(value: fidl::endpoints::ClientEnd<ActorMarker>) -> Self {
593 Self::new(value.into_channel())
594 }
595}
596
597#[derive(Debug, Clone)]
598pub struct ActorProxy {
599 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
600}
601
602impl fidl::endpoints::Proxy for ActorProxy {
603 type Protocol = ActorMarker;
604
605 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
606 Self::new(inner)
607 }
608
609 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
610 self.client.into_channel().map_err(|client| Self { client })
611 }
612
613 fn as_channel(&self) -> &::fidl::AsyncChannel {
614 self.client.as_channel()
615 }
616}
617
618impl ActorProxy {
619 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
621 let protocol_name = <ActorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
622 Self { client: fidl::client::Client::new(channel, protocol_name) }
623 }
624
625 pub fn take_event_stream(&self) -> ActorEventStream {
631 ActorEventStream { event_receiver: self.client.take_event_receiver() }
632 }
633
634 pub fn r#get_actions(
636 &self,
637 ) -> fidl::client::QueryResponseFut<
638 fidl::endpoints::ClientEnd<ActionIteratorMarker>,
639 fidl::encoding::DefaultFuchsiaResourceDialect,
640 > {
641 ActorProxyInterface::r#get_actions(self)
642 }
643
644 pub fn r#run(
647 &self,
648 mut action_name: &str,
649 mut seed: u64,
650 ) -> fidl::client::QueryResponseFut<
651 Option<Box<Error>>,
652 fidl::encoding::DefaultFuchsiaResourceDialect,
653 > {
654 ActorProxyInterface::r#run(self, action_name, seed)
655 }
656}
657
658impl ActorProxyInterface for ActorProxy {
659 type GetActionsResponseFut = fidl::client::QueryResponseFut<
660 fidl::endpoints::ClientEnd<ActionIteratorMarker>,
661 fidl::encoding::DefaultFuchsiaResourceDialect,
662 >;
663 fn r#get_actions(&self) -> Self::GetActionsResponseFut {
664 fn _decode(
665 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
666 ) -> Result<fidl::endpoints::ClientEnd<ActionIteratorMarker>, fidl::Error> {
667 let _response = fidl::client::decode_transaction_body::<
668 ActorGetActionsResponse,
669 fidl::encoding::DefaultFuchsiaResourceDialect,
670 0x21b890f66d9d9cff,
671 >(_buf?)?;
672 Ok(_response.iterator)
673 }
674 self.client.send_query_and_decode::<
675 fidl::encoding::EmptyPayload,
676 fidl::endpoints::ClientEnd<ActionIteratorMarker>,
677 >(
678 (),
679 0x21b890f66d9d9cff,
680 fidl::encoding::DynamicFlags::empty(),
681 _decode,
682 )
683 }
684
685 type RunResponseFut = fidl::client::QueryResponseFut<
686 Option<Box<Error>>,
687 fidl::encoding::DefaultFuchsiaResourceDialect,
688 >;
689 fn r#run(&self, mut action_name: &str, mut seed: u64) -> Self::RunResponseFut {
690 fn _decode(
691 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
692 ) -> Result<Option<Box<Error>>, fidl::Error> {
693 let _response = fidl::client::decode_transaction_body::<
694 ActorRunResponse,
695 fidl::encoding::DefaultFuchsiaResourceDialect,
696 0x28a8ff83256eef02,
697 >(_buf?)?;
698 Ok(_response.error)
699 }
700 self.client.send_query_and_decode::<ActorRunRequest, Option<Box<Error>>>(
701 (action_name, seed),
702 0x28a8ff83256eef02,
703 fidl::encoding::DynamicFlags::empty(),
704 _decode,
705 )
706 }
707}
708
709pub struct ActorEventStream {
710 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
711}
712
713impl std::marker::Unpin for ActorEventStream {}
714
715impl futures::stream::FusedStream for ActorEventStream {
716 fn is_terminated(&self) -> bool {
717 self.event_receiver.is_terminated()
718 }
719}
720
721impl futures::Stream for ActorEventStream {
722 type Item = Result<ActorEvent, fidl::Error>;
723
724 fn poll_next(
725 mut self: std::pin::Pin<&mut Self>,
726 cx: &mut std::task::Context<'_>,
727 ) -> std::task::Poll<Option<Self::Item>> {
728 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
729 &mut self.event_receiver,
730 cx
731 )?) {
732 Some(buf) => std::task::Poll::Ready(Some(ActorEvent::decode(buf))),
733 None => std::task::Poll::Ready(None),
734 }
735 }
736}
737
738#[derive(Debug)]
739pub enum ActorEvent {}
740
741impl ActorEvent {
742 fn decode(
744 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
745 ) -> Result<ActorEvent, fidl::Error> {
746 let (bytes, _handles) = buf.split_mut();
747 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
748 debug_assert_eq!(tx_header.tx_id, 0);
749 match tx_header.ordinal {
750 _ => Err(fidl::Error::UnknownOrdinal {
751 ordinal: tx_header.ordinal,
752 protocol_name: <ActorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
753 }),
754 }
755 }
756}
757
758pub struct ActorRequestStream {
760 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
761 is_terminated: bool,
762}
763
764impl std::marker::Unpin for ActorRequestStream {}
765
766impl futures::stream::FusedStream for ActorRequestStream {
767 fn is_terminated(&self) -> bool {
768 self.is_terminated
769 }
770}
771
772impl fidl::endpoints::RequestStream for ActorRequestStream {
773 type Protocol = ActorMarker;
774 type ControlHandle = ActorControlHandle;
775
776 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
777 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
778 }
779
780 fn control_handle(&self) -> Self::ControlHandle {
781 ActorControlHandle { inner: self.inner.clone() }
782 }
783
784 fn into_inner(
785 self,
786 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
787 {
788 (self.inner, self.is_terminated)
789 }
790
791 fn from_inner(
792 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
793 is_terminated: bool,
794 ) -> Self {
795 Self { inner, is_terminated }
796 }
797}
798
799impl futures::Stream for ActorRequestStream {
800 type Item = Result<ActorRequest, fidl::Error>;
801
802 fn poll_next(
803 mut self: std::pin::Pin<&mut Self>,
804 cx: &mut std::task::Context<'_>,
805 ) -> std::task::Poll<Option<Self::Item>> {
806 let this = &mut *self;
807 if this.inner.check_shutdown(cx) {
808 this.is_terminated = true;
809 return std::task::Poll::Ready(None);
810 }
811 if this.is_terminated {
812 panic!("polled ActorRequestStream after completion");
813 }
814 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
815 |bytes, handles| {
816 match this.inner.channel().read_etc(cx, bytes, handles) {
817 std::task::Poll::Ready(Ok(())) => {}
818 std::task::Poll::Pending => return std::task::Poll::Pending,
819 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
820 this.is_terminated = true;
821 return std::task::Poll::Ready(None);
822 }
823 std::task::Poll::Ready(Err(e)) => {
824 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
825 e.into(),
826 ))));
827 }
828 }
829
830 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
832
833 std::task::Poll::Ready(Some(match header.ordinal {
834 0x21b890f66d9d9cff => {
835 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
836 let mut req = fidl::new_empty!(
837 fidl::encoding::EmptyPayload,
838 fidl::encoding::DefaultFuchsiaResourceDialect
839 );
840 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
841 let control_handle = ActorControlHandle { inner: this.inner.clone() };
842 Ok(ActorRequest::GetActions {
843 responder: ActorGetActionsResponder {
844 control_handle: std::mem::ManuallyDrop::new(control_handle),
845 tx_id: header.tx_id,
846 },
847 })
848 }
849 0x28a8ff83256eef02 => {
850 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
851 let mut req = fidl::new_empty!(
852 ActorRunRequest,
853 fidl::encoding::DefaultFuchsiaResourceDialect
854 );
855 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActorRunRequest>(&header, _body_bytes, handles, &mut req)?;
856 let control_handle = ActorControlHandle { inner: this.inner.clone() };
857 Ok(ActorRequest::Run {
858 action_name: req.action_name,
859 seed: req.seed,
860
861 responder: ActorRunResponder {
862 control_handle: std::mem::ManuallyDrop::new(control_handle),
863 tx_id: header.tx_id,
864 },
865 })
866 }
867 _ => Err(fidl::Error::UnknownOrdinal {
868 ordinal: header.ordinal,
869 protocol_name: <ActorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
870 }),
871 }))
872 },
873 )
874 }
875}
876
877#[derive(Debug)]
881pub enum ActorRequest {
882 GetActions { responder: ActorGetActionsResponder },
884 Run { action_name: String, seed: u64, responder: ActorRunResponder },
887}
888
889impl ActorRequest {
890 #[allow(irrefutable_let_patterns)]
891 pub fn into_get_actions(self) -> Option<(ActorGetActionsResponder)> {
892 if let ActorRequest::GetActions { responder } = self { Some((responder)) } else { None }
893 }
894
895 #[allow(irrefutable_let_patterns)]
896 pub fn into_run(self) -> Option<(String, u64, ActorRunResponder)> {
897 if let ActorRequest::Run { action_name, seed, responder } = self {
898 Some((action_name, seed, responder))
899 } else {
900 None
901 }
902 }
903
904 pub fn method_name(&self) -> &'static str {
906 match *self {
907 ActorRequest::GetActions { .. } => "get_actions",
908 ActorRequest::Run { .. } => "run",
909 }
910 }
911}
912
913#[derive(Debug, Clone)]
914pub struct ActorControlHandle {
915 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
916}
917
918impl ActorControlHandle {
919 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
920 self.inner.shutdown_with_epitaph(status.into())
921 }
922}
923
924impl fidl::endpoints::ControlHandle for ActorControlHandle {
925 fn shutdown(&self) {
926 self.inner.shutdown()
927 }
928
929 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
930 self.inner.shutdown_with_epitaph(status)
931 }
932
933 fn is_closed(&self) -> bool {
934 self.inner.channel().is_closed()
935 }
936 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
937 self.inner.channel().on_closed()
938 }
939
940 #[cfg(target_os = "fuchsia")]
941 fn signal_peer(
942 &self,
943 clear_mask: zx::Signals,
944 set_mask: zx::Signals,
945 ) -> Result<(), zx_status::Status> {
946 use fidl::Peered;
947 self.inner.channel().signal_peer(clear_mask, set_mask)
948 }
949}
950
951impl ActorControlHandle {}
952
953#[must_use = "FIDL methods require a response to be sent"]
954#[derive(Debug)]
955pub struct ActorGetActionsResponder {
956 control_handle: std::mem::ManuallyDrop<ActorControlHandle>,
957 tx_id: u32,
958}
959
960impl std::ops::Drop for ActorGetActionsResponder {
964 fn drop(&mut self) {
965 self.control_handle.shutdown();
966 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
968 }
969}
970
971impl fidl::endpoints::Responder for ActorGetActionsResponder {
972 type ControlHandle = ActorControlHandle;
973
974 fn control_handle(&self) -> &ActorControlHandle {
975 &self.control_handle
976 }
977
978 fn drop_without_shutdown(mut self) {
979 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
981 std::mem::forget(self);
983 }
984}
985
986impl ActorGetActionsResponder {
987 pub fn send(
991 self,
992 mut iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
993 ) -> Result<(), fidl::Error> {
994 let _result = self.send_raw(iterator);
995 if _result.is_err() {
996 self.control_handle.shutdown();
997 }
998 self.drop_without_shutdown();
999 _result
1000 }
1001
1002 pub fn send_no_shutdown_on_err(
1004 self,
1005 mut iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
1006 ) -> Result<(), fidl::Error> {
1007 let _result = self.send_raw(iterator);
1008 self.drop_without_shutdown();
1009 _result
1010 }
1011
1012 fn send_raw(
1013 &self,
1014 mut iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
1015 ) -> Result<(), fidl::Error> {
1016 self.control_handle.inner.send::<ActorGetActionsResponse>(
1017 (iterator,),
1018 self.tx_id,
1019 0x21b890f66d9d9cff,
1020 fidl::encoding::DynamicFlags::empty(),
1021 )
1022 }
1023}
1024
1025#[must_use = "FIDL methods require a response to be sent"]
1026#[derive(Debug)]
1027pub struct ActorRunResponder {
1028 control_handle: std::mem::ManuallyDrop<ActorControlHandle>,
1029 tx_id: u32,
1030}
1031
1032impl std::ops::Drop for ActorRunResponder {
1036 fn drop(&mut self) {
1037 self.control_handle.shutdown();
1038 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1040 }
1041}
1042
1043impl fidl::endpoints::Responder for ActorRunResponder {
1044 type ControlHandle = ActorControlHandle;
1045
1046 fn control_handle(&self) -> &ActorControlHandle {
1047 &self.control_handle
1048 }
1049
1050 fn drop_without_shutdown(mut self) {
1051 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1053 std::mem::forget(self);
1055 }
1056}
1057
1058impl ActorRunResponder {
1059 pub fn send(self, mut error: Option<&Error>) -> Result<(), fidl::Error> {
1063 let _result = self.send_raw(error);
1064 if _result.is_err() {
1065 self.control_handle.shutdown();
1066 }
1067 self.drop_without_shutdown();
1068 _result
1069 }
1070
1071 pub fn send_no_shutdown_on_err(self, mut error: Option<&Error>) -> Result<(), fidl::Error> {
1073 let _result = self.send_raw(error);
1074 self.drop_without_shutdown();
1075 _result
1076 }
1077
1078 fn send_raw(&self, mut error: Option<&Error>) -> Result<(), fidl::Error> {
1079 self.control_handle.inner.send::<ActorRunResponse>(
1080 (error,),
1081 self.tx_id,
1082 0x28a8ff83256eef02,
1083 fidl::encoding::DynamicFlags::empty(),
1084 )
1085 }
1086}
1087
1088mod internal {
1089 use super::*;
1090
1091 impl fidl::encoding::ResourceTypeMarker for ActorGetActionsResponse {
1092 type Borrowed<'a> = &'a mut Self;
1093 fn take_or_borrow<'a>(
1094 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1095 ) -> Self::Borrowed<'a> {
1096 value
1097 }
1098 }
1099
1100 unsafe impl fidl::encoding::TypeMarker for ActorGetActionsResponse {
1101 type Owned = Self;
1102
1103 #[inline(always)]
1104 fn inline_align(_context: fidl::encoding::Context) -> usize {
1105 4
1106 }
1107
1108 #[inline(always)]
1109 fn inline_size(_context: fidl::encoding::Context) -> usize {
1110 4
1111 }
1112 }
1113
1114 unsafe impl
1115 fidl::encoding::Encode<
1116 ActorGetActionsResponse,
1117 fidl::encoding::DefaultFuchsiaResourceDialect,
1118 > for &mut ActorGetActionsResponse
1119 {
1120 #[inline]
1121 unsafe fn encode(
1122 self,
1123 encoder: &mut fidl::encoding::Encoder<
1124 '_,
1125 fidl::encoding::DefaultFuchsiaResourceDialect,
1126 >,
1127 offset: usize,
1128 _depth: fidl::encoding::Depth,
1129 ) -> fidl::Result<()> {
1130 encoder.debug_check_bounds::<ActorGetActionsResponse>(offset);
1131 fidl::encoding::Encode::<ActorGetActionsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1133 (
1134 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
1135 ),
1136 encoder, offset, _depth
1137 )
1138 }
1139 }
1140 unsafe impl<
1141 T0: fidl::encoding::Encode<
1142 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>>,
1143 fidl::encoding::DefaultFuchsiaResourceDialect,
1144 >,
1145 >
1146 fidl::encoding::Encode<
1147 ActorGetActionsResponse,
1148 fidl::encoding::DefaultFuchsiaResourceDialect,
1149 > for (T0,)
1150 {
1151 #[inline]
1152 unsafe fn encode(
1153 self,
1154 encoder: &mut fidl::encoding::Encoder<
1155 '_,
1156 fidl::encoding::DefaultFuchsiaResourceDialect,
1157 >,
1158 offset: usize,
1159 depth: fidl::encoding::Depth,
1160 ) -> fidl::Result<()> {
1161 encoder.debug_check_bounds::<ActorGetActionsResponse>(offset);
1162 self.0.encode(encoder, offset + 0, depth)?;
1166 Ok(())
1167 }
1168 }
1169
1170 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1171 for ActorGetActionsResponse
1172 {
1173 #[inline(always)]
1174 fn new_empty() -> Self {
1175 Self {
1176 iterator: fidl::new_empty!(
1177 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>>,
1178 fidl::encoding::DefaultFuchsiaResourceDialect
1179 ),
1180 }
1181 }
1182
1183 #[inline]
1184 unsafe fn decode(
1185 &mut self,
1186 decoder: &mut fidl::encoding::Decoder<
1187 '_,
1188 fidl::encoding::DefaultFuchsiaResourceDialect,
1189 >,
1190 offset: usize,
1191 _depth: fidl::encoding::Depth,
1192 ) -> fidl::Result<()> {
1193 decoder.debug_check_bounds::<Self>(offset);
1194 fidl::decode!(
1196 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>>,
1197 fidl::encoding::DefaultFuchsiaResourceDialect,
1198 &mut self.iterator,
1199 decoder,
1200 offset + 0,
1201 _depth
1202 )?;
1203 Ok(())
1204 }
1205 }
1206}