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_hardware_interconnect__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18 type Proxy = DeviceProxy;
19 type RequestStream = DeviceRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeviceSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.hardware.interconnect.Device";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
26pub type DeviceSetNodesBandwidthResult = Result<(), i32>;
27
28pub trait DeviceProxyInterface: Send + Sync {
29 type SetNodesBandwidthResponseFut: std::future::Future<Output = Result<DeviceSetNodesBandwidthResult, fidl::Error>>
30 + Send;
31 fn r#set_nodes_bandwidth(&self, nodes: &[NodeBandwidth]) -> Self::SetNodesBandwidthResponseFut;
32 type GetNodeGraphResponseFut: std::future::Future<Output = Result<(Vec<Node>, Vec<Edge>), fidl::Error>>
33 + Send;
34 fn r#get_node_graph(&self) -> Self::GetNodeGraphResponseFut;
35 type GetPathEndpointsResponseFut: std::future::Future<Output = Result<Vec<PathEndpoints>, fidl::Error>>
36 + Send;
37 fn r#get_path_endpoints(&self) -> Self::GetPathEndpointsResponseFut;
38}
39#[derive(Debug)]
40#[cfg(target_os = "fuchsia")]
41pub struct DeviceSynchronousProxy {
42 client: fidl::client::sync::Client,
43}
44
45#[cfg(target_os = "fuchsia")]
46impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
47 type Proxy = DeviceProxy;
48 type Protocol = DeviceMarker;
49
50 fn from_channel(inner: fidl::Channel) -> Self {
51 Self::new(inner)
52 }
53
54 fn into_channel(self) -> fidl::Channel {
55 self.client.into_channel()
56 }
57
58 fn as_channel(&self) -> &fidl::Channel {
59 self.client.as_channel()
60 }
61}
62
63#[cfg(target_os = "fuchsia")]
64impl DeviceSynchronousProxy {
65 pub fn new(channel: fidl::Channel) -> Self {
66 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
67 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
68 }
69
70 pub fn into_channel(self) -> fidl::Channel {
71 self.client.into_channel()
72 }
73
74 pub fn wait_for_event(
77 &self,
78 deadline: zx::MonotonicInstant,
79 ) -> Result<DeviceEvent, fidl::Error> {
80 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
81 }
82
83 pub fn r#set_nodes_bandwidth(
84 &self,
85 mut nodes: &[NodeBandwidth],
86 ___deadline: zx::MonotonicInstant,
87 ) -> Result<DeviceSetNodesBandwidthResult, fidl::Error> {
88 let _response = self.client.send_query::<
89 DeviceSetNodesBandwidthRequest,
90 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
91 >(
92 (nodes,),
93 0x3bb98f59dd645c14,
94 fidl::encoding::DynamicFlags::FLEXIBLE,
95 ___deadline,
96 )?
97 .into_result::<DeviceMarker>("set_nodes_bandwidth")?;
98 Ok(_response.map(|x| x))
99 }
100
101 pub fn r#get_node_graph(
106 &self,
107 ___deadline: zx::MonotonicInstant,
108 ) -> Result<(Vec<Node>, Vec<Edge>), fidl::Error> {
109 let _response = self.client.send_query::<
110 fidl::encoding::EmptyPayload,
111 fidl::encoding::FlexibleType<DeviceGetNodeGraphResponse>,
112 >(
113 (),
114 0x2f676c9ef41b8306,
115 fidl::encoding::DynamicFlags::FLEXIBLE,
116 ___deadline,
117 )?
118 .into_result::<DeviceMarker>("get_node_graph")?;
119 Ok((_response.nodes, _response.edges))
120 }
121
122 pub fn r#get_path_endpoints(
126 &self,
127 ___deadline: zx::MonotonicInstant,
128 ) -> Result<Vec<PathEndpoints>, fidl::Error> {
129 let _response = self.client.send_query::<
130 fidl::encoding::EmptyPayload,
131 fidl::encoding::FlexibleType<DeviceGetPathEndpointsResponse>,
132 >(
133 (),
134 0x656ae602a096765b,
135 fidl::encoding::DynamicFlags::FLEXIBLE,
136 ___deadline,
137 )?
138 .into_result::<DeviceMarker>("get_path_endpoints")?;
139 Ok(_response.paths)
140 }
141}
142
143#[cfg(target_os = "fuchsia")]
144impl From<DeviceSynchronousProxy> for zx::Handle {
145 fn from(value: DeviceSynchronousProxy) -> Self {
146 value.into_channel().into()
147 }
148}
149
150#[cfg(target_os = "fuchsia")]
151impl From<fidl::Channel> for DeviceSynchronousProxy {
152 fn from(value: fidl::Channel) -> Self {
153 Self::new(value)
154 }
155}
156
157#[derive(Debug, Clone)]
158pub struct DeviceProxy {
159 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
160}
161
162impl fidl::endpoints::Proxy for DeviceProxy {
163 type Protocol = DeviceMarker;
164
165 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
166 Self::new(inner)
167 }
168
169 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
170 self.client.into_channel().map_err(|client| Self { client })
171 }
172
173 fn as_channel(&self) -> &::fidl::AsyncChannel {
174 self.client.as_channel()
175 }
176}
177
178impl DeviceProxy {
179 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
181 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
182 Self { client: fidl::client::Client::new(channel, protocol_name) }
183 }
184
185 pub fn take_event_stream(&self) -> DeviceEventStream {
191 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
192 }
193
194 pub fn r#set_nodes_bandwidth(
195 &self,
196 mut nodes: &[NodeBandwidth],
197 ) -> fidl::client::QueryResponseFut<
198 DeviceSetNodesBandwidthResult,
199 fidl::encoding::DefaultFuchsiaResourceDialect,
200 > {
201 DeviceProxyInterface::r#set_nodes_bandwidth(self, nodes)
202 }
203
204 pub fn r#get_node_graph(
209 &self,
210 ) -> fidl::client::QueryResponseFut<
211 (Vec<Node>, Vec<Edge>),
212 fidl::encoding::DefaultFuchsiaResourceDialect,
213 > {
214 DeviceProxyInterface::r#get_node_graph(self)
215 }
216
217 pub fn r#get_path_endpoints(
221 &self,
222 ) -> fidl::client::QueryResponseFut<
223 Vec<PathEndpoints>,
224 fidl::encoding::DefaultFuchsiaResourceDialect,
225 > {
226 DeviceProxyInterface::r#get_path_endpoints(self)
227 }
228}
229
230impl DeviceProxyInterface for DeviceProxy {
231 type SetNodesBandwidthResponseFut = fidl::client::QueryResponseFut<
232 DeviceSetNodesBandwidthResult,
233 fidl::encoding::DefaultFuchsiaResourceDialect,
234 >;
235 fn r#set_nodes_bandwidth(
236 &self,
237 mut nodes: &[NodeBandwidth],
238 ) -> Self::SetNodesBandwidthResponseFut {
239 fn _decode(
240 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
241 ) -> Result<DeviceSetNodesBandwidthResult, fidl::Error> {
242 let _response = fidl::client::decode_transaction_body::<
243 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
244 fidl::encoding::DefaultFuchsiaResourceDialect,
245 0x3bb98f59dd645c14,
246 >(_buf?)?
247 .into_result::<DeviceMarker>("set_nodes_bandwidth")?;
248 Ok(_response.map(|x| x))
249 }
250 self.client
251 .send_query_and_decode::<DeviceSetNodesBandwidthRequest, DeviceSetNodesBandwidthResult>(
252 (nodes,),
253 0x3bb98f59dd645c14,
254 fidl::encoding::DynamicFlags::FLEXIBLE,
255 _decode,
256 )
257 }
258
259 type GetNodeGraphResponseFut = fidl::client::QueryResponseFut<
260 (Vec<Node>, Vec<Edge>),
261 fidl::encoding::DefaultFuchsiaResourceDialect,
262 >;
263 fn r#get_node_graph(&self) -> Self::GetNodeGraphResponseFut {
264 fn _decode(
265 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
266 ) -> Result<(Vec<Node>, Vec<Edge>), fidl::Error> {
267 let _response = fidl::client::decode_transaction_body::<
268 fidl::encoding::FlexibleType<DeviceGetNodeGraphResponse>,
269 fidl::encoding::DefaultFuchsiaResourceDialect,
270 0x2f676c9ef41b8306,
271 >(_buf?)?
272 .into_result::<DeviceMarker>("get_node_graph")?;
273 Ok((_response.nodes, _response.edges))
274 }
275 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<Node>, Vec<Edge>)>(
276 (),
277 0x2f676c9ef41b8306,
278 fidl::encoding::DynamicFlags::FLEXIBLE,
279 _decode,
280 )
281 }
282
283 type GetPathEndpointsResponseFut = fidl::client::QueryResponseFut<
284 Vec<PathEndpoints>,
285 fidl::encoding::DefaultFuchsiaResourceDialect,
286 >;
287 fn r#get_path_endpoints(&self) -> Self::GetPathEndpointsResponseFut {
288 fn _decode(
289 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
290 ) -> Result<Vec<PathEndpoints>, fidl::Error> {
291 let _response = fidl::client::decode_transaction_body::<
292 fidl::encoding::FlexibleType<DeviceGetPathEndpointsResponse>,
293 fidl::encoding::DefaultFuchsiaResourceDialect,
294 0x656ae602a096765b,
295 >(_buf?)?
296 .into_result::<DeviceMarker>("get_path_endpoints")?;
297 Ok(_response.paths)
298 }
299 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PathEndpoints>>(
300 (),
301 0x656ae602a096765b,
302 fidl::encoding::DynamicFlags::FLEXIBLE,
303 _decode,
304 )
305 }
306}
307
308pub struct DeviceEventStream {
309 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
310}
311
312impl std::marker::Unpin for DeviceEventStream {}
313
314impl futures::stream::FusedStream for DeviceEventStream {
315 fn is_terminated(&self) -> bool {
316 self.event_receiver.is_terminated()
317 }
318}
319
320impl futures::Stream for DeviceEventStream {
321 type Item = Result<DeviceEvent, fidl::Error>;
322
323 fn poll_next(
324 mut self: std::pin::Pin<&mut Self>,
325 cx: &mut std::task::Context<'_>,
326 ) -> std::task::Poll<Option<Self::Item>> {
327 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
328 &mut self.event_receiver,
329 cx
330 )?) {
331 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
332 None => std::task::Poll::Ready(None),
333 }
334 }
335}
336
337#[derive(Debug)]
338pub enum DeviceEvent {
339 #[non_exhaustive]
340 _UnknownEvent {
341 ordinal: u64,
343 },
344}
345
346impl DeviceEvent {
347 fn decode(
349 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
350 ) -> Result<DeviceEvent, fidl::Error> {
351 let (bytes, _handles) = buf.split_mut();
352 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
353 debug_assert_eq!(tx_header.tx_id, 0);
354 match tx_header.ordinal {
355 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
356 Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
357 }
358 _ => Err(fidl::Error::UnknownOrdinal {
359 ordinal: tx_header.ordinal,
360 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
361 }),
362 }
363 }
364}
365
366pub struct DeviceRequestStream {
368 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
369 is_terminated: bool,
370}
371
372impl std::marker::Unpin for DeviceRequestStream {}
373
374impl futures::stream::FusedStream for DeviceRequestStream {
375 fn is_terminated(&self) -> bool {
376 self.is_terminated
377 }
378}
379
380impl fidl::endpoints::RequestStream for DeviceRequestStream {
381 type Protocol = DeviceMarker;
382 type ControlHandle = DeviceControlHandle;
383
384 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
385 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
386 }
387
388 fn control_handle(&self) -> Self::ControlHandle {
389 DeviceControlHandle { inner: self.inner.clone() }
390 }
391
392 fn into_inner(
393 self,
394 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
395 {
396 (self.inner, self.is_terminated)
397 }
398
399 fn from_inner(
400 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
401 is_terminated: bool,
402 ) -> Self {
403 Self { inner, is_terminated }
404 }
405}
406
407impl futures::Stream for DeviceRequestStream {
408 type Item = Result<DeviceRequest, fidl::Error>;
409
410 fn poll_next(
411 mut self: std::pin::Pin<&mut Self>,
412 cx: &mut std::task::Context<'_>,
413 ) -> std::task::Poll<Option<Self::Item>> {
414 let this = &mut *self;
415 if this.inner.check_shutdown(cx) {
416 this.is_terminated = true;
417 return std::task::Poll::Ready(None);
418 }
419 if this.is_terminated {
420 panic!("polled DeviceRequestStream after completion");
421 }
422 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
423 |bytes, handles| {
424 match this.inner.channel().read_etc(cx, bytes, handles) {
425 std::task::Poll::Ready(Ok(())) => {}
426 std::task::Poll::Pending => return std::task::Poll::Pending,
427 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
428 this.is_terminated = true;
429 return std::task::Poll::Ready(None);
430 }
431 std::task::Poll::Ready(Err(e)) => {
432 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
433 e.into(),
434 ))))
435 }
436 }
437
438 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
440
441 std::task::Poll::Ready(Some(match header.ordinal {
442 0x3bb98f59dd645c14 => {
443 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
444 let mut req = fidl::new_empty!(
445 DeviceSetNodesBandwidthRequest,
446 fidl::encoding::DefaultFuchsiaResourceDialect
447 );
448 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetNodesBandwidthRequest>(&header, _body_bytes, handles, &mut req)?;
449 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
450 Ok(DeviceRequest::SetNodesBandwidth {
451 nodes: req.nodes,
452
453 responder: DeviceSetNodesBandwidthResponder {
454 control_handle: std::mem::ManuallyDrop::new(control_handle),
455 tx_id: header.tx_id,
456 },
457 })
458 }
459 0x2f676c9ef41b8306 => {
460 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
461 let mut req = fidl::new_empty!(
462 fidl::encoding::EmptyPayload,
463 fidl::encoding::DefaultFuchsiaResourceDialect
464 );
465 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
466 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
467 Ok(DeviceRequest::GetNodeGraph {
468 responder: DeviceGetNodeGraphResponder {
469 control_handle: std::mem::ManuallyDrop::new(control_handle),
470 tx_id: header.tx_id,
471 },
472 })
473 }
474 0x656ae602a096765b => {
475 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
476 let mut req = fidl::new_empty!(
477 fidl::encoding::EmptyPayload,
478 fidl::encoding::DefaultFuchsiaResourceDialect
479 );
480 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
481 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
482 Ok(DeviceRequest::GetPathEndpoints {
483 responder: DeviceGetPathEndpointsResponder {
484 control_handle: std::mem::ManuallyDrop::new(control_handle),
485 tx_id: header.tx_id,
486 },
487 })
488 }
489 _ if header.tx_id == 0
490 && header
491 .dynamic_flags()
492 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
493 {
494 Ok(DeviceRequest::_UnknownMethod {
495 ordinal: header.ordinal,
496 control_handle: DeviceControlHandle { inner: this.inner.clone() },
497 method_type: fidl::MethodType::OneWay,
498 })
499 }
500 _ if header
501 .dynamic_flags()
502 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
503 {
504 this.inner.send_framework_err(
505 fidl::encoding::FrameworkErr::UnknownMethod,
506 header.tx_id,
507 header.ordinal,
508 header.dynamic_flags(),
509 (bytes, handles),
510 )?;
511 Ok(DeviceRequest::_UnknownMethod {
512 ordinal: header.ordinal,
513 control_handle: DeviceControlHandle { inner: this.inner.clone() },
514 method_type: fidl::MethodType::TwoWay,
515 })
516 }
517 _ => Err(fidl::Error::UnknownOrdinal {
518 ordinal: header.ordinal,
519 protocol_name:
520 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
521 }),
522 }))
523 },
524 )
525 }
526}
527
528#[derive(Debug)]
529pub enum DeviceRequest {
530 SetNodesBandwidth {
531 nodes: Vec<NodeBandwidth>,
532 responder: DeviceSetNodesBandwidthResponder,
533 },
534 GetNodeGraph {
539 responder: DeviceGetNodeGraphResponder,
540 },
541 GetPathEndpoints {
545 responder: DeviceGetPathEndpointsResponder,
546 },
547 #[non_exhaustive]
549 _UnknownMethod {
550 ordinal: u64,
552 control_handle: DeviceControlHandle,
553 method_type: fidl::MethodType,
554 },
555}
556
557impl DeviceRequest {
558 #[allow(irrefutable_let_patterns)]
559 pub fn into_set_nodes_bandwidth(
560 self,
561 ) -> Option<(Vec<NodeBandwidth>, DeviceSetNodesBandwidthResponder)> {
562 if let DeviceRequest::SetNodesBandwidth { nodes, responder } = self {
563 Some((nodes, responder))
564 } else {
565 None
566 }
567 }
568
569 #[allow(irrefutable_let_patterns)]
570 pub fn into_get_node_graph(self) -> Option<(DeviceGetNodeGraphResponder)> {
571 if let DeviceRequest::GetNodeGraph { responder } = self {
572 Some((responder))
573 } else {
574 None
575 }
576 }
577
578 #[allow(irrefutable_let_patterns)]
579 pub fn into_get_path_endpoints(self) -> Option<(DeviceGetPathEndpointsResponder)> {
580 if let DeviceRequest::GetPathEndpoints { responder } = self {
581 Some((responder))
582 } else {
583 None
584 }
585 }
586
587 pub fn method_name(&self) -> &'static str {
589 match *self {
590 DeviceRequest::SetNodesBandwidth { .. } => "set_nodes_bandwidth",
591 DeviceRequest::GetNodeGraph { .. } => "get_node_graph",
592 DeviceRequest::GetPathEndpoints { .. } => "get_path_endpoints",
593 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
594 "unknown one-way method"
595 }
596 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
597 "unknown two-way method"
598 }
599 }
600 }
601}
602
603#[derive(Debug, Clone)]
604pub struct DeviceControlHandle {
605 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
606}
607
608impl fidl::endpoints::ControlHandle for DeviceControlHandle {
609 fn shutdown(&self) {
610 self.inner.shutdown()
611 }
612 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
613 self.inner.shutdown_with_epitaph(status)
614 }
615
616 fn is_closed(&self) -> bool {
617 self.inner.channel().is_closed()
618 }
619 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
620 self.inner.channel().on_closed()
621 }
622
623 #[cfg(target_os = "fuchsia")]
624 fn signal_peer(
625 &self,
626 clear_mask: zx::Signals,
627 set_mask: zx::Signals,
628 ) -> Result<(), zx_status::Status> {
629 use fidl::Peered;
630 self.inner.channel().signal_peer(clear_mask, set_mask)
631 }
632}
633
634impl DeviceControlHandle {}
635
636#[must_use = "FIDL methods require a response to be sent"]
637#[derive(Debug)]
638pub struct DeviceSetNodesBandwidthResponder {
639 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
640 tx_id: u32,
641}
642
643impl std::ops::Drop for DeviceSetNodesBandwidthResponder {
647 fn drop(&mut self) {
648 self.control_handle.shutdown();
649 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
651 }
652}
653
654impl fidl::endpoints::Responder for DeviceSetNodesBandwidthResponder {
655 type ControlHandle = DeviceControlHandle;
656
657 fn control_handle(&self) -> &DeviceControlHandle {
658 &self.control_handle
659 }
660
661 fn drop_without_shutdown(mut self) {
662 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
664 std::mem::forget(self);
666 }
667}
668
669impl DeviceSetNodesBandwidthResponder {
670 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
674 let _result = self.send_raw(result);
675 if _result.is_err() {
676 self.control_handle.shutdown();
677 }
678 self.drop_without_shutdown();
679 _result
680 }
681
682 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
684 let _result = self.send_raw(result);
685 self.drop_without_shutdown();
686 _result
687 }
688
689 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
690 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
691 fidl::encoding::EmptyStruct,
692 i32,
693 >>(
694 fidl::encoding::FlexibleResult::new(result),
695 self.tx_id,
696 0x3bb98f59dd645c14,
697 fidl::encoding::DynamicFlags::FLEXIBLE,
698 )
699 }
700}
701
702#[must_use = "FIDL methods require a response to be sent"]
703#[derive(Debug)]
704pub struct DeviceGetNodeGraphResponder {
705 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
706 tx_id: u32,
707}
708
709impl std::ops::Drop for DeviceGetNodeGraphResponder {
713 fn drop(&mut self) {
714 self.control_handle.shutdown();
715 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
717 }
718}
719
720impl fidl::endpoints::Responder for DeviceGetNodeGraphResponder {
721 type ControlHandle = DeviceControlHandle;
722
723 fn control_handle(&self) -> &DeviceControlHandle {
724 &self.control_handle
725 }
726
727 fn drop_without_shutdown(mut self) {
728 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
730 std::mem::forget(self);
732 }
733}
734
735impl DeviceGetNodeGraphResponder {
736 pub fn send(self, mut nodes: &[Node], mut edges: &[Edge]) -> Result<(), fidl::Error> {
740 let _result = self.send_raw(nodes, edges);
741 if _result.is_err() {
742 self.control_handle.shutdown();
743 }
744 self.drop_without_shutdown();
745 _result
746 }
747
748 pub fn send_no_shutdown_on_err(
750 self,
751 mut nodes: &[Node],
752 mut edges: &[Edge],
753 ) -> Result<(), fidl::Error> {
754 let _result = self.send_raw(nodes, edges);
755 self.drop_without_shutdown();
756 _result
757 }
758
759 fn send_raw(&self, mut nodes: &[Node], mut edges: &[Edge]) -> Result<(), fidl::Error> {
760 self.control_handle.inner.send::<fidl::encoding::FlexibleType<DeviceGetNodeGraphResponse>>(
761 fidl::encoding::Flexible::new((nodes, edges)),
762 self.tx_id,
763 0x2f676c9ef41b8306,
764 fidl::encoding::DynamicFlags::FLEXIBLE,
765 )
766 }
767}
768
769#[must_use = "FIDL methods require a response to be sent"]
770#[derive(Debug)]
771pub struct DeviceGetPathEndpointsResponder {
772 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
773 tx_id: u32,
774}
775
776impl std::ops::Drop for DeviceGetPathEndpointsResponder {
780 fn drop(&mut self) {
781 self.control_handle.shutdown();
782 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
784 }
785}
786
787impl fidl::endpoints::Responder for DeviceGetPathEndpointsResponder {
788 type ControlHandle = DeviceControlHandle;
789
790 fn control_handle(&self) -> &DeviceControlHandle {
791 &self.control_handle
792 }
793
794 fn drop_without_shutdown(mut self) {
795 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
797 std::mem::forget(self);
799 }
800}
801
802impl DeviceGetPathEndpointsResponder {
803 pub fn send(self, mut paths: &[PathEndpoints]) -> Result<(), fidl::Error> {
807 let _result = self.send_raw(paths);
808 if _result.is_err() {
809 self.control_handle.shutdown();
810 }
811 self.drop_without_shutdown();
812 _result
813 }
814
815 pub fn send_no_shutdown_on_err(self, mut paths: &[PathEndpoints]) -> Result<(), fidl::Error> {
817 let _result = self.send_raw(paths);
818 self.drop_without_shutdown();
819 _result
820 }
821
822 fn send_raw(&self, mut paths: &[PathEndpoints]) -> Result<(), fidl::Error> {
823 self.control_handle
824 .inner
825 .send::<fidl::encoding::FlexibleType<DeviceGetPathEndpointsResponse>>(
826 fidl::encoding::Flexible::new((paths,)),
827 self.tx_id,
828 0x656ae602a096765b,
829 fidl::encoding::DynamicFlags::FLEXIBLE,
830 )
831 }
832}
833
834#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
835pub struct PathMarker;
836
837impl fidl::endpoints::ProtocolMarker for PathMarker {
838 type Proxy = PathProxy;
839 type RequestStream = PathRequestStream;
840 #[cfg(target_os = "fuchsia")]
841 type SynchronousProxy = PathSynchronousProxy;
842
843 const DEBUG_NAME: &'static str = "fuchsia.hardware.interconnect.Path";
844}
845impl fidl::endpoints::DiscoverableProtocolMarker for PathMarker {}
846pub type PathSetBandwidthResult = Result<(), i32>;
847
848pub trait PathProxyInterface: Send + Sync {
849 type SetBandwidthResponseFut: std::future::Future<Output = Result<PathSetBandwidthResult, fidl::Error>>
850 + Send;
851 fn r#set_bandwidth(&self, payload: &BandwidthRequest) -> Self::SetBandwidthResponseFut;
852}
853#[derive(Debug)]
854#[cfg(target_os = "fuchsia")]
855pub struct PathSynchronousProxy {
856 client: fidl::client::sync::Client,
857}
858
859#[cfg(target_os = "fuchsia")]
860impl fidl::endpoints::SynchronousProxy for PathSynchronousProxy {
861 type Proxy = PathProxy;
862 type Protocol = PathMarker;
863
864 fn from_channel(inner: fidl::Channel) -> Self {
865 Self::new(inner)
866 }
867
868 fn into_channel(self) -> fidl::Channel {
869 self.client.into_channel()
870 }
871
872 fn as_channel(&self) -> &fidl::Channel {
873 self.client.as_channel()
874 }
875}
876
877#[cfg(target_os = "fuchsia")]
878impl PathSynchronousProxy {
879 pub fn new(channel: fidl::Channel) -> Self {
880 let protocol_name = <PathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
881 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
882 }
883
884 pub fn into_channel(self) -> fidl::Channel {
885 self.client.into_channel()
886 }
887
888 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PathEvent, fidl::Error> {
891 PathEvent::decode(self.client.wait_for_event(deadline)?)
892 }
893
894 pub fn r#set_bandwidth(
896 &self,
897 mut payload: &BandwidthRequest,
898 ___deadline: zx::MonotonicInstant,
899 ) -> Result<PathSetBandwidthResult, fidl::Error> {
900 let _response = self.client.send_query::<
901 BandwidthRequest,
902 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
903 >(
904 payload,
905 0xd366c6e86f69d1d,
906 fidl::encoding::DynamicFlags::FLEXIBLE,
907 ___deadline,
908 )?
909 .into_result::<PathMarker>("set_bandwidth")?;
910 Ok(_response.map(|x| x))
911 }
912}
913
914#[cfg(target_os = "fuchsia")]
915impl From<PathSynchronousProxy> for zx::Handle {
916 fn from(value: PathSynchronousProxy) -> Self {
917 value.into_channel().into()
918 }
919}
920
921#[cfg(target_os = "fuchsia")]
922impl From<fidl::Channel> for PathSynchronousProxy {
923 fn from(value: fidl::Channel) -> Self {
924 Self::new(value)
925 }
926}
927
928#[derive(Debug, Clone)]
929pub struct PathProxy {
930 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
931}
932
933impl fidl::endpoints::Proxy for PathProxy {
934 type Protocol = PathMarker;
935
936 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
937 Self::new(inner)
938 }
939
940 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
941 self.client.into_channel().map_err(|client| Self { client })
942 }
943
944 fn as_channel(&self) -> &::fidl::AsyncChannel {
945 self.client.as_channel()
946 }
947}
948
949impl PathProxy {
950 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
952 let protocol_name = <PathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
953 Self { client: fidl::client::Client::new(channel, protocol_name) }
954 }
955
956 pub fn take_event_stream(&self) -> PathEventStream {
962 PathEventStream { event_receiver: self.client.take_event_receiver() }
963 }
964
965 pub fn r#set_bandwidth(
967 &self,
968 mut payload: &BandwidthRequest,
969 ) -> fidl::client::QueryResponseFut<
970 PathSetBandwidthResult,
971 fidl::encoding::DefaultFuchsiaResourceDialect,
972 > {
973 PathProxyInterface::r#set_bandwidth(self, payload)
974 }
975}
976
977impl PathProxyInterface for PathProxy {
978 type SetBandwidthResponseFut = fidl::client::QueryResponseFut<
979 PathSetBandwidthResult,
980 fidl::encoding::DefaultFuchsiaResourceDialect,
981 >;
982 fn r#set_bandwidth(&self, mut payload: &BandwidthRequest) -> Self::SetBandwidthResponseFut {
983 fn _decode(
984 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
985 ) -> Result<PathSetBandwidthResult, fidl::Error> {
986 let _response = fidl::client::decode_transaction_body::<
987 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
988 fidl::encoding::DefaultFuchsiaResourceDialect,
989 0xd366c6e86f69d1d,
990 >(_buf?)?
991 .into_result::<PathMarker>("set_bandwidth")?;
992 Ok(_response.map(|x| x))
993 }
994 self.client.send_query_and_decode::<BandwidthRequest, PathSetBandwidthResult>(
995 payload,
996 0xd366c6e86f69d1d,
997 fidl::encoding::DynamicFlags::FLEXIBLE,
998 _decode,
999 )
1000 }
1001}
1002
1003pub struct PathEventStream {
1004 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1005}
1006
1007impl std::marker::Unpin for PathEventStream {}
1008
1009impl futures::stream::FusedStream for PathEventStream {
1010 fn is_terminated(&self) -> bool {
1011 self.event_receiver.is_terminated()
1012 }
1013}
1014
1015impl futures::Stream for PathEventStream {
1016 type Item = Result<PathEvent, fidl::Error>;
1017
1018 fn poll_next(
1019 mut self: std::pin::Pin<&mut Self>,
1020 cx: &mut std::task::Context<'_>,
1021 ) -> std::task::Poll<Option<Self::Item>> {
1022 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1023 &mut self.event_receiver,
1024 cx
1025 )?) {
1026 Some(buf) => std::task::Poll::Ready(Some(PathEvent::decode(buf))),
1027 None => std::task::Poll::Ready(None),
1028 }
1029 }
1030}
1031
1032#[derive(Debug)]
1033pub enum PathEvent {
1034 #[non_exhaustive]
1035 _UnknownEvent {
1036 ordinal: u64,
1038 },
1039}
1040
1041impl PathEvent {
1042 fn decode(
1044 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1045 ) -> Result<PathEvent, fidl::Error> {
1046 let (bytes, _handles) = buf.split_mut();
1047 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1048 debug_assert_eq!(tx_header.tx_id, 0);
1049 match tx_header.ordinal {
1050 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1051 Ok(PathEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1052 }
1053 _ => Err(fidl::Error::UnknownOrdinal {
1054 ordinal: tx_header.ordinal,
1055 protocol_name: <PathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1056 }),
1057 }
1058 }
1059}
1060
1061pub struct PathRequestStream {
1063 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1064 is_terminated: bool,
1065}
1066
1067impl std::marker::Unpin for PathRequestStream {}
1068
1069impl futures::stream::FusedStream for PathRequestStream {
1070 fn is_terminated(&self) -> bool {
1071 self.is_terminated
1072 }
1073}
1074
1075impl fidl::endpoints::RequestStream for PathRequestStream {
1076 type Protocol = PathMarker;
1077 type ControlHandle = PathControlHandle;
1078
1079 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1080 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1081 }
1082
1083 fn control_handle(&self) -> Self::ControlHandle {
1084 PathControlHandle { inner: self.inner.clone() }
1085 }
1086
1087 fn into_inner(
1088 self,
1089 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1090 {
1091 (self.inner, self.is_terminated)
1092 }
1093
1094 fn from_inner(
1095 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1096 is_terminated: bool,
1097 ) -> Self {
1098 Self { inner, is_terminated }
1099 }
1100}
1101
1102impl futures::Stream for PathRequestStream {
1103 type Item = Result<PathRequest, fidl::Error>;
1104
1105 fn poll_next(
1106 mut self: std::pin::Pin<&mut Self>,
1107 cx: &mut std::task::Context<'_>,
1108 ) -> std::task::Poll<Option<Self::Item>> {
1109 let this = &mut *self;
1110 if this.inner.check_shutdown(cx) {
1111 this.is_terminated = true;
1112 return std::task::Poll::Ready(None);
1113 }
1114 if this.is_terminated {
1115 panic!("polled PathRequestStream after completion");
1116 }
1117 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1118 |bytes, handles| {
1119 match this.inner.channel().read_etc(cx, bytes, handles) {
1120 std::task::Poll::Ready(Ok(())) => {}
1121 std::task::Poll::Pending => return std::task::Poll::Pending,
1122 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1123 this.is_terminated = true;
1124 return std::task::Poll::Ready(None);
1125 }
1126 std::task::Poll::Ready(Err(e)) => {
1127 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1128 e.into(),
1129 ))))
1130 }
1131 }
1132
1133 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1135
1136 std::task::Poll::Ready(Some(match header.ordinal {
1137 0xd366c6e86f69d1d => {
1138 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1139 let mut req = fidl::new_empty!(
1140 BandwidthRequest,
1141 fidl::encoding::DefaultFuchsiaResourceDialect
1142 );
1143 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BandwidthRequest>(&header, _body_bytes, handles, &mut req)?;
1144 let control_handle = PathControlHandle { inner: this.inner.clone() };
1145 Ok(PathRequest::SetBandwidth {
1146 payload: req,
1147 responder: PathSetBandwidthResponder {
1148 control_handle: std::mem::ManuallyDrop::new(control_handle),
1149 tx_id: header.tx_id,
1150 },
1151 })
1152 }
1153 _ if header.tx_id == 0
1154 && header
1155 .dynamic_flags()
1156 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1157 {
1158 Ok(PathRequest::_UnknownMethod {
1159 ordinal: header.ordinal,
1160 control_handle: PathControlHandle { inner: this.inner.clone() },
1161 method_type: fidl::MethodType::OneWay,
1162 })
1163 }
1164 _ if header
1165 .dynamic_flags()
1166 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1167 {
1168 this.inner.send_framework_err(
1169 fidl::encoding::FrameworkErr::UnknownMethod,
1170 header.tx_id,
1171 header.ordinal,
1172 header.dynamic_flags(),
1173 (bytes, handles),
1174 )?;
1175 Ok(PathRequest::_UnknownMethod {
1176 ordinal: header.ordinal,
1177 control_handle: PathControlHandle { inner: this.inner.clone() },
1178 method_type: fidl::MethodType::TwoWay,
1179 })
1180 }
1181 _ => Err(fidl::Error::UnknownOrdinal {
1182 ordinal: header.ordinal,
1183 protocol_name: <PathMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1184 }),
1185 }))
1186 },
1187 )
1188 }
1189}
1190
1191#[derive(Debug)]
1193pub enum PathRequest {
1194 SetBandwidth { payload: BandwidthRequest, responder: PathSetBandwidthResponder },
1196 #[non_exhaustive]
1198 _UnknownMethod {
1199 ordinal: u64,
1201 control_handle: PathControlHandle,
1202 method_type: fidl::MethodType,
1203 },
1204}
1205
1206impl PathRequest {
1207 #[allow(irrefutable_let_patterns)]
1208 pub fn into_set_bandwidth(self) -> Option<(BandwidthRequest, PathSetBandwidthResponder)> {
1209 if let PathRequest::SetBandwidth { payload, responder } = self {
1210 Some((payload, responder))
1211 } else {
1212 None
1213 }
1214 }
1215
1216 pub fn method_name(&self) -> &'static str {
1218 match *self {
1219 PathRequest::SetBandwidth { .. } => "set_bandwidth",
1220 PathRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1221 "unknown one-way method"
1222 }
1223 PathRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1224 "unknown two-way method"
1225 }
1226 }
1227 }
1228}
1229
1230#[derive(Debug, Clone)]
1231pub struct PathControlHandle {
1232 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1233}
1234
1235impl fidl::endpoints::ControlHandle for PathControlHandle {
1236 fn shutdown(&self) {
1237 self.inner.shutdown()
1238 }
1239 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1240 self.inner.shutdown_with_epitaph(status)
1241 }
1242
1243 fn is_closed(&self) -> bool {
1244 self.inner.channel().is_closed()
1245 }
1246 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1247 self.inner.channel().on_closed()
1248 }
1249
1250 #[cfg(target_os = "fuchsia")]
1251 fn signal_peer(
1252 &self,
1253 clear_mask: zx::Signals,
1254 set_mask: zx::Signals,
1255 ) -> Result<(), zx_status::Status> {
1256 use fidl::Peered;
1257 self.inner.channel().signal_peer(clear_mask, set_mask)
1258 }
1259}
1260
1261impl PathControlHandle {}
1262
1263#[must_use = "FIDL methods require a response to be sent"]
1264#[derive(Debug)]
1265pub struct PathSetBandwidthResponder {
1266 control_handle: std::mem::ManuallyDrop<PathControlHandle>,
1267 tx_id: u32,
1268}
1269
1270impl std::ops::Drop for PathSetBandwidthResponder {
1274 fn drop(&mut self) {
1275 self.control_handle.shutdown();
1276 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1278 }
1279}
1280
1281impl fidl::endpoints::Responder for PathSetBandwidthResponder {
1282 type ControlHandle = PathControlHandle;
1283
1284 fn control_handle(&self) -> &PathControlHandle {
1285 &self.control_handle
1286 }
1287
1288 fn drop_without_shutdown(mut self) {
1289 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1291 std::mem::forget(self);
1293 }
1294}
1295
1296impl PathSetBandwidthResponder {
1297 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1301 let _result = self.send_raw(result);
1302 if _result.is_err() {
1303 self.control_handle.shutdown();
1304 }
1305 self.drop_without_shutdown();
1306 _result
1307 }
1308
1309 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1311 let _result = self.send_raw(result);
1312 self.drop_without_shutdown();
1313 _result
1314 }
1315
1316 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1317 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1318 fidl::encoding::EmptyStruct,
1319 i32,
1320 >>(
1321 fidl::encoding::FlexibleResult::new(result),
1322 self.tx_id,
1323 0xd366c6e86f69d1d,
1324 fidl::encoding::DynamicFlags::FLEXIBLE,
1325 )
1326 }
1327}
1328
1329#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1330pub struct PathServiceMarker;
1331
1332#[cfg(target_os = "fuchsia")]
1333impl fidl::endpoints::ServiceMarker for PathServiceMarker {
1334 type Proxy = PathServiceProxy;
1335 type Request = PathServiceRequest;
1336 const SERVICE_NAME: &'static str = "fuchsia.hardware.interconnect.PathService";
1337}
1338
1339#[cfg(target_os = "fuchsia")]
1342pub enum PathServiceRequest {
1343 Path(PathRequestStream),
1344}
1345
1346#[cfg(target_os = "fuchsia")]
1347impl fidl::endpoints::ServiceRequest for PathServiceRequest {
1348 type Service = PathServiceMarker;
1349
1350 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1351 match name {
1352 "path" => Self::Path(
1353 <PathRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1354 ),
1355 _ => panic!("no such member protocol name for service PathService"),
1356 }
1357 }
1358
1359 fn member_names() -> &'static [&'static str] {
1360 &["path"]
1361 }
1362}
1363#[cfg(target_os = "fuchsia")]
1364pub struct PathServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1365
1366#[cfg(target_os = "fuchsia")]
1367impl fidl::endpoints::ServiceProxy for PathServiceProxy {
1368 type Service = PathServiceMarker;
1369
1370 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1371 Self(opener)
1372 }
1373}
1374
1375#[cfg(target_os = "fuchsia")]
1376impl PathServiceProxy {
1377 pub fn connect_to_path(&self) -> Result<PathProxy, fidl::Error> {
1378 let (proxy, server_end) = fidl::endpoints::create_proxy::<PathMarker>();
1379 self.connect_channel_to_path(server_end)?;
1380 Ok(proxy)
1381 }
1382
1383 pub fn connect_to_path_sync(&self) -> Result<PathSynchronousProxy, fidl::Error> {
1386 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<PathMarker>();
1387 self.connect_channel_to_path(server_end)?;
1388 Ok(proxy)
1389 }
1390
1391 pub fn connect_channel_to_path(
1394 &self,
1395 server_end: fidl::endpoints::ServerEnd<PathMarker>,
1396 ) -> Result<(), fidl::Error> {
1397 self.0.open_member("path", server_end.into_channel())
1398 }
1399
1400 pub fn instance_name(&self) -> &str {
1401 self.0.instance_name()
1402 }
1403}
1404
1405#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1406pub struct ServiceMarker;
1407
1408#[cfg(target_os = "fuchsia")]
1409impl fidl::endpoints::ServiceMarker for ServiceMarker {
1410 type Proxy = ServiceProxy;
1411 type Request = ServiceRequest;
1412 const SERVICE_NAME: &'static str = "fuchsia.hardware.interconnect.Service";
1413}
1414
1415#[cfg(target_os = "fuchsia")]
1418pub enum ServiceRequest {
1419 Device(DeviceRequestStream),
1420}
1421
1422#[cfg(target_os = "fuchsia")]
1423impl fidl::endpoints::ServiceRequest for ServiceRequest {
1424 type Service = ServiceMarker;
1425
1426 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1427 match name {
1428 "device" => Self::Device(
1429 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1430 ),
1431 _ => panic!("no such member protocol name for service Service"),
1432 }
1433 }
1434
1435 fn member_names() -> &'static [&'static str] {
1436 &["device"]
1437 }
1438}
1439#[cfg(target_os = "fuchsia")]
1440pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1441
1442#[cfg(target_os = "fuchsia")]
1443impl fidl::endpoints::ServiceProxy for ServiceProxy {
1444 type Service = ServiceMarker;
1445
1446 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1447 Self(opener)
1448 }
1449}
1450
1451#[cfg(target_os = "fuchsia")]
1452impl ServiceProxy {
1453 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
1454 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
1455 self.connect_channel_to_device(server_end)?;
1456 Ok(proxy)
1457 }
1458
1459 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
1462 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
1463 self.connect_channel_to_device(server_end)?;
1464 Ok(proxy)
1465 }
1466
1467 pub fn connect_channel_to_device(
1470 &self,
1471 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1472 ) -> Result<(), fidl::Error> {
1473 self.0.open_member("device", server_end.into_channel())
1474 }
1475
1476 pub fn instance_name(&self) -> &str {
1477 self.0.instance_name()
1478 }
1479}
1480
1481mod internal {
1482 use super::*;
1483}