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::Handle {
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#[derive(Debug, Clone)]
252pub struct ControllerProxy {
253 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
254}
255
256impl fidl::endpoints::Proxy for ControllerProxy {
257 type Protocol = ControllerMarker;
258
259 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
260 Self::new(inner)
261 }
262
263 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
264 self.client.into_channel().map_err(|client| Self { client })
265 }
266
267 fn as_channel(&self) -> &::fidl::AsyncChannel {
268 self.client.as_channel()
269 }
270}
271
272impl ControllerProxy {
273 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
275 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
276 Self { client: fidl::client::Client::new(channel, protocol_name) }
277 }
278
279 pub fn take_event_stream(&self) -> ControllerEventStream {
285 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
286 }
287
288 pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
292 ControllerProxyInterface::r#connect_to_device_fidl(self, server)
293 }
294
295 pub fn r#connect_to_controller(
297 &self,
298 mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
299 ) -> Result<(), fidl::Error> {
300 ControllerProxyInterface::r#connect_to_controller(self, server)
301 }
302
303 pub fn r#bind(
308 &self,
309 mut driver: &str,
310 ) -> fidl::client::QueryResponseFut<
311 ControllerBindResult,
312 fidl::encoding::DefaultFuchsiaResourceDialect,
313 > {
314 ControllerProxyInterface::r#bind(self, driver)
315 }
316
317 pub fn r#rebind(
323 &self,
324 mut driver: &str,
325 ) -> fidl::client::QueryResponseFut<
326 ControllerRebindResult,
327 fidl::encoding::DefaultFuchsiaResourceDialect,
328 > {
329 ControllerProxyInterface::r#rebind(self, driver)
330 }
331
332 pub fn r#unbind_children(
335 &self,
336 ) -> fidl::client::QueryResponseFut<
337 ControllerUnbindChildrenResult,
338 fidl::encoding::DefaultFuchsiaResourceDialect,
339 > {
340 ControllerProxyInterface::r#unbind_children(self)
341 }
342
343 pub fn r#schedule_unbind(
346 &self,
347 ) -> fidl::client::QueryResponseFut<
348 ControllerScheduleUnbindResult,
349 fidl::encoding::DefaultFuchsiaResourceDialect,
350 > {
351 ControllerProxyInterface::r#schedule_unbind(self)
352 }
353
354 pub fn r#get_topological_path(
356 &self,
357 ) -> fidl::client::QueryResponseFut<
358 ControllerGetTopologicalPathResult,
359 fidl::encoding::DefaultFuchsiaResourceDialect,
360 > {
361 ControllerProxyInterface::r#get_topological_path(self)
362 }
363}
364
365impl ControllerProxyInterface for ControllerProxy {
366 fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
367 self.client.send::<ControllerConnectToDeviceFidlRequest>(
368 (server,),
369 0x793c584be7211f0d,
370 fidl::encoding::DynamicFlags::empty(),
371 )
372 }
373
374 fn r#connect_to_controller(
375 &self,
376 mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
377 ) -> Result<(), fidl::Error> {
378 self.client.send::<ControllerConnectToControllerRequest>(
379 (server,),
380 0x66774decb0c7a0d0,
381 fidl::encoding::DynamicFlags::empty(),
382 )
383 }
384
385 type BindResponseFut = fidl::client::QueryResponseFut<
386 ControllerBindResult,
387 fidl::encoding::DefaultFuchsiaResourceDialect,
388 >;
389 fn r#bind(&self, mut driver: &str) -> Self::BindResponseFut {
390 fn _decode(
391 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
392 ) -> Result<ControllerBindResult, fidl::Error> {
393 let _response = fidl::client::decode_transaction_body::<
394 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
395 fidl::encoding::DefaultFuchsiaResourceDialect,
396 0x3388f12801462769,
397 >(_buf?)?;
398 Ok(_response.map(|x| x))
399 }
400 self.client.send_query_and_decode::<ControllerBindRequest, ControllerBindResult>(
401 (driver,),
402 0x3388f12801462769,
403 fidl::encoding::DynamicFlags::empty(),
404 _decode,
405 )
406 }
407
408 type RebindResponseFut = fidl::client::QueryResponseFut<
409 ControllerRebindResult,
410 fidl::encoding::DefaultFuchsiaResourceDialect,
411 >;
412 fn r#rebind(&self, mut driver: &str) -> Self::RebindResponseFut {
413 fn _decode(
414 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
415 ) -> Result<ControllerRebindResult, fidl::Error> {
416 let _response = fidl::client::decode_transaction_body::<
417 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
418 fidl::encoding::DefaultFuchsiaResourceDialect,
419 0x384fb80cbc2782e2,
420 >(_buf?)?;
421 Ok(_response.map(|x| x))
422 }
423 self.client.send_query_and_decode::<ControllerRebindRequest, ControllerRebindResult>(
424 (driver,),
425 0x384fb80cbc2782e2,
426 fidl::encoding::DynamicFlags::empty(),
427 _decode,
428 )
429 }
430
431 type UnbindChildrenResponseFut = fidl::client::QueryResponseFut<
432 ControllerUnbindChildrenResult,
433 fidl::encoding::DefaultFuchsiaResourceDialect,
434 >;
435 fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut {
436 fn _decode(
437 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
438 ) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
439 let _response = fidl::client::decode_transaction_body::<
440 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
441 fidl::encoding::DefaultFuchsiaResourceDialect,
442 0x31fae8d74db7a426,
443 >(_buf?)?;
444 Ok(_response.map(|x| x))
445 }
446 self.client
447 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerUnbindChildrenResult>(
448 (),
449 0x31fae8d74db7a426,
450 fidl::encoding::DynamicFlags::empty(),
451 _decode,
452 )
453 }
454
455 type ScheduleUnbindResponseFut = fidl::client::QueryResponseFut<
456 ControllerScheduleUnbindResult,
457 fidl::encoding::DefaultFuchsiaResourceDialect,
458 >;
459 fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut {
460 fn _decode(
461 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
462 ) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
463 let _response = fidl::client::decode_transaction_body::<
464 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
465 fidl::encoding::DefaultFuchsiaResourceDialect,
466 0x6128ba9d76aff9c,
467 >(_buf?)?;
468 Ok(_response.map(|x| x))
469 }
470 self.client
471 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerScheduleUnbindResult>(
472 (),
473 0x6128ba9d76aff9c,
474 fidl::encoding::DynamicFlags::empty(),
475 _decode,
476 )
477 }
478
479 type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
480 ControllerGetTopologicalPathResult,
481 fidl::encoding::DefaultFuchsiaResourceDialect,
482 >;
483 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
484 fn _decode(
485 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
486 ) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
487 let _response = fidl::client::decode_transaction_body::<
488 fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
489 fidl::encoding::DefaultFuchsiaResourceDialect,
490 0x2689b37663e00788,
491 >(_buf?)?;
492 Ok(_response.map(|x| x.path))
493 }
494 self.client.send_query_and_decode::<
495 fidl::encoding::EmptyPayload,
496 ControllerGetTopologicalPathResult,
497 >(
498 (),
499 0x2689b37663e00788,
500 fidl::encoding::DynamicFlags::empty(),
501 _decode,
502 )
503 }
504}
505
506pub struct ControllerEventStream {
507 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
508}
509
510impl std::marker::Unpin for ControllerEventStream {}
511
512impl futures::stream::FusedStream for ControllerEventStream {
513 fn is_terminated(&self) -> bool {
514 self.event_receiver.is_terminated()
515 }
516}
517
518impl futures::Stream for ControllerEventStream {
519 type Item = Result<ControllerEvent, fidl::Error>;
520
521 fn poll_next(
522 mut self: std::pin::Pin<&mut Self>,
523 cx: &mut std::task::Context<'_>,
524 ) -> std::task::Poll<Option<Self::Item>> {
525 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
526 &mut self.event_receiver,
527 cx
528 )?) {
529 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
530 None => std::task::Poll::Ready(None),
531 }
532 }
533}
534
535#[derive(Debug)]
536pub enum ControllerEvent {}
537
538impl ControllerEvent {
539 fn decode(
541 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
542 ) -> Result<ControllerEvent, fidl::Error> {
543 let (bytes, _handles) = buf.split_mut();
544 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
545 debug_assert_eq!(tx_header.tx_id, 0);
546 match tx_header.ordinal {
547 _ => Err(fidl::Error::UnknownOrdinal {
548 ordinal: tx_header.ordinal,
549 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
550 }),
551 }
552 }
553}
554
555pub struct ControllerRequestStream {
557 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
558 is_terminated: bool,
559}
560
561impl std::marker::Unpin for ControllerRequestStream {}
562
563impl futures::stream::FusedStream for ControllerRequestStream {
564 fn is_terminated(&self) -> bool {
565 self.is_terminated
566 }
567}
568
569impl fidl::endpoints::RequestStream for ControllerRequestStream {
570 type Protocol = ControllerMarker;
571 type ControlHandle = ControllerControlHandle;
572
573 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
574 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
575 }
576
577 fn control_handle(&self) -> Self::ControlHandle {
578 ControllerControlHandle { inner: self.inner.clone() }
579 }
580
581 fn into_inner(
582 self,
583 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
584 {
585 (self.inner, self.is_terminated)
586 }
587
588 fn from_inner(
589 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
590 is_terminated: bool,
591 ) -> Self {
592 Self { inner, is_terminated }
593 }
594}
595
596impl futures::Stream for ControllerRequestStream {
597 type Item = Result<ControllerRequest, fidl::Error>;
598
599 fn poll_next(
600 mut self: std::pin::Pin<&mut Self>,
601 cx: &mut std::task::Context<'_>,
602 ) -> std::task::Poll<Option<Self::Item>> {
603 let this = &mut *self;
604 if this.inner.check_shutdown(cx) {
605 this.is_terminated = true;
606 return std::task::Poll::Ready(None);
607 }
608 if this.is_terminated {
609 panic!("polled ControllerRequestStream after completion");
610 }
611 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
612 |bytes, handles| {
613 match this.inner.channel().read_etc(cx, bytes, handles) {
614 std::task::Poll::Ready(Ok(())) => {}
615 std::task::Poll::Pending => return std::task::Poll::Pending,
616 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
617 this.is_terminated = true;
618 return std::task::Poll::Ready(None);
619 }
620 std::task::Poll::Ready(Err(e)) => {
621 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
622 e.into(),
623 ))))
624 }
625 }
626
627 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
629
630 std::task::Poll::Ready(Some(match header.ordinal {
631 0x793c584be7211f0d => {
632 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
633 let mut req = fidl::new_empty!(
634 ControllerConnectToDeviceFidlRequest,
635 fidl::encoding::DefaultFuchsiaResourceDialect
636 );
637 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToDeviceFidlRequest>(&header, _body_bytes, handles, &mut req)?;
638 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
639 Ok(ControllerRequest::ConnectToDeviceFidl {
640 server: req.server,
641
642 control_handle,
643 })
644 }
645 0x66774decb0c7a0d0 => {
646 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
647 let mut req = fidl::new_empty!(
648 ControllerConnectToControllerRequest,
649 fidl::encoding::DefaultFuchsiaResourceDialect
650 );
651 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToControllerRequest>(&header, _body_bytes, handles, &mut req)?;
652 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
653 Ok(ControllerRequest::ConnectToController {
654 server: req.server,
655
656 control_handle,
657 })
658 }
659 0x3388f12801462769 => {
660 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
661 let mut req = fidl::new_empty!(
662 ControllerBindRequest,
663 fidl::encoding::DefaultFuchsiaResourceDialect
664 );
665 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerBindRequest>(&header, _body_bytes, handles, &mut req)?;
666 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
667 Ok(ControllerRequest::Bind {
668 driver: req.driver,
669
670 responder: ControllerBindResponder {
671 control_handle: std::mem::ManuallyDrop::new(control_handle),
672 tx_id: header.tx_id,
673 },
674 })
675 }
676 0x384fb80cbc2782e2 => {
677 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
678 let mut req = fidl::new_empty!(
679 ControllerRebindRequest,
680 fidl::encoding::DefaultFuchsiaResourceDialect
681 );
682 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerRebindRequest>(&header, _body_bytes, handles, &mut req)?;
683 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
684 Ok(ControllerRequest::Rebind {
685 driver: req.driver,
686
687 responder: ControllerRebindResponder {
688 control_handle: std::mem::ManuallyDrop::new(control_handle),
689 tx_id: header.tx_id,
690 },
691 })
692 }
693 0x31fae8d74db7a426 => {
694 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
695 let mut req = fidl::new_empty!(
696 fidl::encoding::EmptyPayload,
697 fidl::encoding::DefaultFuchsiaResourceDialect
698 );
699 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
700 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
701 Ok(ControllerRequest::UnbindChildren {
702 responder: ControllerUnbindChildrenResponder {
703 control_handle: std::mem::ManuallyDrop::new(control_handle),
704 tx_id: header.tx_id,
705 },
706 })
707 }
708 0x6128ba9d76aff9c => {
709 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
710 let mut req = fidl::new_empty!(
711 fidl::encoding::EmptyPayload,
712 fidl::encoding::DefaultFuchsiaResourceDialect
713 );
714 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
715 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
716 Ok(ControllerRequest::ScheduleUnbind {
717 responder: ControllerScheduleUnbindResponder {
718 control_handle: std::mem::ManuallyDrop::new(control_handle),
719 tx_id: header.tx_id,
720 },
721 })
722 }
723 0x2689b37663e00788 => {
724 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
725 let mut req = fidl::new_empty!(
726 fidl::encoding::EmptyPayload,
727 fidl::encoding::DefaultFuchsiaResourceDialect
728 );
729 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
730 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
731 Ok(ControllerRequest::GetTopologicalPath {
732 responder: ControllerGetTopologicalPathResponder {
733 control_handle: std::mem::ManuallyDrop::new(control_handle),
734 tx_id: header.tx_id,
735 },
736 })
737 }
738 _ => Err(fidl::Error::UnknownOrdinal {
739 ordinal: header.ordinal,
740 protocol_name:
741 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
742 }),
743 }))
744 },
745 )
746 }
747}
748
749#[derive(Debug)]
759pub enum ControllerRequest {
760 ConnectToDeviceFidl { server: fidl::Channel, control_handle: ControllerControlHandle },
764 ConnectToController {
766 server: fidl::endpoints::ServerEnd<ControllerMarker>,
767 control_handle: ControllerControlHandle,
768 },
769 Bind { driver: String, responder: ControllerBindResponder },
774 Rebind { driver: String, responder: ControllerRebindResponder },
780 UnbindChildren { responder: ControllerUnbindChildrenResponder },
783 ScheduleUnbind { responder: ControllerScheduleUnbindResponder },
786 GetTopologicalPath { responder: ControllerGetTopologicalPathResponder },
788}
789
790impl ControllerRequest {
791 #[allow(irrefutable_let_patterns)]
792 pub fn into_connect_to_device_fidl(self) -> Option<(fidl::Channel, ControllerControlHandle)> {
793 if let ControllerRequest::ConnectToDeviceFidl { server, control_handle } = self {
794 Some((server, control_handle))
795 } else {
796 None
797 }
798 }
799
800 #[allow(irrefutable_let_patterns)]
801 pub fn into_connect_to_controller(
802 self,
803 ) -> Option<(fidl::endpoints::ServerEnd<ControllerMarker>, ControllerControlHandle)> {
804 if let ControllerRequest::ConnectToController { server, control_handle } = self {
805 Some((server, control_handle))
806 } else {
807 None
808 }
809 }
810
811 #[allow(irrefutable_let_patterns)]
812 pub fn into_bind(self) -> Option<(String, ControllerBindResponder)> {
813 if let ControllerRequest::Bind { driver, responder } = self {
814 Some((driver, responder))
815 } else {
816 None
817 }
818 }
819
820 #[allow(irrefutable_let_patterns)]
821 pub fn into_rebind(self) -> Option<(String, ControllerRebindResponder)> {
822 if let ControllerRequest::Rebind { driver, responder } = self {
823 Some((driver, responder))
824 } else {
825 None
826 }
827 }
828
829 #[allow(irrefutable_let_patterns)]
830 pub fn into_unbind_children(self) -> Option<(ControllerUnbindChildrenResponder)> {
831 if let ControllerRequest::UnbindChildren { responder } = self {
832 Some((responder))
833 } else {
834 None
835 }
836 }
837
838 #[allow(irrefutable_let_patterns)]
839 pub fn into_schedule_unbind(self) -> Option<(ControllerScheduleUnbindResponder)> {
840 if let ControllerRequest::ScheduleUnbind { responder } = self {
841 Some((responder))
842 } else {
843 None
844 }
845 }
846
847 #[allow(irrefutable_let_patterns)]
848 pub fn into_get_topological_path(self) -> Option<(ControllerGetTopologicalPathResponder)> {
849 if let ControllerRequest::GetTopologicalPath { responder } = self {
850 Some((responder))
851 } else {
852 None
853 }
854 }
855
856 pub fn method_name(&self) -> &'static str {
858 match *self {
859 ControllerRequest::ConnectToDeviceFidl { .. } => "connect_to_device_fidl",
860 ControllerRequest::ConnectToController { .. } => "connect_to_controller",
861 ControllerRequest::Bind { .. } => "bind",
862 ControllerRequest::Rebind { .. } => "rebind",
863 ControllerRequest::UnbindChildren { .. } => "unbind_children",
864 ControllerRequest::ScheduleUnbind { .. } => "schedule_unbind",
865 ControllerRequest::GetTopologicalPath { .. } => "get_topological_path",
866 }
867 }
868}
869
870#[derive(Debug, Clone)]
871pub struct ControllerControlHandle {
872 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
873}
874
875impl fidl::endpoints::ControlHandle for ControllerControlHandle {
876 fn shutdown(&self) {
877 self.inner.shutdown()
878 }
879 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
880 self.inner.shutdown_with_epitaph(status)
881 }
882
883 fn is_closed(&self) -> bool {
884 self.inner.channel().is_closed()
885 }
886 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
887 self.inner.channel().on_closed()
888 }
889
890 #[cfg(target_os = "fuchsia")]
891 fn signal_peer(
892 &self,
893 clear_mask: zx::Signals,
894 set_mask: zx::Signals,
895 ) -> Result<(), zx_status::Status> {
896 use fidl::Peered;
897 self.inner.channel().signal_peer(clear_mask, set_mask)
898 }
899}
900
901impl ControllerControlHandle {}
902
903#[must_use = "FIDL methods require a response to be sent"]
904#[derive(Debug)]
905pub struct ControllerBindResponder {
906 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
907 tx_id: u32,
908}
909
910impl std::ops::Drop for ControllerBindResponder {
914 fn drop(&mut self) {
915 self.control_handle.shutdown();
916 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
918 }
919}
920
921impl fidl::endpoints::Responder for ControllerBindResponder {
922 type ControlHandle = ControllerControlHandle;
923
924 fn control_handle(&self) -> &ControllerControlHandle {
925 &self.control_handle
926 }
927
928 fn drop_without_shutdown(mut self) {
929 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
931 std::mem::forget(self);
933 }
934}
935
936impl ControllerBindResponder {
937 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
941 let _result = self.send_raw(result);
942 if _result.is_err() {
943 self.control_handle.shutdown();
944 }
945 self.drop_without_shutdown();
946 _result
947 }
948
949 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
951 let _result = self.send_raw(result);
952 self.drop_without_shutdown();
953 _result
954 }
955
956 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
957 self.control_handle
958 .inner
959 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
960 result,
961 self.tx_id,
962 0x3388f12801462769,
963 fidl::encoding::DynamicFlags::empty(),
964 )
965 }
966}
967
968#[must_use = "FIDL methods require a response to be sent"]
969#[derive(Debug)]
970pub struct ControllerRebindResponder {
971 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
972 tx_id: u32,
973}
974
975impl std::ops::Drop for ControllerRebindResponder {
979 fn drop(&mut self) {
980 self.control_handle.shutdown();
981 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
983 }
984}
985
986impl fidl::endpoints::Responder for ControllerRebindResponder {
987 type ControlHandle = ControllerControlHandle;
988
989 fn control_handle(&self) -> &ControllerControlHandle {
990 &self.control_handle
991 }
992
993 fn drop_without_shutdown(mut self) {
994 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
996 std::mem::forget(self);
998 }
999}
1000
1001impl ControllerRebindResponder {
1002 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1006 let _result = self.send_raw(result);
1007 if _result.is_err() {
1008 self.control_handle.shutdown();
1009 }
1010 self.drop_without_shutdown();
1011 _result
1012 }
1013
1014 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1016 let _result = self.send_raw(result);
1017 self.drop_without_shutdown();
1018 _result
1019 }
1020
1021 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1022 self.control_handle
1023 .inner
1024 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1025 result,
1026 self.tx_id,
1027 0x384fb80cbc2782e2,
1028 fidl::encoding::DynamicFlags::empty(),
1029 )
1030 }
1031}
1032
1033#[must_use = "FIDL methods require a response to be sent"]
1034#[derive(Debug)]
1035pub struct ControllerUnbindChildrenResponder {
1036 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1037 tx_id: u32,
1038}
1039
1040impl std::ops::Drop for ControllerUnbindChildrenResponder {
1044 fn drop(&mut self) {
1045 self.control_handle.shutdown();
1046 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1048 }
1049}
1050
1051impl fidl::endpoints::Responder for ControllerUnbindChildrenResponder {
1052 type ControlHandle = ControllerControlHandle;
1053
1054 fn control_handle(&self) -> &ControllerControlHandle {
1055 &self.control_handle
1056 }
1057
1058 fn drop_without_shutdown(mut self) {
1059 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1061 std::mem::forget(self);
1063 }
1064}
1065
1066impl ControllerUnbindChildrenResponder {
1067 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1071 let _result = self.send_raw(result);
1072 if _result.is_err() {
1073 self.control_handle.shutdown();
1074 }
1075 self.drop_without_shutdown();
1076 _result
1077 }
1078
1079 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1081 let _result = self.send_raw(result);
1082 self.drop_without_shutdown();
1083 _result
1084 }
1085
1086 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1087 self.control_handle
1088 .inner
1089 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1090 result,
1091 self.tx_id,
1092 0x31fae8d74db7a426,
1093 fidl::encoding::DynamicFlags::empty(),
1094 )
1095 }
1096}
1097
1098#[must_use = "FIDL methods require a response to be sent"]
1099#[derive(Debug)]
1100pub struct ControllerScheduleUnbindResponder {
1101 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1102 tx_id: u32,
1103}
1104
1105impl std::ops::Drop for ControllerScheduleUnbindResponder {
1109 fn drop(&mut self) {
1110 self.control_handle.shutdown();
1111 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1113 }
1114}
1115
1116impl fidl::endpoints::Responder for ControllerScheduleUnbindResponder {
1117 type ControlHandle = ControllerControlHandle;
1118
1119 fn control_handle(&self) -> &ControllerControlHandle {
1120 &self.control_handle
1121 }
1122
1123 fn drop_without_shutdown(mut self) {
1124 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1126 std::mem::forget(self);
1128 }
1129}
1130
1131impl ControllerScheduleUnbindResponder {
1132 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1136 let _result = self.send_raw(result);
1137 if _result.is_err() {
1138 self.control_handle.shutdown();
1139 }
1140 self.drop_without_shutdown();
1141 _result
1142 }
1143
1144 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1146 let _result = self.send_raw(result);
1147 self.drop_without_shutdown();
1148 _result
1149 }
1150
1151 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1152 self.control_handle
1153 .inner
1154 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1155 result,
1156 self.tx_id,
1157 0x6128ba9d76aff9c,
1158 fidl::encoding::DynamicFlags::empty(),
1159 )
1160 }
1161}
1162
1163#[must_use = "FIDL methods require a response to be sent"]
1164#[derive(Debug)]
1165pub struct ControllerGetTopologicalPathResponder {
1166 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1167 tx_id: u32,
1168}
1169
1170impl std::ops::Drop for ControllerGetTopologicalPathResponder {
1174 fn drop(&mut self) {
1175 self.control_handle.shutdown();
1176 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1178 }
1179}
1180
1181impl fidl::endpoints::Responder for ControllerGetTopologicalPathResponder {
1182 type ControlHandle = ControllerControlHandle;
1183
1184 fn control_handle(&self) -> &ControllerControlHandle {
1185 &self.control_handle
1186 }
1187
1188 fn drop_without_shutdown(mut self) {
1189 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1191 std::mem::forget(self);
1193 }
1194}
1195
1196impl ControllerGetTopologicalPathResponder {
1197 pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1201 let _result = self.send_raw(result);
1202 if _result.is_err() {
1203 self.control_handle.shutdown();
1204 }
1205 self.drop_without_shutdown();
1206 _result
1207 }
1208
1209 pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1211 let _result = self.send_raw(result);
1212 self.drop_without_shutdown();
1213 _result
1214 }
1215
1216 fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1217 self.control_handle.inner.send::<fidl::encoding::ResultType<
1218 ControllerGetTopologicalPathResponse,
1219 i32,
1220 >>(
1221 result.map(|path| (path,)),
1222 self.tx_id,
1223 0x2689b37663e00788,
1224 fidl::encoding::DynamicFlags::empty(),
1225 )
1226 }
1227}
1228
1229#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1230pub struct NameProviderMarker;
1231
1232impl fidl::endpoints::ProtocolMarker for NameProviderMarker {
1233 type Proxy = NameProviderProxy;
1234 type RequestStream = NameProviderRequestStream;
1235 #[cfg(target_os = "fuchsia")]
1236 type SynchronousProxy = NameProviderSynchronousProxy;
1237
1238 const DEBUG_NAME: &'static str = "fuchsia.device.NameProvider";
1239}
1240impl fidl::endpoints::DiscoverableProtocolMarker for NameProviderMarker {}
1241pub type NameProviderGetDeviceNameResult = Result<String, i32>;
1242
1243pub trait NameProviderProxyInterface: Send + Sync {
1244 type GetDeviceNameResponseFut: std::future::Future<Output = Result<NameProviderGetDeviceNameResult, fidl::Error>>
1245 + Send;
1246 fn r#get_device_name(&self) -> Self::GetDeviceNameResponseFut;
1247}
1248#[derive(Debug)]
1249#[cfg(target_os = "fuchsia")]
1250pub struct NameProviderSynchronousProxy {
1251 client: fidl::client::sync::Client,
1252}
1253
1254#[cfg(target_os = "fuchsia")]
1255impl fidl::endpoints::SynchronousProxy for NameProviderSynchronousProxy {
1256 type Proxy = NameProviderProxy;
1257 type Protocol = NameProviderMarker;
1258
1259 fn from_channel(inner: fidl::Channel) -> Self {
1260 Self::new(inner)
1261 }
1262
1263 fn into_channel(self) -> fidl::Channel {
1264 self.client.into_channel()
1265 }
1266
1267 fn as_channel(&self) -> &fidl::Channel {
1268 self.client.as_channel()
1269 }
1270}
1271
1272#[cfg(target_os = "fuchsia")]
1273impl NameProviderSynchronousProxy {
1274 pub fn new(channel: fidl::Channel) -> Self {
1275 let protocol_name = <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1276 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1277 }
1278
1279 pub fn into_channel(self) -> fidl::Channel {
1280 self.client.into_channel()
1281 }
1282
1283 pub fn wait_for_event(
1286 &self,
1287 deadline: zx::MonotonicInstant,
1288 ) -> Result<NameProviderEvent, fidl::Error> {
1289 NameProviderEvent::decode(self.client.wait_for_event(deadline)?)
1290 }
1291
1292 pub fn r#get_device_name(
1294 &self,
1295 ___deadline: zx::MonotonicInstant,
1296 ) -> Result<NameProviderGetDeviceNameResult, fidl::Error> {
1297 let _response = self.client.send_query::<
1298 fidl::encoding::EmptyPayload,
1299 fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>,
1300 >(
1301 (),
1302 0x6030de8d2052b2ce,
1303 fidl::encoding::DynamicFlags::empty(),
1304 ___deadline,
1305 )?;
1306 Ok(_response.map(|x| x.name))
1307 }
1308}
1309
1310#[cfg(target_os = "fuchsia")]
1311impl From<NameProviderSynchronousProxy> for zx::Handle {
1312 fn from(value: NameProviderSynchronousProxy) -> Self {
1313 value.into_channel().into()
1314 }
1315}
1316
1317#[cfg(target_os = "fuchsia")]
1318impl From<fidl::Channel> for NameProviderSynchronousProxy {
1319 fn from(value: fidl::Channel) -> Self {
1320 Self::new(value)
1321 }
1322}
1323
1324#[derive(Debug, Clone)]
1325pub struct NameProviderProxy {
1326 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1327}
1328
1329impl fidl::endpoints::Proxy for NameProviderProxy {
1330 type Protocol = NameProviderMarker;
1331
1332 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1333 Self::new(inner)
1334 }
1335
1336 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1337 self.client.into_channel().map_err(|client| Self { client })
1338 }
1339
1340 fn as_channel(&self) -> &::fidl::AsyncChannel {
1341 self.client.as_channel()
1342 }
1343}
1344
1345impl NameProviderProxy {
1346 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1348 let protocol_name = <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1349 Self { client: fidl::client::Client::new(channel, protocol_name) }
1350 }
1351
1352 pub fn take_event_stream(&self) -> NameProviderEventStream {
1358 NameProviderEventStream { event_receiver: self.client.take_event_receiver() }
1359 }
1360
1361 pub fn r#get_device_name(
1363 &self,
1364 ) -> fidl::client::QueryResponseFut<
1365 NameProviderGetDeviceNameResult,
1366 fidl::encoding::DefaultFuchsiaResourceDialect,
1367 > {
1368 NameProviderProxyInterface::r#get_device_name(self)
1369 }
1370}
1371
1372impl NameProviderProxyInterface for NameProviderProxy {
1373 type GetDeviceNameResponseFut = fidl::client::QueryResponseFut<
1374 NameProviderGetDeviceNameResult,
1375 fidl::encoding::DefaultFuchsiaResourceDialect,
1376 >;
1377 fn r#get_device_name(&self) -> Self::GetDeviceNameResponseFut {
1378 fn _decode(
1379 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1380 ) -> Result<NameProviderGetDeviceNameResult, fidl::Error> {
1381 let _response = fidl::client::decode_transaction_body::<
1382 fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>,
1383 fidl::encoding::DefaultFuchsiaResourceDialect,
1384 0x6030de8d2052b2ce,
1385 >(_buf?)?;
1386 Ok(_response.map(|x| x.name))
1387 }
1388 self.client
1389 .send_query_and_decode::<fidl::encoding::EmptyPayload, NameProviderGetDeviceNameResult>(
1390 (),
1391 0x6030de8d2052b2ce,
1392 fidl::encoding::DynamicFlags::empty(),
1393 _decode,
1394 )
1395 }
1396}
1397
1398pub struct NameProviderEventStream {
1399 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1400}
1401
1402impl std::marker::Unpin for NameProviderEventStream {}
1403
1404impl futures::stream::FusedStream for NameProviderEventStream {
1405 fn is_terminated(&self) -> bool {
1406 self.event_receiver.is_terminated()
1407 }
1408}
1409
1410impl futures::Stream for NameProviderEventStream {
1411 type Item = Result<NameProviderEvent, fidl::Error>;
1412
1413 fn poll_next(
1414 mut self: std::pin::Pin<&mut Self>,
1415 cx: &mut std::task::Context<'_>,
1416 ) -> std::task::Poll<Option<Self::Item>> {
1417 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1418 &mut self.event_receiver,
1419 cx
1420 )?) {
1421 Some(buf) => std::task::Poll::Ready(Some(NameProviderEvent::decode(buf))),
1422 None => std::task::Poll::Ready(None),
1423 }
1424 }
1425}
1426
1427#[derive(Debug)]
1428pub enum NameProviderEvent {}
1429
1430impl NameProviderEvent {
1431 fn decode(
1433 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1434 ) -> Result<NameProviderEvent, fidl::Error> {
1435 let (bytes, _handles) = buf.split_mut();
1436 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1437 debug_assert_eq!(tx_header.tx_id, 0);
1438 match tx_header.ordinal {
1439 _ => Err(fidl::Error::UnknownOrdinal {
1440 ordinal: tx_header.ordinal,
1441 protocol_name: <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1442 }),
1443 }
1444 }
1445}
1446
1447pub struct NameProviderRequestStream {
1449 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1450 is_terminated: bool,
1451}
1452
1453impl std::marker::Unpin for NameProviderRequestStream {}
1454
1455impl futures::stream::FusedStream for NameProviderRequestStream {
1456 fn is_terminated(&self) -> bool {
1457 self.is_terminated
1458 }
1459}
1460
1461impl fidl::endpoints::RequestStream for NameProviderRequestStream {
1462 type Protocol = NameProviderMarker;
1463 type ControlHandle = NameProviderControlHandle;
1464
1465 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1466 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1467 }
1468
1469 fn control_handle(&self) -> Self::ControlHandle {
1470 NameProviderControlHandle { inner: self.inner.clone() }
1471 }
1472
1473 fn into_inner(
1474 self,
1475 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1476 {
1477 (self.inner, self.is_terminated)
1478 }
1479
1480 fn from_inner(
1481 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1482 is_terminated: bool,
1483 ) -> Self {
1484 Self { inner, is_terminated }
1485 }
1486}
1487
1488impl futures::Stream for NameProviderRequestStream {
1489 type Item = Result<NameProviderRequest, fidl::Error>;
1490
1491 fn poll_next(
1492 mut self: std::pin::Pin<&mut Self>,
1493 cx: &mut std::task::Context<'_>,
1494 ) -> std::task::Poll<Option<Self::Item>> {
1495 let this = &mut *self;
1496 if this.inner.check_shutdown(cx) {
1497 this.is_terminated = true;
1498 return std::task::Poll::Ready(None);
1499 }
1500 if this.is_terminated {
1501 panic!("polled NameProviderRequestStream after completion");
1502 }
1503 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1504 |bytes, handles| {
1505 match this.inner.channel().read_etc(cx, bytes, handles) {
1506 std::task::Poll::Ready(Ok(())) => {}
1507 std::task::Poll::Pending => return std::task::Poll::Pending,
1508 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1509 this.is_terminated = true;
1510 return std::task::Poll::Ready(None);
1511 }
1512 std::task::Poll::Ready(Err(e)) => {
1513 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1514 e.into(),
1515 ))))
1516 }
1517 }
1518
1519 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1521
1522 std::task::Poll::Ready(Some(match header.ordinal {
1523 0x6030de8d2052b2ce => {
1524 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1525 let mut req = fidl::new_empty!(
1526 fidl::encoding::EmptyPayload,
1527 fidl::encoding::DefaultFuchsiaResourceDialect
1528 );
1529 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1530 let control_handle =
1531 NameProviderControlHandle { inner: this.inner.clone() };
1532 Ok(NameProviderRequest::GetDeviceName {
1533 responder: NameProviderGetDeviceNameResponder {
1534 control_handle: std::mem::ManuallyDrop::new(control_handle),
1535 tx_id: header.tx_id,
1536 },
1537 })
1538 }
1539 _ => Err(fidl::Error::UnknownOrdinal {
1540 ordinal: header.ordinal,
1541 protocol_name:
1542 <NameProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1543 }),
1544 }))
1545 },
1546 )
1547 }
1548}
1549
1550#[derive(Debug)]
1552pub enum NameProviderRequest {
1553 GetDeviceName { responder: NameProviderGetDeviceNameResponder },
1555}
1556
1557impl NameProviderRequest {
1558 #[allow(irrefutable_let_patterns)]
1559 pub fn into_get_device_name(self) -> Option<(NameProviderGetDeviceNameResponder)> {
1560 if let NameProviderRequest::GetDeviceName { responder } = self {
1561 Some((responder))
1562 } else {
1563 None
1564 }
1565 }
1566
1567 pub fn method_name(&self) -> &'static str {
1569 match *self {
1570 NameProviderRequest::GetDeviceName { .. } => "get_device_name",
1571 }
1572 }
1573}
1574
1575#[derive(Debug, Clone)]
1576pub struct NameProviderControlHandle {
1577 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1578}
1579
1580impl fidl::endpoints::ControlHandle for NameProviderControlHandle {
1581 fn shutdown(&self) {
1582 self.inner.shutdown()
1583 }
1584 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1585 self.inner.shutdown_with_epitaph(status)
1586 }
1587
1588 fn is_closed(&self) -> bool {
1589 self.inner.channel().is_closed()
1590 }
1591 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1592 self.inner.channel().on_closed()
1593 }
1594
1595 #[cfg(target_os = "fuchsia")]
1596 fn signal_peer(
1597 &self,
1598 clear_mask: zx::Signals,
1599 set_mask: zx::Signals,
1600 ) -> Result<(), zx_status::Status> {
1601 use fidl::Peered;
1602 self.inner.channel().signal_peer(clear_mask, set_mask)
1603 }
1604}
1605
1606impl NameProviderControlHandle {}
1607
1608#[must_use = "FIDL methods require a response to be sent"]
1609#[derive(Debug)]
1610pub struct NameProviderGetDeviceNameResponder {
1611 control_handle: std::mem::ManuallyDrop<NameProviderControlHandle>,
1612 tx_id: u32,
1613}
1614
1615impl std::ops::Drop for NameProviderGetDeviceNameResponder {
1619 fn drop(&mut self) {
1620 self.control_handle.shutdown();
1621 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1623 }
1624}
1625
1626impl fidl::endpoints::Responder for NameProviderGetDeviceNameResponder {
1627 type ControlHandle = NameProviderControlHandle;
1628
1629 fn control_handle(&self) -> &NameProviderControlHandle {
1630 &self.control_handle
1631 }
1632
1633 fn drop_without_shutdown(mut self) {
1634 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1636 std::mem::forget(self);
1638 }
1639}
1640
1641impl NameProviderGetDeviceNameResponder {
1642 pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1646 let _result = self.send_raw(result);
1647 if _result.is_err() {
1648 self.control_handle.shutdown();
1649 }
1650 self.drop_without_shutdown();
1651 _result
1652 }
1653
1654 pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1656 let _result = self.send_raw(result);
1657 self.drop_without_shutdown();
1658 _result
1659 }
1660
1661 fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
1662 self.control_handle
1663 .inner
1664 .send::<fidl::encoding::ResultType<NameProviderGetDeviceNameResponse, i32>>(
1665 result.map(|name| (name,)),
1666 self.tx_id,
1667 0x6030de8d2052b2ce,
1668 fidl::encoding::DynamicFlags::empty(),
1669 )
1670 }
1671}
1672
1673mod internal {
1674 use super::*;
1675
1676 impl fidl::encoding::ResourceTypeMarker for ControllerConnectToControllerRequest {
1677 type Borrowed<'a> = &'a mut Self;
1678 fn take_or_borrow<'a>(
1679 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1680 ) -> Self::Borrowed<'a> {
1681 value
1682 }
1683 }
1684
1685 unsafe impl fidl::encoding::TypeMarker for ControllerConnectToControllerRequest {
1686 type Owned = Self;
1687
1688 #[inline(always)]
1689 fn inline_align(_context: fidl::encoding::Context) -> usize {
1690 4
1691 }
1692
1693 #[inline(always)]
1694 fn inline_size(_context: fidl::encoding::Context) -> usize {
1695 4
1696 }
1697 }
1698
1699 unsafe impl
1700 fidl::encoding::Encode<
1701 ControllerConnectToControllerRequest,
1702 fidl::encoding::DefaultFuchsiaResourceDialect,
1703 > for &mut ControllerConnectToControllerRequest
1704 {
1705 #[inline]
1706 unsafe fn encode(
1707 self,
1708 encoder: &mut fidl::encoding::Encoder<
1709 '_,
1710 fidl::encoding::DefaultFuchsiaResourceDialect,
1711 >,
1712 offset: usize,
1713 _depth: fidl::encoding::Depth,
1714 ) -> fidl::Result<()> {
1715 encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
1716 fidl::encoding::Encode::<ControllerConnectToControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1718 (
1719 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
1720 ),
1721 encoder, offset, _depth
1722 )
1723 }
1724 }
1725 unsafe impl<
1726 T0: fidl::encoding::Encode<
1727 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1728 fidl::encoding::DefaultFuchsiaResourceDialect,
1729 >,
1730 >
1731 fidl::encoding::Encode<
1732 ControllerConnectToControllerRequest,
1733 fidl::encoding::DefaultFuchsiaResourceDialect,
1734 > for (T0,)
1735 {
1736 #[inline]
1737 unsafe fn encode(
1738 self,
1739 encoder: &mut fidl::encoding::Encoder<
1740 '_,
1741 fidl::encoding::DefaultFuchsiaResourceDialect,
1742 >,
1743 offset: usize,
1744 depth: fidl::encoding::Depth,
1745 ) -> fidl::Result<()> {
1746 encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
1747 self.0.encode(encoder, offset + 0, depth)?;
1751 Ok(())
1752 }
1753 }
1754
1755 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1756 for ControllerConnectToControllerRequest
1757 {
1758 #[inline(always)]
1759 fn new_empty() -> Self {
1760 Self {
1761 server: fidl::new_empty!(
1762 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1763 fidl::encoding::DefaultFuchsiaResourceDialect
1764 ),
1765 }
1766 }
1767
1768 #[inline]
1769 unsafe fn decode(
1770 &mut self,
1771 decoder: &mut fidl::encoding::Decoder<
1772 '_,
1773 fidl::encoding::DefaultFuchsiaResourceDialect,
1774 >,
1775 offset: usize,
1776 _depth: fidl::encoding::Depth,
1777 ) -> fidl::Result<()> {
1778 decoder.debug_check_bounds::<Self>(offset);
1779 fidl::decode!(
1781 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
1782 fidl::encoding::DefaultFuchsiaResourceDialect,
1783 &mut self.server,
1784 decoder,
1785 offset + 0,
1786 _depth
1787 )?;
1788 Ok(())
1789 }
1790 }
1791
1792 impl fidl::encoding::ResourceTypeMarker for ControllerConnectToDeviceFidlRequest {
1793 type Borrowed<'a> = &'a mut Self;
1794 fn take_or_borrow<'a>(
1795 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1796 ) -> Self::Borrowed<'a> {
1797 value
1798 }
1799 }
1800
1801 unsafe impl fidl::encoding::TypeMarker for ControllerConnectToDeviceFidlRequest {
1802 type Owned = Self;
1803
1804 #[inline(always)]
1805 fn inline_align(_context: fidl::encoding::Context) -> usize {
1806 4
1807 }
1808
1809 #[inline(always)]
1810 fn inline_size(_context: fidl::encoding::Context) -> usize {
1811 4
1812 }
1813 }
1814
1815 unsafe impl
1816 fidl::encoding::Encode<
1817 ControllerConnectToDeviceFidlRequest,
1818 fidl::encoding::DefaultFuchsiaResourceDialect,
1819 > for &mut ControllerConnectToDeviceFidlRequest
1820 {
1821 #[inline]
1822 unsafe fn encode(
1823 self,
1824 encoder: &mut fidl::encoding::Encoder<
1825 '_,
1826 fidl::encoding::DefaultFuchsiaResourceDialect,
1827 >,
1828 offset: usize,
1829 _depth: fidl::encoding::Depth,
1830 ) -> fidl::Result<()> {
1831 encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
1832 fidl::encoding::Encode::<
1834 ControllerConnectToDeviceFidlRequest,
1835 fidl::encoding::DefaultFuchsiaResourceDialect,
1836 >::encode(
1837 (<fidl::encoding::HandleType<
1838 fidl::Channel,
1839 { fidl::ObjectType::CHANNEL.into_raw() },
1840 2147483648,
1841 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1842 &mut self.server
1843 ),),
1844 encoder,
1845 offset,
1846 _depth,
1847 )
1848 }
1849 }
1850 unsafe impl<
1851 T0: fidl::encoding::Encode<
1852 fidl::encoding::HandleType<
1853 fidl::Channel,
1854 { fidl::ObjectType::CHANNEL.into_raw() },
1855 2147483648,
1856 >,
1857 fidl::encoding::DefaultFuchsiaResourceDialect,
1858 >,
1859 >
1860 fidl::encoding::Encode<
1861 ControllerConnectToDeviceFidlRequest,
1862 fidl::encoding::DefaultFuchsiaResourceDialect,
1863 > for (T0,)
1864 {
1865 #[inline]
1866 unsafe fn encode(
1867 self,
1868 encoder: &mut fidl::encoding::Encoder<
1869 '_,
1870 fidl::encoding::DefaultFuchsiaResourceDialect,
1871 >,
1872 offset: usize,
1873 depth: fidl::encoding::Depth,
1874 ) -> fidl::Result<()> {
1875 encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
1876 self.0.encode(encoder, offset + 0, depth)?;
1880 Ok(())
1881 }
1882 }
1883
1884 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1885 for ControllerConnectToDeviceFidlRequest
1886 {
1887 #[inline(always)]
1888 fn new_empty() -> Self {
1889 Self {
1890 server: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1891 }
1892 }
1893
1894 #[inline]
1895 unsafe fn decode(
1896 &mut self,
1897 decoder: &mut fidl::encoding::Decoder<
1898 '_,
1899 fidl::encoding::DefaultFuchsiaResourceDialect,
1900 >,
1901 offset: usize,
1902 _depth: fidl::encoding::Depth,
1903 ) -> fidl::Result<()> {
1904 decoder.debug_check_bounds::<Self>(offset);
1905 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
1907 Ok(())
1908 }
1909 }
1910}