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_device__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerConnectToControllerRequest {
16 pub server: fidl::endpoints::ServerEnd<ControllerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for ControllerConnectToControllerRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct ControllerConnectToDeviceFidlRequest {
26 pub server: fidl::Channel,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for ControllerConnectToDeviceFidlRequest
31{
32}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct ControllerMarker;
36
37impl fidl::endpoints::ProtocolMarker for ControllerMarker {
38 type Proxy = ControllerProxy;
39 type RequestStream = ControllerRequestStream;
40 #[cfg(target_os = "fuchsia")]
41 type SynchronousProxy = ControllerSynchronousProxy;
42
43 const DEBUG_NAME: &'static str = "(anonymous) Controller";
44}
45pub type ControllerBindResult = Result<(), i32>;
46pub type ControllerRebindResult = Result<(), i32>;
47pub type ControllerUnbindChildrenResult = Result<(), i32>;
48pub type ControllerScheduleUnbindResult = Result<(), i32>;
49pub type ControllerGetTopologicalPathResult = Result<String, i32>;
50
51pub trait ControllerProxyInterface: Send + Sync {
52 fn r#connect_to_device_fidl(&self, server: fidl::Channel) -> Result<(), fidl::Error>;
53 fn r#connect_to_controller(
54 &self,
55 server: fidl::endpoints::ServerEnd<ControllerMarker>,
56 ) -> Result<(), fidl::Error>;
57 type BindResponseFut: std::future::Future<Output = Result<ControllerBindResult, fidl::Error>>
58 + Send;
59 fn r#bind(&self, driver: &str) -> Self::BindResponseFut;
60 type RebindResponseFut: std::future::Future<Output = Result<ControllerRebindResult, fidl::Error>>
61 + Send;
62 fn r#rebind(&self, driver: &str) -> Self::RebindResponseFut;
63 type UnbindChildrenResponseFut: std::future::Future<Output = Result<ControllerUnbindChildrenResult, fidl::Error>>
64 + Send;
65 fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut;
66 type ScheduleUnbindResponseFut: std::future::Future<Output = Result<ControllerScheduleUnbindResult, fidl::Error>>
67 + Send;
68 fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut;
69 type GetTopologicalPathResponseFut: std::future::Future<Output = Result<ControllerGetTopologicalPathResult, fidl::Error>>
70 + Send;
71 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut;
72}
73#[derive(Debug)]
74#[cfg(target_os = "fuchsia")]
75pub struct ControllerSynchronousProxy {
76 client: fidl::client::sync::Client,
77}
78
79#[cfg(target_os = "fuchsia")]
80impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
81 type Proxy = ControllerProxy;
82 type Protocol = ControllerMarker;
83
84 fn from_channel(inner: fidl::Channel) -> Self {
85 Self::new(inner)
86 }
87
88 fn into_channel(self) -> fidl::Channel {
89 self.client.into_channel()
90 }
91
92 fn as_channel(&self) -> &fidl::Channel {
93 self.client.as_channel()
94 }
95}
96
97#[cfg(target_os = "fuchsia")]
98impl ControllerSynchronousProxy {
99 pub fn new(channel: fidl::Channel) -> Self {
100 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
101 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
102 }
103
104 pub fn into_channel(self) -> fidl::Channel {
105 self.client.into_channel()
106 }
107
108 pub fn wait_for_event(
111 &self,
112 deadline: zx::MonotonicInstant,
113 ) -> Result<ControllerEvent, fidl::Error> {
114 ControllerEvent::decode(self.client.wait_for_event(deadline)?)
115 }
116
117 pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
121 self.client.send::<ControllerConnectToDeviceFidlRequest>(
122 (server,),
123 0x793c584be7211f0d,
124 fidl::encoding::DynamicFlags::empty(),
125 )
126 }
127
128 pub fn r#connect_to_controller(
130 &self,
131 mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
132 ) -> Result<(), fidl::Error> {
133 self.client.send::<ControllerConnectToControllerRequest>(
134 (server,),
135 0x66774decb0c7a0d0,
136 fidl::encoding::DynamicFlags::empty(),
137 )
138 }
139
140 pub fn r#bind(
145 &self,
146 mut driver: &str,
147 ___deadline: zx::MonotonicInstant,
148 ) -> Result<ControllerBindResult, fidl::Error> {
149 let _response = self.client.send_query::<
150 ControllerBindRequest,
151 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
152 >(
153 (driver,),
154 0x3388f12801462769,
155 fidl::encoding::DynamicFlags::empty(),
156 ___deadline,
157 )?;
158 Ok(_response.map(|x| x))
159 }
160
161 pub fn r#rebind(
167 &self,
168 mut driver: &str,
169 ___deadline: zx::MonotonicInstant,
170 ) -> Result<ControllerRebindResult, fidl::Error> {
171 let _response = self.client.send_query::<
172 ControllerRebindRequest,
173 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
174 >(
175 (driver,),
176 0x384fb80cbc2782e2,
177 fidl::encoding::DynamicFlags::empty(),
178 ___deadline,
179 )?;
180 Ok(_response.map(|x| x))
181 }
182
183 pub fn r#unbind_children(
186 &self,
187 ___deadline: zx::MonotonicInstant,
188 ) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
189 let _response = self.client.send_query::<
190 fidl::encoding::EmptyPayload,
191 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
192 >(
193 (),
194 0x31fae8d74db7a426,
195 fidl::encoding::DynamicFlags::empty(),
196 ___deadline,
197 )?;
198 Ok(_response.map(|x| x))
199 }
200
201 pub fn r#schedule_unbind(
204 &self,
205 ___deadline: zx::MonotonicInstant,
206 ) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
207 let _response = self.client.send_query::<
208 fidl::encoding::EmptyPayload,
209 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
210 >(
211 (),
212 0x6128ba9d76aff9c,
213 fidl::encoding::DynamicFlags::empty(),
214 ___deadline,
215 )?;
216 Ok(_response.map(|x| x))
217 }
218
219 pub fn r#get_topological_path(
221 &self,
222 ___deadline: zx::MonotonicInstant,
223 ) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
224 let _response = self.client.send_query::<
225 fidl::encoding::EmptyPayload,
226 fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
227 >(
228 (),
229 0x2689b37663e00788,
230 fidl::encoding::DynamicFlags::empty(),
231 ___deadline,
232 )?;
233 Ok(_response.map(|x| x.path))
234 }
235}
236
237#[cfg(target_os = "fuchsia")]
238impl From<ControllerSynchronousProxy> for zx::NullableHandle {
239 fn from(value: ControllerSynchronousProxy) -> Self {
240 value.into_channel().into()
241 }
242}
243
244#[cfg(target_os = "fuchsia")]
245impl From<fidl::Channel> for ControllerSynchronousProxy {
246 fn from(value: fidl::Channel) -> Self {
247 Self::new(value)
248 }
249}
250
251#[cfg(target_os = "fuchsia")]
252impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
253 type Protocol = ControllerMarker;
254
255 fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
256 Self::new(value.into_channel())
257 }
258}
259
260#[derive(Debug, Clone)]
261pub struct ControllerProxy {
262 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
263}
264
265impl fidl::endpoints::Proxy for ControllerProxy {
266 type Protocol = ControllerMarker;
267
268 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
269 Self::new(inner)
270 }
271
272 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
273 self.client.into_channel().map_err(|client| Self { client })
274 }
275
276 fn as_channel(&self) -> &::fidl::AsyncChannel {
277 self.client.as_channel()
278 }
279}
280
281impl ControllerProxy {
282 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
284 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
285 Self { client: fidl::client::Client::new(channel, protocol_name) }
286 }
287
288 pub fn take_event_stream(&self) -> ControllerEventStream {
294 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
295 }
296
297 pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
301 ControllerProxyInterface::r#connect_to_device_fidl(self, server)
302 }
303
304 pub fn r#connect_to_controller(
306 &self,
307 mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
308 ) -> Result<(), fidl::Error> {
309 ControllerProxyInterface::r#connect_to_controller(self, server)
310 }
311
312 pub fn r#bind(
317 &self,
318 mut driver: &str,
319 ) -> fidl::client::QueryResponseFut<
320 ControllerBindResult,
321 fidl::encoding::DefaultFuchsiaResourceDialect,
322 > {
323 ControllerProxyInterface::r#bind(self, driver)
324 }
325
326 pub fn r#rebind(
332 &self,
333 mut driver: &str,
334 ) -> fidl::client::QueryResponseFut<
335 ControllerRebindResult,
336 fidl::encoding::DefaultFuchsiaResourceDialect,
337 > {
338 ControllerProxyInterface::r#rebind(self, driver)
339 }
340
341 pub fn r#unbind_children(
344 &self,
345 ) -> fidl::client::QueryResponseFut<
346 ControllerUnbindChildrenResult,
347 fidl::encoding::DefaultFuchsiaResourceDialect,
348 > {
349 ControllerProxyInterface::r#unbind_children(self)
350 }
351
352 pub fn r#schedule_unbind(
355 &self,
356 ) -> fidl::client::QueryResponseFut<
357 ControllerScheduleUnbindResult,
358 fidl::encoding::DefaultFuchsiaResourceDialect,
359 > {
360 ControllerProxyInterface::r#schedule_unbind(self)
361 }
362
363 pub fn r#get_topological_path(
365 &self,
366 ) -> fidl::client::QueryResponseFut<
367 ControllerGetTopologicalPathResult,
368 fidl::encoding::DefaultFuchsiaResourceDialect,
369 > {
370 ControllerProxyInterface::r#get_topological_path(self)
371 }
372}
373
374impl ControllerProxyInterface for ControllerProxy {
375 fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
376 self.client.send::<ControllerConnectToDeviceFidlRequest>(
377 (server,),
378 0x793c584be7211f0d,
379 fidl::encoding::DynamicFlags::empty(),
380 )
381 }
382
383 fn r#connect_to_controller(
384 &self,
385 mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
386 ) -> Result<(), fidl::Error> {
387 self.client.send::<ControllerConnectToControllerRequest>(
388 (server,),
389 0x66774decb0c7a0d0,
390 fidl::encoding::DynamicFlags::empty(),
391 )
392 }
393
394 type BindResponseFut = fidl::client::QueryResponseFut<
395 ControllerBindResult,
396 fidl::encoding::DefaultFuchsiaResourceDialect,
397 >;
398 fn r#bind(&self, mut driver: &str) -> Self::BindResponseFut {
399 fn _decode(
400 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
401 ) -> Result<ControllerBindResult, fidl::Error> {
402 let _response = fidl::client::decode_transaction_body::<
403 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
404 fidl::encoding::DefaultFuchsiaResourceDialect,
405 0x3388f12801462769,
406 >(_buf?)?;
407 Ok(_response.map(|x| x))
408 }
409 self.client.send_query_and_decode::<ControllerBindRequest, ControllerBindResult>(
410 (driver,),
411 0x3388f12801462769,
412 fidl::encoding::DynamicFlags::empty(),
413 _decode,
414 )
415 }
416
417 type RebindResponseFut = fidl::client::QueryResponseFut<
418 ControllerRebindResult,
419 fidl::encoding::DefaultFuchsiaResourceDialect,
420 >;
421 fn r#rebind(&self, mut driver: &str) -> Self::RebindResponseFut {
422 fn _decode(
423 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
424 ) -> Result<ControllerRebindResult, fidl::Error> {
425 let _response = fidl::client::decode_transaction_body::<
426 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
427 fidl::encoding::DefaultFuchsiaResourceDialect,
428 0x384fb80cbc2782e2,
429 >(_buf?)?;
430 Ok(_response.map(|x| x))
431 }
432 self.client.send_query_and_decode::<ControllerRebindRequest, ControllerRebindResult>(
433 (driver,),
434 0x384fb80cbc2782e2,
435 fidl::encoding::DynamicFlags::empty(),
436 _decode,
437 )
438 }
439
440 type UnbindChildrenResponseFut = fidl::client::QueryResponseFut<
441 ControllerUnbindChildrenResult,
442 fidl::encoding::DefaultFuchsiaResourceDialect,
443 >;
444 fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut {
445 fn _decode(
446 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
447 ) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
448 let _response = fidl::client::decode_transaction_body::<
449 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
450 fidl::encoding::DefaultFuchsiaResourceDialect,
451 0x31fae8d74db7a426,
452 >(_buf?)?;
453 Ok(_response.map(|x| x))
454 }
455 self.client
456 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerUnbindChildrenResult>(
457 (),
458 0x31fae8d74db7a426,
459 fidl::encoding::DynamicFlags::empty(),
460 _decode,
461 )
462 }
463
464 type ScheduleUnbindResponseFut = fidl::client::QueryResponseFut<
465 ControllerScheduleUnbindResult,
466 fidl::encoding::DefaultFuchsiaResourceDialect,
467 >;
468 fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut {
469 fn _decode(
470 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
471 ) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
472 let _response = fidl::client::decode_transaction_body::<
473 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
474 fidl::encoding::DefaultFuchsiaResourceDialect,
475 0x6128ba9d76aff9c,
476 >(_buf?)?;
477 Ok(_response.map(|x| x))
478 }
479 self.client
480 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerScheduleUnbindResult>(
481 (),
482 0x6128ba9d76aff9c,
483 fidl::encoding::DynamicFlags::empty(),
484 _decode,
485 )
486 }
487
488 type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
489 ControllerGetTopologicalPathResult,
490 fidl::encoding::DefaultFuchsiaResourceDialect,
491 >;
492 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
493 fn _decode(
494 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
495 ) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
496 let _response = fidl::client::decode_transaction_body::<
497 fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
498 fidl::encoding::DefaultFuchsiaResourceDialect,
499 0x2689b37663e00788,
500 >(_buf?)?;
501 Ok(_response.map(|x| x.path))
502 }
503 self.client.send_query_and_decode::<
504 fidl::encoding::EmptyPayload,
505 ControllerGetTopologicalPathResult,
506 >(
507 (),
508 0x2689b37663e00788,
509 fidl::encoding::DynamicFlags::empty(),
510 _decode,
511 )
512 }
513}
514
515pub struct ControllerEventStream {
516 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
517}
518
519impl std::marker::Unpin for ControllerEventStream {}
520
521impl futures::stream::FusedStream for ControllerEventStream {
522 fn is_terminated(&self) -> bool {
523 self.event_receiver.is_terminated()
524 }
525}
526
527impl futures::Stream for ControllerEventStream {
528 type Item = Result<ControllerEvent, fidl::Error>;
529
530 fn poll_next(
531 mut self: std::pin::Pin<&mut Self>,
532 cx: &mut std::task::Context<'_>,
533 ) -> std::task::Poll<Option<Self::Item>> {
534 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
535 &mut self.event_receiver,
536 cx
537 )?) {
538 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
539 None => std::task::Poll::Ready(None),
540 }
541 }
542}
543
544#[derive(Debug)]
545pub enum ControllerEvent {}
546
547impl ControllerEvent {
548 fn decode(
550 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
551 ) -> Result<ControllerEvent, fidl::Error> {
552 let (bytes, _handles) = buf.split_mut();
553 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
554 debug_assert_eq!(tx_header.tx_id, 0);
555 match tx_header.ordinal {
556 _ => Err(fidl::Error::UnknownOrdinal {
557 ordinal: tx_header.ordinal,
558 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
559 }),
560 }
561 }
562}
563
564pub struct ControllerRequestStream {
566 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
567 is_terminated: bool,
568}
569
570impl std::marker::Unpin for ControllerRequestStream {}
571
572impl futures::stream::FusedStream for ControllerRequestStream {
573 fn is_terminated(&self) -> bool {
574 self.is_terminated
575 }
576}
577
578impl fidl::endpoints::RequestStream for ControllerRequestStream {
579 type Protocol = ControllerMarker;
580 type ControlHandle = ControllerControlHandle;
581
582 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
583 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
584 }
585
586 fn control_handle(&self) -> Self::ControlHandle {
587 ControllerControlHandle { inner: self.inner.clone() }
588 }
589
590 fn into_inner(
591 self,
592 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
593 {
594 (self.inner, self.is_terminated)
595 }
596
597 fn from_inner(
598 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
599 is_terminated: bool,
600 ) -> Self {
601 Self { inner, is_terminated }
602 }
603}
604
605impl futures::Stream for ControllerRequestStream {
606 type Item = Result<ControllerRequest, fidl::Error>;
607
608 fn poll_next(
609 mut self: std::pin::Pin<&mut Self>,
610 cx: &mut std::task::Context<'_>,
611 ) -> std::task::Poll<Option<Self::Item>> {
612 let this = &mut *self;
613 if this.inner.check_shutdown(cx) {
614 this.is_terminated = true;
615 return std::task::Poll::Ready(None);
616 }
617 if this.is_terminated {
618 panic!("polled ControllerRequestStream after completion");
619 }
620 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
621 |bytes, handles| {
622 match this.inner.channel().read_etc(cx, bytes, handles) {
623 std::task::Poll::Ready(Ok(())) => {}
624 std::task::Poll::Pending => return std::task::Poll::Pending,
625 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
626 this.is_terminated = true;
627 return std::task::Poll::Ready(None);
628 }
629 std::task::Poll::Ready(Err(e)) => {
630 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
631 e.into(),
632 ))));
633 }
634 }
635
636 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
638
639 std::task::Poll::Ready(Some(match header.ordinal {
640 0x793c584be7211f0d => {
641 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
642 let mut req = fidl::new_empty!(
643 ControllerConnectToDeviceFidlRequest,
644 fidl::encoding::DefaultFuchsiaResourceDialect
645 );
646 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToDeviceFidlRequest>(&header, _body_bytes, handles, &mut req)?;
647 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
648 Ok(ControllerRequest::ConnectToDeviceFidl {
649 server: req.server,
650
651 control_handle,
652 })
653 }
654 0x66774decb0c7a0d0 => {
655 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
656 let mut req = fidl::new_empty!(
657 ControllerConnectToControllerRequest,
658 fidl::encoding::DefaultFuchsiaResourceDialect
659 );
660 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToControllerRequest>(&header, _body_bytes, handles, &mut req)?;
661 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
662 Ok(ControllerRequest::ConnectToController {
663 server: req.server,
664
665 control_handle,
666 })
667 }
668 0x3388f12801462769 => {
669 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
670 let mut req = fidl::new_empty!(
671 ControllerBindRequest,
672 fidl::encoding::DefaultFuchsiaResourceDialect
673 );
674 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerBindRequest>(&header, _body_bytes, handles, &mut req)?;
675 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
676 Ok(ControllerRequest::Bind {
677 driver: req.driver,
678
679 responder: ControllerBindResponder {
680 control_handle: std::mem::ManuallyDrop::new(control_handle),
681 tx_id: header.tx_id,
682 },
683 })
684 }
685 0x384fb80cbc2782e2 => {
686 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
687 let mut req = fidl::new_empty!(
688 ControllerRebindRequest,
689 fidl::encoding::DefaultFuchsiaResourceDialect
690 );
691 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerRebindRequest>(&header, _body_bytes, handles, &mut req)?;
692 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
693 Ok(ControllerRequest::Rebind {
694 driver: req.driver,
695
696 responder: ControllerRebindResponder {
697 control_handle: std::mem::ManuallyDrop::new(control_handle),
698 tx_id: header.tx_id,
699 },
700 })
701 }
702 0x31fae8d74db7a426 => {
703 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
704 let mut req = fidl::new_empty!(
705 fidl::encoding::EmptyPayload,
706 fidl::encoding::DefaultFuchsiaResourceDialect
707 );
708 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
709 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
710 Ok(ControllerRequest::UnbindChildren {
711 responder: ControllerUnbindChildrenResponder {
712 control_handle: std::mem::ManuallyDrop::new(control_handle),
713 tx_id: header.tx_id,
714 },
715 })
716 }
717 0x6128ba9d76aff9c => {
718 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
719 let mut req = fidl::new_empty!(
720 fidl::encoding::EmptyPayload,
721 fidl::encoding::DefaultFuchsiaResourceDialect
722 );
723 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
724 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
725 Ok(ControllerRequest::ScheduleUnbind {
726 responder: ControllerScheduleUnbindResponder {
727 control_handle: std::mem::ManuallyDrop::new(control_handle),
728 tx_id: header.tx_id,
729 },
730 })
731 }
732 0x2689b37663e00788 => {
733 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
734 let mut req = fidl::new_empty!(
735 fidl::encoding::EmptyPayload,
736 fidl::encoding::DefaultFuchsiaResourceDialect
737 );
738 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
739 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
740 Ok(ControllerRequest::GetTopologicalPath {
741 responder: ControllerGetTopologicalPathResponder {
742 control_handle: std::mem::ManuallyDrop::new(control_handle),
743 tx_id: header.tx_id,
744 },
745 })
746 }
747 _ => Err(fidl::Error::UnknownOrdinal {
748 ordinal: header.ordinal,
749 protocol_name:
750 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
751 }),
752 }))
753 },
754 )
755 }
756}
757
758#[derive(Debug)]
768pub enum ControllerRequest {
769 ConnectToDeviceFidl { server: fidl::Channel, control_handle: ControllerControlHandle },
773 ConnectToController {
775 server: fidl::endpoints::ServerEnd<ControllerMarker>,
776 control_handle: ControllerControlHandle,
777 },
778 Bind { driver: String, responder: ControllerBindResponder },
783 Rebind { driver: String, responder: ControllerRebindResponder },
789 UnbindChildren { responder: ControllerUnbindChildrenResponder },
792 ScheduleUnbind { responder: ControllerScheduleUnbindResponder },
795 GetTopologicalPath { responder: ControllerGetTopologicalPathResponder },
797}
798
799impl ControllerRequest {
800 #[allow(irrefutable_let_patterns)]
801 pub fn into_connect_to_device_fidl(self) -> Option<(fidl::Channel, ControllerControlHandle)> {
802 if let ControllerRequest::ConnectToDeviceFidl { server, control_handle } = self {
803 Some((server, control_handle))
804 } else {
805 None
806 }
807 }
808
809 #[allow(irrefutable_let_patterns)]
810 pub fn into_connect_to_controller(
811 self,
812 ) -> Option<(fidl::endpoints::ServerEnd<ControllerMarker>, ControllerControlHandle)> {
813 if let ControllerRequest::ConnectToController { server, control_handle } = self {
814 Some((server, control_handle))
815 } else {
816 None
817 }
818 }
819
820 #[allow(irrefutable_let_patterns)]
821 pub fn into_bind(self) -> Option<(String, ControllerBindResponder)> {
822 if let ControllerRequest::Bind { driver, responder } = self {
823 Some((driver, responder))
824 } else {
825 None
826 }
827 }
828
829 #[allow(irrefutable_let_patterns)]
830 pub fn into_rebind(self) -> Option<(String, ControllerRebindResponder)> {
831 if let ControllerRequest::Rebind { driver, responder } = self {
832 Some((driver, responder))
833 } else {
834 None
835 }
836 }
837
838 #[allow(irrefutable_let_patterns)]
839 pub fn into_unbind_children(self) -> Option<(ControllerUnbindChildrenResponder)> {
840 if let ControllerRequest::UnbindChildren { responder } = self {
841 Some((responder))
842 } else {
843 None
844 }
845 }
846
847 #[allow(irrefutable_let_patterns)]
848 pub fn into_schedule_unbind(self) -> Option<(ControllerScheduleUnbindResponder)> {
849 if let ControllerRequest::ScheduleUnbind { responder } = self {
850 Some((responder))
851 } else {
852 None
853 }
854 }
855
856 #[allow(irrefutable_let_patterns)]
857 pub fn into_get_topological_path(self) -> Option<(ControllerGetTopologicalPathResponder)> {
858 if let ControllerRequest::GetTopologicalPath { responder } = self {
859 Some((responder))
860 } else {
861 None
862 }
863 }
864
865 pub fn method_name(&self) -> &'static str {
867 match *self {
868 ControllerRequest::ConnectToDeviceFidl { .. } => "connect_to_device_fidl",
869 ControllerRequest::ConnectToController { .. } => "connect_to_controller",
870 ControllerRequest::Bind { .. } => "bind",
871 ControllerRequest::Rebind { .. } => "rebind",
872 ControllerRequest::UnbindChildren { .. } => "unbind_children",
873 ControllerRequest::ScheduleUnbind { .. } => "schedule_unbind",
874 ControllerRequest::GetTopologicalPath { .. } => "get_topological_path",
875 }
876 }
877}
878
879#[derive(Debug, Clone)]
880pub struct ControllerControlHandle {
881 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
882}
883
884impl fidl::endpoints::ControlHandle for ControllerControlHandle {
885 fn shutdown(&self) {
886 self.inner.shutdown()
887 }
888
889 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
890 self.inner.shutdown_with_epitaph(status)
891 }
892
893 fn is_closed(&self) -> bool {
894 self.inner.channel().is_closed()
895 }
896 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
897 self.inner.channel().on_closed()
898 }
899
900 #[cfg(target_os = "fuchsia")]
901 fn signal_peer(
902 &self,
903 clear_mask: zx::Signals,
904 set_mask: zx::Signals,
905 ) -> Result<(), zx_status::Status> {
906 use fidl::Peered;
907 self.inner.channel().signal_peer(clear_mask, set_mask)
908 }
909}
910
911impl ControllerControlHandle {}
912
913#[must_use = "FIDL methods require a response to be sent"]
914#[derive(Debug)]
915pub struct ControllerBindResponder {
916 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
917 tx_id: u32,
918}
919
920impl std::ops::Drop for ControllerBindResponder {
924 fn drop(&mut self) {
925 self.control_handle.shutdown();
926 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
928 }
929}
930
931impl fidl::endpoints::Responder for ControllerBindResponder {
932 type ControlHandle = ControllerControlHandle;
933
934 fn control_handle(&self) -> &ControllerControlHandle {
935 &self.control_handle
936 }
937
938 fn drop_without_shutdown(mut self) {
939 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
941 std::mem::forget(self);
943 }
944}
945
946impl ControllerBindResponder {
947 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
951 let _result = self.send_raw(result);
952 if _result.is_err() {
953 self.control_handle.shutdown();
954 }
955 self.drop_without_shutdown();
956 _result
957 }
958
959 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
961 let _result = self.send_raw(result);
962 self.drop_without_shutdown();
963 _result
964 }
965
966 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
967 self.control_handle
968 .inner
969 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
970 result,
971 self.tx_id,
972 0x3388f12801462769,
973 fidl::encoding::DynamicFlags::empty(),
974 )
975 }
976}
977
978#[must_use = "FIDL methods require a response to be sent"]
979#[derive(Debug)]
980pub struct ControllerRebindResponder {
981 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
982 tx_id: u32,
983}
984
985impl std::ops::Drop for ControllerRebindResponder {
989 fn drop(&mut self) {
990 self.control_handle.shutdown();
991 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
993 }
994}
995
996impl fidl::endpoints::Responder for ControllerRebindResponder {
997 type ControlHandle = ControllerControlHandle;
998
999 fn control_handle(&self) -> &ControllerControlHandle {
1000 &self.control_handle
1001 }
1002
1003 fn drop_without_shutdown(mut self) {
1004 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1006 std::mem::forget(self);
1008 }
1009}
1010
1011impl ControllerRebindResponder {
1012 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1016 let _result = self.send_raw(result);
1017 if _result.is_err() {
1018 self.control_handle.shutdown();
1019 }
1020 self.drop_without_shutdown();
1021 _result
1022 }
1023
1024 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1026 let _result = self.send_raw(result);
1027 self.drop_without_shutdown();
1028 _result
1029 }
1030
1031 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1032 self.control_handle
1033 .inner
1034 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1035 result,
1036 self.tx_id,
1037 0x384fb80cbc2782e2,
1038 fidl::encoding::DynamicFlags::empty(),
1039 )
1040 }
1041}
1042
1043#[must_use = "FIDL methods require a response to be sent"]
1044#[derive(Debug)]
1045pub struct ControllerUnbindChildrenResponder {
1046 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1047 tx_id: u32,
1048}
1049
1050impl std::ops::Drop for ControllerUnbindChildrenResponder {
1054 fn drop(&mut self) {
1055 self.control_handle.shutdown();
1056 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1058 }
1059}
1060
1061impl fidl::endpoints::Responder for ControllerUnbindChildrenResponder {
1062 type ControlHandle = ControllerControlHandle;
1063
1064 fn control_handle(&self) -> &ControllerControlHandle {
1065 &self.control_handle
1066 }
1067
1068 fn drop_without_shutdown(mut self) {
1069 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1071 std::mem::forget(self);
1073 }
1074}
1075
1076impl ControllerUnbindChildrenResponder {
1077 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1081 let _result = self.send_raw(result);
1082 if _result.is_err() {
1083 self.control_handle.shutdown();
1084 }
1085 self.drop_without_shutdown();
1086 _result
1087 }
1088
1089 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1091 let _result = self.send_raw(result);
1092 self.drop_without_shutdown();
1093 _result
1094 }
1095
1096 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1097 self.control_handle
1098 .inner
1099 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1100 result,
1101 self.tx_id,
1102 0x31fae8d74db7a426,
1103 fidl::encoding::DynamicFlags::empty(),
1104 )
1105 }
1106}
1107
1108#[must_use = "FIDL methods require a response to be sent"]
1109#[derive(Debug)]
1110pub struct ControllerScheduleUnbindResponder {
1111 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1112 tx_id: u32,
1113}
1114
1115impl std::ops::Drop for ControllerScheduleUnbindResponder {
1119 fn drop(&mut self) {
1120 self.control_handle.shutdown();
1121 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1123 }
1124}
1125
1126impl fidl::endpoints::Responder for ControllerScheduleUnbindResponder {
1127 type ControlHandle = ControllerControlHandle;
1128
1129 fn control_handle(&self) -> &ControllerControlHandle {
1130 &self.control_handle
1131 }
1132
1133 fn drop_without_shutdown(mut self) {
1134 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1136 std::mem::forget(self);
1138 }
1139}
1140
1141impl ControllerScheduleUnbindResponder {
1142 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1146 let _result = self.send_raw(result);
1147 if _result.is_err() {
1148 self.control_handle.shutdown();
1149 }
1150 self.drop_without_shutdown();
1151 _result
1152 }
1153
1154 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1156 let _result = self.send_raw(result);
1157 self.drop_without_shutdown();
1158 _result
1159 }
1160
1161 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1162 self.control_handle
1163 .inner
1164 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1165 result,
1166 self.tx_id,
1167 0x6128ba9d76aff9c,
1168 fidl::encoding::DynamicFlags::empty(),
1169 )
1170 }
1171}
1172
1173#[must_use = "FIDL methods require a response to be sent"]
1174#[derive(Debug)]
1175pub struct ControllerGetTopologicalPathResponder {
1176 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1177 tx_id: u32,
1178}
1179
1180impl std::ops::Drop for ControllerGetTopologicalPathResponder {
1184 fn drop(&mut self) {
1185 self.control_handle.shutdown();
1186 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1188 }
1189}
1190
1191impl fidl::endpoints::Responder for ControllerGetTopologicalPathResponder {
1192 type ControlHandle = ControllerControlHandle;
1193
1194 fn control_handle(&self) -> &ControllerControlHandle {
1195 &self.control_handle
1196 }
1197
1198 fn drop_without_shutdown(mut self) {
1199 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1201 std::mem::forget(self);
1203 }
1204}
1205
1206impl ControllerGetTopologicalPathResponder {
1207 pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1211 let _result = self.send_raw(result);
1212 if _result.is_err() {
1213 self.control_handle.shutdown();
1214 }
1215 self.drop_without_shutdown();
1216 _result
1217 }
1218
1219 pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1221 let _result = self.send_raw(result);
1222 self.drop_without_shutdown();
1223 _result
1224 }
1225
1226 fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1227 self.control_handle.inner.send::<fidl::encoding::ResultType<
1228 ControllerGetTopologicalPathResponse,
1229 i32,
1230 >>(
1231 result.map(|path| (path,)),
1232 self.tx_id,
1233 0x2689b37663e00788,
1234 fidl::encoding::DynamicFlags::empty(),
1235 )
1236 }
1237}
1238
1239#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1240pub struct NameProviderMarker;
1241
1242impl fidl::endpoints::ProtocolMarker for NameProviderMarker {
1243 type Proxy = NameProviderProxy;
1244 type RequestStream = NameProviderRequestStream;
1245 #[cfg(target_os = "fuchsia")]
1246 type SynchronousProxy = NameProviderSynchronousProxy;
1247
1248 const DEBUG_NAME: &'static str = "fuchsia.device.NameProvider";
1249}
1250impl fidl::endpoints::DiscoverableProtocolMarker for NameProviderMarker {}
1251pub type NameProviderGetDeviceNameResult = Result<String, i32>;
1252
1253pub trait NameProviderProxyInterface: Send + Sync {
1254 type GetDeviceNameResponseFut: std::future::Future<Output = Result<NameProviderGetDeviceNameResult, fidl::Error>>
1255 + Send;
1256 fn r#get_device_name(&self) -> Self::GetDeviceNameResponseFut;
1257}
1258#[derive(Debug)]
1259#[cfg(target_os = "fuchsia")]
1260pub struct NameProviderSynchronousProxy {
1261 client: fidl::client::sync::Client,
1262}
1263
1264#[cfg(target_os = "fuchsia")]
1265impl fidl::endpoints::SynchronousProxy for NameProviderSynchronousProxy {
1266 type Proxy = NameProviderProxy;
1267 type Protocol = NameProviderMarker;
1268
1269 fn from_channel(inner: fidl::Channel) -> Self {
1270 Self::new(inner)
1271 }
1272
1273 fn into_channel(self) -> fidl::Channel {
1274 self.client.into_channel()
1275 }
1276
1277 fn as_channel(&self) -> &fidl::Channel {
1278 self.client.as_channel()
1279 }
1280}
1281
1282#[cfg(target_os = "fuchsia")]
1283impl NameProviderSynchronousProxy {
1284 pub fn new(channel: fidl::Channel) -> Self {
1285 let protocol_name = <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1286 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1287 }
1288
1289 pub fn into_channel(self) -> fidl::Channel {
1290 self.client.into_channel()
1291 }
1292
1293 pub fn wait_for_event(
1296 &self,
1297 deadline: zx::MonotonicInstant,
1298 ) -> Result<NameProviderEvent, fidl::Error> {
1299 NameProviderEvent::decode(self.client.wait_for_event(deadline)?)
1300 }
1301
1302 pub fn r#get_device_name(
1304 &self,
1305 ___deadline: zx::MonotonicInstant,
1306 ) -> Result<NameProviderGetDeviceNameResult, fidl::Error> {
1307 let _response = self.client.send_query::<
1308 fidl::encoding::EmptyPayload,
1309 fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>,
1310 >(
1311 (),
1312 0x6030de8d2052b2ce,
1313 fidl::encoding::DynamicFlags::empty(),
1314 ___deadline,
1315 )?;
1316 Ok(_response.map(|x| x.name))
1317 }
1318}
1319
1320#[cfg(target_os = "fuchsia")]
1321impl From<NameProviderSynchronousProxy> for zx::NullableHandle {
1322 fn from(value: NameProviderSynchronousProxy) -> Self {
1323 value.into_channel().into()
1324 }
1325}
1326
1327#[cfg(target_os = "fuchsia")]
1328impl From<fidl::Channel> for NameProviderSynchronousProxy {
1329 fn from(value: fidl::Channel) -> Self {
1330 Self::new(value)
1331 }
1332}
1333
1334#[cfg(target_os = "fuchsia")]
1335impl fidl::endpoints::FromClient for NameProviderSynchronousProxy {
1336 type Protocol = NameProviderMarker;
1337
1338 fn from_client(value: fidl::endpoints::ClientEnd<NameProviderMarker>) -> Self {
1339 Self::new(value.into_channel())
1340 }
1341}
1342
1343#[derive(Debug, Clone)]
1344pub struct NameProviderProxy {
1345 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1346}
1347
1348impl fidl::endpoints::Proxy for NameProviderProxy {
1349 type Protocol = NameProviderMarker;
1350
1351 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1352 Self::new(inner)
1353 }
1354
1355 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1356 self.client.into_channel().map_err(|client| Self { client })
1357 }
1358
1359 fn as_channel(&self) -> &::fidl::AsyncChannel {
1360 self.client.as_channel()
1361 }
1362}
1363
1364impl NameProviderProxy {
1365 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1367 let protocol_name = <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1368 Self { client: fidl::client::Client::new(channel, protocol_name) }
1369 }
1370
1371 pub fn take_event_stream(&self) -> NameProviderEventStream {
1377 NameProviderEventStream { event_receiver: self.client.take_event_receiver() }
1378 }
1379
1380 pub fn r#get_device_name(
1382 &self,
1383 ) -> fidl::client::QueryResponseFut<
1384 NameProviderGetDeviceNameResult,
1385 fidl::encoding::DefaultFuchsiaResourceDialect,
1386 > {
1387 NameProviderProxyInterface::r#get_device_name(self)
1388 }
1389}
1390
1391impl NameProviderProxyInterface for NameProviderProxy {
1392 type GetDeviceNameResponseFut = fidl::client::QueryResponseFut<
1393 NameProviderGetDeviceNameResult,
1394 fidl::encoding::DefaultFuchsiaResourceDialect,
1395 >;
1396 fn r#get_device_name(&self) -> Self::GetDeviceNameResponseFut {
1397 fn _decode(
1398 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1399 ) -> Result<NameProviderGetDeviceNameResult, fidl::Error> {
1400 let _response = fidl::client::decode_transaction_body::<
1401 fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>,
1402 fidl::encoding::DefaultFuchsiaResourceDialect,
1403 0x6030de8d2052b2ce,
1404 >(_buf?)?;
1405 Ok(_response.map(|x| x.name))
1406 }
1407 self.client
1408 .send_query_and_decode::<fidl::encoding::EmptyPayload, NameProviderGetDeviceNameResult>(
1409 (),
1410 0x6030de8d2052b2ce,
1411 fidl::encoding::DynamicFlags::empty(),
1412 _decode,
1413 )
1414 }
1415}
1416
1417pub struct NameProviderEventStream {
1418 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1419}
1420
1421impl std::marker::Unpin for NameProviderEventStream {}
1422
1423impl futures::stream::FusedStream for NameProviderEventStream {
1424 fn is_terminated(&self) -> bool {
1425 self.event_receiver.is_terminated()
1426 }
1427}
1428
1429impl futures::Stream for NameProviderEventStream {
1430 type Item = Result<NameProviderEvent, fidl::Error>;
1431
1432 fn poll_next(
1433 mut self: std::pin::Pin<&mut Self>,
1434 cx: &mut std::task::Context<'_>,
1435 ) -> std::task::Poll<Option<Self::Item>> {
1436 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1437 &mut self.event_receiver,
1438 cx
1439 )?) {
1440 Some(buf) => std::task::Poll::Ready(Some(NameProviderEvent::decode(buf))),
1441 None => std::task::Poll::Ready(None),
1442 }
1443 }
1444}
1445
1446#[derive(Debug)]
1447pub enum NameProviderEvent {}
1448
1449impl NameProviderEvent {
1450 fn decode(
1452 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1453 ) -> Result<NameProviderEvent, fidl::Error> {
1454 let (bytes, _handles) = buf.split_mut();
1455 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1456 debug_assert_eq!(tx_header.tx_id, 0);
1457 match tx_header.ordinal {
1458 _ => Err(fidl::Error::UnknownOrdinal {
1459 ordinal: tx_header.ordinal,
1460 protocol_name: <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1461 }),
1462 }
1463 }
1464}
1465
1466pub struct NameProviderRequestStream {
1468 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1469 is_terminated: bool,
1470}
1471
1472impl std::marker::Unpin for NameProviderRequestStream {}
1473
1474impl futures::stream::FusedStream for NameProviderRequestStream {
1475 fn is_terminated(&self) -> bool {
1476 self.is_terminated
1477 }
1478}
1479
1480impl fidl::endpoints::RequestStream for NameProviderRequestStream {
1481 type Protocol = NameProviderMarker;
1482 type ControlHandle = NameProviderControlHandle;
1483
1484 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1485 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1486 }
1487
1488 fn control_handle(&self) -> Self::ControlHandle {
1489 NameProviderControlHandle { inner: self.inner.clone() }
1490 }
1491
1492 fn into_inner(
1493 self,
1494 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1495 {
1496 (self.inner, self.is_terminated)
1497 }
1498
1499 fn from_inner(
1500 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1501 is_terminated: bool,
1502 ) -> Self {
1503 Self { inner, is_terminated }
1504 }
1505}
1506
1507impl futures::Stream for NameProviderRequestStream {
1508 type Item = Result<NameProviderRequest, fidl::Error>;
1509
1510 fn poll_next(
1511 mut self: std::pin::Pin<&mut Self>,
1512 cx: &mut std::task::Context<'_>,
1513 ) -> std::task::Poll<Option<Self::Item>> {
1514 let this = &mut *self;
1515 if this.inner.check_shutdown(cx) {
1516 this.is_terminated = true;
1517 return std::task::Poll::Ready(None);
1518 }
1519 if this.is_terminated {
1520 panic!("polled NameProviderRequestStream after completion");
1521 }
1522 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1523 |bytes, handles| {
1524 match this.inner.channel().read_etc(cx, bytes, handles) {
1525 std::task::Poll::Ready(Ok(())) => {}
1526 std::task::Poll::Pending => return std::task::Poll::Pending,
1527 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1528 this.is_terminated = true;
1529 return std::task::Poll::Ready(None);
1530 }
1531 std::task::Poll::Ready(Err(e)) => {
1532 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1533 e.into(),
1534 ))));
1535 }
1536 }
1537
1538 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1540
1541 std::task::Poll::Ready(Some(match header.ordinal {
1542 0x6030de8d2052b2ce => {
1543 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1544 let mut req = fidl::new_empty!(
1545 fidl::encoding::EmptyPayload,
1546 fidl::encoding::DefaultFuchsiaResourceDialect
1547 );
1548 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1549 let control_handle =
1550 NameProviderControlHandle { inner: this.inner.clone() };
1551 Ok(NameProviderRequest::GetDeviceName {
1552 responder: NameProviderGetDeviceNameResponder {
1553 control_handle: std::mem::ManuallyDrop::new(control_handle),
1554 tx_id: header.tx_id,
1555 },
1556 })
1557 }
1558 _ => Err(fidl::Error::UnknownOrdinal {
1559 ordinal: header.ordinal,
1560 protocol_name:
1561 <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1562 }),
1563 }))
1564 },
1565 )
1566 }
1567}
1568
1569#[derive(Debug)]
1571pub enum NameProviderRequest {
1572 GetDeviceName { responder: NameProviderGetDeviceNameResponder },
1574}
1575
1576impl NameProviderRequest {
1577 #[allow(irrefutable_let_patterns)]
1578 pub fn into_get_device_name(self) -> Option<(NameProviderGetDeviceNameResponder)> {
1579 if let NameProviderRequest::GetDeviceName { responder } = self {
1580 Some((responder))
1581 } else {
1582 None
1583 }
1584 }
1585
1586 pub fn method_name(&self) -> &'static str {
1588 match *self {
1589 NameProviderRequest::GetDeviceName { .. } => "get_device_name",
1590 }
1591 }
1592}
1593
1594#[derive(Debug, Clone)]
1595pub struct NameProviderControlHandle {
1596 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1597}
1598
1599impl fidl::endpoints::ControlHandle for NameProviderControlHandle {
1600 fn shutdown(&self) {
1601 self.inner.shutdown()
1602 }
1603
1604 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1605 self.inner.shutdown_with_epitaph(status)
1606 }
1607
1608 fn is_closed(&self) -> bool {
1609 self.inner.channel().is_closed()
1610 }
1611 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1612 self.inner.channel().on_closed()
1613 }
1614
1615 #[cfg(target_os = "fuchsia")]
1616 fn signal_peer(
1617 &self,
1618 clear_mask: zx::Signals,
1619 set_mask: zx::Signals,
1620 ) -> Result<(), zx_status::Status> {
1621 use fidl::Peered;
1622 self.inner.channel().signal_peer(clear_mask, set_mask)
1623 }
1624}
1625
1626impl NameProviderControlHandle {}
1627
1628#[must_use = "FIDL methods require a response to be sent"]
1629#[derive(Debug)]
1630pub struct NameProviderGetDeviceNameResponder {
1631 control_handle: std::mem::ManuallyDrop<NameProviderControlHandle>,
1632 tx_id: u32,
1633}
1634
1635impl std::ops::Drop for NameProviderGetDeviceNameResponder {
1639 fn drop(&mut self) {
1640 self.control_handle.shutdown();
1641 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1643 }
1644}
1645
1646impl fidl::endpoints::Responder for NameProviderGetDeviceNameResponder {
1647 type ControlHandle = NameProviderControlHandle;
1648
1649 fn control_handle(&self) -> &NameProviderControlHandle {
1650 &self.control_handle
1651 }
1652
1653 fn drop_without_shutdown(mut self) {
1654 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1656 std::mem::forget(self);
1658 }
1659}
1660
1661impl NameProviderGetDeviceNameResponder {
1662 pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1666 let _result = self.send_raw(result);
1667 if _result.is_err() {
1668 self.control_handle.shutdown();
1669 }
1670 self.drop_without_shutdown();
1671 _result
1672 }
1673
1674 pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1676 let _result = self.send_raw(result);
1677 self.drop_without_shutdown();
1678 _result
1679 }
1680
1681 fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1682 self.control_handle
1683 .inner
1684 .send::<fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>>(
1685 result.map(|name| (name,)),
1686 self.tx_id,
1687 0x6030de8d2052b2ce,
1688 fidl::encoding::DynamicFlags::empty(),
1689 )
1690 }
1691}
1692
1693mod internal {
1694 use super::*;
1695
1696 impl fidl::encoding::ResourceTypeMarker for ControllerConnectToControllerRequest {
1697 type Borrowed<'a> = &'a mut Self;
1698 fn take_or_borrow<'a>(
1699 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1700 ) -> Self::Borrowed<'a> {
1701 value
1702 }
1703 }
1704
1705 unsafe impl fidl::encoding::TypeMarker for ControllerConnectToControllerRequest {
1706 type Owned = Self;
1707
1708 #[inline(always)]
1709 fn inline_align(_context: fidl::encoding::Context) -> usize {
1710 4
1711 }
1712
1713 #[inline(always)]
1714 fn inline_size(_context: fidl::encoding::Context) -> usize {
1715 4
1716 }
1717 }
1718
1719 unsafe impl
1720 fidl::encoding::Encode<
1721 ControllerConnectToControllerRequest,
1722 fidl::encoding::DefaultFuchsiaResourceDialect,
1723 > for &mut ControllerConnectToControllerRequest
1724 {
1725 #[inline]
1726 unsafe fn encode(
1727 self,
1728 encoder: &mut fidl::encoding::Encoder<
1729 '_,
1730 fidl::encoding::DefaultFuchsiaResourceDialect,
1731 >,
1732 offset: usize,
1733 _depth: fidl::encoding::Depth,
1734 ) -> fidl::Result<()> {
1735 encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
1736 fidl::encoding::Encode::<ControllerConnectToControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1738 (
1739 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
1740 ),
1741 encoder, offset, _depth
1742 )
1743 }
1744 }
1745 unsafe impl<
1746 T0: fidl::encoding::Encode<
1747 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1748 fidl::encoding::DefaultFuchsiaResourceDialect,
1749 >,
1750 >
1751 fidl::encoding::Encode<
1752 ControllerConnectToControllerRequest,
1753 fidl::encoding::DefaultFuchsiaResourceDialect,
1754 > for (T0,)
1755 {
1756 #[inline]
1757 unsafe fn encode(
1758 self,
1759 encoder: &mut fidl::encoding::Encoder<
1760 '_,
1761 fidl::encoding::DefaultFuchsiaResourceDialect,
1762 >,
1763 offset: usize,
1764 depth: fidl::encoding::Depth,
1765 ) -> fidl::Result<()> {
1766 encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
1767 self.0.encode(encoder, offset + 0, depth)?;
1771 Ok(())
1772 }
1773 }
1774
1775 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1776 for ControllerConnectToControllerRequest
1777 {
1778 #[inline(always)]
1779 fn new_empty() -> Self {
1780 Self {
1781 server: fidl::new_empty!(
1782 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1783 fidl::encoding::DefaultFuchsiaResourceDialect
1784 ),
1785 }
1786 }
1787
1788 #[inline]
1789 unsafe fn decode(
1790 &mut self,
1791 decoder: &mut fidl::encoding::Decoder<
1792 '_,
1793 fidl::encoding::DefaultFuchsiaResourceDialect,
1794 >,
1795 offset: usize,
1796 _depth: fidl::encoding::Depth,
1797 ) -> fidl::Result<()> {
1798 decoder.debug_check_bounds::<Self>(offset);
1799 fidl::decode!(
1801 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1802 fidl::encoding::DefaultFuchsiaResourceDialect,
1803 &mut self.server,
1804 decoder,
1805 offset + 0,
1806 _depth
1807 )?;
1808 Ok(())
1809 }
1810 }
1811
1812 impl fidl::encoding::ResourceTypeMarker for ControllerConnectToDeviceFidlRequest {
1813 type Borrowed<'a> = &'a mut Self;
1814 fn take_or_borrow<'a>(
1815 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1816 ) -> Self::Borrowed<'a> {
1817 value
1818 }
1819 }
1820
1821 unsafe impl fidl::encoding::TypeMarker for ControllerConnectToDeviceFidlRequest {
1822 type Owned = Self;
1823
1824 #[inline(always)]
1825 fn inline_align(_context: fidl::encoding::Context) -> usize {
1826 4
1827 }
1828
1829 #[inline(always)]
1830 fn inline_size(_context: fidl::encoding::Context) -> usize {
1831 4
1832 }
1833 }
1834
1835 unsafe impl
1836 fidl::encoding::Encode<
1837 ControllerConnectToDeviceFidlRequest,
1838 fidl::encoding::DefaultFuchsiaResourceDialect,
1839 > for &mut ControllerConnectToDeviceFidlRequest
1840 {
1841 #[inline]
1842 unsafe fn encode(
1843 self,
1844 encoder: &mut fidl::encoding::Encoder<
1845 '_,
1846 fidl::encoding::DefaultFuchsiaResourceDialect,
1847 >,
1848 offset: usize,
1849 _depth: fidl::encoding::Depth,
1850 ) -> fidl::Result<()> {
1851 encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
1852 fidl::encoding::Encode::<
1854 ControllerConnectToDeviceFidlRequest,
1855 fidl::encoding::DefaultFuchsiaResourceDialect,
1856 >::encode(
1857 (<fidl::encoding::HandleType<
1858 fidl::Channel,
1859 { fidl::ObjectType::CHANNEL.into_raw() },
1860 2147483648,
1861 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1862 &mut self.server
1863 ),),
1864 encoder,
1865 offset,
1866 _depth,
1867 )
1868 }
1869 }
1870 unsafe impl<
1871 T0: fidl::encoding::Encode<
1872 fidl::encoding::HandleType<
1873 fidl::Channel,
1874 { fidl::ObjectType::CHANNEL.into_raw() },
1875 2147483648,
1876 >,
1877 fidl::encoding::DefaultFuchsiaResourceDialect,
1878 >,
1879 >
1880 fidl::encoding::Encode<
1881 ControllerConnectToDeviceFidlRequest,
1882 fidl::encoding::DefaultFuchsiaResourceDialect,
1883 > for (T0,)
1884 {
1885 #[inline]
1886 unsafe fn encode(
1887 self,
1888 encoder: &mut fidl::encoding::Encoder<
1889 '_,
1890 fidl::encoding::DefaultFuchsiaResourceDialect,
1891 >,
1892 offset: usize,
1893 depth: fidl::encoding::Depth,
1894 ) -> fidl::Result<()> {
1895 encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
1896 self.0.encode(encoder, offset + 0, depth)?;
1900 Ok(())
1901 }
1902 }
1903
1904 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1905 for ControllerConnectToDeviceFidlRequest
1906 {
1907 #[inline(always)]
1908 fn new_empty() -> Self {
1909 Self {
1910 server: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1911 }
1912 }
1913
1914 #[inline]
1915 unsafe fn decode(
1916 &mut self,
1917 decoder: &mut fidl::encoding::Decoder<
1918 '_,
1919 fidl::encoding::DefaultFuchsiaResourceDialect,
1920 >,
1921 offset: usize,
1922 _depth: fidl::encoding::Depth,
1923 ) -> fidl::Result<()> {
1924 decoder.debug_check_bounds::<Self>(offset);
1925 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
1927 Ok(())
1928 }
1929 }
1930}