1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 ::fidl_next::bitflags::bitflags! {
8 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, )]pub struct ConnectionType: u8 {
9 #[doc = " Represents the fuchsia.io/Node protocol.\n"]const NODE = 1;
10 #[doc = " Represents the fuchsia.device/Controller protocol.\n"]const CONTROLLER = 2;
11 #[doc = " Represents the device specific FIDL.\n"]const DEVICE = 4;
12 const _ = !0;
13 }
14 }
15
16 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ConnectionType, ___E> for ConnectionType
17 where
18 ___E: ?Sized,
19 {
20 #[inline]
21 fn encode(
22 self,
23 encoder: &mut ___E,
24 out: &mut ::core::mem::MaybeUninit<crate::wire::ConnectionType>,
25 _: (),
26 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
27 ::fidl_next::Encode::encode(&self, encoder, out, ())
28 }
29 }
30
31 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ConnectionType, ___E> for &'a ConnectionType
32 where
33 ___E: ?Sized,
34 {
35 #[inline]
36 fn encode(
37 self,
38 _: &mut ___E,
39 out: &mut ::core::mem::MaybeUninit<crate::wire::ConnectionType>,
40 _: (),
41 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42 ::fidl_next::munge!(let crate::wire::ConnectionType { value } = out);
43
44 let _ = value.write(u8::from(self.bits()));
45 Ok(())
46 }
47 }
48
49 impl ::core::convert::From<crate::wire::ConnectionType> for ConnectionType {
50 fn from(wire: crate::wire::ConnectionType) -> Self {
51 Self::from_bits_retain(u8::from(wire.value))
52 }
53 }
54
55 impl ::fidl_next::FromWire<crate::wire::ConnectionType> for ConnectionType {
56 #[inline]
57 fn from_wire(wire: crate::wire::ConnectionType) -> Self {
58 Self::from(wire)
59 }
60 }
61
62 impl ::fidl_next::FromWireRef<crate::wire::ConnectionType> for ConnectionType {
63 #[inline]
64 fn from_wire_ref(wire: &crate::wire::ConnectionType) -> Self {
65 Self::from(*wire)
66 }
67 }
68
69 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
70 pub struct TopologicalPathGetTopologicalPathResponse {
71 pub path: ::std::string::String,
72 }
73
74 unsafe impl<___E>
75 ::fidl_next::Encode<crate::wire::TopologicalPathGetTopologicalPathResponse<'static>, ___E>
76 for TopologicalPathGetTopologicalPathResponse
77 where
78 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
79 ___E: ::fidl_next::Encoder,
80 {
81 #[inline]
82 fn encode(
83 self,
84 encoder_: &mut ___E,
85 out_: &mut ::core::mem::MaybeUninit<
86 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
87 >,
88 _: (),
89 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
90 ::fidl_next::munge! {
91 let crate::wire::TopologicalPathGetTopologicalPathResponse {
92 path,
93
94 } = out_;
95 }
96
97 ::fidl_next::Encode::encode(self.path, encoder_, path, 1024)?;
98
99 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(path.as_mut_ptr()) };
100 ::fidl_next::Constrained::validate(_field, 1024)?;
101
102 Ok(())
103 }
104 }
105
106 unsafe impl<'a, ___E>
107 ::fidl_next::Encode<crate::wire::TopologicalPathGetTopologicalPathResponse<'static>, ___E>
108 for &'a TopologicalPathGetTopologicalPathResponse
109 where
110 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
111 ___E: ::fidl_next::Encoder,
112 {
113 #[inline]
114 fn encode(
115 self,
116 encoder_: &mut ___E,
117 out_: &mut ::core::mem::MaybeUninit<
118 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
119 >,
120 _: (),
121 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
122 ::fidl_next::munge! {
123 let crate::wire::TopologicalPathGetTopologicalPathResponse {
124
125 path,
126
127 } = out_;
128 }
129
130 ::fidl_next::Encode::encode(&self.path, encoder_, path, 1024)?;
131
132 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(path.as_mut_ptr()) };
133 ::fidl_next::Constrained::validate(_field, 1024)?;
134
135 Ok(())
136 }
137 }
138
139 unsafe impl<___E>
140 ::fidl_next::EncodeOption<
141 ::fidl_next::WireBox<
142 'static,
143 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
144 >,
145 ___E,
146 > for TopologicalPathGetTopologicalPathResponse
147 where
148 ___E: ::fidl_next::Encoder + ?Sized,
149 TopologicalPathGetTopologicalPathResponse: ::fidl_next::Encode<
150 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
151 ___E,
152 >,
153 {
154 #[inline]
155 fn encode_option(
156 this: ::core::option::Option<Self>,
157 encoder: &mut ___E,
158 out: &mut ::core::mem::MaybeUninit<
159 ::fidl_next::WireBox<
160 'static,
161 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
162 >,
163 >,
164 _: (),
165 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
166 if let Some(inner) = this {
167 ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
168 ::fidl_next::WireBox::encode_present(out);
169 } else {
170 ::fidl_next::WireBox::encode_absent(out);
171 }
172
173 Ok(())
174 }
175 }
176
177 unsafe impl<'a, ___E>
178 ::fidl_next::EncodeOption<
179 ::fidl_next::WireBox<
180 'static,
181 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
182 >,
183 ___E,
184 > for &'a TopologicalPathGetTopologicalPathResponse
185 where
186 ___E: ::fidl_next::Encoder + ?Sized,
187 &'a TopologicalPathGetTopologicalPathResponse: ::fidl_next::Encode<
188 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
189 ___E,
190 >,
191 {
192 #[inline]
193 fn encode_option(
194 this: ::core::option::Option<Self>,
195 encoder: &mut ___E,
196 out: &mut ::core::mem::MaybeUninit<
197 ::fidl_next::WireBox<
198 'static,
199 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
200 >,
201 >,
202 _: (),
203 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
204 if let Some(inner) = this {
205 ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
206 ::fidl_next::WireBox::encode_present(out);
207 } else {
208 ::fidl_next::WireBox::encode_absent(out);
209 }
210
211 Ok(())
212 }
213 }
214
215 impl<'de> ::fidl_next::FromWire<crate::wire::TopologicalPathGetTopologicalPathResponse<'de>>
216 for TopologicalPathGetTopologicalPathResponse
217 {
218 #[inline]
219 fn from_wire(wire: crate::wire::TopologicalPathGetTopologicalPathResponse<'de>) -> Self {
220 Self { path: ::fidl_next::FromWire::from_wire(wire.path) }
221 }
222 }
223
224 impl<'de> ::fidl_next::FromWireRef<crate::wire::TopologicalPathGetTopologicalPathResponse<'de>>
225 for TopologicalPathGetTopologicalPathResponse
226 {
227 #[inline]
228 fn from_wire_ref(
229 wire: &crate::wire::TopologicalPathGetTopologicalPathResponse<'de>,
230 ) -> Self {
231 Self { path: ::fidl_next::FromWireRef::from_wire_ref(&wire.path) }
232 }
233 }
234}
235
236pub mod wire {
237
238 #[derive(Clone, Copy, Debug)]
240 #[repr(transparent)]
241 pub struct ConnectionType {
242 pub(crate) value: u8,
243 }
244
245 unsafe impl ::fidl_next::Wire for ConnectionType {
246 type Owned<'de> = Self;
247
248 #[inline]
249 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
250 }
252 }
253
254 unsafe impl<___D> ::fidl_next::Decode<___D> for ConnectionType
255 where
256 ___D: ?Sized,
257 {
258 fn decode(
259 slot: ::fidl_next::Slot<'_, Self>,
260 _: &mut ___D,
261 _: (),
262 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
263 Ok(())
264 }
265 }
266
267 impl ::core::convert::From<crate::natural::ConnectionType> for ConnectionType {
268 fn from(natural: crate::natural::ConnectionType) -> Self {
269 Self { value: u8::from(natural.bits()) }
270 }
271 }
272
273 impl ::fidl_next::IntoNatural for ConnectionType {
274 type Natural = crate::natural::ConnectionType;
275 }
276
277 impl ::fidl_next::Unconstrained for ConnectionType {}
278
279 #[derive(Debug)]
281 #[repr(C)]
282 pub struct TopologicalPathGetTopologicalPathResponse<'de> {
283 pub path: ::fidl_next::WireString<'de>,
284 }
285
286 static_assertions::const_assert_eq!(
287 std::mem::size_of::<TopologicalPathGetTopologicalPathResponse<'_>>(),
288 16
289 );
290 static_assertions::const_assert_eq!(
291 std::mem::align_of::<TopologicalPathGetTopologicalPathResponse<'_>>(),
292 8
293 );
294
295 static_assertions::const_assert_eq!(
296 std::mem::offset_of!(TopologicalPathGetTopologicalPathResponse<'_>, path),
297 0
298 );
299
300 unsafe impl ::fidl_next::Wire for TopologicalPathGetTopologicalPathResponse<'static> {
301 type Owned<'de> = TopologicalPathGetTopologicalPathResponse<'de>;
302
303 #[inline]
304 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
305 ::fidl_next::munge! {
306 let Self {
307
308 path,
309
310 } = &mut *out_;
311 }
312
313 ::fidl_next::Wire::zero_padding(path);
314 }
315 }
316
317 unsafe impl<___D> ::fidl_next::Decode<___D> for TopologicalPathGetTopologicalPathResponse<'static>
318 where
319 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
320 ___D: ::fidl_next::Decoder,
321 {
322 fn decode(
323 slot_: ::fidl_next::Slot<'_, Self>,
324 decoder_: &mut ___D,
325 _: (),
326 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
327 ::fidl_next::munge! {
328 let Self {
329
330 mut path,
331
332 } = slot_;
333 }
334
335 let _field = path.as_mut();
336 ::fidl_next::Constrained::validate(_field, 1024)?;
337 ::fidl_next::Decode::decode(path.as_mut(), decoder_, 1024)?;
338
339 let path = unsafe { path.deref_unchecked() };
340
341 if path.len() > 1024 {
342 return Err(::fidl_next::DecodeError::VectorTooLong {
343 size: path.len() as u64,
344 limit: 1024,
345 });
346 }
347
348 Ok(())
349 }
350 }
351
352 impl<'de> ::fidl_next::IntoNatural for TopologicalPathGetTopologicalPathResponse<'de> {
353 type Natural = crate::natural::TopologicalPathGetTopologicalPathResponse;
354 }
355
356 impl ::fidl_next::Unconstrained for TopologicalPathGetTopologicalPathResponse<'static> {}
357}
358
359pub mod wire_optional {}
360
361pub mod generic {
362
363 pub struct TopologicalPathGetTopologicalPathResponse<T0> {
364 pub path: T0,
365 }
366
367 unsafe impl<___E, T0>
368 ::fidl_next::Encode<crate::wire::TopologicalPathGetTopologicalPathResponse<'static>, ___E>
369 for TopologicalPathGetTopologicalPathResponse<T0>
370 where
371 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
372 ___E: ::fidl_next::Encoder,
373 T0: ::fidl_next::Encode<::fidl_next::WireString<'static>, ___E>,
374 {
375 #[inline]
376 fn encode(
377 self,
378 encoder_: &mut ___E,
379 out_: &mut ::core::mem::MaybeUninit<
380 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
381 >,
382 _: (),
383 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
384 ::fidl_next::munge! {
385 let crate::wire::TopologicalPathGetTopologicalPathResponse {
386
387 path,
388
389 } = out_;
390 }
391
392 ::fidl_next::Encode::encode(self.path, encoder_, path, 1024)?;
393
394 Ok(())
395 }
396 }
397}
398
399pub use self::natural::*;
400
401#[doc = " This name is reserved for accessing the fuchsia.device/Controller protocol\n within /dev/. No devices can be created with this name.\n"]
402pub const DEVICE_CONTROLLER_NAME: &str = "device_controller";
403
404#[doc = " This name is reserved for accessing the device specific protocol\n within /dev/. No devices can be created with this name.\n"]
405pub const DEVICE_PROTOCOL_NAME: &str = "device_protocol";
406
407#[doc = " This name is reserved for accessing the fuchsia.device.fs/TopologicalPath protocol\n within /dev/. No devices can be created with this name.\n"]
408pub const DEVICE_TOPOLOGY_NAME: &str = "device_topology";
409
410#[doc = " Maximum length of a device path\n"]
411pub const MAX_DEVICE_PATH_LEN: u64 = 1024 as u64;
412
413#[doc = " Maximum length for a driver path\n"]
414pub const MAX_DRIVER_PATH_LEN: u64 = 1024 as u64;
415
416#[derive(PartialEq, Debug)]
418pub struct TopologicalPath;
419
420#[cfg(target_os = "fuchsia")]
421impl ::fidl_next::HasTransport for TopologicalPath {
422 type Transport = ::fidl_next::fuchsia::zx::Channel;
423}
424
425pub mod topological_path {
426 pub mod prelude {
427 pub use crate::{
428 TopologicalPath, TopologicalPathClientHandler, TopologicalPathServerHandler,
429 topological_path,
430 };
431
432 pub use crate::natural::TopologicalPathGetTopologicalPathResponse;
433 }
434
435 pub struct GetTopologicalPath;
436
437 impl ::fidl_next::Method for GetTopologicalPath {
438 const ORDINAL: u64 = 6266213890697819096;
439 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
440 ::fidl_next::protocol::Flexibility::Strict;
441
442 type Protocol = crate::TopologicalPath;
443
444 type Request = ();
445 }
446
447 impl ::fidl_next::TwoWayMethod for GetTopologicalPath {
448 type Response = ::fidl_next::WireResult<
449 'static,
450 crate::wire::TopologicalPathGetTopologicalPathResponse<'static>,
451 ::fidl_next::WireI32,
452 >;
453 }
454
455 impl<___R> ::fidl_next::Respond<___R> for GetTopologicalPath {
456 type Output = ::core::result::Result<
457 crate::generic::TopologicalPathGetTopologicalPathResponse<___R>,
458 ::fidl_next::util::Never,
459 >;
460
461 fn respond(response: ___R) -> Self::Output {
462 ::core::result::Result::Ok(crate::generic::TopologicalPathGetTopologicalPathResponse {
463 path: response,
464 })
465 }
466 }
467
468 impl<___R> ::fidl_next::RespondErr<___R> for GetTopologicalPath {
469 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
470
471 fn respond_err(response: ___R) -> Self::Output {
472 ::core::result::Result::Err(response)
473 }
474 }
475
476 mod ___detail {
477 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::TopologicalPath
478 where
479 ___T: ::fidl_next::Transport,
480 {
481 type Client = TopologicalPathClient<___T>;
482 type Server = TopologicalPathServer<___T>;
483 }
484
485 #[repr(transparent)]
487 pub struct TopologicalPathClient<___T: ::fidl_next::Transport> {
488 #[allow(dead_code)]
489 client: ::fidl_next::protocol::Client<___T>,
490 }
491
492 impl<___T> TopologicalPathClient<___T>
493 where
494 ___T: ::fidl_next::Transport,
495 {
496 #[doc = " Return the topological path for this device\n"]
497 pub fn get_topological_path(
498 &self,
499 ) -> ::fidl_next::TwoWayFuture<'_, super::GetTopologicalPath, ___T> {
500 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
501 6266213890697819096,
502 <super::GetTopologicalPath as ::fidl_next::Method>::FLEXIBILITY,
503 (),
504 ))
505 }
506 }
507
508 #[repr(transparent)]
510 pub struct TopologicalPathServer<___T: ::fidl_next::Transport> {
511 server: ::fidl_next::protocol::Server<___T>,
512 }
513
514 impl<___T> TopologicalPathServer<___T> where ___T: ::fidl_next::Transport {}
515 }
516}
517
518pub trait TopologicalPathClientHandler<
522 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
523 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
524>
525{
526}
527
528impl<___T> TopologicalPathClientHandler<___T> for ::fidl_next::IgnoreEvents where
529 ___T: ::fidl_next::Transport
530{
531}
532
533impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for TopologicalPath
534where
535 ___H: TopologicalPathClientHandler<___T> + ::core::marker::Send,
536 ___T: ::fidl_next::Transport,
537{
538 async fn on_event(
539 handler: &mut ___H,
540 ordinal: u64,
541 flexibility: ::fidl_next::protocol::Flexibility,
542 buffer: ___T::RecvBuffer,
543 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
544 match ordinal {
545 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
546 }
547 }
548}
549
550pub trait TopologicalPathServerHandler<
554 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
555 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
556>
557{
558 #[doc = " Return the topological path for this device\n"]
559 fn get_topological_path(
560 &mut self,
561
562 responder: ::fidl_next::Responder<topological_path::GetTopologicalPath, ___T>,
563 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
564}
565
566impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for TopologicalPath
567where
568 ___H: TopologicalPathServerHandler<___T> + ::core::marker::Send,
569 ___T: ::fidl_next::Transport,
570{
571 async fn on_one_way(
572 handler: &mut ___H,
573 ordinal: u64,
574 flexibility: ::fidl_next::protocol::Flexibility,
575 buffer: ___T::RecvBuffer,
576 ) -> ::core::result::Result<
577 (),
578 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
579 > {
580 match ordinal {
581 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
582 }
583 }
584
585 async fn on_two_way(
586 handler: &mut ___H,
587 ordinal: u64,
588 flexibility: ::fidl_next::protocol::Flexibility,
589 buffer: ___T::RecvBuffer,
590 responder: ::fidl_next::protocol::Responder<___T>,
591 ) -> ::core::result::Result<
592 (),
593 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
594 > {
595 match ordinal {
596 6266213890697819096 => {
597 let responder = ::fidl_next::Responder::from_untyped(responder);
598
599 handler.get_topological_path(responder).await;
600 Ok(())
601 }
602
603 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
604 }
605 }
606}
607
608pub mod compat {
610
611 impl ::fidl_next::CompatFrom<crate::ConnectionType> for ::fidl_fuchsia_device_fs::ConnectionType {
612 fn compat_from(value: crate::ConnectionType) -> Self {
613 Self::from_bits_retain(value.bits())
614 }
615 }
616
617 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::ConnectionType> for crate::ConnectionType {
618 fn compat_from(value: ::fidl_fuchsia_device_fs::ConnectionType) -> Self {
619 Self::from_bits_retain(value.bits())
620 }
621 }
622
623 impl ::fidl_next::CompatFrom<crate::TopologicalPathGetTopologicalPathResponse>
624 for ::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse
625 {
626 #[inline]
627 fn compat_from(value: crate::TopologicalPathGetTopologicalPathResponse) -> Self {
628 Self { path: ::fidl_next::CompatFrom::compat_from(value.path) }
629 }
630 }
631
632 impl
633 ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse>
634 for crate::TopologicalPathGetTopologicalPathResponse
635 {
636 #[inline]
637 fn compat_from(
638 value: ::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse,
639 ) -> Self {
640 Self { path: ::fidl_next::CompatFrom::compat_from(value.path) }
641 }
642 }
643
644 #[cfg(target_os = "fuchsia")]
645 pub type TopologicalPathProxy = ::fidl_next::Client<crate::TopologicalPath>;
648
649 impl ::fidl_next::CompatFrom<crate::TopologicalPath>
650 for ::fidl_fuchsia_device_fs::TopologicalPathMarker
651 {
652 fn compat_from(_: crate::TopologicalPath) -> Self {
653 Self
654 }
655 }
656
657 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::TopologicalPathMarker>
658 for crate::TopologicalPath
659 {
660 fn compat_from(_: ::fidl_fuchsia_device_fs::TopologicalPathMarker) -> Self {
661 Self
662 }
663 }
664
665 #[cfg(target_os = "fuchsia")]
666
667 impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_device_fs::TopologicalPathProxy>
668 for crate::TopologicalPath
669 {
670 fn client_compat_from(
671 proxy: ::fidl_fuchsia_device_fs::TopologicalPathProxy,
672 ) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
673 let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
674 let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
675 ::fidl_next::ClientDispatcher::new(client_end)
676 }
677 }
678}