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