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