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