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_bluetooth_pandora_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct GrpcServerControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for GrpcServerControllerMarker {
18 type Proxy = GrpcServerControllerProxy;
19 type RequestStream = GrpcServerControllerRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = GrpcServerControllerSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.pandora.GrpcServerController";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for GrpcServerControllerMarker {}
26pub type GrpcServerControllerStartResult = Result<(), ServiceError>;
27
28pub trait GrpcServerControllerProxyInterface: Send + Sync {
29 type StartResponseFut: std::future::Future<Output = Result<GrpcServerControllerStartResult, fidl::Error>>
30 + Send;
31 fn r#start(&self, payload: &GrpcServerControllerStartRequest) -> Self::StartResponseFut;
32 type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
33 fn r#stop(&self) -> Self::StopResponseFut;
34}
35#[derive(Debug)]
36#[cfg(target_os = "fuchsia")]
37pub struct GrpcServerControllerSynchronousProxy {
38 client: fidl::client::sync::Client,
39}
40
41#[cfg(target_os = "fuchsia")]
42impl fidl::endpoints::SynchronousProxy for GrpcServerControllerSynchronousProxy {
43 type Proxy = GrpcServerControllerProxy;
44 type Protocol = GrpcServerControllerMarker;
45
46 fn from_channel(inner: fidl::Channel) -> Self {
47 Self::new(inner)
48 }
49
50 fn into_channel(self) -> fidl::Channel {
51 self.client.into_channel()
52 }
53
54 fn as_channel(&self) -> &fidl::Channel {
55 self.client.as_channel()
56 }
57}
58
59#[cfg(target_os = "fuchsia")]
60impl GrpcServerControllerSynchronousProxy {
61 pub fn new(channel: fidl::Channel) -> Self {
62 let protocol_name =
63 <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
64 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
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<GrpcServerControllerEvent, fidl::Error> {
77 GrpcServerControllerEvent::decode(self.client.wait_for_event(deadline)?)
78 }
79
80 pub fn r#start(
87 &self,
88 mut payload: &GrpcServerControllerStartRequest,
89 ___deadline: zx::MonotonicInstant,
90 ) -> Result<GrpcServerControllerStartResult, fidl::Error> {
91 let _response = self.client.send_query::<
92 GrpcServerControllerStartRequest,
93 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
94 >(
95 payload,
96 0x39b64f9031375c29,
97 fidl::encoding::DynamicFlags::FLEXIBLE,
98 ___deadline,
99 )?
100 .into_result::<GrpcServerControllerMarker>("start")?;
101 Ok(_response.map(|x| x))
102 }
103
104 pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
106 let _response = self.client.send_query::<
107 fidl::encoding::EmptyPayload,
108 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
109 >(
110 (),
111 0x4e8601feb5d930b9,
112 fidl::encoding::DynamicFlags::FLEXIBLE,
113 ___deadline,
114 )?
115 .into_result::<GrpcServerControllerMarker>("stop")?;
116 Ok(_response)
117 }
118}
119
120#[derive(Debug, Clone)]
121pub struct GrpcServerControllerProxy {
122 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
123}
124
125impl fidl::endpoints::Proxy for GrpcServerControllerProxy {
126 type Protocol = GrpcServerControllerMarker;
127
128 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
129 Self::new(inner)
130 }
131
132 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
133 self.client.into_channel().map_err(|client| Self { client })
134 }
135
136 fn as_channel(&self) -> &::fidl::AsyncChannel {
137 self.client.as_channel()
138 }
139}
140
141impl GrpcServerControllerProxy {
142 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
144 let protocol_name =
145 <GrpcServerControllerMarker 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) -> GrpcServerControllerEventStream {
155 GrpcServerControllerEventStream { event_receiver: self.client.take_event_receiver() }
156 }
157
158 pub fn r#start(
165 &self,
166 mut payload: &GrpcServerControllerStartRequest,
167 ) -> fidl::client::QueryResponseFut<
168 GrpcServerControllerStartResult,
169 fidl::encoding::DefaultFuchsiaResourceDialect,
170 > {
171 GrpcServerControllerProxyInterface::r#start(self, payload)
172 }
173
174 pub fn r#stop(
176 &self,
177 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
178 GrpcServerControllerProxyInterface::r#stop(self)
179 }
180}
181
182impl GrpcServerControllerProxyInterface for GrpcServerControllerProxy {
183 type StartResponseFut = fidl::client::QueryResponseFut<
184 GrpcServerControllerStartResult,
185 fidl::encoding::DefaultFuchsiaResourceDialect,
186 >;
187 fn r#start(&self, mut payload: &GrpcServerControllerStartRequest) -> Self::StartResponseFut {
188 fn _decode(
189 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
190 ) -> Result<GrpcServerControllerStartResult, fidl::Error> {
191 let _response = fidl::client::decode_transaction_body::<
192 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
193 fidl::encoding::DefaultFuchsiaResourceDialect,
194 0x39b64f9031375c29,
195 >(_buf?)?
196 .into_result::<GrpcServerControllerMarker>("start")?;
197 Ok(_response.map(|x| x))
198 }
199 self.client.send_query_and_decode::<
200 GrpcServerControllerStartRequest,
201 GrpcServerControllerStartResult,
202 >(
203 payload,
204 0x39b64f9031375c29,
205 fidl::encoding::DynamicFlags::FLEXIBLE,
206 _decode,
207 )
208 }
209
210 type StopResponseFut =
211 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
212 fn r#stop(&self) -> Self::StopResponseFut {
213 fn _decode(
214 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
215 ) -> Result<(), fidl::Error> {
216 let _response = fidl::client::decode_transaction_body::<
217 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 0x4e8601feb5d930b9,
220 >(_buf?)?
221 .into_result::<GrpcServerControllerMarker>("stop")?;
222 Ok(_response)
223 }
224 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
225 (),
226 0x4e8601feb5d930b9,
227 fidl::encoding::DynamicFlags::FLEXIBLE,
228 _decode,
229 )
230 }
231}
232
233pub struct GrpcServerControllerEventStream {
234 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
235}
236
237impl std::marker::Unpin for GrpcServerControllerEventStream {}
238
239impl futures::stream::FusedStream for GrpcServerControllerEventStream {
240 fn is_terminated(&self) -> bool {
241 self.event_receiver.is_terminated()
242 }
243}
244
245impl futures::Stream for GrpcServerControllerEventStream {
246 type Item = Result<GrpcServerControllerEvent, fidl::Error>;
247
248 fn poll_next(
249 mut self: std::pin::Pin<&mut Self>,
250 cx: &mut std::task::Context<'_>,
251 ) -> std::task::Poll<Option<Self::Item>> {
252 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
253 &mut self.event_receiver,
254 cx
255 )?) {
256 Some(buf) => std::task::Poll::Ready(Some(GrpcServerControllerEvent::decode(buf))),
257 None => std::task::Poll::Ready(None),
258 }
259 }
260}
261
262#[derive(Debug)]
263pub enum GrpcServerControllerEvent {
264 #[non_exhaustive]
265 _UnknownEvent {
266 ordinal: u64,
268 },
269}
270
271impl GrpcServerControllerEvent {
272 fn decode(
274 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
275 ) -> Result<GrpcServerControllerEvent, fidl::Error> {
276 let (bytes, _handles) = buf.split_mut();
277 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
278 debug_assert_eq!(tx_header.tx_id, 0);
279 match tx_header.ordinal {
280 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
281 Ok(GrpcServerControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
282 }
283 _ => Err(fidl::Error::UnknownOrdinal {
284 ordinal: tx_header.ordinal,
285 protocol_name:
286 <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
287 }),
288 }
289 }
290}
291
292pub struct GrpcServerControllerRequestStream {
294 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
295 is_terminated: bool,
296}
297
298impl std::marker::Unpin for GrpcServerControllerRequestStream {}
299
300impl futures::stream::FusedStream for GrpcServerControllerRequestStream {
301 fn is_terminated(&self) -> bool {
302 self.is_terminated
303 }
304}
305
306impl fidl::endpoints::RequestStream for GrpcServerControllerRequestStream {
307 type Protocol = GrpcServerControllerMarker;
308 type ControlHandle = GrpcServerControllerControlHandle;
309
310 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
311 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
312 }
313
314 fn control_handle(&self) -> Self::ControlHandle {
315 GrpcServerControllerControlHandle { inner: self.inner.clone() }
316 }
317
318 fn into_inner(
319 self,
320 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
321 {
322 (self.inner, self.is_terminated)
323 }
324
325 fn from_inner(
326 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
327 is_terminated: bool,
328 ) -> Self {
329 Self { inner, is_terminated }
330 }
331}
332
333impl futures::Stream for GrpcServerControllerRequestStream {
334 type Item = Result<GrpcServerControllerRequest, fidl::Error>;
335
336 fn poll_next(
337 mut self: std::pin::Pin<&mut Self>,
338 cx: &mut std::task::Context<'_>,
339 ) -> std::task::Poll<Option<Self::Item>> {
340 let this = &mut *self;
341 if this.inner.check_shutdown(cx) {
342 this.is_terminated = true;
343 return std::task::Poll::Ready(None);
344 }
345 if this.is_terminated {
346 panic!("polled GrpcServerControllerRequestStream after completion");
347 }
348 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
349 |bytes, handles| {
350 match this.inner.channel().read_etc(cx, bytes, handles) {
351 std::task::Poll::Ready(Ok(())) => {}
352 std::task::Poll::Pending => return std::task::Poll::Pending,
353 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
354 this.is_terminated = true;
355 return std::task::Poll::Ready(None);
356 }
357 std::task::Poll::Ready(Err(e)) => {
358 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
359 e.into(),
360 ))))
361 }
362 }
363
364 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
366
367 std::task::Poll::Ready(Some(match header.ordinal {
368 0x39b64f9031375c29 => {
369 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
370 let mut req = fidl::new_empty!(GrpcServerControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GrpcServerControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
372 let control_handle = GrpcServerControllerControlHandle {
373 inner: this.inner.clone(),
374 };
375 Ok(GrpcServerControllerRequest::Start {payload: req,
376 responder: GrpcServerControllerStartResponder {
377 control_handle: std::mem::ManuallyDrop::new(control_handle),
378 tx_id: header.tx_id,
379 },
380 })
381 }
382 0x4e8601feb5d930b9 => {
383 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
384 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
385 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
386 let control_handle = GrpcServerControllerControlHandle {
387 inner: this.inner.clone(),
388 };
389 Ok(GrpcServerControllerRequest::Stop {
390 responder: GrpcServerControllerStopResponder {
391 control_handle: std::mem::ManuallyDrop::new(control_handle),
392 tx_id: header.tx_id,
393 },
394 })
395 }
396 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
397 Ok(GrpcServerControllerRequest::_UnknownMethod {
398 ordinal: header.ordinal,
399 control_handle: GrpcServerControllerControlHandle { inner: this.inner.clone() },
400 method_type: fidl::MethodType::OneWay,
401 })
402 }
403 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
404 this.inner.send_framework_err(
405 fidl::encoding::FrameworkErr::UnknownMethod,
406 header.tx_id,
407 header.ordinal,
408 header.dynamic_flags(),
409 (bytes, handles),
410 )?;
411 Ok(GrpcServerControllerRequest::_UnknownMethod {
412 ordinal: header.ordinal,
413 control_handle: GrpcServerControllerControlHandle { inner: this.inner.clone() },
414 method_type: fidl::MethodType::TwoWay,
415 })
416 }
417 _ => Err(fidl::Error::UnknownOrdinal {
418 ordinal: header.ordinal,
419 protocol_name: <GrpcServerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
420 }),
421 }))
422 },
423 )
424 }
425}
426
427#[derive(Debug)]
430pub enum GrpcServerControllerRequest {
431 Start {
438 payload: GrpcServerControllerStartRequest,
439 responder: GrpcServerControllerStartResponder,
440 },
441 Stop { responder: GrpcServerControllerStopResponder },
443 #[non_exhaustive]
445 _UnknownMethod {
446 ordinal: u64,
448 control_handle: GrpcServerControllerControlHandle,
449 method_type: fidl::MethodType,
450 },
451}
452
453impl GrpcServerControllerRequest {
454 #[allow(irrefutable_let_patterns)]
455 pub fn into_start(
456 self,
457 ) -> Option<(GrpcServerControllerStartRequest, GrpcServerControllerStartResponder)> {
458 if let GrpcServerControllerRequest::Start { payload, responder } = self {
459 Some((payload, responder))
460 } else {
461 None
462 }
463 }
464
465 #[allow(irrefutable_let_patterns)]
466 pub fn into_stop(self) -> Option<(GrpcServerControllerStopResponder)> {
467 if let GrpcServerControllerRequest::Stop { responder } = self {
468 Some((responder))
469 } else {
470 None
471 }
472 }
473
474 pub fn method_name(&self) -> &'static str {
476 match *self {
477 GrpcServerControllerRequest::Start { .. } => "start",
478 GrpcServerControllerRequest::Stop { .. } => "stop",
479 GrpcServerControllerRequest::_UnknownMethod {
480 method_type: fidl::MethodType::OneWay,
481 ..
482 } => "unknown one-way method",
483 GrpcServerControllerRequest::_UnknownMethod {
484 method_type: fidl::MethodType::TwoWay,
485 ..
486 } => "unknown two-way method",
487 }
488 }
489}
490
491#[derive(Debug, Clone)]
492pub struct GrpcServerControllerControlHandle {
493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
494}
495
496impl fidl::endpoints::ControlHandle for GrpcServerControllerControlHandle {
497 fn shutdown(&self) {
498 self.inner.shutdown()
499 }
500 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
501 self.inner.shutdown_with_epitaph(status)
502 }
503
504 fn is_closed(&self) -> bool {
505 self.inner.channel().is_closed()
506 }
507 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
508 self.inner.channel().on_closed()
509 }
510
511 #[cfg(target_os = "fuchsia")]
512 fn signal_peer(
513 &self,
514 clear_mask: zx::Signals,
515 set_mask: zx::Signals,
516 ) -> Result<(), zx_status::Status> {
517 use fidl::Peered;
518 self.inner.channel().signal_peer(clear_mask, set_mask)
519 }
520}
521
522impl GrpcServerControllerControlHandle {}
523
524#[must_use = "FIDL methods require a response to be sent"]
525#[derive(Debug)]
526pub struct GrpcServerControllerStartResponder {
527 control_handle: std::mem::ManuallyDrop<GrpcServerControllerControlHandle>,
528 tx_id: u32,
529}
530
531impl std::ops::Drop for GrpcServerControllerStartResponder {
535 fn drop(&mut self) {
536 self.control_handle.shutdown();
537 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
539 }
540}
541
542impl fidl::endpoints::Responder for GrpcServerControllerStartResponder {
543 type ControlHandle = GrpcServerControllerControlHandle;
544
545 fn control_handle(&self) -> &GrpcServerControllerControlHandle {
546 &self.control_handle
547 }
548
549 fn drop_without_shutdown(mut self) {
550 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
552 std::mem::forget(self);
554 }
555}
556
557impl GrpcServerControllerStartResponder {
558 pub fn send(self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
562 let _result = self.send_raw(result);
563 if _result.is_err() {
564 self.control_handle.shutdown();
565 }
566 self.drop_without_shutdown();
567 _result
568 }
569
570 pub fn send_no_shutdown_on_err(
572 self,
573 mut result: Result<(), ServiceError>,
574 ) -> Result<(), fidl::Error> {
575 let _result = self.send_raw(result);
576 self.drop_without_shutdown();
577 _result
578 }
579
580 fn send_raw(&self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
581 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
582 fidl::encoding::EmptyStruct,
583 ServiceError,
584 >>(
585 fidl::encoding::FlexibleResult::new(result),
586 self.tx_id,
587 0x39b64f9031375c29,
588 fidl::encoding::DynamicFlags::FLEXIBLE,
589 )
590 }
591}
592
593#[must_use = "FIDL methods require a response to be sent"]
594#[derive(Debug)]
595pub struct GrpcServerControllerStopResponder {
596 control_handle: std::mem::ManuallyDrop<GrpcServerControllerControlHandle>,
597 tx_id: u32,
598}
599
600impl std::ops::Drop for GrpcServerControllerStopResponder {
604 fn drop(&mut self) {
605 self.control_handle.shutdown();
606 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
608 }
609}
610
611impl fidl::endpoints::Responder for GrpcServerControllerStopResponder {
612 type ControlHandle = GrpcServerControllerControlHandle;
613
614 fn control_handle(&self) -> &GrpcServerControllerControlHandle {
615 &self.control_handle
616 }
617
618 fn drop_without_shutdown(mut self) {
619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
621 std::mem::forget(self);
623 }
624}
625
626impl GrpcServerControllerStopResponder {
627 pub fn send(self) -> Result<(), fidl::Error> {
631 let _result = self.send_raw();
632 if _result.is_err() {
633 self.control_handle.shutdown();
634 }
635 self.drop_without_shutdown();
636 _result
637 }
638
639 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
641 let _result = self.send_raw();
642 self.drop_without_shutdown();
643 _result
644 }
645
646 fn send_raw(&self) -> Result<(), fidl::Error> {
647 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
648 fidl::encoding::Flexible::new(()),
649 self.tx_id,
650 0x4e8601feb5d930b9,
651 fidl::encoding::DynamicFlags::FLEXIBLE,
652 )
653 }
654}
655
656#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
657pub struct RootcanalClientControllerMarker;
658
659impl fidl::endpoints::ProtocolMarker for RootcanalClientControllerMarker {
660 type Proxy = RootcanalClientControllerProxy;
661 type RequestStream = RootcanalClientControllerRequestStream;
662 #[cfg(target_os = "fuchsia")]
663 type SynchronousProxy = RootcanalClientControllerSynchronousProxy;
664
665 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.pandora.RootcanalClientController";
666}
667impl fidl::endpoints::DiscoverableProtocolMarker for RootcanalClientControllerMarker {}
668pub type RootcanalClientControllerStartResult = Result<(), ServiceError>;
669
670pub trait RootcanalClientControllerProxyInterface: Send + Sync {
671 type StartResponseFut: std::future::Future<Output = Result<RootcanalClientControllerStartResult, fidl::Error>>
672 + Send;
673 fn r#start(&self, payload: &RootcanalClientControllerStartRequest) -> Self::StartResponseFut;
674 type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
675 fn r#stop(&self) -> Self::StopResponseFut;
676}
677#[derive(Debug)]
678#[cfg(target_os = "fuchsia")]
679pub struct RootcanalClientControllerSynchronousProxy {
680 client: fidl::client::sync::Client,
681}
682
683#[cfg(target_os = "fuchsia")]
684impl fidl::endpoints::SynchronousProxy for RootcanalClientControllerSynchronousProxy {
685 type Proxy = RootcanalClientControllerProxy;
686 type Protocol = RootcanalClientControllerMarker;
687
688 fn from_channel(inner: fidl::Channel) -> Self {
689 Self::new(inner)
690 }
691
692 fn into_channel(self) -> fidl::Channel {
693 self.client.into_channel()
694 }
695
696 fn as_channel(&self) -> &fidl::Channel {
697 self.client.as_channel()
698 }
699}
700
701#[cfg(target_os = "fuchsia")]
702impl RootcanalClientControllerSynchronousProxy {
703 pub fn new(channel: fidl::Channel) -> Self {
704 let protocol_name =
705 <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
706 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
707 }
708
709 pub fn into_channel(self) -> fidl::Channel {
710 self.client.into_channel()
711 }
712
713 pub fn wait_for_event(
716 &self,
717 deadline: zx::MonotonicInstant,
718 ) -> Result<RootcanalClientControllerEvent, fidl::Error> {
719 RootcanalClientControllerEvent::decode(self.client.wait_for_event(deadline)?)
720 }
721
722 pub fn r#start(
733 &self,
734 mut payload: &RootcanalClientControllerStartRequest,
735 ___deadline: zx::MonotonicInstant,
736 ) -> Result<RootcanalClientControllerStartResult, fidl::Error> {
737 let _response = self.client.send_query::<
738 RootcanalClientControllerStartRequest,
739 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
740 >(
741 payload,
742 0xde429b8e402832c,
743 fidl::encoding::DynamicFlags::FLEXIBLE,
744 ___deadline,
745 )?
746 .into_result::<RootcanalClientControllerMarker>("start")?;
747 Ok(_response.map(|x| x))
748 }
749
750 pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
752 let _response = self.client.send_query::<
753 fidl::encoding::EmptyPayload,
754 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
755 >(
756 (),
757 0x30419bba3f039d1d,
758 fidl::encoding::DynamicFlags::FLEXIBLE,
759 ___deadline,
760 )?
761 .into_result::<RootcanalClientControllerMarker>("stop")?;
762 Ok(_response)
763 }
764}
765
766#[derive(Debug, Clone)]
767pub struct RootcanalClientControllerProxy {
768 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
769}
770
771impl fidl::endpoints::Proxy for RootcanalClientControllerProxy {
772 type Protocol = RootcanalClientControllerMarker;
773
774 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
775 Self::new(inner)
776 }
777
778 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
779 self.client.into_channel().map_err(|client| Self { client })
780 }
781
782 fn as_channel(&self) -> &::fidl::AsyncChannel {
783 self.client.as_channel()
784 }
785}
786
787impl RootcanalClientControllerProxy {
788 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
790 let protocol_name =
791 <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
792 Self { client: fidl::client::Client::new(channel, protocol_name) }
793 }
794
795 pub fn take_event_stream(&self) -> RootcanalClientControllerEventStream {
801 RootcanalClientControllerEventStream { event_receiver: self.client.take_event_receiver() }
802 }
803
804 pub fn r#start(
815 &self,
816 mut payload: &RootcanalClientControllerStartRequest,
817 ) -> fidl::client::QueryResponseFut<
818 RootcanalClientControllerStartResult,
819 fidl::encoding::DefaultFuchsiaResourceDialect,
820 > {
821 RootcanalClientControllerProxyInterface::r#start(self, payload)
822 }
823
824 pub fn r#stop(
826 &self,
827 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
828 RootcanalClientControllerProxyInterface::r#stop(self)
829 }
830}
831
832impl RootcanalClientControllerProxyInterface for RootcanalClientControllerProxy {
833 type StartResponseFut = fidl::client::QueryResponseFut<
834 RootcanalClientControllerStartResult,
835 fidl::encoding::DefaultFuchsiaResourceDialect,
836 >;
837 fn r#start(
838 &self,
839 mut payload: &RootcanalClientControllerStartRequest,
840 ) -> Self::StartResponseFut {
841 fn _decode(
842 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
843 ) -> Result<RootcanalClientControllerStartResult, fidl::Error> {
844 let _response = fidl::client::decode_transaction_body::<
845 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ServiceError>,
846 fidl::encoding::DefaultFuchsiaResourceDialect,
847 0xde429b8e402832c,
848 >(_buf?)?
849 .into_result::<RootcanalClientControllerMarker>("start")?;
850 Ok(_response.map(|x| x))
851 }
852 self.client.send_query_and_decode::<
853 RootcanalClientControllerStartRequest,
854 RootcanalClientControllerStartResult,
855 >(
856 payload,
857 0xde429b8e402832c,
858 fidl::encoding::DynamicFlags::FLEXIBLE,
859 _decode,
860 )
861 }
862
863 type StopResponseFut =
864 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
865 fn r#stop(&self) -> Self::StopResponseFut {
866 fn _decode(
867 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
868 ) -> Result<(), fidl::Error> {
869 let _response = fidl::client::decode_transaction_body::<
870 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
871 fidl::encoding::DefaultFuchsiaResourceDialect,
872 0x30419bba3f039d1d,
873 >(_buf?)?
874 .into_result::<RootcanalClientControllerMarker>("stop")?;
875 Ok(_response)
876 }
877 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
878 (),
879 0x30419bba3f039d1d,
880 fidl::encoding::DynamicFlags::FLEXIBLE,
881 _decode,
882 )
883 }
884}
885
886pub struct RootcanalClientControllerEventStream {
887 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
888}
889
890impl std::marker::Unpin for RootcanalClientControllerEventStream {}
891
892impl futures::stream::FusedStream for RootcanalClientControllerEventStream {
893 fn is_terminated(&self) -> bool {
894 self.event_receiver.is_terminated()
895 }
896}
897
898impl futures::Stream for RootcanalClientControllerEventStream {
899 type Item = Result<RootcanalClientControllerEvent, fidl::Error>;
900
901 fn poll_next(
902 mut self: std::pin::Pin<&mut Self>,
903 cx: &mut std::task::Context<'_>,
904 ) -> std::task::Poll<Option<Self::Item>> {
905 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
906 &mut self.event_receiver,
907 cx
908 )?) {
909 Some(buf) => std::task::Poll::Ready(Some(RootcanalClientControllerEvent::decode(buf))),
910 None => std::task::Poll::Ready(None),
911 }
912 }
913}
914
915#[derive(Debug)]
916pub enum RootcanalClientControllerEvent {
917 #[non_exhaustive]
918 _UnknownEvent {
919 ordinal: u64,
921 },
922}
923
924impl RootcanalClientControllerEvent {
925 fn decode(
927 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
928 ) -> Result<RootcanalClientControllerEvent, fidl::Error> {
929 let (bytes, _handles) = buf.split_mut();
930 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
931 debug_assert_eq!(tx_header.tx_id, 0);
932 match tx_header.ordinal {
933 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
934 Ok(RootcanalClientControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
935 }
936 _ => Err(fidl::Error::UnknownOrdinal {
937 ordinal: tx_header.ordinal,
938 protocol_name:
939 <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
940 }),
941 }
942 }
943}
944
945pub struct RootcanalClientControllerRequestStream {
947 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
948 is_terminated: bool,
949}
950
951impl std::marker::Unpin for RootcanalClientControllerRequestStream {}
952
953impl futures::stream::FusedStream for RootcanalClientControllerRequestStream {
954 fn is_terminated(&self) -> bool {
955 self.is_terminated
956 }
957}
958
959impl fidl::endpoints::RequestStream for RootcanalClientControllerRequestStream {
960 type Protocol = RootcanalClientControllerMarker;
961 type ControlHandle = RootcanalClientControllerControlHandle;
962
963 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
964 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
965 }
966
967 fn control_handle(&self) -> Self::ControlHandle {
968 RootcanalClientControllerControlHandle { inner: self.inner.clone() }
969 }
970
971 fn into_inner(
972 self,
973 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
974 {
975 (self.inner, self.is_terminated)
976 }
977
978 fn from_inner(
979 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
980 is_terminated: bool,
981 ) -> Self {
982 Self { inner, is_terminated }
983 }
984}
985
986impl futures::Stream for RootcanalClientControllerRequestStream {
987 type Item = Result<RootcanalClientControllerRequest, fidl::Error>;
988
989 fn poll_next(
990 mut self: std::pin::Pin<&mut Self>,
991 cx: &mut std::task::Context<'_>,
992 ) -> std::task::Poll<Option<Self::Item>> {
993 let this = &mut *self;
994 if this.inner.check_shutdown(cx) {
995 this.is_terminated = true;
996 return std::task::Poll::Ready(None);
997 }
998 if this.is_terminated {
999 panic!("polled RootcanalClientControllerRequestStream after completion");
1000 }
1001 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1002 |bytes, handles| {
1003 match this.inner.channel().read_etc(cx, bytes, handles) {
1004 std::task::Poll::Ready(Ok(())) => {}
1005 std::task::Poll::Pending => return std::task::Poll::Pending,
1006 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1007 this.is_terminated = true;
1008 return std::task::Poll::Ready(None);
1009 }
1010 std::task::Poll::Ready(Err(e)) => {
1011 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1012 e.into(),
1013 ))))
1014 }
1015 }
1016
1017 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1019
1020 std::task::Poll::Ready(Some(match header.ordinal {
1021 0xde429b8e402832c => {
1022 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1023 let mut req = fidl::new_empty!(RootcanalClientControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1024 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RootcanalClientControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1025 let control_handle = RootcanalClientControllerControlHandle {
1026 inner: this.inner.clone(),
1027 };
1028 Ok(RootcanalClientControllerRequest::Start {payload: req,
1029 responder: RootcanalClientControllerStartResponder {
1030 control_handle: std::mem::ManuallyDrop::new(control_handle),
1031 tx_id: header.tx_id,
1032 },
1033 })
1034 }
1035 0x30419bba3f039d1d => {
1036 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1037 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1039 let control_handle = RootcanalClientControllerControlHandle {
1040 inner: this.inner.clone(),
1041 };
1042 Ok(RootcanalClientControllerRequest::Stop {
1043 responder: RootcanalClientControllerStopResponder {
1044 control_handle: std::mem::ManuallyDrop::new(control_handle),
1045 tx_id: header.tx_id,
1046 },
1047 })
1048 }
1049 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1050 Ok(RootcanalClientControllerRequest::_UnknownMethod {
1051 ordinal: header.ordinal,
1052 control_handle: RootcanalClientControllerControlHandle { inner: this.inner.clone() },
1053 method_type: fidl::MethodType::OneWay,
1054 })
1055 }
1056 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1057 this.inner.send_framework_err(
1058 fidl::encoding::FrameworkErr::UnknownMethod,
1059 header.tx_id,
1060 header.ordinal,
1061 header.dynamic_flags(),
1062 (bytes, handles),
1063 )?;
1064 Ok(RootcanalClientControllerRequest::_UnknownMethod {
1065 ordinal: header.ordinal,
1066 control_handle: RootcanalClientControllerControlHandle { inner: this.inner.clone() },
1067 method_type: fidl::MethodType::TwoWay,
1068 })
1069 }
1070 _ => Err(fidl::Error::UnknownOrdinal {
1071 ordinal: header.ordinal,
1072 protocol_name: <RootcanalClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1073 }),
1074 }))
1075 },
1076 )
1077 }
1078}
1079
1080#[derive(Debug)]
1083pub enum RootcanalClientControllerRequest {
1084 Start {
1095 payload: RootcanalClientControllerStartRequest,
1096 responder: RootcanalClientControllerStartResponder,
1097 },
1098 Stop { responder: RootcanalClientControllerStopResponder },
1100 #[non_exhaustive]
1102 _UnknownMethod {
1103 ordinal: u64,
1105 control_handle: RootcanalClientControllerControlHandle,
1106 method_type: fidl::MethodType,
1107 },
1108}
1109
1110impl RootcanalClientControllerRequest {
1111 #[allow(irrefutable_let_patterns)]
1112 pub fn into_start(
1113 self,
1114 ) -> Option<(RootcanalClientControllerStartRequest, RootcanalClientControllerStartResponder)>
1115 {
1116 if let RootcanalClientControllerRequest::Start { payload, responder } = self {
1117 Some((payload, responder))
1118 } else {
1119 None
1120 }
1121 }
1122
1123 #[allow(irrefutable_let_patterns)]
1124 pub fn into_stop(self) -> Option<(RootcanalClientControllerStopResponder)> {
1125 if let RootcanalClientControllerRequest::Stop { responder } = self {
1126 Some((responder))
1127 } else {
1128 None
1129 }
1130 }
1131
1132 pub fn method_name(&self) -> &'static str {
1134 match *self {
1135 RootcanalClientControllerRequest::Start { .. } => "start",
1136 RootcanalClientControllerRequest::Stop { .. } => "stop",
1137 RootcanalClientControllerRequest::_UnknownMethod {
1138 method_type: fidl::MethodType::OneWay,
1139 ..
1140 } => "unknown one-way method",
1141 RootcanalClientControllerRequest::_UnknownMethod {
1142 method_type: fidl::MethodType::TwoWay,
1143 ..
1144 } => "unknown two-way method",
1145 }
1146 }
1147}
1148
1149#[derive(Debug, Clone)]
1150pub struct RootcanalClientControllerControlHandle {
1151 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1152}
1153
1154impl fidl::endpoints::ControlHandle for RootcanalClientControllerControlHandle {
1155 fn shutdown(&self) {
1156 self.inner.shutdown()
1157 }
1158 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1159 self.inner.shutdown_with_epitaph(status)
1160 }
1161
1162 fn is_closed(&self) -> bool {
1163 self.inner.channel().is_closed()
1164 }
1165 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1166 self.inner.channel().on_closed()
1167 }
1168
1169 #[cfg(target_os = "fuchsia")]
1170 fn signal_peer(
1171 &self,
1172 clear_mask: zx::Signals,
1173 set_mask: zx::Signals,
1174 ) -> Result<(), zx_status::Status> {
1175 use fidl::Peered;
1176 self.inner.channel().signal_peer(clear_mask, set_mask)
1177 }
1178}
1179
1180impl RootcanalClientControllerControlHandle {}
1181
1182#[must_use = "FIDL methods require a response to be sent"]
1183#[derive(Debug)]
1184pub struct RootcanalClientControllerStartResponder {
1185 control_handle: std::mem::ManuallyDrop<RootcanalClientControllerControlHandle>,
1186 tx_id: u32,
1187}
1188
1189impl std::ops::Drop for RootcanalClientControllerStartResponder {
1193 fn drop(&mut self) {
1194 self.control_handle.shutdown();
1195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1197 }
1198}
1199
1200impl fidl::endpoints::Responder for RootcanalClientControllerStartResponder {
1201 type ControlHandle = RootcanalClientControllerControlHandle;
1202
1203 fn control_handle(&self) -> &RootcanalClientControllerControlHandle {
1204 &self.control_handle
1205 }
1206
1207 fn drop_without_shutdown(mut self) {
1208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1210 std::mem::forget(self);
1212 }
1213}
1214
1215impl RootcanalClientControllerStartResponder {
1216 pub fn send(self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
1220 let _result = self.send_raw(result);
1221 if _result.is_err() {
1222 self.control_handle.shutdown();
1223 }
1224 self.drop_without_shutdown();
1225 _result
1226 }
1227
1228 pub fn send_no_shutdown_on_err(
1230 self,
1231 mut result: Result<(), ServiceError>,
1232 ) -> Result<(), fidl::Error> {
1233 let _result = self.send_raw(result);
1234 self.drop_without_shutdown();
1235 _result
1236 }
1237
1238 fn send_raw(&self, mut result: Result<(), ServiceError>) -> Result<(), fidl::Error> {
1239 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1240 fidl::encoding::EmptyStruct,
1241 ServiceError,
1242 >>(
1243 fidl::encoding::FlexibleResult::new(result),
1244 self.tx_id,
1245 0xde429b8e402832c,
1246 fidl::encoding::DynamicFlags::FLEXIBLE,
1247 )
1248 }
1249}
1250
1251#[must_use = "FIDL methods require a response to be sent"]
1252#[derive(Debug)]
1253pub struct RootcanalClientControllerStopResponder {
1254 control_handle: std::mem::ManuallyDrop<RootcanalClientControllerControlHandle>,
1255 tx_id: u32,
1256}
1257
1258impl std::ops::Drop for RootcanalClientControllerStopResponder {
1262 fn drop(&mut self) {
1263 self.control_handle.shutdown();
1264 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1266 }
1267}
1268
1269impl fidl::endpoints::Responder for RootcanalClientControllerStopResponder {
1270 type ControlHandle = RootcanalClientControllerControlHandle;
1271
1272 fn control_handle(&self) -> &RootcanalClientControllerControlHandle {
1273 &self.control_handle
1274 }
1275
1276 fn drop_without_shutdown(mut self) {
1277 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1279 std::mem::forget(self);
1281 }
1282}
1283
1284impl RootcanalClientControllerStopResponder {
1285 pub fn send(self) -> Result<(), fidl::Error> {
1289 let _result = self.send_raw();
1290 if _result.is_err() {
1291 self.control_handle.shutdown();
1292 }
1293 self.drop_without_shutdown();
1294 _result
1295 }
1296
1297 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1299 let _result = self.send_raw();
1300 self.drop_without_shutdown();
1301 _result
1302 }
1303
1304 fn send_raw(&self) -> Result<(), fidl::Error> {
1305 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1306 fidl::encoding::Flexible::new(()),
1307 self.tx_id,
1308 0x30419bba3f039d1d,
1309 fidl::encoding::DynamicFlags::FLEXIBLE,
1310 )
1311 }
1312}
1313
1314mod internal {
1315 use super::*;
1316}