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 fidl::endpoints::ControlHandle for ActionIteratorControlHandle {
378 fn shutdown(&self) {
379 self.inner.shutdown()
380 }
381
382 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
383 self.inner.shutdown_with_epitaph(status)
384 }
385
386 fn is_closed(&self) -> bool {
387 self.inner.channel().is_closed()
388 }
389 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
390 self.inner.channel().on_closed()
391 }
392
393 #[cfg(target_os = "fuchsia")]
394 fn signal_peer(
395 &self,
396 clear_mask: zx::Signals,
397 set_mask: zx::Signals,
398 ) -> Result<(), zx_status::Status> {
399 use fidl::Peered;
400 self.inner.channel().signal_peer(clear_mask, set_mask)
401 }
402}
403
404impl ActionIteratorControlHandle {}
405
406#[must_use = "FIDL methods require a response to be sent"]
407#[derive(Debug)]
408pub struct ActionIteratorGetNextResponder {
409 control_handle: std::mem::ManuallyDrop<ActionIteratorControlHandle>,
410 tx_id: u32,
411}
412
413impl std::ops::Drop for ActionIteratorGetNextResponder {
417 fn drop(&mut self) {
418 self.control_handle.shutdown();
419 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
421 }
422}
423
424impl fidl::endpoints::Responder for ActionIteratorGetNextResponder {
425 type ControlHandle = ActionIteratorControlHandle;
426
427 fn control_handle(&self) -> &ActionIteratorControlHandle {
428 &self.control_handle
429 }
430
431 fn drop_without_shutdown(mut self) {
432 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
434 std::mem::forget(self);
436 }
437}
438
439impl ActionIteratorGetNextResponder {
440 pub fn send(self, mut actions: &[Action]) -> Result<(), fidl::Error> {
444 let _result = self.send_raw(actions);
445 if _result.is_err() {
446 self.control_handle.shutdown();
447 }
448 self.drop_without_shutdown();
449 _result
450 }
451
452 pub fn send_no_shutdown_on_err(self, mut actions: &[Action]) -> Result<(), fidl::Error> {
454 let _result = self.send_raw(actions);
455 self.drop_without_shutdown();
456 _result
457 }
458
459 fn send_raw(&self, mut actions: &[Action]) -> Result<(), fidl::Error> {
460 self.control_handle.inner.send::<ActionIteratorGetNextResponse>(
461 (actions,),
462 self.tx_id,
463 0x3a6cfa20518e766a,
464 fidl::encoding::DynamicFlags::empty(),
465 )
466 }
467}
468
469#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
470pub struct ActorMarker;
471
472impl fidl::endpoints::ProtocolMarker for ActorMarker {
473 type Proxy = ActorProxy;
474 type RequestStream = ActorRequestStream;
475 #[cfg(target_os = "fuchsia")]
476 type SynchronousProxy = ActorSynchronousProxy;
477
478 const DEBUG_NAME: &'static str = "fuchsia.stresstest.Actor";
479}
480impl fidl::endpoints::DiscoverableProtocolMarker for ActorMarker {}
481
482pub trait ActorProxyInterface: Send + Sync {
483 type GetActionsResponseFut: std::future::Future<
484 Output = Result<fidl::endpoints::ClientEnd<ActionIteratorMarker>, fidl::Error>,
485 > + Send;
486 fn r#get_actions(&self) -> Self::GetActionsResponseFut;
487 type RunResponseFut: std::future::Future<Output = Result<Option<Box<Error>>, fidl::Error>>
488 + Send;
489 fn r#run(&self, action_name: &str, seed: u64) -> Self::RunResponseFut;
490}
491#[derive(Debug)]
492#[cfg(target_os = "fuchsia")]
493pub struct ActorSynchronousProxy {
494 client: fidl::client::sync::Client,
495}
496
497#[cfg(target_os = "fuchsia")]
498impl fidl::endpoints::SynchronousProxy for ActorSynchronousProxy {
499 type Proxy = ActorProxy;
500 type Protocol = ActorMarker;
501
502 fn from_channel(inner: fidl::Channel) -> Self {
503 Self::new(inner)
504 }
505
506 fn into_channel(self) -> fidl::Channel {
507 self.client.into_channel()
508 }
509
510 fn as_channel(&self) -> &fidl::Channel {
511 self.client.as_channel()
512 }
513}
514
515#[cfg(target_os = "fuchsia")]
516impl ActorSynchronousProxy {
517 pub fn new(channel: fidl::Channel) -> Self {
518 Self { client: fidl::client::sync::Client::new(channel) }
519 }
520
521 pub fn into_channel(self) -> fidl::Channel {
522 self.client.into_channel()
523 }
524
525 pub fn wait_for_event(
528 &self,
529 deadline: zx::MonotonicInstant,
530 ) -> Result<ActorEvent, fidl::Error> {
531 ActorEvent::decode(self.client.wait_for_event::<ActorMarker>(deadline)?)
532 }
533
534 pub fn r#get_actions(
536 &self,
537 ___deadline: zx::MonotonicInstant,
538 ) -> Result<fidl::endpoints::ClientEnd<ActionIteratorMarker>, fidl::Error> {
539 let _response = self
540 .client
541 .send_query::<fidl::encoding::EmptyPayload, ActorGetActionsResponse, ActorMarker>(
542 (),
543 0x21b890f66d9d9cff,
544 fidl::encoding::DynamicFlags::empty(),
545 ___deadline,
546 )?;
547 Ok(_response.iterator)
548 }
549
550 pub fn r#run(
553 &self,
554 mut action_name: &str,
555 mut seed: u64,
556 ___deadline: zx::MonotonicInstant,
557 ) -> Result<Option<Box<Error>>, fidl::Error> {
558 let _response = self.client.send_query::<ActorRunRequest, ActorRunResponse, ActorMarker>(
559 (action_name, seed),
560 0x28a8ff83256eef02,
561 fidl::encoding::DynamicFlags::empty(),
562 ___deadline,
563 )?;
564 Ok(_response.error)
565 }
566}
567
568#[cfg(target_os = "fuchsia")]
569impl From<ActorSynchronousProxy> for zx::NullableHandle {
570 fn from(value: ActorSynchronousProxy) -> Self {
571 value.into_channel().into()
572 }
573}
574
575#[cfg(target_os = "fuchsia")]
576impl From<fidl::Channel> for ActorSynchronousProxy {
577 fn from(value: fidl::Channel) -> Self {
578 Self::new(value)
579 }
580}
581
582#[cfg(target_os = "fuchsia")]
583impl fidl::endpoints::FromClient for ActorSynchronousProxy {
584 type Protocol = ActorMarker;
585
586 fn from_client(value: fidl::endpoints::ClientEnd<ActorMarker>) -> Self {
587 Self::new(value.into_channel())
588 }
589}
590
591#[derive(Debug, Clone)]
592pub struct ActorProxy {
593 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
594}
595
596impl fidl::endpoints::Proxy for ActorProxy {
597 type Protocol = ActorMarker;
598
599 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
600 Self::new(inner)
601 }
602
603 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
604 self.client.into_channel().map_err(|client| Self { client })
605 }
606
607 fn as_channel(&self) -> &::fidl::AsyncChannel {
608 self.client.as_channel()
609 }
610}
611
612impl ActorProxy {
613 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
615 let protocol_name = <ActorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
616 Self { client: fidl::client::Client::new(channel, protocol_name) }
617 }
618
619 pub fn take_event_stream(&self) -> ActorEventStream {
625 ActorEventStream { event_receiver: self.client.take_event_receiver() }
626 }
627
628 pub fn r#get_actions(
630 &self,
631 ) -> fidl::client::QueryResponseFut<
632 fidl::endpoints::ClientEnd<ActionIteratorMarker>,
633 fidl::encoding::DefaultFuchsiaResourceDialect,
634 > {
635 ActorProxyInterface::r#get_actions(self)
636 }
637
638 pub fn r#run(
641 &self,
642 mut action_name: &str,
643 mut seed: u64,
644 ) -> fidl::client::QueryResponseFut<
645 Option<Box<Error>>,
646 fidl::encoding::DefaultFuchsiaResourceDialect,
647 > {
648 ActorProxyInterface::r#run(self, action_name, seed)
649 }
650}
651
652impl ActorProxyInterface for ActorProxy {
653 type GetActionsResponseFut = fidl::client::QueryResponseFut<
654 fidl::endpoints::ClientEnd<ActionIteratorMarker>,
655 fidl::encoding::DefaultFuchsiaResourceDialect,
656 >;
657 fn r#get_actions(&self) -> Self::GetActionsResponseFut {
658 fn _decode(
659 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
660 ) -> Result<fidl::endpoints::ClientEnd<ActionIteratorMarker>, fidl::Error> {
661 let _response = fidl::client::decode_transaction_body::<
662 ActorGetActionsResponse,
663 fidl::encoding::DefaultFuchsiaResourceDialect,
664 0x21b890f66d9d9cff,
665 >(_buf?)?;
666 Ok(_response.iterator)
667 }
668 self.client.send_query_and_decode::<
669 fidl::encoding::EmptyPayload,
670 fidl::endpoints::ClientEnd<ActionIteratorMarker>,
671 >(
672 (),
673 0x21b890f66d9d9cff,
674 fidl::encoding::DynamicFlags::empty(),
675 _decode,
676 )
677 }
678
679 type RunResponseFut = fidl::client::QueryResponseFut<
680 Option<Box<Error>>,
681 fidl::encoding::DefaultFuchsiaResourceDialect,
682 >;
683 fn r#run(&self, mut action_name: &str, mut seed: u64) -> Self::RunResponseFut {
684 fn _decode(
685 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
686 ) -> Result<Option<Box<Error>>, fidl::Error> {
687 let _response = fidl::client::decode_transaction_body::<
688 ActorRunResponse,
689 fidl::encoding::DefaultFuchsiaResourceDialect,
690 0x28a8ff83256eef02,
691 >(_buf?)?;
692 Ok(_response.error)
693 }
694 self.client.send_query_and_decode::<ActorRunRequest, Option<Box<Error>>>(
695 (action_name, seed),
696 0x28a8ff83256eef02,
697 fidl::encoding::DynamicFlags::empty(),
698 _decode,
699 )
700 }
701}
702
703pub struct ActorEventStream {
704 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
705}
706
707impl std::marker::Unpin for ActorEventStream {}
708
709impl futures::stream::FusedStream for ActorEventStream {
710 fn is_terminated(&self) -> bool {
711 self.event_receiver.is_terminated()
712 }
713}
714
715impl futures::Stream for ActorEventStream {
716 type Item = Result<ActorEvent, fidl::Error>;
717
718 fn poll_next(
719 mut self: std::pin::Pin<&mut Self>,
720 cx: &mut std::task::Context<'_>,
721 ) -> std::task::Poll<Option<Self::Item>> {
722 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
723 &mut self.event_receiver,
724 cx
725 )?) {
726 Some(buf) => std::task::Poll::Ready(Some(ActorEvent::decode(buf))),
727 None => std::task::Poll::Ready(None),
728 }
729 }
730}
731
732#[derive(Debug)]
733pub enum ActorEvent {}
734
735impl ActorEvent {
736 fn decode(
738 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
739 ) -> Result<ActorEvent, fidl::Error> {
740 let (bytes, _handles) = buf.split_mut();
741 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
742 debug_assert_eq!(tx_header.tx_id, 0);
743 match tx_header.ordinal {
744 _ => Err(fidl::Error::UnknownOrdinal {
745 ordinal: tx_header.ordinal,
746 protocol_name: <ActorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
747 }),
748 }
749 }
750}
751
752pub struct ActorRequestStream {
754 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
755 is_terminated: bool,
756}
757
758impl std::marker::Unpin for ActorRequestStream {}
759
760impl futures::stream::FusedStream for ActorRequestStream {
761 fn is_terminated(&self) -> bool {
762 self.is_terminated
763 }
764}
765
766impl fidl::endpoints::RequestStream for ActorRequestStream {
767 type Protocol = ActorMarker;
768 type ControlHandle = ActorControlHandle;
769
770 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
771 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
772 }
773
774 fn control_handle(&self) -> Self::ControlHandle {
775 ActorControlHandle { inner: self.inner.clone() }
776 }
777
778 fn into_inner(
779 self,
780 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
781 {
782 (self.inner, self.is_terminated)
783 }
784
785 fn from_inner(
786 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
787 is_terminated: bool,
788 ) -> Self {
789 Self { inner, is_terminated }
790 }
791}
792
793impl futures::Stream for ActorRequestStream {
794 type Item = Result<ActorRequest, fidl::Error>;
795
796 fn poll_next(
797 mut self: std::pin::Pin<&mut Self>,
798 cx: &mut std::task::Context<'_>,
799 ) -> std::task::Poll<Option<Self::Item>> {
800 let this = &mut *self;
801 if this.inner.check_shutdown(cx) {
802 this.is_terminated = true;
803 return std::task::Poll::Ready(None);
804 }
805 if this.is_terminated {
806 panic!("polled ActorRequestStream after completion");
807 }
808 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
809 |bytes, handles| {
810 match this.inner.channel().read_etc(cx, bytes, handles) {
811 std::task::Poll::Ready(Ok(())) => {}
812 std::task::Poll::Pending => return std::task::Poll::Pending,
813 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
814 this.is_terminated = true;
815 return std::task::Poll::Ready(None);
816 }
817 std::task::Poll::Ready(Err(e)) => {
818 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
819 e.into(),
820 ))));
821 }
822 }
823
824 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
826
827 std::task::Poll::Ready(Some(match header.ordinal {
828 0x21b890f66d9d9cff => {
829 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
830 let mut req = fidl::new_empty!(
831 fidl::encoding::EmptyPayload,
832 fidl::encoding::DefaultFuchsiaResourceDialect
833 );
834 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
835 let control_handle = ActorControlHandle { inner: this.inner.clone() };
836 Ok(ActorRequest::GetActions {
837 responder: ActorGetActionsResponder {
838 control_handle: std::mem::ManuallyDrop::new(control_handle),
839 tx_id: header.tx_id,
840 },
841 })
842 }
843 0x28a8ff83256eef02 => {
844 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
845 let mut req = fidl::new_empty!(
846 ActorRunRequest,
847 fidl::encoding::DefaultFuchsiaResourceDialect
848 );
849 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ActorRunRequest>(&header, _body_bytes, handles, &mut req)?;
850 let control_handle = ActorControlHandle { inner: this.inner.clone() };
851 Ok(ActorRequest::Run {
852 action_name: req.action_name,
853 seed: req.seed,
854
855 responder: ActorRunResponder {
856 control_handle: std::mem::ManuallyDrop::new(control_handle),
857 tx_id: header.tx_id,
858 },
859 })
860 }
861 _ => Err(fidl::Error::UnknownOrdinal {
862 ordinal: header.ordinal,
863 protocol_name: <ActorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
864 }),
865 }))
866 },
867 )
868 }
869}
870
871#[derive(Debug)]
875pub enum ActorRequest {
876 GetActions { responder: ActorGetActionsResponder },
878 Run { action_name: String, seed: u64, responder: ActorRunResponder },
881}
882
883impl ActorRequest {
884 #[allow(irrefutable_let_patterns)]
885 pub fn into_get_actions(self) -> Option<(ActorGetActionsResponder)> {
886 if let ActorRequest::GetActions { responder } = self { Some((responder)) } else { None }
887 }
888
889 #[allow(irrefutable_let_patterns)]
890 pub fn into_run(self) -> Option<(String, u64, ActorRunResponder)> {
891 if let ActorRequest::Run { action_name, seed, responder } = self {
892 Some((action_name, seed, responder))
893 } else {
894 None
895 }
896 }
897
898 pub fn method_name(&self) -> &'static str {
900 match *self {
901 ActorRequest::GetActions { .. } => "get_actions",
902 ActorRequest::Run { .. } => "run",
903 }
904 }
905}
906
907#[derive(Debug, Clone)]
908pub struct ActorControlHandle {
909 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
910}
911
912impl fidl::endpoints::ControlHandle for ActorControlHandle {
913 fn shutdown(&self) {
914 self.inner.shutdown()
915 }
916
917 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
918 self.inner.shutdown_with_epitaph(status)
919 }
920
921 fn is_closed(&self) -> bool {
922 self.inner.channel().is_closed()
923 }
924 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
925 self.inner.channel().on_closed()
926 }
927
928 #[cfg(target_os = "fuchsia")]
929 fn signal_peer(
930 &self,
931 clear_mask: zx::Signals,
932 set_mask: zx::Signals,
933 ) -> Result<(), zx_status::Status> {
934 use fidl::Peered;
935 self.inner.channel().signal_peer(clear_mask, set_mask)
936 }
937}
938
939impl ActorControlHandle {}
940
941#[must_use = "FIDL methods require a response to be sent"]
942#[derive(Debug)]
943pub struct ActorGetActionsResponder {
944 control_handle: std::mem::ManuallyDrop<ActorControlHandle>,
945 tx_id: u32,
946}
947
948impl std::ops::Drop for ActorGetActionsResponder {
952 fn drop(&mut self) {
953 self.control_handle.shutdown();
954 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
956 }
957}
958
959impl fidl::endpoints::Responder for ActorGetActionsResponder {
960 type ControlHandle = ActorControlHandle;
961
962 fn control_handle(&self) -> &ActorControlHandle {
963 &self.control_handle
964 }
965
966 fn drop_without_shutdown(mut self) {
967 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
969 std::mem::forget(self);
971 }
972}
973
974impl ActorGetActionsResponder {
975 pub fn send(
979 self,
980 mut iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
981 ) -> Result<(), fidl::Error> {
982 let _result = self.send_raw(iterator);
983 if _result.is_err() {
984 self.control_handle.shutdown();
985 }
986 self.drop_without_shutdown();
987 _result
988 }
989
990 pub fn send_no_shutdown_on_err(
992 self,
993 mut iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
994 ) -> Result<(), fidl::Error> {
995 let _result = self.send_raw(iterator);
996 self.drop_without_shutdown();
997 _result
998 }
999
1000 fn send_raw(
1001 &self,
1002 mut iterator: fidl::endpoints::ClientEnd<ActionIteratorMarker>,
1003 ) -> Result<(), fidl::Error> {
1004 self.control_handle.inner.send::<ActorGetActionsResponse>(
1005 (iterator,),
1006 self.tx_id,
1007 0x21b890f66d9d9cff,
1008 fidl::encoding::DynamicFlags::empty(),
1009 )
1010 }
1011}
1012
1013#[must_use = "FIDL methods require a response to be sent"]
1014#[derive(Debug)]
1015pub struct ActorRunResponder {
1016 control_handle: std::mem::ManuallyDrop<ActorControlHandle>,
1017 tx_id: u32,
1018}
1019
1020impl std::ops::Drop for ActorRunResponder {
1024 fn drop(&mut self) {
1025 self.control_handle.shutdown();
1026 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1028 }
1029}
1030
1031impl fidl::endpoints::Responder for ActorRunResponder {
1032 type ControlHandle = ActorControlHandle;
1033
1034 fn control_handle(&self) -> &ActorControlHandle {
1035 &self.control_handle
1036 }
1037
1038 fn drop_without_shutdown(mut self) {
1039 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1041 std::mem::forget(self);
1043 }
1044}
1045
1046impl ActorRunResponder {
1047 pub fn send(self, mut error: Option<&Error>) -> Result<(), fidl::Error> {
1051 let _result = self.send_raw(error);
1052 if _result.is_err() {
1053 self.control_handle.shutdown();
1054 }
1055 self.drop_without_shutdown();
1056 _result
1057 }
1058
1059 pub fn send_no_shutdown_on_err(self, mut error: Option<&Error>) -> Result<(), fidl::Error> {
1061 let _result = self.send_raw(error);
1062 self.drop_without_shutdown();
1063 _result
1064 }
1065
1066 fn send_raw(&self, mut error: Option<&Error>) -> Result<(), fidl::Error> {
1067 self.control_handle.inner.send::<ActorRunResponse>(
1068 (error,),
1069 self.tx_id,
1070 0x28a8ff83256eef02,
1071 fidl::encoding::DynamicFlags::empty(),
1072 )
1073 }
1074}
1075
1076mod internal {
1077 use super::*;
1078
1079 impl fidl::encoding::ResourceTypeMarker for ActorGetActionsResponse {
1080 type Borrowed<'a> = &'a mut Self;
1081 fn take_or_borrow<'a>(
1082 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1083 ) -> Self::Borrowed<'a> {
1084 value
1085 }
1086 }
1087
1088 unsafe impl fidl::encoding::TypeMarker for ActorGetActionsResponse {
1089 type Owned = Self;
1090
1091 #[inline(always)]
1092 fn inline_align(_context: fidl::encoding::Context) -> usize {
1093 4
1094 }
1095
1096 #[inline(always)]
1097 fn inline_size(_context: fidl::encoding::Context) -> usize {
1098 4
1099 }
1100 }
1101
1102 unsafe impl
1103 fidl::encoding::Encode<
1104 ActorGetActionsResponse,
1105 fidl::encoding::DefaultFuchsiaResourceDialect,
1106 > for &mut ActorGetActionsResponse
1107 {
1108 #[inline]
1109 unsafe fn encode(
1110 self,
1111 encoder: &mut fidl::encoding::Encoder<
1112 '_,
1113 fidl::encoding::DefaultFuchsiaResourceDialect,
1114 >,
1115 offset: usize,
1116 _depth: fidl::encoding::Depth,
1117 ) -> fidl::Result<()> {
1118 encoder.debug_check_bounds::<ActorGetActionsResponse>(offset);
1119 fidl::encoding::Encode::<ActorGetActionsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1121 (
1122 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
1123 ),
1124 encoder, offset, _depth
1125 )
1126 }
1127 }
1128 unsafe impl<
1129 T0: fidl::encoding::Encode<
1130 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>>,
1131 fidl::encoding::DefaultFuchsiaResourceDialect,
1132 >,
1133 >
1134 fidl::encoding::Encode<
1135 ActorGetActionsResponse,
1136 fidl::encoding::DefaultFuchsiaResourceDialect,
1137 > for (T0,)
1138 {
1139 #[inline]
1140 unsafe fn encode(
1141 self,
1142 encoder: &mut fidl::encoding::Encoder<
1143 '_,
1144 fidl::encoding::DefaultFuchsiaResourceDialect,
1145 >,
1146 offset: usize,
1147 depth: fidl::encoding::Depth,
1148 ) -> fidl::Result<()> {
1149 encoder.debug_check_bounds::<ActorGetActionsResponse>(offset);
1150 self.0.encode(encoder, offset + 0, depth)?;
1154 Ok(())
1155 }
1156 }
1157
1158 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1159 for ActorGetActionsResponse
1160 {
1161 #[inline(always)]
1162 fn new_empty() -> Self {
1163 Self {
1164 iterator: fidl::new_empty!(
1165 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>>,
1166 fidl::encoding::DefaultFuchsiaResourceDialect
1167 ),
1168 }
1169 }
1170
1171 #[inline]
1172 unsafe fn decode(
1173 &mut self,
1174 decoder: &mut fidl::encoding::Decoder<
1175 '_,
1176 fidl::encoding::DefaultFuchsiaResourceDialect,
1177 >,
1178 offset: usize,
1179 _depth: fidl::encoding::Depth,
1180 ) -> fidl::Result<()> {
1181 decoder.debug_check_bounds::<Self>(offset);
1182 fidl::decode!(
1184 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ActionIteratorMarker>>,
1185 fidl::encoding::DefaultFuchsiaResourceDialect,
1186 &mut self.iterator,
1187 decoder,
1188 offset + 0,
1189 _depth
1190 )?;
1191 Ok(())
1192 }
1193 }
1194}