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