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::Handle,
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 && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::Encodable>::COPY_OPTIMIZATION
120 .is_enabled(),
121 )
122 };
123
124 type Encoded = WireConnectorConnectRequest;
125}
126
127unsafe impl<___E> ::fidl_next::Encode<___E> for ConnectorConnectRequest
128where
129 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
130
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::Handle as ::fidl_next::FromWire<
182 ::fidl_next::fuchsia::WireHandle,
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::WireHandle,
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
212 ___D: ::fidl_next::fuchsia::HandleDecoder,
213{
214 fn decode(
215 slot: ::fidl_next::Slot<'_, Self>,
216 decoder: &mut ___D,
217 ) -> Result<(), ::fidl_next::DecodeError> {
218 ::fidl_next::munge! {
219 let Self {
220 mut server,
221
222 } = slot;
223 }
224
225 ::fidl_next::Decode::decode(server.as_mut(), decoder)?;
226
227 Ok(())
228 }
229}
230
231#[doc = " A connector lets a client forward the server end of a protocol.\n"]
233#[derive(Debug)]
234pub struct Connector;
235
236pub mod connector {
237 pub mod prelude {
238 pub use crate::{connector, Connector, ConnectorClientHandler, ConnectorServerHandler};
239
240 pub use crate::ConnectorConnectRequest;
241 }
242
243 pub struct Connect;
244
245 impl ::fidl_next::Method for Connect {
246 const ORDINAL: u64 = 3169778387179902201;
247
248 type Protocol = crate::Connector;
249
250 type Request = crate::WireConnectorConnectRequest;
251
252 type Response = ::fidl_next::Never;
253 }
254
255 mod ___detail {
256
257 pub struct Connect<T0> {
258 server: T0,
259 }
260
261 impl<T0> ::fidl_next::Encodable for Connect<T0>
262 where
263 T0: ::fidl_next::Encodable<Encoded = ::fidl_next::fuchsia::WireHandle>,
264 {
265 type Encoded = crate::WireConnectorConnectRequest;
266 }
267
268 unsafe impl<___E, T0> ::fidl_next::Encode<___E> for Connect<T0>
269 where
270 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
271
272 ___E: ::fidl_next::fuchsia::HandleEncoder,
273
274 T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::fuchsia::WireHandle>,
275 {
276 #[inline]
277 fn encode(
278 self,
279 encoder: &mut ___E,
280 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
281 ) -> Result<(), ::fidl_next::EncodeError> {
282 ::fidl_next::munge! {
283 let Self::Encoded {
284 server,
285
286 } = out;
287 }
288
289 ::fidl_next::Encode::encode(self.server, encoder, server)?;
290
291 Ok(())
292 }
293 }
294
295 unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::Connector
296 where
297 ___T: ::fidl_next::Transport,
298 {
299 type ClientSender = ConnectorClientSender<___T>;
300 type ServerSender = ConnectorServerSender<___T>;
301 }
302
303 pub struct ConnectorClientSender<___T: ::fidl_next::Transport> {
305 #[allow(dead_code)]
306 sender: ::fidl_next::protocol::ClientSender<___T>,
307 }
308
309 impl<___T> ConnectorClientSender<___T>
310 where
311 ___T: ::fidl_next::Transport,
312 {
313 #[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"]
314 pub fn connect(
315 &self,
316
317 server: impl ::fidl_next::Encode<
318 <___T as ::fidl_next::Transport>::SendBuffer,
319 Encoded = ::fidl_next::fuchsia::WireHandle,
320 >,
321 ) -> Result<::fidl_next::SendFuture<'_, ___T>, ::fidl_next::EncodeError>
322 where
323 <___T as ::fidl_next::Transport>::SendBuffer:
324 ::fidl_next::encoder::InternalHandleEncoder,
325
326 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
327 {
328 self.connect_with(Connect { server })
329 }
330
331 #[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"]
332 pub fn connect_with<___R>(
333 &self,
334 request: ___R,
335 ) -> Result<::fidl_next::SendFuture<'_, ___T>, ::fidl_next::EncodeError>
336 where
337 ___R: ::fidl_next::Encode<
338 <___T as ::fidl_next::Transport>::SendBuffer,
339 Encoded = crate::WireConnectorConnectRequest,
340 >,
341 {
342 self.sender.send_one_way(3169778387179902201, request)
343 }
344 }
345
346 #[repr(transparent)]
348 pub struct ConnectorServerSender<___T: ::fidl_next::Transport> {
349 sender: ::fidl_next::protocol::ServerSender<___T>,
350 }
351
352 impl<___T> ConnectorServerSender<___T> where ___T: ::fidl_next::Transport {}
353 }
354}
355
356pub trait ConnectorClientHandler<___T: ::fidl_next::Transport> {}
360
361impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for Connector
362where
363 ___H: ConnectorClientHandler<___T> + Send,
364 ___T: ::fidl_next::Transport,
365{
366 async fn on_event(
367 handler: &mut ___H,
368 sender: &::fidl_next::ClientSender<Self, ___T>,
369 ordinal: u64,
370 buffer: ___T::RecvBuffer,
371 ) {
372 match ordinal {
373 ordinal => {
374 sender.close();
375 }
376 }
377 }
378}
379
380pub trait ConnectorServerHandler<___T: ::fidl_next::Transport> {
384 #[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"]
385 fn connect(
386 &mut self,
387 sender: &::fidl_next::ServerSender<Connector, ___T>,
388
389 request: ::fidl_next::Request<connector::Connect, ___T>,
390 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
391}
392
393impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for Connector
394where
395 ___H: ConnectorServerHandler<___T> + Send,
396 ___T: ::fidl_next::Transport,
397
398 <connector::Connect as ::fidl_next::Method>::Request:
399 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
400{
401 async fn on_one_way(
402 handler: &mut ___H,
403 sender: &::fidl_next::ServerSender<Self, ___T>,
404 ordinal: u64,
405 buffer: ___T::RecvBuffer,
406 ) {
407 match ordinal {
408 3169778387179902201 => match ::fidl_next::DecoderExt::decode(buffer) {
409 Ok(decoded) => handler.connect(sender, decoded).await,
410 Err(e) => {
411 sender.close();
412 }
413 },
414
415 ordinal => {
416 sender.close();
417 }
418 }
419 }
420
421 async fn on_two_way(
422 handler: &mut ___H,
423 sender: &::fidl_next::ServerSender<Self, ___T>,
424 ordinal: u64,
425 buffer: ___T::RecvBuffer,
426 responder: ::fidl_next::protocol::Responder,
427 ) {
428 match ordinal {
429 ordinal => {
430 sender.close();
431 }
432 }
433 }
434}
435
436#[doc = " This name is reserved for accessing the fuchsia.device/Controller protocol\n within /dev/. No devices can be created with this name.\n"]
437pub const DEVICE_CONTROLLER_NAME: &str = "device_controller";
438
439#[doc = " This name is reserved for accessing the device specific protocol\n within /dev/. No devices can be created with this name.\n"]
440pub const DEVICE_PROTOCOL_NAME: &str = "device_protocol";
441
442#[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"]
443pub const DEVICE_TOPOLOGY_NAME: &str = "device_topology";
444
445#[derive(Debug, Default)]
446pub struct DevfsAddArgs {
447 pub connector:
448 Option<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::zx::Channel>>,
449
450 pub class_name: Option<String>,
451
452 pub inspect: Option<::fidl_next::fuchsia::zx::Handle>,
453
454 pub connector_supports: Option<crate::ConnectionType>,
455
456 pub controller_connector:
457 Option<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::zx::Channel>>,
458}
459
460impl DevfsAddArgs {
461 fn __max_ordinal(&self) -> usize {
462 if self.controller_connector.is_some() {
463 return 5;
464 }
465
466 if self.connector_supports.is_some() {
467 return 4;
468 }
469
470 if self.inspect.is_some() {
471 return 3;
472 }
473
474 if self.class_name.is_some() {
475 return 2;
476 }
477
478 if self.connector.is_some() {
479 return 1;
480 }
481
482 0
483 }
484}
485
486impl ::fidl_next::Encodable for DevfsAddArgs {
487 type Encoded = WireDevfsAddArgs<'static>;
488}
489
490unsafe impl<___E> ::fidl_next::Encode<___E> for DevfsAddArgs
491where
492 ___E: ::fidl_next::Encoder + ?Sized,
493
494 ___E: ::fidl_next::fuchsia::HandleEncoder,
495{
496 #[inline]
497 fn encode(
498 mut self,
499 encoder: &mut ___E,
500 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
501 ) -> Result<(), ::fidl_next::EncodeError> {
502 ::fidl_next::munge!(let WireDevfsAddArgs { table } = out);
503
504 let max_ord = self.__max_ordinal();
505
506 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
507 ::fidl_next::Wire::zero_padding(&mut out);
508
509 let mut preallocated =
510 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
511
512 for i in 1..=max_ord {
513 match i {
514 5 => {
515 if let Some(controller_connector) = self.controller_connector.take() {
516 ::fidl_next::WireEnvelope::encode_value(
517 controller_connector,
518 preallocated.encoder,
519 &mut out,
520 )?;
521 } else {
522 ::fidl_next::WireEnvelope::encode_zero(&mut out)
523 }
524 }
525
526 4 => {
527 if let Some(connector_supports) = self.connector_supports.take() {
528 ::fidl_next::WireEnvelope::encode_value(
529 connector_supports,
530 preallocated.encoder,
531 &mut out,
532 )?;
533 } else {
534 ::fidl_next::WireEnvelope::encode_zero(&mut out)
535 }
536 }
537
538 3 => {
539 if let Some(inspect) = self.inspect.take() {
540 ::fidl_next::WireEnvelope::encode_value(
541 inspect,
542 preallocated.encoder,
543 &mut out,
544 )?;
545 } else {
546 ::fidl_next::WireEnvelope::encode_zero(&mut out)
547 }
548 }
549
550 2 => {
551 if let Some(class_name) = self.class_name.take() {
552 ::fidl_next::WireEnvelope::encode_value(
553 class_name,
554 preallocated.encoder,
555 &mut out,
556 )?;
557 } else {
558 ::fidl_next::WireEnvelope::encode_zero(&mut out)
559 }
560 }
561
562 1 => {
563 if let Some(connector) = self.connector.take() {
564 ::fidl_next::WireEnvelope::encode_value(
565 connector,
566 preallocated.encoder,
567 &mut out,
568 )?;
569 } else {
570 ::fidl_next::WireEnvelope::encode_zero(&mut out)
571 }
572 }
573
574 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
575 }
576 unsafe {
577 preallocated.write_next(out.assume_init_ref());
578 }
579 }
580
581 ::fidl_next::WireTable::encode_len(table, max_ord);
582
583 Ok(())
584 }
585}
586
587impl<'de> ::fidl_next::FromWire<WireDevfsAddArgs<'de>> for DevfsAddArgs {
588 #[inline]
589 fn from_wire(wire: WireDevfsAddArgs<'de>) -> Self {
590 let wire = ::core::mem::ManuallyDrop::new(wire);
591
592 let connector = wire.table.get(1);
593
594 let class_name = wire.table.get(2);
595
596 let inspect = wire.table.get(3);
597
598 let connector_supports = wire.table.get(4);
599
600 let controller_connector = wire.table.get(5);
601
602 Self {
603 connector:
604 connector.map(|envelope| {
605 ::fidl_next::FromWire::from_wire(unsafe {
606 envelope.read_unchecked::<::fidl_next::ClientEnd<
607 crate::Connector,
608 ::fidl_next::fuchsia::WireChannel,
609 >>()
610 })
611 }),
612
613 class_name: class_name.map(|envelope| {
614 ::fidl_next::FromWire::from_wire(unsafe {
615 envelope.read_unchecked::<::fidl_next::WireString<'de>>()
616 })
617 }),
618
619 inspect: inspect.map(|envelope| {
620 ::fidl_next::FromWire::from_wire(unsafe {
621 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
622 })
623 }),
624
625 connector_supports: connector_supports.map(|envelope| {
626 ::fidl_next::FromWire::from_wire(unsafe {
627 envelope.read_unchecked::<crate::WireConnectionType>()
628 })
629 }),
630
631 controller_connector:
632 controller_connector.map(|envelope| {
633 ::fidl_next::FromWire::from_wire(unsafe {
634 envelope.read_unchecked::<::fidl_next::ClientEnd<
635 crate::Connector,
636 ::fidl_next::fuchsia::WireChannel,
637 >>()
638 })
639 }),
640 }
641 }
642}
643
644#[repr(C)]
646pub struct WireDevfsAddArgs<'de> {
647 table: ::fidl_next::WireTable<'de>,
648}
649
650impl<'de> Drop for WireDevfsAddArgs<'de> {
651 fn drop(&mut self) {
652 let _ = self.table.get(1)
653 .map(|envelope| unsafe {
654 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>>()
655 });
656
657 let _ = self
658 .table
659 .get(2)
660 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::WireString<'de>>() });
661
662 let _ = self.table.get(3).map(|envelope| unsafe {
663 envelope.read_unchecked::<::fidl_next::fuchsia::WireHandle>()
664 });
665
666 let _ = self
667 .table
668 .get(4)
669 .map(|envelope| unsafe { envelope.read_unchecked::<crate::WireConnectionType>() });
670
671 let _ = self.table.get(5)
672 .map(|envelope| unsafe {
673 envelope.read_unchecked::<::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>>()
674 });
675 }
676}
677
678unsafe impl ::fidl_next::Wire for WireDevfsAddArgs<'static> {
679 type Decoded<'de> = WireDevfsAddArgs<'de>;
680
681 #[inline]
682 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
683 ::fidl_next::munge!(let Self { table } = out);
684 ::fidl_next::WireTable::zero_padding(table);
685 }
686}
687
688unsafe impl<___D> ::fidl_next::Decode<___D> for WireDevfsAddArgs<'static>
689where
690 ___D: ::fidl_next::Decoder + ?Sized,
691
692 ___D: ::fidl_next::fuchsia::HandleDecoder,
693{
694 fn decode(
695 slot: ::fidl_next::Slot<'_, Self>,
696 decoder: &mut ___D,
697 ) -> Result<(), ::fidl_next::DecodeError> {
698 ::fidl_next::munge!(let Self { table } = slot);
699
700 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
701 match ordinal {
702 0 => unsafe { ::core::hint::unreachable_unchecked() },
703
704 1 => {
705 ::fidl_next::WireEnvelope::decode_as::<
706 ___D,
707 ::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>,
708 >(slot.as_mut(), decoder)?;
709
710 Ok(())
711 }
712
713 2 => {
714 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString<'static>>(
715 slot.as_mut(),
716 decoder,
717 )?;
718
719 let class_name = unsafe {
720 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString<'_>>()
721 };
722
723 if class_name.len() > 255 {
724 return Err(::fidl_next::DecodeError::VectorTooLong {
725 size: class_name.len() as u64,
726 limit: 255,
727 });
728 }
729
730 Ok(())
731 }
732
733 3 => {
734 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
735 slot.as_mut(),
736 decoder,
737 )?;
738
739 Ok(())
740 }
741
742 4 => {
743 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConnectionType>(
744 slot.as_mut(),
745 decoder,
746 )?;
747
748 Ok(())
749 }
750
751 5 => {
752 ::fidl_next::WireEnvelope::decode_as::<
753 ___D,
754 ::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>,
755 >(slot.as_mut(), decoder)?;
756
757 Ok(())
758 }
759
760 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
761 }
762 })
763 }
764}
765
766impl<'de> WireDevfsAddArgs<'de> {
767 pub fn connector(
768 &self,
769 ) -> Option<&::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>> {
770 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
771 }
772
773 pub fn class_name(&self) -> Option<&::fidl_next::WireString<'de>> {
774 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
775 }
776
777 pub fn inspect(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
778 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
779 }
780
781 pub fn connector_supports(&self) -> Option<&crate::WireConnectionType> {
782 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
783 }
784
785 pub fn controller_connector(
786 &self,
787 ) -> Option<&::fidl_next::ClientEnd<crate::Connector, ::fidl_next::fuchsia::WireChannel>> {
788 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
789 }
790}
791
792impl<'de> ::core::fmt::Debug for WireDevfsAddArgs<'de> {
793 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
794 f.debug_struct("DevfsAddArgs")
795 .field("connector", &self.connector())
796 .field("class_name", &self.class_name())
797 .field("inspect", &self.inspect())
798 .field("connector_supports", &self.connector_supports())
799 .field("controller_connector", &self.controller_connector())
800 .finish()
801 }
802}
803
804#[doc = " Maximum length of a device path\n"]
805pub const MAX_DEVICE_PATH_LEN: u64 = 1024;
806
807#[doc = " Maximum length for a driver path\n"]
808pub const MAX_DRIVER_PATH_LEN: u64 = 1024;
809
810#[derive(Clone, Debug)]
811pub struct TopologicalPathGetTopologicalPathResponse {
812 pub path: String,
813}
814
815impl ::fidl_next::Encodable for TopologicalPathGetTopologicalPathResponse {
816 type Encoded = WireTopologicalPathGetTopologicalPathResponse<'static>;
817}
818
819unsafe impl<___E> ::fidl_next::Encode<___E> for TopologicalPathGetTopologicalPathResponse
820where
821 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
822
823 ___E: ::fidl_next::Encoder,
824{
825 #[inline]
826 fn encode(
827 self,
828 encoder: &mut ___E,
829 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
830 ) -> Result<(), ::fidl_next::EncodeError> {
831 ::fidl_next::munge! {
832 let Self::Encoded {
833 path,
834
835 } = out;
836 }
837
838 ::fidl_next::Encode::encode(self.path, encoder, path)?;
839
840 Ok(())
841 }
842}
843
844unsafe impl<___E> ::fidl_next::EncodeRef<___E> for TopologicalPathGetTopologicalPathResponse
845where
846 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
847
848 ___E: ::fidl_next::Encoder,
849{
850 #[inline]
851 fn encode_ref(
852 &self,
853 encoder: &mut ___E,
854 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
855 ) -> Result<(), ::fidl_next::EncodeError> {
856 ::fidl_next::munge! {
857 let Self::Encoded {
858 path,
859
860 } = out;
861 }
862
863 ::fidl_next::EncodeRef::encode_ref(&self.path, encoder, path)?;
864
865 Ok(())
866 }
867}
868
869impl ::fidl_next::EncodableOption for TopologicalPathGetTopologicalPathResponse {
870 type EncodedOption =
871 ::fidl_next::WireBox<'static, WireTopologicalPathGetTopologicalPathResponse<'static>>;
872}
873
874unsafe impl<___E> ::fidl_next::EncodeOption<___E> for TopologicalPathGetTopologicalPathResponse
875where
876 ___E: ::fidl_next::Encoder + ?Sized,
877 TopologicalPathGetTopologicalPathResponse: ::fidl_next::Encode<___E>,
878{
879 #[inline]
880 fn encode_option(
881 this: Option<Self>,
882 encoder: &mut ___E,
883 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
884 ) -> Result<(), ::fidl_next::EncodeError> {
885 if let Some(inner) = this {
886 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
887 ::fidl_next::WireBox::encode_present(out);
888 } else {
889 ::fidl_next::WireBox::encode_absent(out);
890 }
891
892 Ok(())
893 }
894}
895
896unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for TopologicalPathGetTopologicalPathResponse
897where
898 ___E: ::fidl_next::Encoder + ?Sized,
899 TopologicalPathGetTopologicalPathResponse: ::fidl_next::EncodeRef<___E>,
900{
901 #[inline]
902 fn encode_option_ref(
903 this: Option<&Self>,
904 encoder: &mut ___E,
905 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
906 ) -> Result<(), ::fidl_next::EncodeError> {
907 if let Some(inner) = this {
908 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
909 ::fidl_next::WireBox::encode_present(out);
910 } else {
911 ::fidl_next::WireBox::encode_absent(out);
912 }
913
914 Ok(())
915 }
916}
917
918impl<'de> ::fidl_next::FromWire<WireTopologicalPathGetTopologicalPathResponse<'de>>
919 for TopologicalPathGetTopologicalPathResponse
920{
921 #[inline]
922 fn from_wire(wire: WireTopologicalPathGetTopologicalPathResponse<'de>) -> Self {
923 Self { path: ::fidl_next::FromWire::from_wire(wire.path) }
924 }
925}
926
927impl<'de> ::fidl_next::FromWireRef<WireTopologicalPathGetTopologicalPathResponse<'de>>
928 for TopologicalPathGetTopologicalPathResponse
929{
930 #[inline]
931 fn from_wire_ref(wire: &WireTopologicalPathGetTopologicalPathResponse<'de>) -> Self {
932 Self { path: ::fidl_next::FromWireRef::from_wire_ref(&wire.path) }
933 }
934}
935
936#[derive(Debug)]
938#[repr(C)]
939pub struct WireTopologicalPathGetTopologicalPathResponse<'de> {
940 pub path: ::fidl_next::WireString<'de>,
941}
942
943unsafe impl ::fidl_next::Wire for WireTopologicalPathGetTopologicalPathResponse<'static> {
944 type Decoded<'de> = WireTopologicalPathGetTopologicalPathResponse<'de>;
945
946 #[inline]
947 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
948}
949
950unsafe impl<___D> ::fidl_next::Decode<___D>
951 for WireTopologicalPathGetTopologicalPathResponse<'static>
952where
953 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
954
955 ___D: ::fidl_next::Decoder,
956{
957 fn decode(
958 slot: ::fidl_next::Slot<'_, Self>,
959 decoder: &mut ___D,
960 ) -> Result<(), ::fidl_next::DecodeError> {
961 ::fidl_next::munge! {
962 let Self {
963 mut path,
964
965 } = slot;
966 }
967
968 ::fidl_next::Decode::decode(path.as_mut(), decoder)?;
969
970 let path = unsafe { path.deref_unchecked() };
971
972 if path.len() > 1024 {
973 return Err(::fidl_next::DecodeError::VectorTooLong {
974 size: path.len() as u64,
975 limit: 1024,
976 });
977 }
978
979 Ok(())
980 }
981}
982
983#[derive(Debug)]
985pub struct TopologicalPath;
986
987pub mod topological_path {
988 pub mod prelude {
989 pub use crate::{
990 topological_path, TopologicalPath, TopologicalPathClientHandler,
991 TopologicalPathServerHandler,
992 };
993
994 pub use crate::TopologicalPathGetTopologicalPathResponse;
995 }
996
997 pub struct GetTopologicalPath;
998
999 impl ::fidl_next::Method for GetTopologicalPath {
1000 const ORDINAL: u64 = 6266213890697819096;
1001
1002 type Protocol = crate::TopologicalPath;
1003
1004 type Request = ();
1005
1006 type Response = ::fidl_next::WireResult<
1007 'static,
1008 crate::WireTopologicalPathGetTopologicalPathResponse<'static>,
1009 ::fidl_next::WireI32,
1010 >;
1011 }
1012
1013 mod ___detail {
1014
1015 unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::TopologicalPath
1016 where
1017 ___T: ::fidl_next::Transport,
1018 {
1019 type ClientSender = TopologicalPathClientSender<___T>;
1020 type ServerSender = TopologicalPathServerSender<___T>;
1021 }
1022
1023 pub struct TopologicalPathClientSender<___T: ::fidl_next::Transport> {
1025 #[allow(dead_code)]
1026 sender: ::fidl_next::protocol::ClientSender<___T>,
1027 }
1028
1029 impl<___T> TopologicalPathClientSender<___T>
1030 where
1031 ___T: ::fidl_next::Transport,
1032 {
1033 #[doc = " Return the topological path for this device\n"]
1034 pub fn get_topological_path(
1035 &self,
1036 ) -> Result<
1037 ::fidl_next::ResponseFuture<'_, super::GetTopologicalPath, ___T>,
1038 ::fidl_next::EncodeError,
1039 > {
1040 self.sender
1041 .send_two_way(6266213890697819096, ())
1042 .map(::fidl_next::ResponseFuture::from_untyped)
1043 }
1044 }
1045
1046 #[repr(transparent)]
1048 pub struct TopologicalPathServerSender<___T: ::fidl_next::Transport> {
1049 sender: ::fidl_next::protocol::ServerSender<___T>,
1050 }
1051
1052 impl<___T> TopologicalPathServerSender<___T> where ___T: ::fidl_next::Transport {}
1053 }
1054}
1055
1056pub trait TopologicalPathClientHandler<___T: ::fidl_next::Transport> {}
1060
1061impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for TopologicalPath
1062where
1063 ___H: TopologicalPathClientHandler<___T> + Send,
1064 ___T: ::fidl_next::Transport,
1065
1066 <topological_path::GetTopologicalPath as ::fidl_next::Method>::Response:
1067 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1068{
1069 async fn on_event(
1070 handler: &mut ___H,
1071 sender: &::fidl_next::ClientSender<Self, ___T>,
1072 ordinal: u64,
1073 buffer: ___T::RecvBuffer,
1074 ) {
1075 match ordinal {
1076 ordinal => {
1077 sender.close();
1078 }
1079 }
1080 }
1081}
1082
1083pub trait TopologicalPathServerHandler<___T: ::fidl_next::Transport> {
1087 #[doc = " Return the topological path for this device\n"]
1088 fn get_topological_path(
1089 &mut self,
1090 sender: &::fidl_next::ServerSender<TopologicalPath, ___T>,
1091
1092 responder: ::fidl_next::Responder<topological_path::GetTopologicalPath>,
1093 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1094}
1095
1096impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for TopologicalPath
1097where
1098 ___H: TopologicalPathServerHandler<___T> + Send,
1099 ___T: ::fidl_next::Transport,
1100{
1101 async fn on_one_way(
1102 handler: &mut ___H,
1103 sender: &::fidl_next::ServerSender<Self, ___T>,
1104 ordinal: u64,
1105 buffer: ___T::RecvBuffer,
1106 ) {
1107 match ordinal {
1108 ordinal => {
1109 sender.close();
1110 }
1111 }
1112 }
1113
1114 async fn on_two_way(
1115 handler: &mut ___H,
1116 sender: &::fidl_next::ServerSender<Self, ___T>,
1117 ordinal: u64,
1118 buffer: ___T::RecvBuffer,
1119 responder: ::fidl_next::protocol::Responder,
1120 ) {
1121 match ordinal {
1122 6266213890697819096 => {
1123 let responder = ::fidl_next::Responder::from_untyped(responder);
1124
1125 handler.get_topological_path(sender, responder).await;
1126 }
1127
1128 ordinal => {
1129 sender.close();
1130 }
1131 }
1132 }
1133}
1134
1135pub mod compat {
1137
1138 impl ::core::convert::From<crate::ConnectionType> for ::fidl_fuchsia_device_fs::ConnectionType {
1139 #[inline]
1140 fn from(from: crate::ConnectionType) -> Self {
1141 Self::from_bits_retain(from.bits())
1142 }
1143 }
1144
1145 #[cfg(target_os = "fuchsia")]
1146 pub type ConnectorProxy =
1149 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Connector>;
1150
1151 impl ::core::convert::From<crate::Connector> for ::fidl_fuchsia_device_fs::ConnectorMarker {
1152 #[inline]
1153 fn from(_: crate::Connector) -> Self {
1154 Self
1155 }
1156 }
1157
1158 #[cfg(target_os = "fuchsia")]
1159 pub type TopologicalPathProxy =
1162 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::TopologicalPath>;
1163
1164 impl ::core::convert::From<crate::TopologicalPath>
1165 for ::fidl_fuchsia_device_fs::TopologicalPathMarker
1166 {
1167 #[inline]
1168 fn from(_: crate::TopologicalPath) -> Self {
1169 Self
1170 }
1171 }
1172}