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