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 DebugGetHostKoidRequest {
16 pub node_token: fidl::Event,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugGetHostKoidRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct DebugLogStackTraceRequest {
23 pub node_token: fidl::Event,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugLogStackTraceRequest {}
27
28#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub struct NodeBusTopologyGetRequest {
30 pub token: fidl::Event,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeBusTopologyGetRequest {}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct NodeTokenGetResponse {
37 pub token: fidl::Event,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeTokenGetResponse {}
41
42#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
43pub struct DebugMarker;
44
45impl fidl::endpoints::ProtocolMarker for DebugMarker {
46 type Proxy = DebugProxy;
47 type RequestStream = DebugRequestStream;
48 #[cfg(target_os = "fuchsia")]
49 type SynchronousProxy = DebugSynchronousProxy;
50
51 const DEBUG_NAME: &'static str = "fuchsia.driver.token.Debug";
52}
53impl fidl::endpoints::DiscoverableProtocolMarker for DebugMarker {}
54pub type DebugLogStackTraceResult = Result<(), i32>;
55pub type DebugGetHostKoidResult = Result<u64, i32>;
56
57pub trait DebugProxyInterface: Send + Sync {
58 type LogStackTraceResponseFut: std::future::Future<Output = Result<DebugLogStackTraceResult, fidl::Error>>
59 + Send;
60 fn r#log_stack_trace(&self, node_token: fidl::Event) -> Self::LogStackTraceResponseFut;
61 type GetHostKoidResponseFut: std::future::Future<Output = Result<DebugGetHostKoidResult, fidl::Error>>
62 + Send;
63 fn r#get_host_koid(&self, node_token: fidl::Event) -> Self::GetHostKoidResponseFut;
64}
65#[derive(Debug)]
66#[cfg(target_os = "fuchsia")]
67pub struct DebugSynchronousProxy {
68 client: fidl::client::sync::Client,
69}
70
71#[cfg(target_os = "fuchsia")]
72impl fidl::endpoints::SynchronousProxy for DebugSynchronousProxy {
73 type Proxy = DebugProxy;
74 type Protocol = DebugMarker;
75
76 fn from_channel(inner: fidl::Channel) -> Self {
77 Self::new(inner)
78 }
79
80 fn into_channel(self) -> fidl::Channel {
81 self.client.into_channel()
82 }
83
84 fn as_channel(&self) -> &fidl::Channel {
85 self.client.as_channel()
86 }
87}
88
89#[cfg(target_os = "fuchsia")]
90impl DebugSynchronousProxy {
91 pub fn new(channel: fidl::Channel) -> Self {
92 Self { client: fidl::client::sync::Client::new(channel) }
93 }
94
95 pub fn into_channel(self) -> fidl::Channel {
96 self.client.into_channel()
97 }
98
99 pub fn wait_for_event(
102 &self,
103 deadline: zx::MonotonicInstant,
104 ) -> Result<DebugEvent, fidl::Error> {
105 DebugEvent::decode(self.client.wait_for_event::<DebugMarker>(deadline)?)
106 }
107
108 pub fn r#log_stack_trace(
111 &self,
112 mut node_token: fidl::Event,
113 ___deadline: zx::MonotonicInstant,
114 ) -> Result<DebugLogStackTraceResult, fidl::Error> {
115 let _response = self.client.send_query::<
116 DebugLogStackTraceRequest,
117 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
118 DebugMarker,
119 >(
120 (node_token,),
121 0x6c839ab9a2f61de1,
122 fidl::encoding::DynamicFlags::FLEXIBLE,
123 ___deadline,
124 )?
125 .into_result::<DebugMarker>("log_stack_trace")?;
126 Ok(_response.map(|x| x))
127 }
128
129 pub fn r#get_host_koid(
132 &self,
133 mut node_token: fidl::Event,
134 ___deadline: zx::MonotonicInstant,
135 ) -> Result<DebugGetHostKoidResult, fidl::Error> {
136 let _response = self.client.send_query::<
137 DebugGetHostKoidRequest,
138 fidl::encoding::FlexibleResultType<DebugGetHostKoidResponse, i32>,
139 DebugMarker,
140 >(
141 (node_token,),
142 0x250b90689178cf1c,
143 fidl::encoding::DynamicFlags::FLEXIBLE,
144 ___deadline,
145 )?
146 .into_result::<DebugMarker>("get_host_koid")?;
147 Ok(_response.map(|x| x.host_koid))
148 }
149}
150
151#[cfg(target_os = "fuchsia")]
152impl From<DebugSynchronousProxy> for zx::NullableHandle {
153 fn from(value: DebugSynchronousProxy) -> Self {
154 value.into_channel().into()
155 }
156}
157
158#[cfg(target_os = "fuchsia")]
159impl From<fidl::Channel> for DebugSynchronousProxy {
160 fn from(value: fidl::Channel) -> Self {
161 Self::new(value)
162 }
163}
164
165#[cfg(target_os = "fuchsia")]
166impl fidl::endpoints::FromClient for DebugSynchronousProxy {
167 type Protocol = DebugMarker;
168
169 fn from_client(value: fidl::endpoints::ClientEnd<DebugMarker>) -> Self {
170 Self::new(value.into_channel())
171 }
172}
173
174#[derive(Debug, Clone)]
175pub struct DebugProxy {
176 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
177}
178
179impl fidl::endpoints::Proxy for DebugProxy {
180 type Protocol = DebugMarker;
181
182 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
183 Self::new(inner)
184 }
185
186 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
187 self.client.into_channel().map_err(|client| Self { client })
188 }
189
190 fn as_channel(&self) -> &::fidl::AsyncChannel {
191 self.client.as_channel()
192 }
193}
194
195impl DebugProxy {
196 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
198 let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
199 Self { client: fidl::client::Client::new(channel, protocol_name) }
200 }
201
202 pub fn take_event_stream(&self) -> DebugEventStream {
208 DebugEventStream { event_receiver: self.client.take_event_receiver() }
209 }
210
211 pub fn r#log_stack_trace(
214 &self,
215 mut node_token: fidl::Event,
216 ) -> fidl::client::QueryResponseFut<
217 DebugLogStackTraceResult,
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 > {
220 DebugProxyInterface::r#log_stack_trace(self, node_token)
221 }
222
223 pub fn r#get_host_koid(
226 &self,
227 mut node_token: fidl::Event,
228 ) -> fidl::client::QueryResponseFut<
229 DebugGetHostKoidResult,
230 fidl::encoding::DefaultFuchsiaResourceDialect,
231 > {
232 DebugProxyInterface::r#get_host_koid(self, node_token)
233 }
234}
235
236impl DebugProxyInterface for DebugProxy {
237 type LogStackTraceResponseFut = fidl::client::QueryResponseFut<
238 DebugLogStackTraceResult,
239 fidl::encoding::DefaultFuchsiaResourceDialect,
240 >;
241 fn r#log_stack_trace(&self, mut node_token: fidl::Event) -> Self::LogStackTraceResponseFut {
242 fn _decode(
243 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
244 ) -> Result<DebugLogStackTraceResult, fidl::Error> {
245 let _response = fidl::client::decode_transaction_body::<
246 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
247 fidl::encoding::DefaultFuchsiaResourceDialect,
248 0x6c839ab9a2f61de1,
249 >(_buf?)?
250 .into_result::<DebugMarker>("log_stack_trace")?;
251 Ok(_response.map(|x| x))
252 }
253 self.client.send_query_and_decode::<DebugLogStackTraceRequest, DebugLogStackTraceResult>(
254 (node_token,),
255 0x6c839ab9a2f61de1,
256 fidl::encoding::DynamicFlags::FLEXIBLE,
257 _decode,
258 )
259 }
260
261 type GetHostKoidResponseFut = fidl::client::QueryResponseFut<
262 DebugGetHostKoidResult,
263 fidl::encoding::DefaultFuchsiaResourceDialect,
264 >;
265 fn r#get_host_koid(&self, mut node_token: fidl::Event) -> Self::GetHostKoidResponseFut {
266 fn _decode(
267 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
268 ) -> Result<DebugGetHostKoidResult, fidl::Error> {
269 let _response = fidl::client::decode_transaction_body::<
270 fidl::encoding::FlexibleResultType<DebugGetHostKoidResponse, i32>,
271 fidl::encoding::DefaultFuchsiaResourceDialect,
272 0x250b90689178cf1c,
273 >(_buf?)?
274 .into_result::<DebugMarker>("get_host_koid")?;
275 Ok(_response.map(|x| x.host_koid))
276 }
277 self.client.send_query_and_decode::<DebugGetHostKoidRequest, DebugGetHostKoidResult>(
278 (node_token,),
279 0x250b90689178cf1c,
280 fidl::encoding::DynamicFlags::FLEXIBLE,
281 _decode,
282 )
283 }
284}
285
286pub struct DebugEventStream {
287 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
288}
289
290impl std::marker::Unpin for DebugEventStream {}
291
292impl futures::stream::FusedStream for DebugEventStream {
293 fn is_terminated(&self) -> bool {
294 self.event_receiver.is_terminated()
295 }
296}
297
298impl futures::Stream for DebugEventStream {
299 type Item = Result<DebugEvent, fidl::Error>;
300
301 fn poll_next(
302 mut self: std::pin::Pin<&mut Self>,
303 cx: &mut std::task::Context<'_>,
304 ) -> std::task::Poll<Option<Self::Item>> {
305 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
306 &mut self.event_receiver,
307 cx
308 )?) {
309 Some(buf) => std::task::Poll::Ready(Some(DebugEvent::decode(buf))),
310 None => std::task::Poll::Ready(None),
311 }
312 }
313}
314
315#[derive(Debug)]
316pub enum DebugEvent {
317 #[non_exhaustive]
318 _UnknownEvent {
319 ordinal: u64,
321 },
322}
323
324impl DebugEvent {
325 fn decode(
327 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
328 ) -> Result<DebugEvent, fidl::Error> {
329 let (bytes, _handles) = buf.split_mut();
330 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
331 debug_assert_eq!(tx_header.tx_id, 0);
332 match tx_header.ordinal {
333 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
334 Ok(DebugEvent::_UnknownEvent { ordinal: tx_header.ordinal })
335 }
336 _ => Err(fidl::Error::UnknownOrdinal {
337 ordinal: tx_header.ordinal,
338 protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
339 }),
340 }
341 }
342}
343
344pub struct DebugRequestStream {
346 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
347 is_terminated: bool,
348}
349
350impl std::marker::Unpin for DebugRequestStream {}
351
352impl futures::stream::FusedStream for DebugRequestStream {
353 fn is_terminated(&self) -> bool {
354 self.is_terminated
355 }
356}
357
358impl fidl::endpoints::RequestStream for DebugRequestStream {
359 type Protocol = DebugMarker;
360 type ControlHandle = DebugControlHandle;
361
362 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
363 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
364 }
365
366 fn control_handle(&self) -> Self::ControlHandle {
367 DebugControlHandle { inner: self.inner.clone() }
368 }
369
370 fn into_inner(
371 self,
372 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
373 {
374 (self.inner, self.is_terminated)
375 }
376
377 fn from_inner(
378 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
379 is_terminated: bool,
380 ) -> Self {
381 Self { inner, is_terminated }
382 }
383}
384
385impl futures::Stream for DebugRequestStream {
386 type Item = Result<DebugRequest, fidl::Error>;
387
388 fn poll_next(
389 mut self: std::pin::Pin<&mut Self>,
390 cx: &mut std::task::Context<'_>,
391 ) -> std::task::Poll<Option<Self::Item>> {
392 let this = &mut *self;
393 if this.inner.check_shutdown(cx) {
394 this.is_terminated = true;
395 return std::task::Poll::Ready(None);
396 }
397 if this.is_terminated {
398 panic!("polled DebugRequestStream after completion");
399 }
400 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
401 |bytes, handles| {
402 match this.inner.channel().read_etc(cx, bytes, handles) {
403 std::task::Poll::Ready(Ok(())) => {}
404 std::task::Poll::Pending => return std::task::Poll::Pending,
405 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
406 this.is_terminated = true;
407 return std::task::Poll::Ready(None);
408 }
409 std::task::Poll::Ready(Err(e)) => {
410 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
411 e.into(),
412 ))));
413 }
414 }
415
416 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
418
419 std::task::Poll::Ready(Some(match header.ordinal {
420 0x6c839ab9a2f61de1 => {
421 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
422 let mut req = fidl::new_empty!(
423 DebugLogStackTraceRequest,
424 fidl::encoding::DefaultFuchsiaResourceDialect
425 );
426 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugLogStackTraceRequest>(&header, _body_bytes, handles, &mut req)?;
427 let control_handle = DebugControlHandle { inner: this.inner.clone() };
428 Ok(DebugRequest::LogStackTrace {
429 node_token: req.node_token,
430
431 responder: DebugLogStackTraceResponder {
432 control_handle: std::mem::ManuallyDrop::new(control_handle),
433 tx_id: header.tx_id,
434 },
435 })
436 }
437 0x250b90689178cf1c => {
438 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
439 let mut req = fidl::new_empty!(
440 DebugGetHostKoidRequest,
441 fidl::encoding::DefaultFuchsiaResourceDialect
442 );
443 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugGetHostKoidRequest>(&header, _body_bytes, handles, &mut req)?;
444 let control_handle = DebugControlHandle { inner: this.inner.clone() };
445 Ok(DebugRequest::GetHostKoid {
446 node_token: req.node_token,
447
448 responder: DebugGetHostKoidResponder {
449 control_handle: std::mem::ManuallyDrop::new(control_handle),
450 tx_id: header.tx_id,
451 },
452 })
453 }
454 _ if header.tx_id == 0
455 && header
456 .dynamic_flags()
457 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
458 {
459 Ok(DebugRequest::_UnknownMethod {
460 ordinal: header.ordinal,
461 control_handle: DebugControlHandle { inner: this.inner.clone() },
462 method_type: fidl::MethodType::OneWay,
463 })
464 }
465 _ if header
466 .dynamic_flags()
467 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
468 {
469 this.inner.send_framework_err(
470 fidl::encoding::FrameworkErr::UnknownMethod,
471 header.tx_id,
472 header.ordinal,
473 header.dynamic_flags(),
474 (bytes, handles),
475 )?;
476 Ok(DebugRequest::_UnknownMethod {
477 ordinal: header.ordinal,
478 control_handle: DebugControlHandle { inner: this.inner.clone() },
479 method_type: fidl::MethodType::TwoWay,
480 })
481 }
482 _ => Err(fidl::Error::UnknownOrdinal {
483 ordinal: header.ordinal,
484 protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
485 }),
486 }))
487 },
488 )
489 }
490}
491
492#[derive(Debug)]
494pub enum DebugRequest {
495 LogStackTrace { node_token: fidl::Event, responder: DebugLogStackTraceResponder },
498 GetHostKoid { node_token: fidl::Event, responder: DebugGetHostKoidResponder },
501 #[non_exhaustive]
503 _UnknownMethod {
504 ordinal: u64,
506 control_handle: DebugControlHandle,
507 method_type: fidl::MethodType,
508 },
509}
510
511impl DebugRequest {
512 #[allow(irrefutable_let_patterns)]
513 pub fn into_log_stack_trace(self) -> Option<(fidl::Event, DebugLogStackTraceResponder)> {
514 if let DebugRequest::LogStackTrace { node_token, responder } = self {
515 Some((node_token, responder))
516 } else {
517 None
518 }
519 }
520
521 #[allow(irrefutable_let_patterns)]
522 pub fn into_get_host_koid(self) -> Option<(fidl::Event, DebugGetHostKoidResponder)> {
523 if let DebugRequest::GetHostKoid { node_token, responder } = self {
524 Some((node_token, responder))
525 } else {
526 None
527 }
528 }
529
530 pub fn method_name(&self) -> &'static str {
532 match *self {
533 DebugRequest::LogStackTrace { .. } => "log_stack_trace",
534 DebugRequest::GetHostKoid { .. } => "get_host_koid",
535 DebugRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
536 "unknown one-way method"
537 }
538 DebugRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
539 "unknown two-way method"
540 }
541 }
542 }
543}
544
545#[derive(Debug, Clone)]
546pub struct DebugControlHandle {
547 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
548}
549
550impl DebugControlHandle {
551 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
552 self.inner.shutdown_with_epitaph(status.into())
553 }
554}
555
556impl fidl::endpoints::ControlHandle for DebugControlHandle {
557 fn shutdown(&self) {
558 self.inner.shutdown()
559 }
560
561 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
562 self.inner.shutdown_with_epitaph(status)
563 }
564
565 fn is_closed(&self) -> bool {
566 self.inner.channel().is_closed()
567 }
568 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
569 self.inner.channel().on_closed()
570 }
571
572 #[cfg(target_os = "fuchsia")]
573 fn signal_peer(
574 &self,
575 clear_mask: zx::Signals,
576 set_mask: zx::Signals,
577 ) -> Result<(), zx_status::Status> {
578 use fidl::Peered;
579 self.inner.channel().signal_peer(clear_mask, set_mask)
580 }
581}
582
583impl DebugControlHandle {}
584
585#[must_use = "FIDL methods require a response to be sent"]
586#[derive(Debug)]
587pub struct DebugLogStackTraceResponder {
588 control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
589 tx_id: u32,
590}
591
592impl std::ops::Drop for DebugLogStackTraceResponder {
596 fn drop(&mut self) {
597 self.control_handle.shutdown();
598 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
600 }
601}
602
603impl fidl::endpoints::Responder for DebugLogStackTraceResponder {
604 type ControlHandle = DebugControlHandle;
605
606 fn control_handle(&self) -> &DebugControlHandle {
607 &self.control_handle
608 }
609
610 fn drop_without_shutdown(mut self) {
611 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
613 std::mem::forget(self);
615 }
616}
617
618impl DebugLogStackTraceResponder {
619 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
623 let _result = self.send_raw(result);
624 if _result.is_err() {
625 self.control_handle.shutdown();
626 }
627 self.drop_without_shutdown();
628 _result
629 }
630
631 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
633 let _result = self.send_raw(result);
634 self.drop_without_shutdown();
635 _result
636 }
637
638 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
639 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
640 fidl::encoding::EmptyStruct,
641 i32,
642 >>(
643 fidl::encoding::FlexibleResult::new(result),
644 self.tx_id,
645 0x6c839ab9a2f61de1,
646 fidl::encoding::DynamicFlags::FLEXIBLE,
647 )
648 }
649}
650
651#[must_use = "FIDL methods require a response to be sent"]
652#[derive(Debug)]
653pub struct DebugGetHostKoidResponder {
654 control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
655 tx_id: u32,
656}
657
658impl std::ops::Drop for DebugGetHostKoidResponder {
662 fn drop(&mut self) {
663 self.control_handle.shutdown();
664 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
666 }
667}
668
669impl fidl::endpoints::Responder for DebugGetHostKoidResponder {
670 type ControlHandle = DebugControlHandle;
671
672 fn control_handle(&self) -> &DebugControlHandle {
673 &self.control_handle
674 }
675
676 fn drop_without_shutdown(mut self) {
677 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
679 std::mem::forget(self);
681 }
682}
683
684impl DebugGetHostKoidResponder {
685 pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
689 let _result = self.send_raw(result);
690 if _result.is_err() {
691 self.control_handle.shutdown();
692 }
693 self.drop_without_shutdown();
694 _result
695 }
696
697 pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
699 let _result = self.send_raw(result);
700 self.drop_without_shutdown();
701 _result
702 }
703
704 fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
705 self.control_handle
706 .inner
707 .send::<fidl::encoding::FlexibleResultType<DebugGetHostKoidResponse, i32>>(
708 fidl::encoding::FlexibleResult::new(result.map(|host_koid| (host_koid,))),
709 self.tx_id,
710 0x250b90689178cf1c,
711 fidl::encoding::DynamicFlags::FLEXIBLE,
712 )
713 }
714}
715
716#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
717pub struct NodeBusTopologyMarker;
718
719impl fidl::endpoints::ProtocolMarker for NodeBusTopologyMarker {
720 type Proxy = NodeBusTopologyProxy;
721 type RequestStream = NodeBusTopologyRequestStream;
722 #[cfg(target_os = "fuchsia")]
723 type SynchronousProxy = NodeBusTopologySynchronousProxy;
724
725 const DEBUG_NAME: &'static str = "fuchsia.driver.token.NodeBusTopology";
726}
727impl fidl::endpoints::DiscoverableProtocolMarker for NodeBusTopologyMarker {}
728pub type NodeBusTopologyGetResult = Result<Vec<fidl_fuchsia_driver_framework::BusInfo>, i32>;
729
730pub trait NodeBusTopologyProxyInterface: Send + Sync {
731 type GetResponseFut: std::future::Future<Output = Result<NodeBusTopologyGetResult, fidl::Error>>
732 + Send;
733 fn r#get(&self, token: fidl::Event) -> Self::GetResponseFut;
734}
735#[derive(Debug)]
736#[cfg(target_os = "fuchsia")]
737pub struct NodeBusTopologySynchronousProxy {
738 client: fidl::client::sync::Client,
739}
740
741#[cfg(target_os = "fuchsia")]
742impl fidl::endpoints::SynchronousProxy for NodeBusTopologySynchronousProxy {
743 type Proxy = NodeBusTopologyProxy;
744 type Protocol = NodeBusTopologyMarker;
745
746 fn from_channel(inner: fidl::Channel) -> Self {
747 Self::new(inner)
748 }
749
750 fn into_channel(self) -> fidl::Channel {
751 self.client.into_channel()
752 }
753
754 fn as_channel(&self) -> &fidl::Channel {
755 self.client.as_channel()
756 }
757}
758
759#[cfg(target_os = "fuchsia")]
760impl NodeBusTopologySynchronousProxy {
761 pub fn new(channel: fidl::Channel) -> Self {
762 Self { client: fidl::client::sync::Client::new(channel) }
763 }
764
765 pub fn into_channel(self) -> fidl::Channel {
766 self.client.into_channel()
767 }
768
769 pub fn wait_for_event(
772 &self,
773 deadline: zx::MonotonicInstant,
774 ) -> Result<NodeBusTopologyEvent, fidl::Error> {
775 NodeBusTopologyEvent::decode(self.client.wait_for_event::<NodeBusTopologyMarker>(deadline)?)
776 }
777
778 pub fn r#get(
779 &self,
780 mut token: fidl::Event,
781 ___deadline: zx::MonotonicInstant,
782 ) -> Result<NodeBusTopologyGetResult, fidl::Error> {
783 let _response = self.client.send_query::<
784 NodeBusTopologyGetRequest,
785 fidl::encoding::ResultType<NodeBusTopologyGetResponse, i32>,
786 NodeBusTopologyMarker,
787 >(
788 (token,),
789 0x1f35948edf73f5bd,
790 fidl::encoding::DynamicFlags::empty(),
791 ___deadline,
792 )?;
793 Ok(_response.map(|x| x.path))
794 }
795}
796
797#[cfg(target_os = "fuchsia")]
798impl From<NodeBusTopologySynchronousProxy> for zx::NullableHandle {
799 fn from(value: NodeBusTopologySynchronousProxy) -> Self {
800 value.into_channel().into()
801 }
802}
803
804#[cfg(target_os = "fuchsia")]
805impl From<fidl::Channel> for NodeBusTopologySynchronousProxy {
806 fn from(value: fidl::Channel) -> Self {
807 Self::new(value)
808 }
809}
810
811#[cfg(target_os = "fuchsia")]
812impl fidl::endpoints::FromClient for NodeBusTopologySynchronousProxy {
813 type Protocol = NodeBusTopologyMarker;
814
815 fn from_client(value: fidl::endpoints::ClientEnd<NodeBusTopologyMarker>) -> Self {
816 Self::new(value.into_channel())
817 }
818}
819
820#[derive(Debug, Clone)]
821pub struct NodeBusTopologyProxy {
822 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
823}
824
825impl fidl::endpoints::Proxy for NodeBusTopologyProxy {
826 type Protocol = NodeBusTopologyMarker;
827
828 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
829 Self::new(inner)
830 }
831
832 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
833 self.client.into_channel().map_err(|client| Self { client })
834 }
835
836 fn as_channel(&self) -> &::fidl::AsyncChannel {
837 self.client.as_channel()
838 }
839}
840
841impl NodeBusTopologyProxy {
842 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
844 let protocol_name = <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
845 Self { client: fidl::client::Client::new(channel, protocol_name) }
846 }
847
848 pub fn take_event_stream(&self) -> NodeBusTopologyEventStream {
854 NodeBusTopologyEventStream { event_receiver: self.client.take_event_receiver() }
855 }
856
857 pub fn r#get(
858 &self,
859 mut token: fidl::Event,
860 ) -> fidl::client::QueryResponseFut<
861 NodeBusTopologyGetResult,
862 fidl::encoding::DefaultFuchsiaResourceDialect,
863 > {
864 NodeBusTopologyProxyInterface::r#get(self, token)
865 }
866}
867
868impl NodeBusTopologyProxyInterface for NodeBusTopologyProxy {
869 type GetResponseFut = fidl::client::QueryResponseFut<
870 NodeBusTopologyGetResult,
871 fidl::encoding::DefaultFuchsiaResourceDialect,
872 >;
873 fn r#get(&self, mut token: fidl::Event) -> Self::GetResponseFut {
874 fn _decode(
875 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
876 ) -> Result<NodeBusTopologyGetResult, fidl::Error> {
877 let _response = fidl::client::decode_transaction_body::<
878 fidl::encoding::ResultType<NodeBusTopologyGetResponse, i32>,
879 fidl::encoding::DefaultFuchsiaResourceDialect,
880 0x1f35948edf73f5bd,
881 >(_buf?)?;
882 Ok(_response.map(|x| x.path))
883 }
884 self.client.send_query_and_decode::<NodeBusTopologyGetRequest, NodeBusTopologyGetResult>(
885 (token,),
886 0x1f35948edf73f5bd,
887 fidl::encoding::DynamicFlags::empty(),
888 _decode,
889 )
890 }
891}
892
893pub struct NodeBusTopologyEventStream {
894 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
895}
896
897impl std::marker::Unpin for NodeBusTopologyEventStream {}
898
899impl futures::stream::FusedStream for NodeBusTopologyEventStream {
900 fn is_terminated(&self) -> bool {
901 self.event_receiver.is_terminated()
902 }
903}
904
905impl futures::Stream for NodeBusTopologyEventStream {
906 type Item = Result<NodeBusTopologyEvent, fidl::Error>;
907
908 fn poll_next(
909 mut self: std::pin::Pin<&mut Self>,
910 cx: &mut std::task::Context<'_>,
911 ) -> std::task::Poll<Option<Self::Item>> {
912 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
913 &mut self.event_receiver,
914 cx
915 )?) {
916 Some(buf) => std::task::Poll::Ready(Some(NodeBusTopologyEvent::decode(buf))),
917 None => std::task::Poll::Ready(None),
918 }
919 }
920}
921
922#[derive(Debug)]
923pub enum NodeBusTopologyEvent {
924 #[non_exhaustive]
925 _UnknownEvent {
926 ordinal: u64,
928 },
929}
930
931impl NodeBusTopologyEvent {
932 fn decode(
934 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
935 ) -> Result<NodeBusTopologyEvent, fidl::Error> {
936 let (bytes, _handles) = buf.split_mut();
937 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
938 debug_assert_eq!(tx_header.tx_id, 0);
939 match tx_header.ordinal {
940 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
941 Ok(NodeBusTopologyEvent::_UnknownEvent { ordinal: tx_header.ordinal })
942 }
943 _ => Err(fidl::Error::UnknownOrdinal {
944 ordinal: tx_header.ordinal,
945 protocol_name:
946 <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
947 }),
948 }
949 }
950}
951
952pub struct NodeBusTopologyRequestStream {
954 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
955 is_terminated: bool,
956}
957
958impl std::marker::Unpin for NodeBusTopologyRequestStream {}
959
960impl futures::stream::FusedStream for NodeBusTopologyRequestStream {
961 fn is_terminated(&self) -> bool {
962 self.is_terminated
963 }
964}
965
966impl fidl::endpoints::RequestStream for NodeBusTopologyRequestStream {
967 type Protocol = NodeBusTopologyMarker;
968 type ControlHandle = NodeBusTopologyControlHandle;
969
970 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
971 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
972 }
973
974 fn control_handle(&self) -> Self::ControlHandle {
975 NodeBusTopologyControlHandle { inner: self.inner.clone() }
976 }
977
978 fn into_inner(
979 self,
980 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
981 {
982 (self.inner, self.is_terminated)
983 }
984
985 fn from_inner(
986 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
987 is_terminated: bool,
988 ) -> Self {
989 Self { inner, is_terminated }
990 }
991}
992
993impl futures::Stream for NodeBusTopologyRequestStream {
994 type Item = Result<NodeBusTopologyRequest, fidl::Error>;
995
996 fn poll_next(
997 mut self: std::pin::Pin<&mut Self>,
998 cx: &mut std::task::Context<'_>,
999 ) -> std::task::Poll<Option<Self::Item>> {
1000 let this = &mut *self;
1001 if this.inner.check_shutdown(cx) {
1002 this.is_terminated = true;
1003 return std::task::Poll::Ready(None);
1004 }
1005 if this.is_terminated {
1006 panic!("polled NodeBusTopologyRequestStream after completion");
1007 }
1008 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1009 |bytes, handles| {
1010 match this.inner.channel().read_etc(cx, bytes, handles) {
1011 std::task::Poll::Ready(Ok(())) => {}
1012 std::task::Poll::Pending => return std::task::Poll::Pending,
1013 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1014 this.is_terminated = true;
1015 return std::task::Poll::Ready(None);
1016 }
1017 std::task::Poll::Ready(Err(e)) => {
1018 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1019 e.into(),
1020 ))));
1021 }
1022 }
1023
1024 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1026
1027 std::task::Poll::Ready(Some(match header.ordinal {
1028 0x1f35948edf73f5bd => {
1029 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1030 let mut req = fidl::new_empty!(
1031 NodeBusTopologyGetRequest,
1032 fidl::encoding::DefaultFuchsiaResourceDialect
1033 );
1034 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeBusTopologyGetRequest>(&header, _body_bytes, handles, &mut req)?;
1035 let control_handle =
1036 NodeBusTopologyControlHandle { inner: this.inner.clone() };
1037 Ok(NodeBusTopologyRequest::Get {
1038 token: req.token,
1039
1040 responder: NodeBusTopologyGetResponder {
1041 control_handle: std::mem::ManuallyDrop::new(control_handle),
1042 tx_id: header.tx_id,
1043 },
1044 })
1045 }
1046 _ if header.tx_id == 0
1047 && header
1048 .dynamic_flags()
1049 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1050 {
1051 Ok(NodeBusTopologyRequest::_UnknownMethod {
1052 ordinal: header.ordinal,
1053 control_handle: NodeBusTopologyControlHandle {
1054 inner: this.inner.clone(),
1055 },
1056 method_type: fidl::MethodType::OneWay,
1057 })
1058 }
1059 _ if header
1060 .dynamic_flags()
1061 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1062 {
1063 this.inner.send_framework_err(
1064 fidl::encoding::FrameworkErr::UnknownMethod,
1065 header.tx_id,
1066 header.ordinal,
1067 header.dynamic_flags(),
1068 (bytes, handles),
1069 )?;
1070 Ok(NodeBusTopologyRequest::_UnknownMethod {
1071 ordinal: header.ordinal,
1072 control_handle: NodeBusTopologyControlHandle {
1073 inner: this.inner.clone(),
1074 },
1075 method_type: fidl::MethodType::TwoWay,
1076 })
1077 }
1078 _ => Err(fidl::Error::UnknownOrdinal {
1079 ordinal: header.ordinal,
1080 protocol_name:
1081 <NodeBusTopologyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1082 }),
1083 }))
1084 },
1085 )
1086 }
1087}
1088
1089#[derive(Debug)]
1091pub enum NodeBusTopologyRequest {
1092 Get {
1093 token: fidl::Event,
1094 responder: NodeBusTopologyGetResponder,
1095 },
1096 #[non_exhaustive]
1098 _UnknownMethod {
1099 ordinal: u64,
1101 control_handle: NodeBusTopologyControlHandle,
1102 method_type: fidl::MethodType,
1103 },
1104}
1105
1106impl NodeBusTopologyRequest {
1107 #[allow(irrefutable_let_patterns)]
1108 pub fn into_get(self) -> Option<(fidl::Event, NodeBusTopologyGetResponder)> {
1109 if let NodeBusTopologyRequest::Get { token, responder } = self {
1110 Some((token, responder))
1111 } else {
1112 None
1113 }
1114 }
1115
1116 pub fn method_name(&self) -> &'static str {
1118 match *self {
1119 NodeBusTopologyRequest::Get { .. } => "get",
1120 NodeBusTopologyRequest::_UnknownMethod {
1121 method_type: fidl::MethodType::OneWay,
1122 ..
1123 } => "unknown one-way method",
1124 NodeBusTopologyRequest::_UnknownMethod {
1125 method_type: fidl::MethodType::TwoWay,
1126 ..
1127 } => "unknown two-way method",
1128 }
1129 }
1130}
1131
1132#[derive(Debug, Clone)]
1133pub struct NodeBusTopologyControlHandle {
1134 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1135}
1136
1137impl NodeBusTopologyControlHandle {
1138 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1139 self.inner.shutdown_with_epitaph(status.into())
1140 }
1141}
1142
1143impl fidl::endpoints::ControlHandle for NodeBusTopologyControlHandle {
1144 fn shutdown(&self) {
1145 self.inner.shutdown()
1146 }
1147
1148 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1149 self.inner.shutdown_with_epitaph(status)
1150 }
1151
1152 fn is_closed(&self) -> bool {
1153 self.inner.channel().is_closed()
1154 }
1155 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1156 self.inner.channel().on_closed()
1157 }
1158
1159 #[cfg(target_os = "fuchsia")]
1160 fn signal_peer(
1161 &self,
1162 clear_mask: zx::Signals,
1163 set_mask: zx::Signals,
1164 ) -> Result<(), zx_status::Status> {
1165 use fidl::Peered;
1166 self.inner.channel().signal_peer(clear_mask, set_mask)
1167 }
1168}
1169
1170impl NodeBusTopologyControlHandle {}
1171
1172#[must_use = "FIDL methods require a response to be sent"]
1173#[derive(Debug)]
1174pub struct NodeBusTopologyGetResponder {
1175 control_handle: std::mem::ManuallyDrop<NodeBusTopologyControlHandle>,
1176 tx_id: u32,
1177}
1178
1179impl std::ops::Drop for NodeBusTopologyGetResponder {
1183 fn drop(&mut self) {
1184 self.control_handle.shutdown();
1185 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1187 }
1188}
1189
1190impl fidl::endpoints::Responder for NodeBusTopologyGetResponder {
1191 type ControlHandle = NodeBusTopologyControlHandle;
1192
1193 fn control_handle(&self) -> &NodeBusTopologyControlHandle {
1194 &self.control_handle
1195 }
1196
1197 fn drop_without_shutdown(mut self) {
1198 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1200 std::mem::forget(self);
1202 }
1203}
1204
1205impl NodeBusTopologyGetResponder {
1206 pub fn send(
1210 self,
1211 mut result: Result<&[fidl_fuchsia_driver_framework::BusInfo], i32>,
1212 ) -> Result<(), fidl::Error> {
1213 let _result = self.send_raw(result);
1214 if _result.is_err() {
1215 self.control_handle.shutdown();
1216 }
1217 self.drop_without_shutdown();
1218 _result
1219 }
1220
1221 pub fn send_no_shutdown_on_err(
1223 self,
1224 mut result: Result<&[fidl_fuchsia_driver_framework::BusInfo], i32>,
1225 ) -> Result<(), fidl::Error> {
1226 let _result = self.send_raw(result);
1227 self.drop_without_shutdown();
1228 _result
1229 }
1230
1231 fn send_raw(
1232 &self,
1233 mut result: Result<&[fidl_fuchsia_driver_framework::BusInfo], i32>,
1234 ) -> Result<(), fidl::Error> {
1235 self.control_handle
1236 .inner
1237 .send::<fidl::encoding::ResultType<NodeBusTopologyGetResponse, i32>>(
1238 result.map(|path| (path,)),
1239 self.tx_id,
1240 0x1f35948edf73f5bd,
1241 fidl::encoding::DynamicFlags::empty(),
1242 )
1243 }
1244}
1245
1246#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1247pub struct NodeTokenMarker;
1248
1249impl fidl::endpoints::ProtocolMarker for NodeTokenMarker {
1250 type Proxy = NodeTokenProxy;
1251 type RequestStream = NodeTokenRequestStream;
1252 #[cfg(target_os = "fuchsia")]
1253 type SynchronousProxy = NodeTokenSynchronousProxy;
1254
1255 const DEBUG_NAME: &'static str = "(anonymous) NodeToken";
1256}
1257pub type NodeTokenGetResult = Result<fidl::Event, i32>;
1258
1259pub trait NodeTokenProxyInterface: Send + Sync {
1260 type GetResponseFut: std::future::Future<Output = Result<NodeTokenGetResult, fidl::Error>>
1261 + Send;
1262 fn r#get(&self) -> Self::GetResponseFut;
1263}
1264#[derive(Debug)]
1265#[cfg(target_os = "fuchsia")]
1266pub struct NodeTokenSynchronousProxy {
1267 client: fidl::client::sync::Client,
1268}
1269
1270#[cfg(target_os = "fuchsia")]
1271impl fidl::endpoints::SynchronousProxy for NodeTokenSynchronousProxy {
1272 type Proxy = NodeTokenProxy;
1273 type Protocol = NodeTokenMarker;
1274
1275 fn from_channel(inner: fidl::Channel) -> Self {
1276 Self::new(inner)
1277 }
1278
1279 fn into_channel(self) -> fidl::Channel {
1280 self.client.into_channel()
1281 }
1282
1283 fn as_channel(&self) -> &fidl::Channel {
1284 self.client.as_channel()
1285 }
1286}
1287
1288#[cfg(target_os = "fuchsia")]
1289impl NodeTokenSynchronousProxy {
1290 pub fn new(channel: fidl::Channel) -> Self {
1291 Self { client: fidl::client::sync::Client::new(channel) }
1292 }
1293
1294 pub fn into_channel(self) -> fidl::Channel {
1295 self.client.into_channel()
1296 }
1297
1298 pub fn wait_for_event(
1301 &self,
1302 deadline: zx::MonotonicInstant,
1303 ) -> Result<NodeTokenEvent, fidl::Error> {
1304 NodeTokenEvent::decode(self.client.wait_for_event::<NodeTokenMarker>(deadline)?)
1305 }
1306
1307 pub fn r#get(
1308 &self,
1309 ___deadline: zx::MonotonicInstant,
1310 ) -> Result<NodeTokenGetResult, fidl::Error> {
1311 let _response = self.client.send_query::<
1312 fidl::encoding::EmptyPayload,
1313 fidl::encoding::ResultType<NodeTokenGetResponse, i32>,
1314 NodeTokenMarker,
1315 >(
1316 (),
1317 0x64166e3a6984b1d9,
1318 fidl::encoding::DynamicFlags::empty(),
1319 ___deadline,
1320 )?;
1321 Ok(_response.map(|x| x.token))
1322 }
1323}
1324
1325#[cfg(target_os = "fuchsia")]
1326impl From<NodeTokenSynchronousProxy> for zx::NullableHandle {
1327 fn from(value: NodeTokenSynchronousProxy) -> Self {
1328 value.into_channel().into()
1329 }
1330}
1331
1332#[cfg(target_os = "fuchsia")]
1333impl From<fidl::Channel> for NodeTokenSynchronousProxy {
1334 fn from(value: fidl::Channel) -> Self {
1335 Self::new(value)
1336 }
1337}
1338
1339#[cfg(target_os = "fuchsia")]
1340impl fidl::endpoints::FromClient for NodeTokenSynchronousProxy {
1341 type Protocol = NodeTokenMarker;
1342
1343 fn from_client(value: fidl::endpoints::ClientEnd<NodeTokenMarker>) -> Self {
1344 Self::new(value.into_channel())
1345 }
1346}
1347
1348#[derive(Debug, Clone)]
1349pub struct NodeTokenProxy {
1350 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1351}
1352
1353impl fidl::endpoints::Proxy for NodeTokenProxy {
1354 type Protocol = NodeTokenMarker;
1355
1356 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1357 Self::new(inner)
1358 }
1359
1360 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1361 self.client.into_channel().map_err(|client| Self { client })
1362 }
1363
1364 fn as_channel(&self) -> &::fidl::AsyncChannel {
1365 self.client.as_channel()
1366 }
1367}
1368
1369impl NodeTokenProxy {
1370 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1372 let protocol_name = <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1373 Self { client: fidl::client::Client::new(channel, protocol_name) }
1374 }
1375
1376 pub fn take_event_stream(&self) -> NodeTokenEventStream {
1382 NodeTokenEventStream { event_receiver: self.client.take_event_receiver() }
1383 }
1384
1385 pub fn r#get(
1386 &self,
1387 ) -> fidl::client::QueryResponseFut<
1388 NodeTokenGetResult,
1389 fidl::encoding::DefaultFuchsiaResourceDialect,
1390 > {
1391 NodeTokenProxyInterface::r#get(self)
1392 }
1393}
1394
1395impl NodeTokenProxyInterface for NodeTokenProxy {
1396 type GetResponseFut = fidl::client::QueryResponseFut<
1397 NodeTokenGetResult,
1398 fidl::encoding::DefaultFuchsiaResourceDialect,
1399 >;
1400 fn r#get(&self) -> Self::GetResponseFut {
1401 fn _decode(
1402 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1403 ) -> Result<NodeTokenGetResult, fidl::Error> {
1404 let _response = fidl::client::decode_transaction_body::<
1405 fidl::encoding::ResultType<NodeTokenGetResponse, i32>,
1406 fidl::encoding::DefaultFuchsiaResourceDialect,
1407 0x64166e3a6984b1d9,
1408 >(_buf?)?;
1409 Ok(_response.map(|x| x.token))
1410 }
1411 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NodeTokenGetResult>(
1412 (),
1413 0x64166e3a6984b1d9,
1414 fidl::encoding::DynamicFlags::empty(),
1415 _decode,
1416 )
1417 }
1418}
1419
1420pub struct NodeTokenEventStream {
1421 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1422}
1423
1424impl std::marker::Unpin for NodeTokenEventStream {}
1425
1426impl futures::stream::FusedStream for NodeTokenEventStream {
1427 fn is_terminated(&self) -> bool {
1428 self.event_receiver.is_terminated()
1429 }
1430}
1431
1432impl futures::Stream for NodeTokenEventStream {
1433 type Item = Result<NodeTokenEvent, fidl::Error>;
1434
1435 fn poll_next(
1436 mut self: std::pin::Pin<&mut Self>,
1437 cx: &mut std::task::Context<'_>,
1438 ) -> std::task::Poll<Option<Self::Item>> {
1439 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1440 &mut self.event_receiver,
1441 cx
1442 )?) {
1443 Some(buf) => std::task::Poll::Ready(Some(NodeTokenEvent::decode(buf))),
1444 None => std::task::Poll::Ready(None),
1445 }
1446 }
1447}
1448
1449#[derive(Debug)]
1450pub enum NodeTokenEvent {}
1451
1452impl NodeTokenEvent {
1453 fn decode(
1455 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1456 ) -> Result<NodeTokenEvent, fidl::Error> {
1457 let (bytes, _handles) = buf.split_mut();
1458 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1459 debug_assert_eq!(tx_header.tx_id, 0);
1460 match tx_header.ordinal {
1461 _ => Err(fidl::Error::UnknownOrdinal {
1462 ordinal: tx_header.ordinal,
1463 protocol_name: <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1464 }),
1465 }
1466 }
1467}
1468
1469pub struct NodeTokenRequestStream {
1471 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1472 is_terminated: bool,
1473}
1474
1475impl std::marker::Unpin for NodeTokenRequestStream {}
1476
1477impl futures::stream::FusedStream for NodeTokenRequestStream {
1478 fn is_terminated(&self) -> bool {
1479 self.is_terminated
1480 }
1481}
1482
1483impl fidl::endpoints::RequestStream for NodeTokenRequestStream {
1484 type Protocol = NodeTokenMarker;
1485 type ControlHandle = NodeTokenControlHandle;
1486
1487 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1488 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1489 }
1490
1491 fn control_handle(&self) -> Self::ControlHandle {
1492 NodeTokenControlHandle { inner: self.inner.clone() }
1493 }
1494
1495 fn into_inner(
1496 self,
1497 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1498 {
1499 (self.inner, self.is_terminated)
1500 }
1501
1502 fn from_inner(
1503 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1504 is_terminated: bool,
1505 ) -> Self {
1506 Self { inner, is_terminated }
1507 }
1508}
1509
1510impl futures::Stream for NodeTokenRequestStream {
1511 type Item = Result<NodeTokenRequest, fidl::Error>;
1512
1513 fn poll_next(
1514 mut self: std::pin::Pin<&mut Self>,
1515 cx: &mut std::task::Context<'_>,
1516 ) -> std::task::Poll<Option<Self::Item>> {
1517 let this = &mut *self;
1518 if this.inner.check_shutdown(cx) {
1519 this.is_terminated = true;
1520 return std::task::Poll::Ready(None);
1521 }
1522 if this.is_terminated {
1523 panic!("polled NodeTokenRequestStream after completion");
1524 }
1525 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1526 |bytes, handles| {
1527 match this.inner.channel().read_etc(cx, bytes, handles) {
1528 std::task::Poll::Ready(Ok(())) => {}
1529 std::task::Poll::Pending => return std::task::Poll::Pending,
1530 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1531 this.is_terminated = true;
1532 return std::task::Poll::Ready(None);
1533 }
1534 std::task::Poll::Ready(Err(e)) => {
1535 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1536 e.into(),
1537 ))));
1538 }
1539 }
1540
1541 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1543
1544 std::task::Poll::Ready(Some(match header.ordinal {
1545 0x64166e3a6984b1d9 => {
1546 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1547 let mut req = fidl::new_empty!(
1548 fidl::encoding::EmptyPayload,
1549 fidl::encoding::DefaultFuchsiaResourceDialect
1550 );
1551 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1552 let control_handle = NodeTokenControlHandle { inner: this.inner.clone() };
1553 Ok(NodeTokenRequest::Get {
1554 responder: NodeTokenGetResponder {
1555 control_handle: std::mem::ManuallyDrop::new(control_handle),
1556 tx_id: header.tx_id,
1557 },
1558 })
1559 }
1560 _ => Err(fidl::Error::UnknownOrdinal {
1561 ordinal: header.ordinal,
1562 protocol_name:
1563 <NodeTokenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1564 }),
1565 }))
1566 },
1567 )
1568 }
1569}
1570
1571#[derive(Debug)]
1577pub enum NodeTokenRequest {
1578 Get { responder: NodeTokenGetResponder },
1579}
1580
1581impl NodeTokenRequest {
1582 #[allow(irrefutable_let_patterns)]
1583 pub fn into_get(self) -> Option<(NodeTokenGetResponder)> {
1584 if let NodeTokenRequest::Get { responder } = self { Some((responder)) } else { None }
1585 }
1586
1587 pub fn method_name(&self) -> &'static str {
1589 match *self {
1590 NodeTokenRequest::Get { .. } => "get",
1591 }
1592 }
1593}
1594
1595#[derive(Debug, Clone)]
1596pub struct NodeTokenControlHandle {
1597 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1598}
1599
1600impl NodeTokenControlHandle {
1601 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1602 self.inner.shutdown_with_epitaph(status.into())
1603 }
1604}
1605
1606impl fidl::endpoints::ControlHandle for NodeTokenControlHandle {
1607 fn shutdown(&self) {
1608 self.inner.shutdown()
1609 }
1610
1611 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1612 self.inner.shutdown_with_epitaph(status)
1613 }
1614
1615 fn is_closed(&self) -> bool {
1616 self.inner.channel().is_closed()
1617 }
1618 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1619 self.inner.channel().on_closed()
1620 }
1621
1622 #[cfg(target_os = "fuchsia")]
1623 fn signal_peer(
1624 &self,
1625 clear_mask: zx::Signals,
1626 set_mask: zx::Signals,
1627 ) -> Result<(), zx_status::Status> {
1628 use fidl::Peered;
1629 self.inner.channel().signal_peer(clear_mask, set_mask)
1630 }
1631}
1632
1633impl NodeTokenControlHandle {}
1634
1635#[must_use = "FIDL methods require a response to be sent"]
1636#[derive(Debug)]
1637pub struct NodeTokenGetResponder {
1638 control_handle: std::mem::ManuallyDrop<NodeTokenControlHandle>,
1639 tx_id: u32,
1640}
1641
1642impl std::ops::Drop for NodeTokenGetResponder {
1646 fn drop(&mut self) {
1647 self.control_handle.shutdown();
1648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1650 }
1651}
1652
1653impl fidl::endpoints::Responder for NodeTokenGetResponder {
1654 type ControlHandle = NodeTokenControlHandle;
1655
1656 fn control_handle(&self) -> &NodeTokenControlHandle {
1657 &self.control_handle
1658 }
1659
1660 fn drop_without_shutdown(mut self) {
1661 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1663 std::mem::forget(self);
1665 }
1666}
1667
1668impl NodeTokenGetResponder {
1669 pub fn send(self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
1673 let _result = self.send_raw(result);
1674 if _result.is_err() {
1675 self.control_handle.shutdown();
1676 }
1677 self.drop_without_shutdown();
1678 _result
1679 }
1680
1681 pub fn send_no_shutdown_on_err(
1683 self,
1684 mut result: Result<fidl::Event, i32>,
1685 ) -> Result<(), fidl::Error> {
1686 let _result = self.send_raw(result);
1687 self.drop_without_shutdown();
1688 _result
1689 }
1690
1691 fn send_raw(&self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
1692 self.control_handle.inner.send::<fidl::encoding::ResultType<NodeTokenGetResponse, i32>>(
1693 result.map(|token| (token,)),
1694 self.tx_id,
1695 0x64166e3a6984b1d9,
1696 fidl::encoding::DynamicFlags::empty(),
1697 )
1698 }
1699}
1700
1701mod internal {
1702 use super::*;
1703
1704 impl fidl::encoding::ResourceTypeMarker for DebugGetHostKoidRequest {
1705 type Borrowed<'a> = &'a mut Self;
1706 fn take_or_borrow<'a>(
1707 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1708 ) -> Self::Borrowed<'a> {
1709 value
1710 }
1711 }
1712
1713 unsafe impl fidl::encoding::TypeMarker for DebugGetHostKoidRequest {
1714 type Owned = Self;
1715
1716 #[inline(always)]
1717 fn inline_align(_context: fidl::encoding::Context) -> usize {
1718 4
1719 }
1720
1721 #[inline(always)]
1722 fn inline_size(_context: fidl::encoding::Context) -> usize {
1723 4
1724 }
1725 }
1726
1727 unsafe impl
1728 fidl::encoding::Encode<
1729 DebugGetHostKoidRequest,
1730 fidl::encoding::DefaultFuchsiaResourceDialect,
1731 > for &mut DebugGetHostKoidRequest
1732 {
1733 #[inline]
1734 unsafe fn encode(
1735 self,
1736 encoder: &mut fidl::encoding::Encoder<
1737 '_,
1738 fidl::encoding::DefaultFuchsiaResourceDialect,
1739 >,
1740 offset: usize,
1741 _depth: fidl::encoding::Depth,
1742 ) -> fidl::Result<()> {
1743 encoder.debug_check_bounds::<DebugGetHostKoidRequest>(offset);
1744 fidl::encoding::Encode::<
1746 DebugGetHostKoidRequest,
1747 fidl::encoding::DefaultFuchsiaResourceDialect,
1748 >::encode(
1749 (<fidl::encoding::HandleType<
1750 fidl::Event,
1751 { fidl::ObjectType::EVENT.into_raw() },
1752 2147483648,
1753 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1754 &mut self.node_token
1755 ),),
1756 encoder,
1757 offset,
1758 _depth,
1759 )
1760 }
1761 }
1762 unsafe impl<
1763 T0: fidl::encoding::Encode<
1764 fidl::encoding::HandleType<
1765 fidl::Event,
1766 { fidl::ObjectType::EVENT.into_raw() },
1767 2147483648,
1768 >,
1769 fidl::encoding::DefaultFuchsiaResourceDialect,
1770 >,
1771 >
1772 fidl::encoding::Encode<
1773 DebugGetHostKoidRequest,
1774 fidl::encoding::DefaultFuchsiaResourceDialect,
1775 > for (T0,)
1776 {
1777 #[inline]
1778 unsafe fn encode(
1779 self,
1780 encoder: &mut fidl::encoding::Encoder<
1781 '_,
1782 fidl::encoding::DefaultFuchsiaResourceDialect,
1783 >,
1784 offset: usize,
1785 depth: fidl::encoding::Depth,
1786 ) -> fidl::Result<()> {
1787 encoder.debug_check_bounds::<DebugGetHostKoidRequest>(offset);
1788 self.0.encode(encoder, offset + 0, depth)?;
1792 Ok(())
1793 }
1794 }
1795
1796 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1797 for DebugGetHostKoidRequest
1798 {
1799 #[inline(always)]
1800 fn new_empty() -> Self {
1801 Self {
1802 node_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1803 }
1804 }
1805
1806 #[inline]
1807 unsafe fn decode(
1808 &mut self,
1809 decoder: &mut fidl::encoding::Decoder<
1810 '_,
1811 fidl::encoding::DefaultFuchsiaResourceDialect,
1812 >,
1813 offset: usize,
1814 _depth: fidl::encoding::Depth,
1815 ) -> fidl::Result<()> {
1816 decoder.debug_check_bounds::<Self>(offset);
1817 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.node_token, decoder, offset + 0, _depth)?;
1819 Ok(())
1820 }
1821 }
1822
1823 impl fidl::encoding::ResourceTypeMarker for DebugLogStackTraceRequest {
1824 type Borrowed<'a> = &'a mut Self;
1825 fn take_or_borrow<'a>(
1826 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1827 ) -> Self::Borrowed<'a> {
1828 value
1829 }
1830 }
1831
1832 unsafe impl fidl::encoding::TypeMarker for DebugLogStackTraceRequest {
1833 type Owned = Self;
1834
1835 #[inline(always)]
1836 fn inline_align(_context: fidl::encoding::Context) -> usize {
1837 4
1838 }
1839
1840 #[inline(always)]
1841 fn inline_size(_context: fidl::encoding::Context) -> usize {
1842 4
1843 }
1844 }
1845
1846 unsafe impl
1847 fidl::encoding::Encode<
1848 DebugLogStackTraceRequest,
1849 fidl::encoding::DefaultFuchsiaResourceDialect,
1850 > for &mut DebugLogStackTraceRequest
1851 {
1852 #[inline]
1853 unsafe fn encode(
1854 self,
1855 encoder: &mut fidl::encoding::Encoder<
1856 '_,
1857 fidl::encoding::DefaultFuchsiaResourceDialect,
1858 >,
1859 offset: usize,
1860 _depth: fidl::encoding::Depth,
1861 ) -> fidl::Result<()> {
1862 encoder.debug_check_bounds::<DebugLogStackTraceRequest>(offset);
1863 fidl::encoding::Encode::<
1865 DebugLogStackTraceRequest,
1866 fidl::encoding::DefaultFuchsiaResourceDialect,
1867 >::encode(
1868 (<fidl::encoding::HandleType<
1869 fidl::Event,
1870 { fidl::ObjectType::EVENT.into_raw() },
1871 2147483648,
1872 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1873 &mut self.node_token
1874 ),),
1875 encoder,
1876 offset,
1877 _depth,
1878 )
1879 }
1880 }
1881 unsafe impl<
1882 T0: fidl::encoding::Encode<
1883 fidl::encoding::HandleType<
1884 fidl::Event,
1885 { fidl::ObjectType::EVENT.into_raw() },
1886 2147483648,
1887 >,
1888 fidl::encoding::DefaultFuchsiaResourceDialect,
1889 >,
1890 >
1891 fidl::encoding::Encode<
1892 DebugLogStackTraceRequest,
1893 fidl::encoding::DefaultFuchsiaResourceDialect,
1894 > for (T0,)
1895 {
1896 #[inline]
1897 unsafe fn encode(
1898 self,
1899 encoder: &mut fidl::encoding::Encoder<
1900 '_,
1901 fidl::encoding::DefaultFuchsiaResourceDialect,
1902 >,
1903 offset: usize,
1904 depth: fidl::encoding::Depth,
1905 ) -> fidl::Result<()> {
1906 encoder.debug_check_bounds::<DebugLogStackTraceRequest>(offset);
1907 self.0.encode(encoder, offset + 0, depth)?;
1911 Ok(())
1912 }
1913 }
1914
1915 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1916 for DebugLogStackTraceRequest
1917 {
1918 #[inline(always)]
1919 fn new_empty() -> Self {
1920 Self {
1921 node_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1922 }
1923 }
1924
1925 #[inline]
1926 unsafe fn decode(
1927 &mut self,
1928 decoder: &mut fidl::encoding::Decoder<
1929 '_,
1930 fidl::encoding::DefaultFuchsiaResourceDialect,
1931 >,
1932 offset: usize,
1933 _depth: fidl::encoding::Depth,
1934 ) -> fidl::Result<()> {
1935 decoder.debug_check_bounds::<Self>(offset);
1936 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.node_token, decoder, offset + 0, _depth)?;
1938 Ok(())
1939 }
1940 }
1941
1942 impl fidl::encoding::ResourceTypeMarker for NodeBusTopologyGetRequest {
1943 type Borrowed<'a> = &'a mut Self;
1944 fn take_or_borrow<'a>(
1945 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1946 ) -> Self::Borrowed<'a> {
1947 value
1948 }
1949 }
1950
1951 unsafe impl fidl::encoding::TypeMarker for NodeBusTopologyGetRequest {
1952 type Owned = Self;
1953
1954 #[inline(always)]
1955 fn inline_align(_context: fidl::encoding::Context) -> usize {
1956 4
1957 }
1958
1959 #[inline(always)]
1960 fn inline_size(_context: fidl::encoding::Context) -> usize {
1961 4
1962 }
1963 }
1964
1965 unsafe impl
1966 fidl::encoding::Encode<
1967 NodeBusTopologyGetRequest,
1968 fidl::encoding::DefaultFuchsiaResourceDialect,
1969 > for &mut NodeBusTopologyGetRequest
1970 {
1971 #[inline]
1972 unsafe fn encode(
1973 self,
1974 encoder: &mut fidl::encoding::Encoder<
1975 '_,
1976 fidl::encoding::DefaultFuchsiaResourceDialect,
1977 >,
1978 offset: usize,
1979 _depth: fidl::encoding::Depth,
1980 ) -> fidl::Result<()> {
1981 encoder.debug_check_bounds::<NodeBusTopologyGetRequest>(offset);
1982 fidl::encoding::Encode::<
1984 NodeBusTopologyGetRequest,
1985 fidl::encoding::DefaultFuchsiaResourceDialect,
1986 >::encode(
1987 (<fidl::encoding::HandleType<
1988 fidl::Event,
1989 { fidl::ObjectType::EVENT.into_raw() },
1990 2147483648,
1991 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1992 &mut self.token
1993 ),),
1994 encoder,
1995 offset,
1996 _depth,
1997 )
1998 }
1999 }
2000 unsafe impl<
2001 T0: fidl::encoding::Encode<
2002 fidl::encoding::HandleType<
2003 fidl::Event,
2004 { fidl::ObjectType::EVENT.into_raw() },
2005 2147483648,
2006 >,
2007 fidl::encoding::DefaultFuchsiaResourceDialect,
2008 >,
2009 >
2010 fidl::encoding::Encode<
2011 NodeBusTopologyGetRequest,
2012 fidl::encoding::DefaultFuchsiaResourceDialect,
2013 > for (T0,)
2014 {
2015 #[inline]
2016 unsafe fn encode(
2017 self,
2018 encoder: &mut fidl::encoding::Encoder<
2019 '_,
2020 fidl::encoding::DefaultFuchsiaResourceDialect,
2021 >,
2022 offset: usize,
2023 depth: fidl::encoding::Depth,
2024 ) -> fidl::Result<()> {
2025 encoder.debug_check_bounds::<NodeBusTopologyGetRequest>(offset);
2026 self.0.encode(encoder, offset + 0, depth)?;
2030 Ok(())
2031 }
2032 }
2033
2034 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2035 for NodeBusTopologyGetRequest
2036 {
2037 #[inline(always)]
2038 fn new_empty() -> Self {
2039 Self {
2040 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2041 }
2042 }
2043
2044 #[inline]
2045 unsafe fn decode(
2046 &mut self,
2047 decoder: &mut fidl::encoding::Decoder<
2048 '_,
2049 fidl::encoding::DefaultFuchsiaResourceDialect,
2050 >,
2051 offset: usize,
2052 _depth: fidl::encoding::Depth,
2053 ) -> fidl::Result<()> {
2054 decoder.debug_check_bounds::<Self>(offset);
2055 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
2057 Ok(())
2058 }
2059 }
2060
2061 impl fidl::encoding::ResourceTypeMarker for NodeTokenGetResponse {
2062 type Borrowed<'a> = &'a mut Self;
2063 fn take_or_borrow<'a>(
2064 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2065 ) -> Self::Borrowed<'a> {
2066 value
2067 }
2068 }
2069
2070 unsafe impl fidl::encoding::TypeMarker for NodeTokenGetResponse {
2071 type Owned = Self;
2072
2073 #[inline(always)]
2074 fn inline_align(_context: fidl::encoding::Context) -> usize {
2075 4
2076 }
2077
2078 #[inline(always)]
2079 fn inline_size(_context: fidl::encoding::Context) -> usize {
2080 4
2081 }
2082 }
2083
2084 unsafe impl
2085 fidl::encoding::Encode<NodeTokenGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2086 for &mut NodeTokenGetResponse
2087 {
2088 #[inline]
2089 unsafe fn encode(
2090 self,
2091 encoder: &mut fidl::encoding::Encoder<
2092 '_,
2093 fidl::encoding::DefaultFuchsiaResourceDialect,
2094 >,
2095 offset: usize,
2096 _depth: fidl::encoding::Depth,
2097 ) -> fidl::Result<()> {
2098 encoder.debug_check_bounds::<NodeTokenGetResponse>(offset);
2099 fidl::encoding::Encode::<
2101 NodeTokenGetResponse,
2102 fidl::encoding::DefaultFuchsiaResourceDialect,
2103 >::encode(
2104 (<fidl::encoding::HandleType<
2105 fidl::Event,
2106 { fidl::ObjectType::EVENT.into_raw() },
2107 2147483648,
2108 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2109 &mut self.token
2110 ),),
2111 encoder,
2112 offset,
2113 _depth,
2114 )
2115 }
2116 }
2117 unsafe impl<
2118 T0: fidl::encoding::Encode<
2119 fidl::encoding::HandleType<
2120 fidl::Event,
2121 { fidl::ObjectType::EVENT.into_raw() },
2122 2147483648,
2123 >,
2124 fidl::encoding::DefaultFuchsiaResourceDialect,
2125 >,
2126 >
2127 fidl::encoding::Encode<NodeTokenGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2128 for (T0,)
2129 {
2130 #[inline]
2131 unsafe fn encode(
2132 self,
2133 encoder: &mut fidl::encoding::Encoder<
2134 '_,
2135 fidl::encoding::DefaultFuchsiaResourceDialect,
2136 >,
2137 offset: usize,
2138 depth: fidl::encoding::Depth,
2139 ) -> fidl::Result<()> {
2140 encoder.debug_check_bounds::<NodeTokenGetResponse>(offset);
2141 self.0.encode(encoder, offset + 0, depth)?;
2145 Ok(())
2146 }
2147 }
2148
2149 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2150 for NodeTokenGetResponse
2151 {
2152 #[inline(always)]
2153 fn new_empty() -> Self {
2154 Self {
2155 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2156 }
2157 }
2158
2159 #[inline]
2160 unsafe fn decode(
2161 &mut self,
2162 decoder: &mut fidl::encoding::Decoder<
2163 '_,
2164 fidl::encoding::DefaultFuchsiaResourceDialect,
2165 >,
2166 offset: usize,
2167 _depth: fidl::encoding::Depth,
2168 ) -> fidl::Result<()> {
2169 decoder.debug_check_bounds::<Self>(offset);
2170 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
2172 Ok(())
2173 }
2174 }
2175}