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