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