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