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_driver_token__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct NodeBusTopologyGetRequest {
16 pub token: fidl::Event,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeBusTopologyGetRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct NodeTokenGetResponse {
23 pub token: fidl::Event,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeTokenGetResponse {}
27
28#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
29pub struct NodeBusTopologyMarker;
30
31impl fidl::endpoints::ProtocolMarker for NodeBusTopologyMarker {
32 type Proxy = NodeBusTopologyProxy;
33 type RequestStream = NodeBusTopologyRequestStream;
34 #[cfg(target_os = "fuchsia")]
35 type SynchronousProxy = NodeBusTopologySynchronousProxy;
36
37 const DEBUG_NAME: &'static str = "fuchsia.driver.token.NodeBusTopology";
38}
39impl fidl::endpoints::DiscoverableProtocolMarker for NodeBusTopologyMarker {}
40pub type NodeBusTopologyGetResult = Result<Vec<fidl_fuchsia_driver_framework::BusInfo>, i32>;
41
42pub trait NodeBusTopologyProxyInterface: Send + Sync {
43 type GetResponseFut: std::future::Future<Output = Result<NodeBusTopologyGetResult, fidl::Error>>
44 + Send;
45 fn r#get(&self, token: fidl::Event) -> Self::GetResponseFut;
46}
47#[derive(Debug)]
48#[cfg(target_os = "fuchsia")]
49pub struct NodeBusTopologySynchronousProxy {
50 client: fidl::client::sync::Client,
51}
52
53#[cfg(target_os = "fuchsia")]
54impl fidl::endpoints::SynchronousProxy for NodeBusTopologySynchronousProxy {
55 type Proxy = NodeBusTopologyProxy;
56 type Protocol = NodeBusTopologyMarker;
57
58 fn from_channel(inner: fidl::Channel) -> Self {
59 Self::new(inner)
60 }
61
62 fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 fn as_channel(&self) -> &fidl::Channel {
67 self.client.as_channel()
68 }
69}
70
71#[cfg(target_os = "fuchsia")]
72impl NodeBusTopologySynchronousProxy {
73 pub fn new(channel: fidl::Channel) -> Self {
74 let protocol_name = <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
75 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
76 }
77
78 pub fn into_channel(self) -> fidl::Channel {
79 self.client.into_channel()
80 }
81
82 pub fn wait_for_event(
85 &self,
86 deadline: zx::MonotonicInstant,
87 ) -> Result<NodeBusTopologyEvent, fidl::Error> {
88 NodeBusTopologyEvent::decode(self.client.wait_for_event(deadline)?)
89 }
90
91 pub fn r#get(
92 &self,
93 mut token: fidl::Event,
94 ___deadline: zx::MonotonicInstant,
95 ) -> Result<NodeBusTopologyGetResult, fidl::Error> {
96 let _response = self.client.send_query::<
97 NodeBusTopologyGetRequest,
98 fidl::encoding::ResultType<NodeBusTopologyGetResponse, i32>,
99 >(
100 (token,),
101 0x1f35948edf73f5bd,
102 fidl::encoding::DynamicFlags::empty(),
103 ___deadline,
104 )?;
105 Ok(_response.map(|x| x.path))
106 }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl From<NodeBusTopologySynchronousProxy> for zx::NullableHandle {
111 fn from(value: NodeBusTopologySynchronousProxy) -> Self {
112 value.into_channel().into()
113 }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl From<fidl::Channel> for NodeBusTopologySynchronousProxy {
118 fn from(value: fidl::Channel) -> Self {
119 Self::new(value)
120 }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl fidl::endpoints::FromClient for NodeBusTopologySynchronousProxy {
125 type Protocol = NodeBusTopologyMarker;
126
127 fn from_client(value: fidl::endpoints::ClientEnd<NodeBusTopologyMarker>) -> Self {
128 Self::new(value.into_channel())
129 }
130}
131
132#[derive(Debug, Clone)]
133pub struct NodeBusTopologyProxy {
134 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
135}
136
137impl fidl::endpoints::Proxy for NodeBusTopologyProxy {
138 type Protocol = NodeBusTopologyMarker;
139
140 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
141 Self::new(inner)
142 }
143
144 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
145 self.client.into_channel().map_err(|client| Self { client })
146 }
147
148 fn as_channel(&self) -> &::fidl::AsyncChannel {
149 self.client.as_channel()
150 }
151}
152
153impl NodeBusTopologyProxy {
154 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
156 let protocol_name = <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
157 Self { client: fidl::client::Client::new(channel, protocol_name) }
158 }
159
160 pub fn take_event_stream(&self) -> NodeBusTopologyEventStream {
166 NodeBusTopologyEventStream { event_receiver: self.client.take_event_receiver() }
167 }
168
169 pub fn r#get(
170 &self,
171 mut token: fidl::Event,
172 ) -> fidl::client::QueryResponseFut<
173 NodeBusTopologyGetResult,
174 fidl::encoding::DefaultFuchsiaResourceDialect,
175 > {
176 NodeBusTopologyProxyInterface::r#get(self, token)
177 }
178}
179
180impl NodeBusTopologyProxyInterface for NodeBusTopologyProxy {
181 type GetResponseFut = fidl::client::QueryResponseFut<
182 NodeBusTopologyGetResult,
183 fidl::encoding::DefaultFuchsiaResourceDialect,
184 >;
185 fn r#get(&self, mut token: fidl::Event) -> Self::GetResponseFut {
186 fn _decode(
187 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
188 ) -> Result<NodeBusTopologyGetResult, fidl::Error> {
189 let _response = fidl::client::decode_transaction_body::<
190 fidl::encoding::ResultType<NodeBusTopologyGetResponse, i32>,
191 fidl::encoding::DefaultFuchsiaResourceDialect,
192 0x1f35948edf73f5bd,
193 >(_buf?)?;
194 Ok(_response.map(|x| x.path))
195 }
196 self.client.send_query_and_decode::<NodeBusTopologyGetRequest, NodeBusTopologyGetResult>(
197 (token,),
198 0x1f35948edf73f5bd,
199 fidl::encoding::DynamicFlags::empty(),
200 _decode,
201 )
202 }
203}
204
205pub struct NodeBusTopologyEventStream {
206 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
207}
208
209impl std::marker::Unpin for NodeBusTopologyEventStream {}
210
211impl futures::stream::FusedStream for NodeBusTopologyEventStream {
212 fn is_terminated(&self) -> bool {
213 self.event_receiver.is_terminated()
214 }
215}
216
217impl futures::Stream for NodeBusTopologyEventStream {
218 type Item = Result<NodeBusTopologyEvent, fidl::Error>;
219
220 fn poll_next(
221 mut self: std::pin::Pin<&mut Self>,
222 cx: &mut std::task::Context<'_>,
223 ) -> std::task::Poll<Option<Self::Item>> {
224 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
225 &mut self.event_receiver,
226 cx
227 )?) {
228 Some(buf) => std::task::Poll::Ready(Some(NodeBusTopologyEvent::decode(buf))),
229 None => std::task::Poll::Ready(None),
230 }
231 }
232}
233
234#[derive(Debug)]
235pub enum NodeBusTopologyEvent {
236 #[non_exhaustive]
237 _UnknownEvent {
238 ordinal: u64,
240 },
241}
242
243impl NodeBusTopologyEvent {
244 fn decode(
246 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
247 ) -> Result<NodeBusTopologyEvent, fidl::Error> {
248 let (bytes, _handles) = buf.split_mut();
249 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
250 debug_assert_eq!(tx_header.tx_id, 0);
251 match tx_header.ordinal {
252 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
253 Ok(NodeBusTopologyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
254 }
255 _ => Err(fidl::Error::UnknownOrdinal {
256 ordinal: tx_header.ordinal,
257 protocol_name:
258 <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
259 }),
260 }
261 }
262}
263
264pub struct NodeBusTopologyRequestStream {
266 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
267 is_terminated: bool,
268}
269
270impl std::marker::Unpin for NodeBusTopologyRequestStream {}
271
272impl futures::stream::FusedStream for NodeBusTopologyRequestStream {
273 fn is_terminated(&self) -> bool {
274 self.is_terminated
275 }
276}
277
278impl fidl::endpoints::RequestStream for NodeBusTopologyRequestStream {
279 type Protocol = NodeBusTopologyMarker;
280 type ControlHandle = NodeBusTopologyControlHandle;
281
282 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
283 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
284 }
285
286 fn control_handle(&self) -> Self::ControlHandle {
287 NodeBusTopologyControlHandle { inner: self.inner.clone() }
288 }
289
290 fn into_inner(
291 self,
292 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
293 {
294 (self.inner, self.is_terminated)
295 }
296
297 fn from_inner(
298 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
299 is_terminated: bool,
300 ) -> Self {
301 Self { inner, is_terminated }
302 }
303}
304
305impl futures::Stream for NodeBusTopologyRequestStream {
306 type Item = Result<NodeBusTopologyRequest, fidl::Error>;
307
308 fn poll_next(
309 mut self: std::pin::Pin<&mut Self>,
310 cx: &mut std::task::Context<'_>,
311 ) -> std::task::Poll<Option<Self::Item>> {
312 let this = &mut *self;
313 if this.inner.check_shutdown(cx) {
314 this.is_terminated = true;
315 return std::task::Poll::Ready(None);
316 }
317 if this.is_terminated {
318 panic!("polled NodeBusTopologyRequestStream after completion");
319 }
320 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
321 |bytes, handles| {
322 match this.inner.channel().read_etc(cx, bytes, handles) {
323 std::task::Poll::Ready(Ok(())) => {}
324 std::task::Poll::Pending => return std::task::Poll::Pending,
325 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
326 this.is_terminated = true;
327 return std::task::Poll::Ready(None);
328 }
329 std::task::Poll::Ready(Err(e)) => {
330 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
331 e.into(),
332 ))));
333 }
334 }
335
336 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
338
339 std::task::Poll::Ready(Some(match header.ordinal {
340 0x1f35948edf73f5bd => {
341 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
342 let mut req = fidl::new_empty!(
343 NodeBusTopologyGetRequest,
344 fidl::encoding::DefaultFuchsiaResourceDialect
345 );
346 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeBusTopologyGetRequest>(&header, _body_bytes, handles, &mut req)?;
347 let control_handle =
348 NodeBusTopologyControlHandle { inner: this.inner.clone() };
349 Ok(NodeBusTopologyRequest::Get {
350 token: req.token,
351
352 responder: NodeBusTopologyGetResponder {
353 control_handle: std::mem::ManuallyDrop::new(control_handle),
354 tx_id: header.tx_id,
355 },
356 })
357 }
358 _ if header.tx_id == 0
359 && header
360 .dynamic_flags()
361 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
362 {
363 Ok(NodeBusTopologyRequest::_UnknownMethod {
364 ordinal: header.ordinal,
365 control_handle: NodeBusTopologyControlHandle {
366 inner: this.inner.clone(),
367 },
368 method_type: fidl::MethodType::OneWay,
369 })
370 }
371 _ if header
372 .dynamic_flags()
373 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
374 {
375 this.inner.send_framework_err(
376 fidl::encoding::FrameworkErr::UnknownMethod,
377 header.tx_id,
378 header.ordinal,
379 header.dynamic_flags(),
380 (bytes, handles),
381 )?;
382 Ok(NodeBusTopologyRequest::_UnknownMethod {
383 ordinal: header.ordinal,
384 control_handle: NodeBusTopologyControlHandle {
385 inner: this.inner.clone(),
386 },
387 method_type: fidl::MethodType::TwoWay,
388 })
389 }
390 _ => Err(fidl::Error::UnknownOrdinal {
391 ordinal: header.ordinal,
392 protocol_name:
393 <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394 }),
395 }))
396 },
397 )
398 }
399}
400
401#[derive(Debug)]
403pub enum NodeBusTopologyRequest {
404 Get {
405 token: fidl::Event,
406 responder: NodeBusTopologyGetResponder,
407 },
408 #[non_exhaustive]
410 _UnknownMethod {
411 ordinal: u64,
413 control_handle: NodeBusTopologyControlHandle,
414 method_type: fidl::MethodType,
415 },
416}
417
418impl NodeBusTopologyRequest {
419 #[allow(irrefutable_let_patterns)]
420 pub fn into_get(self) -> Option<(fidl::Event, NodeBusTopologyGetResponder)> {
421 if let NodeBusTopologyRequest::Get { token, responder } = self {
422 Some((token, responder))
423 } else {
424 None
425 }
426 }
427
428 pub fn method_name(&self) -> &'static str {
430 match *self {
431 NodeBusTopologyRequest::Get { .. } => "get",
432 NodeBusTopologyRequest::_UnknownMethod {
433 method_type: fidl::MethodType::OneWay,
434 ..
435 } => "unknown one-way method",
436 NodeBusTopologyRequest::_UnknownMethod {
437 method_type: fidl::MethodType::TwoWay,
438 ..
439 } => "unknown two-way method",
440 }
441 }
442}
443
444#[derive(Debug, Clone)]
445pub struct NodeBusTopologyControlHandle {
446 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
447}
448
449impl fidl::endpoints::ControlHandle for NodeBusTopologyControlHandle {
450 fn shutdown(&self) {
451 self.inner.shutdown()
452 }
453
454 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
455 self.inner.shutdown_with_epitaph(status)
456 }
457
458 fn is_closed(&self) -> bool {
459 self.inner.channel().is_closed()
460 }
461 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
462 self.inner.channel().on_closed()
463 }
464
465 #[cfg(target_os = "fuchsia")]
466 fn signal_peer(
467 &self,
468 clear_mask: zx::Signals,
469 set_mask: zx::Signals,
470 ) -> Result<(), zx_status::Status> {
471 use fidl::Peered;
472 self.inner.channel().signal_peer(clear_mask, set_mask)
473 }
474}
475
476impl NodeBusTopologyControlHandle {}
477
478#[must_use = "FIDL methods require a response to be sent"]
479#[derive(Debug)]
480pub struct NodeBusTopologyGetResponder {
481 control_handle: std::mem::ManuallyDrop<NodeBusTopologyControlHandle>,
482 tx_id: u32,
483}
484
485impl std::ops::Drop for NodeBusTopologyGetResponder {
489 fn drop(&mut self) {
490 self.control_handle.shutdown();
491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
493 }
494}
495
496impl fidl::endpoints::Responder for NodeBusTopologyGetResponder {
497 type ControlHandle = NodeBusTopologyControlHandle;
498
499 fn control_handle(&self) -> &NodeBusTopologyControlHandle {
500 &self.control_handle
501 }
502
503 fn drop_without_shutdown(mut self) {
504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
506 std::mem::forget(self);
508 }
509}
510
511impl NodeBusTopologyGetResponder {
512 pub fn send(
516 self,
517 mut result: Result<&[fidl_fuchsia_driver_framework::BusInfo], i32>,
518 ) -> Result<(), fidl::Error> {
519 let _result = self.send_raw(result);
520 if _result.is_err() {
521 self.control_handle.shutdown();
522 }
523 self.drop_without_shutdown();
524 _result
525 }
526
527 pub fn send_no_shutdown_on_err(
529 self,
530 mut result: Result<&[fidl_fuchsia_driver_framework::BusInfo], i32>,
531 ) -> Result<(), fidl::Error> {
532 let _result = self.send_raw(result);
533 self.drop_without_shutdown();
534 _result
535 }
536
537 fn send_raw(
538 &self,
539 mut result: Result<&[fidl_fuchsia_driver_framework::BusInfo], i32>,
540 ) -> Result<(), fidl::Error> {
541 self.control_handle
542 .inner
543 .send::<fidl::encoding::ResultType<NodeBusTopologyGetResponse, i32>>(
544 result.map(|path| (path,)),
545 self.tx_id,
546 0x1f35948edf73f5bd,
547 fidl::encoding::DynamicFlags::empty(),
548 )
549 }
550}
551
552#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
553pub struct NodeTokenMarker;
554
555impl fidl::endpoints::ProtocolMarker for NodeTokenMarker {
556 type Proxy = NodeTokenProxy;
557 type RequestStream = NodeTokenRequestStream;
558 #[cfg(target_os = "fuchsia")]
559 type SynchronousProxy = NodeTokenSynchronousProxy;
560
561 const DEBUG_NAME: &'static str = "(anonymous) NodeToken";
562}
563pub type NodeTokenGetResult = Result<fidl::Event, i32>;
564
565pub trait NodeTokenProxyInterface: Send + Sync {
566 type GetResponseFut: std::future::Future<Output = Result<NodeTokenGetResult, fidl::Error>>
567 + Send;
568 fn r#get(&self) -> Self::GetResponseFut;
569}
570#[derive(Debug)]
571#[cfg(target_os = "fuchsia")]
572pub struct NodeTokenSynchronousProxy {
573 client: fidl::client::sync::Client,
574}
575
576#[cfg(target_os = "fuchsia")]
577impl fidl::endpoints::SynchronousProxy for NodeTokenSynchronousProxy {
578 type Proxy = NodeTokenProxy;
579 type Protocol = NodeTokenMarker;
580
581 fn from_channel(inner: fidl::Channel) -> Self {
582 Self::new(inner)
583 }
584
585 fn into_channel(self) -> fidl::Channel {
586 self.client.into_channel()
587 }
588
589 fn as_channel(&self) -> &fidl::Channel {
590 self.client.as_channel()
591 }
592}
593
594#[cfg(target_os = "fuchsia")]
595impl NodeTokenSynchronousProxy {
596 pub fn new(channel: fidl::Channel) -> Self {
597 let protocol_name = <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
598 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
599 }
600
601 pub fn into_channel(self) -> fidl::Channel {
602 self.client.into_channel()
603 }
604
605 pub fn wait_for_event(
608 &self,
609 deadline: zx::MonotonicInstant,
610 ) -> Result<NodeTokenEvent, fidl::Error> {
611 NodeTokenEvent::decode(self.client.wait_for_event(deadline)?)
612 }
613
614 pub fn r#get(
615 &self,
616 ___deadline: zx::MonotonicInstant,
617 ) -> Result<NodeTokenGetResult, fidl::Error> {
618 let _response = self.client.send_query::<
619 fidl::encoding::EmptyPayload,
620 fidl::encoding::ResultType<NodeTokenGetResponse, i32>,
621 >(
622 (),
623 0x64166e3a6984b1d9,
624 fidl::encoding::DynamicFlags::empty(),
625 ___deadline,
626 )?;
627 Ok(_response.map(|x| x.token))
628 }
629}
630
631#[cfg(target_os = "fuchsia")]
632impl From<NodeTokenSynchronousProxy> for zx::NullableHandle {
633 fn from(value: NodeTokenSynchronousProxy) -> Self {
634 value.into_channel().into()
635 }
636}
637
638#[cfg(target_os = "fuchsia")]
639impl From<fidl::Channel> for NodeTokenSynchronousProxy {
640 fn from(value: fidl::Channel) -> Self {
641 Self::new(value)
642 }
643}
644
645#[cfg(target_os = "fuchsia")]
646impl fidl::endpoints::FromClient for NodeTokenSynchronousProxy {
647 type Protocol = NodeTokenMarker;
648
649 fn from_client(value: fidl::endpoints::ClientEnd<NodeTokenMarker>) -> Self {
650 Self::new(value.into_channel())
651 }
652}
653
654#[derive(Debug, Clone)]
655pub struct NodeTokenProxy {
656 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
657}
658
659impl fidl::endpoints::Proxy for NodeTokenProxy {
660 type Protocol = NodeTokenMarker;
661
662 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
663 Self::new(inner)
664 }
665
666 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
667 self.client.into_channel().map_err(|client| Self { client })
668 }
669
670 fn as_channel(&self) -> &::fidl::AsyncChannel {
671 self.client.as_channel()
672 }
673}
674
675impl NodeTokenProxy {
676 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
678 let protocol_name = <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
679 Self { client: fidl::client::Client::new(channel, protocol_name) }
680 }
681
682 pub fn take_event_stream(&self) -> NodeTokenEventStream {
688 NodeTokenEventStream { event_receiver: self.client.take_event_receiver() }
689 }
690
691 pub fn r#get(
692 &self,
693 ) -> fidl::client::QueryResponseFut<
694 NodeTokenGetResult,
695 fidl::encoding::DefaultFuchsiaResourceDialect,
696 > {
697 NodeTokenProxyInterface::r#get(self)
698 }
699}
700
701impl NodeTokenProxyInterface for NodeTokenProxy {
702 type GetResponseFut = fidl::client::QueryResponseFut<
703 NodeTokenGetResult,
704 fidl::encoding::DefaultFuchsiaResourceDialect,
705 >;
706 fn r#get(&self) -> Self::GetResponseFut {
707 fn _decode(
708 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
709 ) -> Result<NodeTokenGetResult, fidl::Error> {
710 let _response = fidl::client::decode_transaction_body::<
711 fidl::encoding::ResultType<NodeTokenGetResponse, i32>,
712 fidl::encoding::DefaultFuchsiaResourceDialect,
713 0x64166e3a6984b1d9,
714 >(_buf?)?;
715 Ok(_response.map(|x| x.token))
716 }
717 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NodeTokenGetResult>(
718 (),
719 0x64166e3a6984b1d9,
720 fidl::encoding::DynamicFlags::empty(),
721 _decode,
722 )
723 }
724}
725
726pub struct NodeTokenEventStream {
727 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
728}
729
730impl std::marker::Unpin for NodeTokenEventStream {}
731
732impl futures::stream::FusedStream for NodeTokenEventStream {
733 fn is_terminated(&self) -> bool {
734 self.event_receiver.is_terminated()
735 }
736}
737
738impl futures::Stream for NodeTokenEventStream {
739 type Item = Result<NodeTokenEvent, fidl::Error>;
740
741 fn poll_next(
742 mut self: std::pin::Pin<&mut Self>,
743 cx: &mut std::task::Context<'_>,
744 ) -> std::task::Poll<Option<Self::Item>> {
745 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
746 &mut self.event_receiver,
747 cx
748 )?) {
749 Some(buf) => std::task::Poll::Ready(Some(NodeTokenEvent::decode(buf))),
750 None => std::task::Poll::Ready(None),
751 }
752 }
753}
754
755#[derive(Debug)]
756pub enum NodeTokenEvent {}
757
758impl NodeTokenEvent {
759 fn decode(
761 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
762 ) -> Result<NodeTokenEvent, fidl::Error> {
763 let (bytes, _handles) = buf.split_mut();
764 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
765 debug_assert_eq!(tx_header.tx_id, 0);
766 match tx_header.ordinal {
767 _ => Err(fidl::Error::UnknownOrdinal {
768 ordinal: tx_header.ordinal,
769 protocol_name: <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
770 }),
771 }
772 }
773}
774
775pub struct NodeTokenRequestStream {
777 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
778 is_terminated: bool,
779}
780
781impl std::marker::Unpin for NodeTokenRequestStream {}
782
783impl futures::stream::FusedStream for NodeTokenRequestStream {
784 fn is_terminated(&self) -> bool {
785 self.is_terminated
786 }
787}
788
789impl fidl::endpoints::RequestStream for NodeTokenRequestStream {
790 type Protocol = NodeTokenMarker;
791 type ControlHandle = NodeTokenControlHandle;
792
793 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
794 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
795 }
796
797 fn control_handle(&self) -> Self::ControlHandle {
798 NodeTokenControlHandle { inner: self.inner.clone() }
799 }
800
801 fn into_inner(
802 self,
803 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
804 {
805 (self.inner, self.is_terminated)
806 }
807
808 fn from_inner(
809 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
810 is_terminated: bool,
811 ) -> Self {
812 Self { inner, is_terminated }
813 }
814}
815
816impl futures::Stream for NodeTokenRequestStream {
817 type Item = Result<NodeTokenRequest, fidl::Error>;
818
819 fn poll_next(
820 mut self: std::pin::Pin<&mut Self>,
821 cx: &mut std::task::Context<'_>,
822 ) -> std::task::Poll<Option<Self::Item>> {
823 let this = &mut *self;
824 if this.inner.check_shutdown(cx) {
825 this.is_terminated = true;
826 return std::task::Poll::Ready(None);
827 }
828 if this.is_terminated {
829 panic!("polled NodeTokenRequestStream after completion");
830 }
831 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
832 |bytes, handles| {
833 match this.inner.channel().read_etc(cx, bytes, handles) {
834 std::task::Poll::Ready(Ok(())) => {}
835 std::task::Poll::Pending => return std::task::Poll::Pending,
836 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
837 this.is_terminated = true;
838 return std::task::Poll::Ready(None);
839 }
840 std::task::Poll::Ready(Err(e)) => {
841 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
842 e.into(),
843 ))));
844 }
845 }
846
847 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
849
850 std::task::Poll::Ready(Some(match header.ordinal {
851 0x64166e3a6984b1d9 => {
852 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
853 let mut req = fidl::new_empty!(
854 fidl::encoding::EmptyPayload,
855 fidl::encoding::DefaultFuchsiaResourceDialect
856 );
857 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
858 let control_handle = NodeTokenControlHandle { inner: this.inner.clone() };
859 Ok(NodeTokenRequest::Get {
860 responder: NodeTokenGetResponder {
861 control_handle: std::mem::ManuallyDrop::new(control_handle),
862 tx_id: header.tx_id,
863 },
864 })
865 }
866 _ => Err(fidl::Error::UnknownOrdinal {
867 ordinal: header.ordinal,
868 protocol_name:
869 <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
870 }),
871 }))
872 },
873 )
874 }
875}
876
877#[derive(Debug)]
883pub enum NodeTokenRequest {
884 Get { responder: NodeTokenGetResponder },
885}
886
887impl NodeTokenRequest {
888 #[allow(irrefutable_let_patterns)]
889 pub fn into_get(self) -> Option<(NodeTokenGetResponder)> {
890 if let NodeTokenRequest::Get { responder } = self { Some((responder)) } else { None }
891 }
892
893 pub fn method_name(&self) -> &'static str {
895 match *self {
896 NodeTokenRequest::Get { .. } => "get",
897 }
898 }
899}
900
901#[derive(Debug, Clone)]
902pub struct NodeTokenControlHandle {
903 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
904}
905
906impl fidl::endpoints::ControlHandle for NodeTokenControlHandle {
907 fn shutdown(&self) {
908 self.inner.shutdown()
909 }
910
911 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
912 self.inner.shutdown_with_epitaph(status)
913 }
914
915 fn is_closed(&self) -> bool {
916 self.inner.channel().is_closed()
917 }
918 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
919 self.inner.channel().on_closed()
920 }
921
922 #[cfg(target_os = "fuchsia")]
923 fn signal_peer(
924 &self,
925 clear_mask: zx::Signals,
926 set_mask: zx::Signals,
927 ) -> Result<(), zx_status::Status> {
928 use fidl::Peered;
929 self.inner.channel().signal_peer(clear_mask, set_mask)
930 }
931}
932
933impl NodeTokenControlHandle {}
934
935#[must_use = "FIDL methods require a response to be sent"]
936#[derive(Debug)]
937pub struct NodeTokenGetResponder {
938 control_handle: std::mem::ManuallyDrop<NodeTokenControlHandle>,
939 tx_id: u32,
940}
941
942impl std::ops::Drop for NodeTokenGetResponder {
946 fn drop(&mut self) {
947 self.control_handle.shutdown();
948 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
950 }
951}
952
953impl fidl::endpoints::Responder for NodeTokenGetResponder {
954 type ControlHandle = NodeTokenControlHandle;
955
956 fn control_handle(&self) -> &NodeTokenControlHandle {
957 &self.control_handle
958 }
959
960 fn drop_without_shutdown(mut self) {
961 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
963 std::mem::forget(self);
965 }
966}
967
968impl NodeTokenGetResponder {
969 pub fn send(self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
973 let _result = self.send_raw(result);
974 if _result.is_err() {
975 self.control_handle.shutdown();
976 }
977 self.drop_without_shutdown();
978 _result
979 }
980
981 pub fn send_no_shutdown_on_err(
983 self,
984 mut result: Result<fidl::Event, i32>,
985 ) -> Result<(), fidl::Error> {
986 let _result = self.send_raw(result);
987 self.drop_without_shutdown();
988 _result
989 }
990
991 fn send_raw(&self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
992 self.control_handle.inner.send::<fidl::encoding::ResultType<NodeTokenGetResponse, i32>>(
993 result.map(|token| (token,)),
994 self.tx_id,
995 0x64166e3a6984b1d9,
996 fidl::encoding::DynamicFlags::empty(),
997 )
998 }
999}
1000
1001mod internal {
1002 use super::*;
1003
1004 impl fidl::encoding::ResourceTypeMarker for NodeBusTopologyGetRequest {
1005 type Borrowed<'a> = &'a mut Self;
1006 fn take_or_borrow<'a>(
1007 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1008 ) -> Self::Borrowed<'a> {
1009 value
1010 }
1011 }
1012
1013 unsafe impl fidl::encoding::TypeMarker for NodeBusTopologyGetRequest {
1014 type Owned = Self;
1015
1016 #[inline(always)]
1017 fn inline_align(_context: fidl::encoding::Context) -> usize {
1018 4
1019 }
1020
1021 #[inline(always)]
1022 fn inline_size(_context: fidl::encoding::Context) -> usize {
1023 4
1024 }
1025 }
1026
1027 unsafe impl
1028 fidl::encoding::Encode<
1029 NodeBusTopologyGetRequest,
1030 fidl::encoding::DefaultFuchsiaResourceDialect,
1031 > for &mut NodeBusTopologyGetRequest
1032 {
1033 #[inline]
1034 unsafe fn encode(
1035 self,
1036 encoder: &mut fidl::encoding::Encoder<
1037 '_,
1038 fidl::encoding::DefaultFuchsiaResourceDialect,
1039 >,
1040 offset: usize,
1041 _depth: fidl::encoding::Depth,
1042 ) -> fidl::Result<()> {
1043 encoder.debug_check_bounds::<NodeBusTopologyGetRequest>(offset);
1044 fidl::encoding::Encode::<
1046 NodeBusTopologyGetRequest,
1047 fidl::encoding::DefaultFuchsiaResourceDialect,
1048 >::encode(
1049 (<fidl::encoding::HandleType<
1050 fidl::Event,
1051 { fidl::ObjectType::EVENT.into_raw() },
1052 2147483648,
1053 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1054 &mut self.token
1055 ),),
1056 encoder,
1057 offset,
1058 _depth,
1059 )
1060 }
1061 }
1062 unsafe impl<
1063 T0: fidl::encoding::Encode<
1064 fidl::encoding::HandleType<
1065 fidl::Event,
1066 { fidl::ObjectType::EVENT.into_raw() },
1067 2147483648,
1068 >,
1069 fidl::encoding::DefaultFuchsiaResourceDialect,
1070 >,
1071 >
1072 fidl::encoding::Encode<
1073 NodeBusTopologyGetRequest,
1074 fidl::encoding::DefaultFuchsiaResourceDialect,
1075 > for (T0,)
1076 {
1077 #[inline]
1078 unsafe fn encode(
1079 self,
1080 encoder: &mut fidl::encoding::Encoder<
1081 '_,
1082 fidl::encoding::DefaultFuchsiaResourceDialect,
1083 >,
1084 offset: usize,
1085 depth: fidl::encoding::Depth,
1086 ) -> fidl::Result<()> {
1087 encoder.debug_check_bounds::<NodeBusTopologyGetRequest>(offset);
1088 self.0.encode(encoder, offset + 0, depth)?;
1092 Ok(())
1093 }
1094 }
1095
1096 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1097 for NodeBusTopologyGetRequest
1098 {
1099 #[inline(always)]
1100 fn new_empty() -> Self {
1101 Self {
1102 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1103 }
1104 }
1105
1106 #[inline]
1107 unsafe fn decode(
1108 &mut self,
1109 decoder: &mut fidl::encoding::Decoder<
1110 '_,
1111 fidl::encoding::DefaultFuchsiaResourceDialect,
1112 >,
1113 offset: usize,
1114 _depth: fidl::encoding::Depth,
1115 ) -> fidl::Result<()> {
1116 decoder.debug_check_bounds::<Self>(offset);
1117 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
1119 Ok(())
1120 }
1121 }
1122
1123 impl fidl::encoding::ResourceTypeMarker for NodeTokenGetResponse {
1124 type Borrowed<'a> = &'a mut Self;
1125 fn take_or_borrow<'a>(
1126 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1127 ) -> Self::Borrowed<'a> {
1128 value
1129 }
1130 }
1131
1132 unsafe impl fidl::encoding::TypeMarker for NodeTokenGetResponse {
1133 type Owned = Self;
1134
1135 #[inline(always)]
1136 fn inline_align(_context: fidl::encoding::Context) -> usize {
1137 4
1138 }
1139
1140 #[inline(always)]
1141 fn inline_size(_context: fidl::encoding::Context) -> usize {
1142 4
1143 }
1144 }
1145
1146 unsafe impl
1147 fidl::encoding::Encode<NodeTokenGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1148 for &mut NodeTokenGetResponse
1149 {
1150 #[inline]
1151 unsafe fn encode(
1152 self,
1153 encoder: &mut fidl::encoding::Encoder<
1154 '_,
1155 fidl::encoding::DefaultFuchsiaResourceDialect,
1156 >,
1157 offset: usize,
1158 _depth: fidl::encoding::Depth,
1159 ) -> fidl::Result<()> {
1160 encoder.debug_check_bounds::<NodeTokenGetResponse>(offset);
1161 fidl::encoding::Encode::<
1163 NodeTokenGetResponse,
1164 fidl::encoding::DefaultFuchsiaResourceDialect,
1165 >::encode(
1166 (<fidl::encoding::HandleType<
1167 fidl::Event,
1168 { fidl::ObjectType::EVENT.into_raw() },
1169 2147483648,
1170 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1171 &mut self.token
1172 ),),
1173 encoder,
1174 offset,
1175 _depth,
1176 )
1177 }
1178 }
1179 unsafe impl<
1180 T0: fidl::encoding::Encode<
1181 fidl::encoding::HandleType<
1182 fidl::Event,
1183 { fidl::ObjectType::EVENT.into_raw() },
1184 2147483648,
1185 >,
1186 fidl::encoding::DefaultFuchsiaResourceDialect,
1187 >,
1188 >
1189 fidl::encoding::Encode<NodeTokenGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1190 for (T0,)
1191 {
1192 #[inline]
1193 unsafe fn encode(
1194 self,
1195 encoder: &mut fidl::encoding::Encoder<
1196 '_,
1197 fidl::encoding::DefaultFuchsiaResourceDialect,
1198 >,
1199 offset: usize,
1200 depth: fidl::encoding::Depth,
1201 ) -> fidl::Result<()> {
1202 encoder.debug_check_bounds::<NodeTokenGetResponse>(offset);
1203 self.0.encode(encoder, offset + 0, depth)?;
1207 Ok(())
1208 }
1209 }
1210
1211 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1212 for NodeTokenGetResponse
1213 {
1214 #[inline(always)]
1215 fn new_empty() -> Self {
1216 Self {
1217 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1218 }
1219 }
1220
1221 #[inline]
1222 unsafe fn decode(
1223 &mut self,
1224 decoder: &mut fidl::encoding::Decoder<
1225 '_,
1226 fidl::encoding::DefaultFuchsiaResourceDialect,
1227 >,
1228 offset: usize,
1229 _depth: fidl::encoding::Depth,
1230 ) -> fidl::Result<()> {
1231 decoder.debug_check_bounds::<Self>(offset);
1232 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
1234 Ok(())
1235 }
1236 }
1237}