1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5::fidl_next::bitflags! {
6 #[derive(
7 Clone,
8 Copy,
9 Debug,
10 PartialEq,
11 Eq,
12 Hash,
13 )]
14 pub struct ConnectionType: u8 {
15 #[doc = " Represents the fuchsia.io/Node protocol.\n"]const NODE = 1;
16 #[doc = " Represents the fuchsia.device/Controller protocol.\n"]const CONTROLLER = 2;
17 #[doc = " Represents the device specific FIDL.\n"]const DEVICE = 4;
18 const _ = !0;
19 }
20}
21
22impl ::fidl_next::Encodable for ConnectionType {
23 type Encoded = WireConnectionType;
24}
25
26unsafe impl<___E> ::fidl_next::Encode<___E> for ConnectionType
27where
28 ___E: ?Sized,
29{
30 #[inline]
31 fn encode(
32 self,
33 encoder: &mut ___E,
34 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
35 ) -> Result<(), ::fidl_next::EncodeError> {
36 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
37 }
38}
39
40unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ConnectionType
41where
42 ___E: ?Sized,
43{
44 #[inline]
45 fn encode_ref(
46 &self,
47 _: &mut ___E,
48 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
49 ) -> Result<(), ::fidl_next::EncodeError> {
50 ::fidl_next::munge!(let WireConnectionType { value } = out);
51 let _ = value.write(u8::from(self.bits()));
52 Ok(())
53 }
54}
55
56impl ::core::convert::From<WireConnectionType> for ConnectionType {
57 fn from(wire: WireConnectionType) -> Self {
58 Self::from_bits_retain(u8::from(wire.value))
59 }
60}
61
62impl ::fidl_next::FromWire<WireConnectionType> for ConnectionType {
63 #[inline]
64 fn from_wire(wire: WireConnectionType) -> Self {
65 Self::from(wire)
66 }
67}
68
69impl ::fidl_next::FromWireRef<WireConnectionType> for ConnectionType {
70 #[inline]
71 fn from_wire_ref(wire: &WireConnectionType) -> Self {
72 Self::from(*wire)
73 }
74}
75
76#[derive(Clone, Copy, Debug)]
78#[repr(transparent)]
79pub struct WireConnectionType {
80 value: u8,
81}
82
83unsafe impl ::fidl_next::Wire for WireConnectionType {
84 type Decoded<'de> = Self;
85
86 #[inline]
87 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
88 }
90}
91
92unsafe impl<___D> ::fidl_next::Decode<___D> for WireConnectionType
93where
94 ___D: ?Sized,
95{
96 fn decode(
97 slot: ::fidl_next::Slot<'_, Self>,
98 _: &mut ___D,
99 ) -> Result<(), ::fidl_next::DecodeError> {
100 Ok(())
101 }
102}
103
104impl ::core::convert::From<ConnectionType> for WireConnectionType {
105 fn from(natural: ConnectionType) -> Self {
106 Self { value: u8::from(natural.bits()) }
107 }
108}
109
110#[derive(Debug)]
111#[repr(C)]
112pub struct ConnectorConnectRequest {
113 pub server: ::fidl_next::fuchsia::zx::Channel,
114}
115
116impl ::fidl_next::Encodable for ConnectorConnectRequest {
117 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireConnectorConnectRequest> = unsafe {
118 ::fidl_next::CopyOptimization::enable_if(
119 true
120 && <::fidl_next::fuchsia::zx::Channel as ::fidl_next::Encodable>::COPY_OPTIMIZATION
121 .is_enabled(),
122 )
123 };
124
125 type Encoded = WireConnectorConnectRequest;
126}
127
128unsafe impl<___E> ::fidl_next::Encode<___E> for ConnectorConnectRequest
129where
130 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
131 ___E: ::fidl_next::fuchsia::HandleEncoder,
132{
133 #[inline]
134 fn encode(
135 self,
136 encoder: &mut ___E,
137 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
138 ) -> Result<(), ::fidl_next::EncodeError> {
139 ::fidl_next::munge! {
140 let Self::Encoded {
141 server,
142
143 } = out;
144 }
145
146 ::fidl_next::Encode::encode(self.server, encoder, server)?;
147
148 Ok(())
149 }
150}
151
152impl ::fidl_next::EncodableOption for ConnectorConnectRequest {
153 type EncodedOption = ::fidl_next::WireBox<'static, WireConnectorConnectRequest>;
154}
155
156unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ConnectorConnectRequest
157where
158 ___E: ::fidl_next::Encoder + ?Sized,
159 ConnectorConnectRequest: ::fidl_next::Encode<___E>,
160{
161 #[inline]
162 fn encode_option(
163 this: Option<Self>,
164 encoder: &mut ___E,
165 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
166 ) -> Result<(), ::fidl_next::EncodeError> {
167 if let Some(inner) = this {
168 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
169 ::fidl_next::WireBox::encode_present(out);
170 } else {
171 ::fidl_next::WireBox::encode_absent(out);
172 }
173
174 Ok(())
175 }
176}
177
178impl ::fidl_next::FromWire<WireConnectorConnectRequest> for ConnectorConnectRequest {
179 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireConnectorConnectRequest, Self> = unsafe {
180 ::fidl_next::CopyOptimization::enable_if(
181 true && <::fidl_next::fuchsia::zx::Channel as ::fidl_next::FromWire<
182 ::fidl_next::fuchsia::WireChannel,
183 >>::COPY_OPTIMIZATION
184 .is_enabled(),
185 )
186 };
187
188 #[inline]
189 fn from_wire(wire: WireConnectorConnectRequest) -> Self {
190 Self { server: ::fidl_next::FromWire::from_wire(wire.server) }
191 }
192}
193
194#[derive(Debug)]
196#[repr(C)]
197pub struct WireConnectorConnectRequest {
198 pub server: ::fidl_next::fuchsia::WireChannel,
199}
200
201unsafe impl ::fidl_next::Wire for WireConnectorConnectRequest {
202 type Decoded<'de> = WireConnectorConnectRequest;
203
204 #[inline]
205 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
206}
207
208unsafe impl<___D> ::fidl_next::Decode<___D> for WireConnectorConnectRequest
209where
210 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
211 ___D: ::fidl_next::fuchsia::HandleDecoder,
212{
213 fn decode(
214 slot: ::fidl_next::Slot<'_, Self>,
215 decoder: &mut ___D,
216 ) -> Result<(), ::fidl_next::DecodeError> {
217 ::fidl_next::munge! {
218 let Self {
219 mut server,
220
221 } = slot;
222 }
223
224 ::fidl_next::Decode::decode(server.as_mut(), decoder)?;
225
226 Ok(())
227 }
228}
229
230#[doc = " A connector lets a client forward the server end of a protocol.\n"]
232#[derive(Debug)]
233pub struct Connector;
234
235pub mod connector {
236 pub mod prelude {
237 pub use crate::{Connector, ConnectorClientHandler, ConnectorServerHandler, connector};
238
239 pub use crate::ConnectorConnectRequest;
240 }
241
242 pub struct Connect;
243
244 impl ::fidl_next::Method for Connect {
245 const ORDINAL: u64 = 3169778387179902201;
246
247 type Protocol = crate::Connector;
248
249 type Request = crate::WireConnectorConnectRequest;
250
251 type Response = ::fidl_next::Never;
252 }
253
254 mod ___detail {
255
256 pub struct Connect<T0> {
257 server: T0,
258 }
259
260 impl<T0> ::fidl_next::Encodable for Connect<T0>
261 where
262 T0: ::fidl_next::Encodable<Encoded = ::fidl_next::fuchsia::WireChannel>,
263 {
264 type Encoded = crate::WireConnectorConnectRequest;
265 }
266
267 unsafe impl<___E, T0> ::fidl_next::Encode<___E> for Connect<T0>
268 where
269 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
270 ___E: ::fidl_next::fuchsia::HandleEncoder,
271 T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::fuchsia::WireChannel>,
272 {
273 #[inline]
274 fn encode(
275 self,
276 encoder: &mut ___E,
277 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
278 ) -> Result<(), ::fidl_next::EncodeError> {
279 ::fidl_next::munge! {
280 let Self::Encoded {
281 server,
282
283 } = out;
284 }
285
286 ::fidl_next::Encode::encode(self.server, encoder, server)?;
287
288 Ok(())
289 }
290 }
291
292 unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::Connector
293 where
294 ___T: ::fidl_next::Transport,
295 {
296 type ClientSender = ConnectorClientSender<___T>;
297 type ServerSender = ConnectorServerSender<___T>;
298 }
299
300 #[repr(transparent)]
302 pub struct ConnectorClientSender<___T: ::fidl_next::Transport> {
303 #[allow(dead_code)]
304 sender: ::fidl_next::protocol::ClientSender<___T>,
305 }
306
307 impl<___T> ConnectorClientSender<___T>
308 where
309 ___T: ::fidl_next::Transport,
310 {
311 #[doc = " Forward a server end of a protocol so that it can be connected.\n + request `server` the server end of the protocol to be served. The FIDL protocol that\n this speaks is determined out-of-band.\n - response This function has no response. The function is one-way to match the pipelining\n behaviors of other virtual filesystems.\n"]
312 pub fn connect(
313 &self,
314
315 server: impl ::fidl_next::Encode<
316 <___T as ::fidl_next::Transport>::SendBuffer,
317 Encoded = ::fidl_next::fuchsia::WireChannel,
318 >,
319 ) -> ::fidl_next::SendFuture<'_, ___T>
320 where
321 <___T as ::fidl_next::Transport>::SendBuffer:
322 ::fidl_next::encoder::InternalHandleEncoder,
323 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
324 {
325 self.connect_with(Connect { server })
326 }
327
328 #[doc = " Forward a server end of a protocol so that it can be connected.\n + request `server` the server end of the protocol to be served. The FIDL protocol that\n this speaks is determined out-of-band.\n - response This function has no response. The function is one-way to match the pipelining\n behaviors of other virtual filesystems.\n"]
329 pub fn connect_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
330 where
331 ___R: ::fidl_next::Encode<
332 <___T as ::fidl_next::Transport>::SendBuffer,
333 Encoded = crate::WireConnectorConnectRequest,
334 >,
335 {
336 ::fidl_next::SendFuture::from_untyped(
337 self.sender.send_one_way(3169778387179902201, request),
338 )
339 }
340 }
341
342 #[repr(transparent)]
344 pub struct ConnectorServerSender<___T: ::fidl_next::Transport> {
345 sender: ::fidl_next::protocol::ServerSender<___T>,
346 }
347
348 impl<___T> ConnectorServerSender<___T> where ___T: ::fidl_next::Transport {}
349 }
350}
351
352pub trait ConnectorClientHandler<
356 #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
357 #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
358>
359{
360}
361
362impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Connector
363where
364 ___H: ConnectorClientHandler<___T> + ::core::marker::Send,
365 ___T: ::fidl_next::Transport,
366{
367 async fn on_event(
368 handler: &mut ___H,
369 sender: &::fidl_next::ClientSender<Self, ___T>,
370 ordinal: u64,
371 buffer: ___T::RecvBuffer,
372 ) {
373 match ordinal {
374 ordinal => sender.close(),
375 }
376 }
377}
378
379pub trait ConnectorServerHandler<
383 #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
384 #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
385>
386{
387 #[doc = " Forward a server end of a protocol so that it can be connected.\n + request `server` the server end of the protocol to be served. The FIDL protocol that\n this speaks is determined out-of-band.\n - response This function has no response. The function is one-way to match the pipelining\n behaviors of other virtual filesystems.\n"]
388 fn connect(
389 &mut self,
390 sender: &::fidl_next::ServerSender<Connector, ___T>,
391
392 request: ::fidl_next::Request<connector::Connect, ___T>,
393 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
394}
395
396impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Connector
397where
398 ___H: ConnectorServerHandler<___T> + ::core::marker::Send,
399 ___T: ::fidl_next::Transport,
400 <connector::Connect as ::fidl_next::Method>::Request:
401 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
402{
403 async fn on_one_way(
404 handler: &mut ___H,
405 sender: &::fidl_next::ServerSender<Self, ___T>,
406 ordinal: u64,
407 buffer: ___T::RecvBuffer,
408 ) {
409 match ordinal {
410 3169778387179902201 => match ::fidl_next::DecoderExt::decode(buffer) {
411 Ok(decoded) => handler.connect(sender, decoded).await,
412 Err(e) => sender.close(),
413 },
414
415 ordinal => sender.close(),
416 }
417 }
418
419 async fn on_two_way(
420 handler: &mut ___H,
421 sender: &::fidl_next::ServerSender<Self, ___T>,
422 ordinal: u64,
423 buffer: ___T::RecvBuffer,
424 responder: ::fidl_next::protocol::Responder,
425 ) {
426 match ordinal {
427 ordinal => sender.close(),
428 }
429 }
430}
431
432#[doc = " This name is reserved for accessing the fuchsia.device/Controller protocol\n within /dev/. No devices can be created with this name.\n"]
433pub const DEVICE_CONTROLLER_NAME: &str = "device_controller";
434
435#[doc = " This name is reserved for accessing the device specific protocol\n within /dev/. No devices can be created with this name.\n"]
436pub const DEVICE_PROTOCOL_NAME: &str = "device_protocol";
437
438#[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"]
439pub const DEVICE_TOPOLOGY_NAME: &str = "device_topology";
440
441#[derive(Debug, Default)]
442pub struct DevfsAddArgs {
443 pub connector:
444 Option<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::zx::Channel>>,
445
446 pub class_name: Option<String>,
447
448 pub inspect: Option<::fidl_next::fuchsia::zx::Vmo>,
449
450 pub connector_supports: Option<crate::ConnectionType>,
451
452 pub controller_connector:
453 Option<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::zx::Channel>>,
454}
455
456impl DevfsAddArgs {
457 fn __max_ordinal(&self) -> usize {
458 if self.controller_connector.is_some() {
459 return 5;
460 }
461
462 if self.connector_supports.is_some() {
463 return 4;
464 }
465
466 if self.inspect.is_some() {
467 return 3;
468 }
469
470 if self.class_name.is_some() {
471 return 2;
472 }
473
474 if self.connector.is_some() {
475 return 1;
476 }
477
478 0
479 }
480}
481
482impl ::fidl_next::Encodable for DevfsAddArgs {
483 type Encoded = WireDevfsAddArgs<'static>;
484}
485
486unsafe impl<___E> ::fidl_next::Encode<___E> for DevfsAddArgs
487where
488 ___E: ::fidl_next::Encoder + ?Sized,
489 ___E: ::fidl_next::fuchsia::HandleEncoder,
490{
491 #[inline]
492 fn encode(
493 mut self,
494 encoder: &mut ___E,
495 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
496 ) -> Result<(), ::fidl_next::EncodeError> {
497 ::fidl_next::munge!(let WireDevfsAddArgs { table } = out);
498
499 let max_ord = self.__max_ordinal();
500
501 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
502 ::fidl_next::Wire::zero_padding(&mut out);
503
504 let mut preallocated =
505 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
506
507 for i in 1..=max_ord {
508 match i {
509 5 => {
510 if let Some(controller_connector) = self.controller_connector.take() {
511 ::fidl_next::WireEnvelope::encode_value(
512 controller_connector,
513 preallocated.encoder,
514 &mut out,
515 )?;
516 } else {
517 ::fidl_next::WireEnvelope::encode_zero(&mut out)
518 }
519 }
520
521 4 => {
522 if let Some(connector_supports) = self.connector_supports.take() {
523 ::fidl_next::WireEnvelope::encode_value(
524 connector_supports,
525 preallocated.encoder,
526 &mut out,
527 )?;
528 } else {
529 ::fidl_next::WireEnvelope::encode_zero(&mut out)
530 }
531 }
532
533 3 => {
534 if let Some(inspect) = self.inspect.take() {
535 ::fidl_next::WireEnvelope::encode_value(
536 inspect,
537 preallocated.encoder,
538 &mut out,
539 )?;
540 } else {
541 ::fidl_next::WireEnvelope::encode_zero(&mut out)
542 }
543 }
544
545 2 => {
546 if let Some(class_name) = self.class_name.take() {
547 ::fidl_next::WireEnvelope::encode_value(
548 class_name,
549 preallocated.encoder,
550 &mut out,
551 )?;
552 } else {
553 ::fidl_next::WireEnvelope::encode_zero(&mut out)
554 }
555 }
556
557 1 => {
558 if let Some(connector) = self.connector.take() {
559 ::fidl_next::WireEnvelope::encode_value(
560 connector,
561 preallocated.encoder,
562 &mut out,
563 )?;
564 } else {
565 ::fidl_next::WireEnvelope::encode_zero(&mut out)
566 }
567 }
568
569 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
570 }
571 unsafe {
572 preallocated.write_next(out.assume_init_ref());
573 }
574 }
575
576 ::fidl_next::WireTable::encode_len(table, max_ord);
577
578 Ok(())
579 }
580}
581
582impl<'de> ::fidl_next::FromWire<WireDevfsAddArgs<'de>> for DevfsAddArgs {
583 #[inline]
584 fn from_wire(wire: WireDevfsAddArgs<'de>) -> Self {
585 let wire = ::core::mem::ManuallyDrop::new(wire);
586
587 let connector = wire.table.get(1);
588
589 let class_name = wire.table.get(2);
590
591 let inspect = wire.table.get(3);
592
593 let connector_supports = wire.table.get(4);
594
595 let controller_connector = wire.table.get(5);
596
597 Self {
598 connector:
599 connector.map(|envelope| {
600 ::fidl_next::FromWire::from_wire(unsafe {
601 envelope.read_unchecked::<::fidl_next::ClientEnd<
602 crate::Connector,
603 ::fidl_next::fuchsia::WireChannel,
604 >>()
605 })
606 }),
607
608 class_name: class_name.map(|envelope| {
609 ::fidl_next::FromWire::from_wire(unsafe {
610 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
611 })
612 }),
613
614 inspect: inspect.map(|envelope| {
615 ::fidl_next::FromWire::from_wire(unsafe {
616 envelope.read_unchecked::<::fidl_next::fuchsia::WireVmo>()
617 })
618 }),
619
620 connector_supports: connector_supports.map(|envelope| {
621 ::fidl_next::FromWire::from_wire(unsafe {
622 envelope.read_unchecked::<crate::WireConnectionType>()
623 })
624 }),
625
626 controller_connector:
627 controller_connector.map(|envelope| {
628 ::fidl_next::FromWire::from_wire(unsafe {
629 envelope.read_unchecked::<::fidl_next::ClientEnd<
630 crate::Connector,
631 ::fidl_next::fuchsia::WireChannel,
632 >>()
633 })
634 }),
635 }
636 }
637}
638
639#[repr(C)]
641pub struct WireDevfsAddArgs<'de> {
642 table: ::fidl_next::WireTable<'de>,
643}
644
645impl<'de> Drop for WireDevfsAddArgs<'de> {
646 fn drop(&mut self) {
647 let _ = self.table.get(1)
648 .map(|envelope| unsafe {
649 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>>()
650 });
651
652 let _ = self
653 .table
654 .get(2)
655 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
656
657 let _ = self
658 .table
659 .get(3)
660 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::fuchsia::WireVmo>() });
661
662 let _ = self
663 .table
664 .get(4)
665 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConnectionType>() });
666
667 let _ = self.table.get(5)
668 .map(|envelope| unsafe {
669 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>>()
670 });
671 }
672}
673
674unsafe impl ::fidl_next::Wire for WireDevfsAddArgs<'static> {
675 type Decoded<'de> = WireDevfsAddArgs<'de>;
676
677 #[inline]
678 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
679 ::fidl_next::munge!(let Self { table } = out);
680 ::fidl_next::WireTable::zero_padding(table);
681 }
682}
683
684unsafe impl<___D> ::fidl_next::Decode<___D> for WireDevfsAddArgs<'static>
685where
686 ___D: ::fidl_next::Decoder + ?Sized,
687 ___D: ::fidl_next::fuchsia::HandleDecoder,
688{
689 fn decode(
690 slot: ::fidl_next::Slot<'_, Self>,
691 decoder: &mut ___D,
692 ) -> Result<(), ::fidl_next::DecodeError> {
693 ::fidl_next::munge!(let Self { table } = slot);
694
695 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
696 match ordinal {
697 0 => unsafe { ::core::hint::unreachable_unchecked() },
698
699 1 => {
700 ::fidl_next::WireEnvelope::decode_as::<
701 ___D,
702 ::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>,
703 >(slot.as_mut(), decoder)?;
704
705 Ok(())
706 }
707
708 2 => {
709 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
710 slot.as_mut(),
711 decoder,
712 )?;
713
714 let class_name = unsafe {
715 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
716 };
717
718 if class_name.len() > 255 {
719 return Err(::fidl_next::DecodeError::VectorTooLong {
720 size: class_name.len() as u64,
721 limit: 255,
722 });
723 }
724
725 Ok(())
726 }
727
728 3 => {
729 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireVmo>(
730 slot.as_mut(),
731 decoder,
732 )?;
733
734 Ok(())
735 }
736
737 4 => {
738 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConnectionType>(
739 slot.as_mut(),
740 decoder,
741 )?;
742
743 Ok(())
744 }
745
746 5 => {
747 ::fidl_next::WireEnvelope::decode_as::<
748 ___D,
749 ::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>,
750 >(slot.as_mut(), decoder)?;
751
752 Ok(())
753 }
754
755 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
756 }
757 })
758 }
759}
760
761impl<'de> WireDevfsAddArgs<'de> {
762 pub fn connector(
763 &self,
764 ) -> Option<&::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>> {
765 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
766 }
767
768 pub fn class_name(&self) -> Option<&::fidl_next::WireString<'de>> {
769 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
770 }
771
772 pub fn inspect(&self) -> Option<&::fidl_next::fuchsia::WireVmo> {
773 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
774 }
775
776 pub fn connector_supports(&self) -> Option<&crate::WireConnectionType> {
777 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
778 }
779
780 pub fn controller_connector(
781 &self,
782 ) -> Option<&::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>> {
783 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
784 }
785}
786
787impl<'de> ::core::fmt::Debug for WireDevfsAddArgs<'de> {
788 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
789 f.debug_struct("DevfsAddArgs")
790 .field("connector", &self.connector())
791 .field("class_name", &self.class_name())
792 .field("inspect", &self.inspect())
793 .field("connector_supports", &self.connector_supports())
794 .field("controller_connector", &self.controller_connector())
795 .finish()
796 }
797}
798
799#[doc = " Maximum length of a device path\n"]
800pub const MAX_DEVICE_PATH_LEN: u64 = 1024;
801
802#[doc = " Maximum length for a driver path\n"]
803pub const MAX_DRIVER_PATH_LEN: u64 = 1024;
804
805#[derive(Clone, Debug)]
806pub struct TopologicalPathGetTopologicalPathResponse {
807 pub path: String,
808}
809
810impl ::fidl_next::Encodable for TopologicalPathGetTopologicalPathResponse {
811 type Encoded = WireTopologicalPathGetTopologicalPathResponse<'static>;
812}
813
814unsafe impl<___E> ::fidl_next::Encode<___E> for TopologicalPathGetTopologicalPathResponse
815where
816 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
817 ___E: ::fidl_next::Encoder,
818{
819 #[inline]
820 fn encode(
821 self,
822 encoder: &mut ___E,
823 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
824 ) -> Result<(), ::fidl_next::EncodeError> {
825 ::fidl_next::munge! {
826 let Self::Encoded {
827 path,
828
829 } = out;
830 }
831
832 ::fidl_next::Encode::encode(self.path, encoder, path)?;
833
834 Ok(())
835 }
836}
837
838unsafe impl<___E> ::fidl_next::EncodeRef<___E> for TopologicalPathGetTopologicalPathResponse
839where
840 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
841 ___E: ::fidl_next::Encoder,
842{
843 #[inline]
844 fn encode_ref(
845 &self,
846 encoder: &mut ___E,
847 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
848 ) -> Result<(), ::fidl_next::EncodeError> {
849 ::fidl_next::munge! {
850 let Self::Encoded {
851 path,
852
853 } = out;
854 }
855
856 ::fidl_next::EncodeRef::encode_ref(&self.path, encoder, path)?;
857
858 Ok(())
859 }
860}
861
862impl ::fidl_next::EncodableOption for TopologicalPathGetTopologicalPathResponse {
863 type EncodedOption =
864 ::fidl_next::WireBox<'static, WireTopologicalPathGetTopologicalPathResponse<'static>>;
865}
866
867unsafe impl<___E> ::fidl_next::EncodeOption<___E> for TopologicalPathGetTopologicalPathResponse
868where
869 ___E: ::fidl_next::Encoder + ?Sized,
870 TopologicalPathGetTopologicalPathResponse: ::fidl_next::Encode<___E>,
871{
872 #[inline]
873 fn encode_option(
874 this: Option<Self>,
875 encoder: &mut ___E,
876 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
877 ) -> Result<(), ::fidl_next::EncodeError> {
878 if let Some(inner) = this {
879 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
880 ::fidl_next::WireBox::encode_present(out);
881 } else {
882 ::fidl_next::WireBox::encode_absent(out);
883 }
884
885 Ok(())
886 }
887}
888
889unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for TopologicalPathGetTopologicalPathResponse
890where
891 ___E: ::fidl_next::Encoder + ?Sized,
892 TopologicalPathGetTopologicalPathResponse: ::fidl_next::EncodeRef<___E>,
893{
894 #[inline]
895 fn encode_option_ref(
896 this: Option<&Self>,
897 encoder: &mut ___E,
898 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
899 ) -> Result<(), ::fidl_next::EncodeError> {
900 if let Some(inner) = this {
901 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
902 ::fidl_next::WireBox::encode_present(out);
903 } else {
904 ::fidl_next::WireBox::encode_absent(out);
905 }
906
907 Ok(())
908 }
909}
910
911impl<'de> ::fidl_next::FromWire<WireTopologicalPathGetTopologicalPathResponse<'de>>
912 for TopologicalPathGetTopologicalPathResponse
913{
914 #[inline]
915 fn from_wire(wire: WireTopologicalPathGetTopologicalPathResponse<'de>) -> Self {
916 Self { path: ::fidl_next::FromWire::from_wire(wire.path) }
917 }
918}
919
920impl<'de> ::fidl_next::FromWireRef<WireTopologicalPathGetTopologicalPathResponse<'de>>
921 for TopologicalPathGetTopologicalPathResponse
922{
923 #[inline]
924 fn from_wire_ref(wire: &WireTopologicalPathGetTopologicalPathResponse<'de>) -> Self {
925 Self { path: ::fidl_next::FromWireRef::from_wire_ref(&wire.path) }
926 }
927}
928
929#[derive(Debug)]
931#[repr(C)]
932pub struct WireTopologicalPathGetTopologicalPathResponse<'de> {
933 pub path: ::fidl_next::WireString<'de>,
934}
935
936unsafe impl ::fidl_next::Wire for WireTopologicalPathGetTopologicalPathResponse<'static> {
937 type Decoded<'de> = WireTopologicalPathGetTopologicalPathResponse<'de>;
938
939 #[inline]
940 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
941}
942
943unsafe impl<___D> ::fidl_next::Decode<___D>
944 for WireTopologicalPathGetTopologicalPathResponse<'static>
945where
946 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
947 ___D: ::fidl_next::Decoder,
948{
949 fn decode(
950 slot: ::fidl_next::Slot<'_, Self>,
951 decoder: &mut ___D,
952 ) -> Result<(), ::fidl_next::DecodeError> {
953 ::fidl_next::munge! {
954 let Self {
955 mut path,
956
957 } = slot;
958 }
959
960 ::fidl_next::Decode::decode(path.as_mut(), decoder)?;
961
962 let path = unsafe { path.deref_unchecked() };
963
964 if path.len() > 1024 {
965 return Err(::fidl_next::DecodeError::VectorTooLong {
966 size: path.len() as u64,
967 limit: 1024,
968 });
969 }
970
971 Ok(())
972 }
973}
974
975#[derive(Debug)]
977pub struct TopologicalPath;
978
979pub mod topological_path {
980 pub mod prelude {
981 pub use crate::{
982 TopologicalPath, TopologicalPathClientHandler, TopologicalPathServerHandler,
983 topological_path,
984 };
985
986 pub use crate::TopologicalPathGetTopologicalPathResponse;
987 }
988
989 pub struct GetTopologicalPath;
990
991 impl ::fidl_next::Method for GetTopologicalPath {
992 const ORDINAL: u64 = 6266213890697819096;
993
994 type Protocol = crate::TopologicalPath;
995
996 type Request = ();
997
998 type Response = ::fidl_next::WireResult<
999 'static,
1000 crate::WireTopologicalPathGetTopologicalPathResponse<'static>,
1001 ::fidl_next::WireI32,
1002 >;
1003 }
1004
1005 mod ___detail {
1006
1007 unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::TopologicalPath
1008 where
1009 ___T: ::fidl_next::Transport,
1010 {
1011 type ClientSender = TopologicalPathClientSender<___T>;
1012 type ServerSender = TopologicalPathServerSender<___T>;
1013 }
1014
1015 #[repr(transparent)]
1017 pub struct TopologicalPathClientSender<___T: ::fidl_next::Transport> {
1018 #[allow(dead_code)]
1019 sender: ::fidl_next::protocol::ClientSender<___T>,
1020 }
1021
1022 impl<___T> TopologicalPathClientSender<___T>
1023 where
1024 ___T: ::fidl_next::Transport,
1025 {
1026 #[doc = " Return the topological path for this device\n"]
1027 pub fn get_topological_path(
1028 &self,
1029 ) -> ::fidl_next::TwoWayFuture<'_, super::GetTopologicalPath, ___T> {
1030 ::fidl_next::TwoWayFuture::from_untyped(
1031 self.sender.send_two_way(6266213890697819096, ()),
1032 )
1033 }
1034 }
1035
1036 #[repr(transparent)]
1038 pub struct TopologicalPathServerSender<___T: ::fidl_next::Transport> {
1039 sender: ::fidl_next::protocol::ServerSender<___T>,
1040 }
1041
1042 impl<___T> TopologicalPathServerSender<___T> where ___T: ::fidl_next::Transport {}
1043 }
1044}
1045
1046pub trait TopologicalPathClientHandler<
1050 #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
1051 #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1052>
1053{
1054}
1055
1056impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for TopologicalPath
1057where
1058 ___H: TopologicalPathClientHandler<___T> + ::core::marker::Send,
1059 ___T: ::fidl_next::Transport,
1060 <topological_path::GetTopologicalPath as ::fidl_next::Method>::Response:
1061 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1062{
1063 async fn on_event(
1064 handler: &mut ___H,
1065 sender: &::fidl_next::ClientSender<Self, ___T>,
1066 ordinal: u64,
1067 buffer: ___T::RecvBuffer,
1068 ) {
1069 match ordinal {
1070 ordinal => sender.close(),
1071 }
1072 }
1073}
1074
1075pub trait TopologicalPathServerHandler<
1079 #[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
1080 #[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1081>
1082{
1083 #[doc = " Return the topological path for this device\n"]
1084 fn get_topological_path(
1085 &mut self,
1086 sender: &::fidl_next::ServerSender<TopologicalPath, ___T>,
1087
1088 responder: ::fidl_next::Responder<topological_path::GetTopologicalPath>,
1089 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1090}
1091
1092impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for TopologicalPath
1093where
1094 ___H: TopologicalPathServerHandler<___T> + ::core::marker::Send,
1095 ___T: ::fidl_next::Transport,
1096{
1097 async fn on_one_way(
1098 handler: &mut ___H,
1099 sender: &::fidl_next::ServerSender<Self, ___T>,
1100 ordinal: u64,
1101 buffer: ___T::RecvBuffer,
1102 ) {
1103 match ordinal {
1104 ordinal => sender.close(),
1105 }
1106 }
1107
1108 async fn on_two_way(
1109 handler: &mut ___H,
1110 sender: &::fidl_next::ServerSender<Self, ___T>,
1111 ordinal: u64,
1112 buffer: ___T::RecvBuffer,
1113 responder: ::fidl_next::protocol::Responder,
1114 ) {
1115 match ordinal {
1116 6266213890697819096 => {
1117 let responder = ::fidl_next::Responder::from_untyped(responder);
1118
1119 handler.get_topological_path(sender, responder).await;
1120 }
1121
1122 ordinal => sender.close(),
1123 }
1124 }
1125}
1126
1127pub mod compat {
1129
1130 impl ::fidl_next::CompatFrom<crate::ConnectionType> for ::fidl_fuchsia_device_fs::ConnectionType {
1131 fn compat_from(value: crate::ConnectionType) -> Self {
1132 Self::from_bits_retain(value.bits())
1133 }
1134 }
1135
1136 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::ConnectionType> for crate::ConnectionType {
1137 fn compat_from(value: ::fidl_fuchsia_device_fs::ConnectionType) -> Self {
1138 Self::from_bits_retain(value.bits())
1139 }
1140 }
1141
1142 impl ::fidl_next::CompatFrom<crate::ConnectorConnectRequest>
1143 for ::fidl_fuchsia_device_fs::ConnectorConnectRequest
1144 {
1145 #[inline]
1146 fn compat_from(value: crate::ConnectorConnectRequest) -> Self {
1147 Self { server: ::fidl_next::CompatFrom::compat_from(value.server) }
1148 }
1149 }
1150
1151 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::ConnectorConnectRequest>
1152 for crate::ConnectorConnectRequest
1153 {
1154 #[inline]
1155 fn compat_from(value: ::fidl_fuchsia_device_fs::ConnectorConnectRequest) -> Self {
1156 Self { server: ::fidl_next::CompatFrom::compat_from(value.server) }
1157 }
1158 }
1159
1160 #[cfg(target_os = "fuchsia")]
1161 pub type ConnectorProxy = ::fidl_next::ClientSender<crate::Connector>;
1164
1165 impl ::fidl_next::CompatFrom<crate::Connector> for ::fidl_fuchsia_device_fs::ConnectorMarker {
1166 fn compat_from(_: crate::Connector) -> Self {
1167 Self
1168 }
1169 }
1170
1171 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::ConnectorMarker> for crate::Connector {
1172 fn compat_from(_: ::fidl_fuchsia_device_fs::ConnectorMarker) -> Self {
1173 Self
1174 }
1175 }
1176
1177 #[cfg(target_os = "fuchsia")]
1178
1179 impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_device_fs::ConnectorProxy> for crate::Connector {
1180 fn client_compat_from(
1181 proxy: ::fidl_fuchsia_device_fs::ConnectorProxy,
1182 ) -> ::fidl_next::Client<Self, ::fidl_next::fuchsia::zx::Channel> {
1183 let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
1184 let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
1185 ::fidl_next::Client::new(client_end)
1186 }
1187 }
1188
1189 impl ::fidl_next::CompatFrom<crate::DevfsAddArgs> for ::fidl_fuchsia_device_fs::DevfsAddArgs {
1190 fn compat_from(value: crate::DevfsAddArgs) -> Self {
1191 Self {
1192 connector: ::fidl_next::CompatFrom::compat_from(value.connector),
1193
1194 class_name: ::fidl_next::CompatFrom::compat_from(value.class_name),
1195
1196 inspect: ::fidl_next::CompatFrom::compat_from(value.inspect),
1197
1198 connector_supports: ::fidl_next::CompatFrom::compat_from(value.connector_supports),
1199
1200 controller_connector: ::fidl_next::CompatFrom::compat_from(
1201 value.controller_connector,
1202 ),
1203
1204 __source_breaking: ::fidl::marker::SourceBreaking,
1205 }
1206 }
1207 }
1208
1209 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::DevfsAddArgs> for crate::DevfsAddArgs {
1210 fn compat_from(value: ::fidl_fuchsia_device_fs::DevfsAddArgs) -> Self {
1211 Self {
1212 connector: ::fidl_next::CompatFrom::compat_from(value.connector),
1213
1214 class_name: ::fidl_next::CompatFrom::compat_from(value.class_name),
1215
1216 inspect: ::fidl_next::CompatFrom::compat_from(value.inspect),
1217
1218 connector_supports: ::fidl_next::CompatFrom::compat_from(value.connector_supports),
1219
1220 controller_connector: ::fidl_next::CompatFrom::compat_from(
1221 value.controller_connector,
1222 ),
1223 }
1224 }
1225 }
1226
1227 impl ::fidl_next::CompatFrom<crate::TopologicalPathGetTopologicalPathResponse>
1228 for ::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse
1229 {
1230 #[inline]
1231 fn compat_from(value: crate::TopologicalPathGetTopologicalPathResponse) -> Self {
1232 Self { path: ::fidl_next::CompatFrom::compat_from(value.path) }
1233 }
1234 }
1235
1236 impl
1237 ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse>
1238 for crate::TopologicalPathGetTopologicalPathResponse
1239 {
1240 #[inline]
1241 fn compat_from(
1242 value: ::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse,
1243 ) -> Self {
1244 Self { path: ::fidl_next::CompatFrom::compat_from(value.path) }
1245 }
1246 }
1247
1248 #[cfg(target_os = "fuchsia")]
1249 pub type TopologicalPathProxy = ::fidl_next::ClientSender<crate::TopologicalPath>;
1252
1253 impl ::fidl_next::CompatFrom<crate::TopologicalPath>
1254 for ::fidl_fuchsia_device_fs::TopologicalPathMarker
1255 {
1256 fn compat_from(_: crate::TopologicalPath) -> Self {
1257 Self
1258 }
1259 }
1260
1261 impl ::fidl_next::CompatFrom<::fidl_fuchsia_device_fs::TopologicalPathMarker>
1262 for crate::TopologicalPath
1263 {
1264 fn compat_from(_: ::fidl_fuchsia_device_fs::TopologicalPathMarker) -> Self {
1265 Self
1266 }
1267 }
1268
1269 #[cfg(target_os = "fuchsia")]
1270
1271 impl ::fidl_next::ClientCompatFrom<::fidl_fuchsia_device_fs::TopologicalPathProxy>
1272 for crate::TopologicalPath
1273 {
1274 fn client_compat_from(
1275 proxy: ::fidl_fuchsia_device_fs::TopologicalPathProxy,
1276 ) -> ::fidl_next::Client<Self, ::fidl_next::fuchsia::zx::Channel> {
1277 let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
1278 let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
1279 ::fidl_next::Client::new(client_end)
1280 }
1281 }
1282}