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::TakeFrom<WireConnectionType> for ConnectionType {
63 #[inline]
64 fn take_from(from: &WireConnectionType) -> Self {
65 Self::from(*from)
66 }
67}
68
69#[derive(Clone, Copy, Debug)]
71#[repr(transparent)]
72pub struct WireConnectionType {
73 value: u8,
74}
75
76unsafe impl ::fidl_next::ZeroPadding for WireConnectionType {
77 #[inline]
78 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
79 }
81}
82
83unsafe impl<___D> ::fidl_next::Decode<___D> for WireConnectionType
84where
85 ___D: ?Sized,
86{
87 fn decode(
88 slot: ::fidl_next::Slot<'_, Self>,
89 _: &mut ___D,
90 ) -> Result<(), ::fidl_next::DecodeError> {
91 Ok(())
92 }
93}
94
95impl ::core::convert::From<ConnectionType> for WireConnectionType {
96 fn from(natural: ConnectionType) -> Self {
97 Self { value: u8::from(natural.bits()) }
98 }
99}
100
101#[derive(Debug)]
102#[repr(C)]
103pub struct ConnectorConnectRequest {
104 pub server: ::fidl_next::fuchsia::zx::Handle,
105}
106
107impl ::fidl_next::Encodable for ConnectorConnectRequest {
108 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> = unsafe {
109 ::fidl_next::CopyOptimization::enable_if(
110 true && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::Encodable>::COPY_OPTIMIZATION
111 .is_enabled(),
112 )
113 };
114
115 type Encoded = WireConnectorConnectRequest;
116}
117
118unsafe impl<___E> ::fidl_next::Encode<___E> for ConnectorConnectRequest
119where
120 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
121
122 ___E: ::fidl_next::fuchsia::HandleEncoder,
123{
124 #[inline]
125 fn encode(
126 self,
127 encoder: &mut ___E,
128 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
129 ) -> Result<(), ::fidl_next::EncodeError> {
130 ::fidl_next::munge! {
131 let Self::Encoded {
132 server,
133
134 } = out;
135 }
136
137 ::fidl_next::Encode::encode(self.server, encoder, server)?;
138
139 Ok(())
140 }
141}
142
143impl ::fidl_next::EncodableOption for Box<ConnectorConnectRequest> {
144 type EncodedOption = ::fidl_next::WireBox<WireConnectorConnectRequest>;
145}
146
147unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<ConnectorConnectRequest>
148where
149 ___E: ::fidl_next::Encoder + ?Sized,
150 ConnectorConnectRequest: ::fidl_next::Encode<___E>,
151{
152 #[inline]
153 fn encode_option(
154 this: Option<Self>,
155 encoder: &mut ___E,
156 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
157 ) -> Result<(), ::fidl_next::EncodeError> {
158 if let Some(inner) = this {
159 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
160 ::fidl_next::WireBox::encode_present(out);
161 } else {
162 ::fidl_next::WireBox::encode_absent(out);
163 }
164
165 Ok(())
166 }
167}
168
169impl ::fidl_next::TakeFrom<WireConnectorConnectRequest> for ConnectorConnectRequest {
170 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self> = unsafe {
171 ::fidl_next::CopyOptimization::enable_if(
172 true && <::fidl_next::fuchsia::zx::Handle as ::fidl_next::Encodable>::COPY_OPTIMIZATION
173 .is_enabled(),
174 )
175 };
176
177 #[inline]
178 fn take_from(from: &WireConnectorConnectRequest) -> Self {
179 Self { server: ::fidl_next::TakeFrom::take_from(&from.server) }
180 }
181}
182
183#[derive(Debug)]
185#[repr(C)]
186pub struct WireConnectorConnectRequest {
187 pub server: ::fidl_next::fuchsia::WireHandle,
188}
189
190unsafe impl ::fidl_next::ZeroPadding for WireConnectorConnectRequest {
191 #[inline]
192 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
193}
194
195unsafe impl<___D> ::fidl_next::Decode<___D> for WireConnectorConnectRequest
196where
197 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
198
199 ___D: ::fidl_next::fuchsia::HandleDecoder,
200{
201 fn decode(
202 slot: ::fidl_next::Slot<'_, Self>,
203 decoder: &mut ___D,
204 ) -> Result<(), ::fidl_next::DecodeError> {
205 ::fidl_next::munge! {
206 let Self {
207 mut server,
208
209 } = slot;
210 }
211
212 ::fidl_next::Decode::decode(server.as_mut(), decoder)?;
213
214 Ok(())
215 }
216}
217
218#[doc = " A connector lets a client forward the server end of a protocol.\n"]
220#[derive(Debug)]
221pub struct Connector;
222
223pub mod connector {
224 pub mod prelude {
225 pub use crate::{
226 connector, Connector, ConnectorClientHandler, ConnectorClientSender,
227 ConnectorServerHandler, ConnectorServerSender,
228 };
229
230 pub use crate::ConnectorConnectRequest;
231 }
232
233 pub struct Connect;
234
235 impl ::fidl_next::Method for Connect {
236 const ORDINAL: u64 = 3169778387179902201;
237
238 type Protocol = crate::Connector;
239
240 type Request = crate::WireConnectorConnectRequest;
241
242 type Response = ::fidl_next::Never;
243 }
244}
245
246pub trait ConnectorClientSender {
248 type Transport: ::fidl_next::Transport;
249
250 #[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"]
251 fn connect<___R>(
252 &self,
253 request: ___R,
254 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
255 where
256 ___R: ::fidl_next::Encode<
257 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
258 Encoded = crate::WireConnectorConnectRequest,
259 >;
260}
261
262impl<___T> ConnectorClientSender for ::fidl_next::ClientSender<___T, Connector>
263where
264 ___T: ::fidl_next::Transport,
265{
266 type Transport = ___T;
267
268 #[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"]
269 fn connect<___R>(
270 &self,
271 request: ___R,
272 ) -> Result<::fidl_next::SendFuture<'_, Self::Transport>, ::fidl_next::EncodeError>
273 where
274 ___R: ::fidl_next::Encode<
275 <Self::Transport as ::fidl_next::Transport>::SendBuffer,
276 Encoded = crate::WireConnectorConnectRequest,
277 >,
278 {
279 self.as_untyped().send_one_way(3169778387179902201, request)
280 }
281}
282
283pub trait ConnectorClientHandler<___T: ::fidl_next::Transport> {}
287
288impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for Connector
289where
290 ___T: ::fidl_next::Transport,
291 ___H: ConnectorClientHandler<___T>,
292{
293 fn on_event(
294 handler: &mut ___H,
295 sender: &::fidl_next::ClientSender<___T, Self>,
296 ordinal: u64,
297 buffer: ___T::RecvBuffer,
298 ) {
299 match ordinal {
300 ordinal => {
301 sender.close();
302 }
303 }
304 }
305}
306
307pub trait ConnectorServerSender {
309 type Transport: ::fidl_next::Transport;
310}
311
312impl<___T> ConnectorServerSender for ::fidl_next::ServerSender<___T, Connector>
313where
314 ___T: ::fidl_next::Transport,
315{
316 type Transport = ___T;
317}
318
319pub trait ConnectorServerHandler<___T: ::fidl_next::Transport> {
323 #[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"]
324 fn connect(
325 &mut self,
326 sender: &::fidl_next::ServerSender<___T, Connector>,
327
328 request: ::fidl_next::Request<___T, connector::Connect>,
329 );
330}
331
332impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for Connector
333where
334 ___T: ::fidl_next::Transport,
335 ___H: ConnectorServerHandler<___T>,
336
337 crate::WireConnectorConnectRequest:
338 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
339{
340 fn on_one_way(
341 handler: &mut ___H,
342 sender: &::fidl_next::ServerSender<___T, Self>,
343 ordinal: u64,
344 buffer: ___T::RecvBuffer,
345 ) {
346 match ordinal {
347 3169778387179902201 => match ::fidl_next::DecoderExt::decode(buffer) {
348 Ok(decoded) => handler.connect(sender, decoded),
349 Err(e) => {
350 sender.close();
351 }
352 },
353
354 ordinal => {
355 sender.close();
356 }
357 }
358 }
359
360 fn on_two_way(
361 handler: &mut ___H,
362 sender: &::fidl_next::ServerSender<___T, Self>,
363 ordinal: u64,
364 buffer: ___T::RecvBuffer,
365 responder: ::fidl_next::protocol::Responder,
366 ) {
367 match ordinal {
368 ordinal => {
369 sender.close();
370 }
371 }
372 }
373}
374
375#[doc = " This name is reserved for accessing the fuchsia.device/Controller protocol\n within /dev/. No devices can be created with this name.\n"]
376pub const DEVICE_CONTROLLER_NAME: &str = "device_controller";
377
378#[doc = " This name is reserved for accessing the device specific protocol\n within /dev/. No devices can be created with this name.\n"]
379pub const DEVICE_PROTOCOL_NAME: &str = "device_protocol";
380
381#[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"]
382pub const DEVICE_TOPOLOGY_NAME: &str = "device_topology";
383
384#[derive(Debug, Default)]
385pub struct DevfsAddArgs {
386 pub connector:
387 Option<::fidl_next::ClientEnd<::fidl_next::fuchsia::zx::Channel, crate::Connector>>,
388
389 pub class_name: Option<String>,
390
391 pub inspect: Option<::fidl_next::fuchsia::zx::Handle>,
392
393 pub connector_supports: Option<crate::ConnectionType>,
394
395 pub controller_connector:
396 Option<::fidl_next::ClientEnd<::fidl_next::fuchsia::zx::Channel, crate::Connector>>,
397}
398
399impl DevfsAddArgs {
400 fn __max_ordinal(&self) -> usize {
401 if self.connector.is_some() {
402 return 1;
403 }
404
405 if self.class_name.is_some() {
406 return 2;
407 }
408
409 if self.inspect.is_some() {
410 return 3;
411 }
412
413 if self.connector_supports.is_some() {
414 return 4;
415 }
416
417 if self.controller_connector.is_some() {
418 return 5;
419 }
420
421 0
422 }
423}
424
425impl ::fidl_next::Encodable for DevfsAddArgs {
426 type Encoded = WireDevfsAddArgs;
427}
428
429unsafe impl<___E> ::fidl_next::Encode<___E> for DevfsAddArgs
430where
431 ___E: ::fidl_next::Encoder + ?Sized,
432
433 ___E: ::fidl_next::fuchsia::HandleEncoder,
434{
435 #[inline]
436 fn encode(
437 mut self,
438 encoder: &mut ___E,
439 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
440 ) -> Result<(), ::fidl_next::EncodeError> {
441 ::fidl_next::munge!(let WireDevfsAddArgs { table } = out);
442
443 let max_ord = self.__max_ordinal();
444
445 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
446 ::fidl_next::ZeroPadding::zero_padding(&mut out);
447
448 let mut preallocated =
449 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
450
451 for i in 1..=max_ord {
452 match i {
453 5 => {
454 if let Some(controller_connector) = self.controller_connector.take() {
455 ::fidl_next::WireEnvelope::encode_value(
456 controller_connector,
457 preallocated.encoder,
458 &mut out,
459 )?;
460 } else {
461 ::fidl_next::WireEnvelope::encode_zero(&mut out)
462 }
463 }
464
465 4 => {
466 if let Some(connector_supports) = self.connector_supports.take() {
467 ::fidl_next::WireEnvelope::encode_value(
468 connector_supports,
469 preallocated.encoder,
470 &mut out,
471 )?;
472 } else {
473 ::fidl_next::WireEnvelope::encode_zero(&mut out)
474 }
475 }
476
477 3 => {
478 if let Some(inspect) = self.inspect.take() {
479 ::fidl_next::WireEnvelope::encode_value(
480 inspect,
481 preallocated.encoder,
482 &mut out,
483 )?;
484 } else {
485 ::fidl_next::WireEnvelope::encode_zero(&mut out)
486 }
487 }
488
489 2 => {
490 if let Some(class_name) = self.class_name.take() {
491 ::fidl_next::WireEnvelope::encode_value(
492 class_name,
493 preallocated.encoder,
494 &mut out,
495 )?;
496 } else {
497 ::fidl_next::WireEnvelope::encode_zero(&mut out)
498 }
499 }
500
501 1 => {
502 if let Some(connector) = self.connector.take() {
503 ::fidl_next::WireEnvelope::encode_value(
504 connector,
505 preallocated.encoder,
506 &mut out,
507 )?;
508 } else {
509 ::fidl_next::WireEnvelope::encode_zero(&mut out)
510 }
511 }
512
513 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
514 }
515 unsafe {
516 preallocated.write_next(out.assume_init_ref());
517 }
518 }
519
520 ::fidl_next::WireTable::encode_len(table, max_ord);
521
522 Ok(())
523 }
524}
525
526impl ::fidl_next::TakeFrom<WireDevfsAddArgs> for DevfsAddArgs {
527 #[inline]
528 fn take_from(from: &WireDevfsAddArgs) -> Self {
529 Self {
530 connector: from.connector().map(::fidl_next::TakeFrom::take_from),
531
532 class_name: from.class_name().map(::fidl_next::TakeFrom::take_from),
533
534 inspect: from.inspect().map(::fidl_next::TakeFrom::take_from),
535
536 connector_supports: from.connector_supports().map(::fidl_next::TakeFrom::take_from),
537
538 controller_connector: from.controller_connector().map(::fidl_next::TakeFrom::take_from),
539 }
540 }
541}
542
543#[repr(C)]
545pub struct WireDevfsAddArgs {
546 table: ::fidl_next::WireTable,
547}
548
549unsafe impl ::fidl_next::ZeroPadding for WireDevfsAddArgs {
550 #[inline]
551 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
552 ::fidl_next::munge!(let Self { table } = out);
553 ::fidl_next::WireTable::zero_padding(table);
554 }
555}
556
557unsafe impl<___D> ::fidl_next::Decode<___D> for WireDevfsAddArgs
558where
559 ___D: ::fidl_next::Decoder + ?Sized,
560
561 ___D: ::fidl_next::fuchsia::HandleDecoder,
562{
563 fn decode(
564 slot: ::fidl_next::Slot<'_, Self>,
565 decoder: &mut ___D,
566 ) -> Result<(), ::fidl_next::DecodeError> {
567 ::fidl_next::munge!(let Self { table } = slot);
568
569 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
570 match ordinal {
571 0 => unsafe { ::core::hint::unreachable_unchecked() },
572
573 1 => {
574 ::fidl_next::WireEnvelope::decode_as::<
575 ___D,
576 ::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel, crate::Connector>,
577 >(slot.as_mut(), decoder)?;
578
579 Ok(())
580 }
581
582 2 => {
583 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::WireString>(
584 slot.as_mut(),
585 decoder,
586 )?;
587
588 let class_name = unsafe {
589 slot.deref_unchecked().deref_unchecked::<::fidl_next::WireString>()
590 };
591
592 if class_name.len() > 255 {
593 return Err(::fidl_next::DecodeError::VectorTooLong {
594 size: class_name.len() as u64,
595 limit: 255,
596 });
597 }
598
599 Ok(())
600 }
601
602 3 => {
603 ::fidl_next::WireEnvelope::decode_as::<___D, ::fidl_next::fuchsia::WireHandle>(
604 slot.as_mut(),
605 decoder,
606 )?;
607
608 Ok(())
609 }
610
611 4 => {
612 ::fidl_next::WireEnvelope::decode_as::<___D, crate::WireConnectionType>(
613 slot.as_mut(),
614 decoder,
615 )?;
616
617 Ok(())
618 }
619
620 5 => {
621 ::fidl_next::WireEnvelope::decode_as::<
622 ___D,
623 ::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel, crate::Connector>,
624 >(slot.as_mut(), decoder)?;
625
626 Ok(())
627 }
628
629 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
630 }
631 })
632 }
633}
634
635impl WireDevfsAddArgs {
636 pub fn connector(
637 &self,
638 ) -> Option<&::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel, crate::Connector>> {
639 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
640 }
641
642 pub fn class_name(&self) -> Option<&::fidl_next::WireString> {
643 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
644 }
645
646 pub fn inspect(&self) -> Option<&::fidl_next::fuchsia::WireHandle> {
647 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
648 }
649
650 pub fn connector_supports(&self) -> Option<&crate::WireConnectionType> {
651 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
652 }
653
654 pub fn controller_connector(
655 &self,
656 ) -> Option<&::fidl_next::ClientEnd<::fidl_next::fuchsia::WireChannel, crate::Connector>> {
657 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
658 }
659}
660
661impl ::core::fmt::Debug for WireDevfsAddArgs {
662 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> Result<(), ::core::fmt::Error> {
663 f.debug_struct("DevfsAddArgs")
664 .field("connector", &self.connector())
665 .field("class_name", &self.class_name())
666 .field("inspect", &self.inspect())
667 .field("connector_supports", &self.connector_supports())
668 .field("controller_connector", &self.controller_connector())
669 .finish()
670 }
671}
672
673#[doc = " Maximum length of a device path\n"]
674pub const MAX_DEVICE_PATH_LEN: u64 = 1024;
675
676#[doc = " Maximum length for a driver path\n"]
677pub const MAX_DRIVER_PATH_LEN: u64 = 1024;
678
679#[derive(Clone, Debug)]
680pub struct TopologicalPathGetTopologicalPathResponse {
681 pub path: String,
682}
683
684impl ::fidl_next::Encodable for TopologicalPathGetTopologicalPathResponse {
685 type Encoded = WireTopologicalPathGetTopologicalPathResponse;
686}
687
688unsafe impl<___E> ::fidl_next::Encode<___E> for TopologicalPathGetTopologicalPathResponse
689where
690 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
691
692 ___E: ::fidl_next::Encoder,
693{
694 #[inline]
695 fn encode(
696 self,
697 encoder: &mut ___E,
698 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
699 ) -> Result<(), ::fidl_next::EncodeError> {
700 ::fidl_next::munge! {
701 let Self::Encoded {
702 path,
703
704 } = out;
705 }
706
707 ::fidl_next::Encode::encode(self.path, encoder, path)?;
708
709 Ok(())
710 }
711}
712
713unsafe impl<___E> ::fidl_next::EncodeRef<___E> for TopologicalPathGetTopologicalPathResponse
714where
715 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
716
717 ___E: ::fidl_next::Encoder,
718{
719 #[inline]
720 fn encode_ref(
721 &self,
722 encoder: &mut ___E,
723 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
724 ) -> Result<(), ::fidl_next::EncodeError> {
725 ::fidl_next::munge! {
726 let Self::Encoded {
727 path,
728
729 } = out;
730 }
731
732 ::fidl_next::EncodeRef::encode_ref(&self.path, encoder, path)?;
733
734 Ok(())
735 }
736}
737
738impl ::fidl_next::EncodableOption for Box<TopologicalPathGetTopologicalPathResponse> {
739 type EncodedOption = ::fidl_next::WireBox<WireTopologicalPathGetTopologicalPathResponse>;
740}
741
742unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Box<TopologicalPathGetTopologicalPathResponse>
743where
744 ___E: ::fidl_next::Encoder + ?Sized,
745 TopologicalPathGetTopologicalPathResponse: ::fidl_next::Encode<___E>,
746{
747 #[inline]
748 fn encode_option(
749 this: Option<Self>,
750 encoder: &mut ___E,
751 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
752 ) -> Result<(), ::fidl_next::EncodeError> {
753 if let Some(inner) = this {
754 ::fidl_next::EncoderExt::encode_next(encoder, *inner)?;
755 ::fidl_next::WireBox::encode_present(out);
756 } else {
757 ::fidl_next::WireBox::encode_absent(out);
758 }
759
760 Ok(())
761 }
762}
763
764unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E>
765 for Box<TopologicalPathGetTopologicalPathResponse>
766where
767 ___E: ::fidl_next::Encoder + ?Sized,
768 TopologicalPathGetTopologicalPathResponse: ::fidl_next::EncodeRef<___E>,
769{
770 #[inline]
771 fn encode_option_ref(
772 this: Option<&Self>,
773 encoder: &mut ___E,
774 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
775 ) -> Result<(), ::fidl_next::EncodeError> {
776 if let Some(inner) = this {
777 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
778 ::fidl_next::WireBox::encode_present(out);
779 } else {
780 ::fidl_next::WireBox::encode_absent(out);
781 }
782
783 Ok(())
784 }
785}
786
787impl ::fidl_next::TakeFrom<WireTopologicalPathGetTopologicalPathResponse>
788 for TopologicalPathGetTopologicalPathResponse
789{
790 #[inline]
791 fn take_from(from: &WireTopologicalPathGetTopologicalPathResponse) -> Self {
792 Self { path: ::fidl_next::TakeFrom::take_from(&from.path) }
793 }
794}
795
796#[derive(Debug)]
798#[repr(C)]
799pub struct WireTopologicalPathGetTopologicalPathResponse {
800 pub path: ::fidl_next::WireString,
801}
802
803unsafe impl ::fidl_next::ZeroPadding for WireTopologicalPathGetTopologicalPathResponse {
804 #[inline]
805 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
806}
807
808unsafe impl<___D> ::fidl_next::Decode<___D> for WireTopologicalPathGetTopologicalPathResponse
809where
810 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
811
812 ___D: ::fidl_next::Decoder,
813{
814 fn decode(
815 slot: ::fidl_next::Slot<'_, Self>,
816 decoder: &mut ___D,
817 ) -> Result<(), ::fidl_next::DecodeError> {
818 ::fidl_next::munge! {
819 let Self {
820 mut path,
821
822 } = slot;
823 }
824
825 ::fidl_next::Decode::decode(path.as_mut(), decoder)?;
826
827 let path = unsafe { path.deref_unchecked() };
828
829 if path.len() > 1024 {
830 return Err(::fidl_next::DecodeError::VectorTooLong {
831 size: path.len() as u64,
832 limit: 1024,
833 });
834 }
835
836 Ok(())
837 }
838}
839
840#[derive(Debug)]
842pub struct TopologicalPath;
843
844pub mod topological_path {
845 pub mod prelude {
846 pub use crate::{
847 topological_path, TopologicalPath, TopologicalPathClientHandler,
848 TopologicalPathClientSender, TopologicalPathServerHandler, TopologicalPathServerSender,
849 };
850
851 pub use crate::TopologicalPathGetTopologicalPathResponse;
852 }
853
854 pub struct GetTopologicalPath;
855
856 impl ::fidl_next::Method for GetTopologicalPath {
857 const ORDINAL: u64 = 6266213890697819096;
858
859 type Protocol = crate::TopologicalPath;
860
861 type Request = ();
862
863 type Response = ::fidl_next::WireResult<
864 crate::WireTopologicalPathGetTopologicalPathResponse,
865 ::fidl_next::WireI32,
866 >;
867 }
868}
869
870pub trait TopologicalPathClientSender {
872 type Transport: ::fidl_next::Transport;
873
874 #[doc = " Return the topological path for this device\n"]
875 fn get_topological_path(
876 &self,
877 ) -> Result<
878 ::fidl_next::ResponseFuture<'_, Self::Transport, topological_path::GetTopologicalPath>,
879 ::fidl_next::EncodeError,
880 >;
881}
882
883impl<___T> TopologicalPathClientSender for ::fidl_next::ClientSender<___T, TopologicalPath>
884where
885 ___T: ::fidl_next::Transport,
886{
887 type Transport = ___T;
888
889 #[doc = " Return the topological path for this device\n"]
890 fn get_topological_path(
891 &self,
892 ) -> Result<
893 ::fidl_next::ResponseFuture<'_, Self::Transport, topological_path::GetTopologicalPath>,
894 ::fidl_next::EncodeError,
895 > {
896 self.as_untyped()
897 .send_two_way(6266213890697819096, ())
898 .map(::fidl_next::ResponseFuture::from_untyped)
899 }
900}
901
902pub trait TopologicalPathClientHandler<___T: ::fidl_next::Transport> {}
906
907impl<___T, ___H> ::fidl_next::ClientProtocol<___T, ___H> for TopologicalPath
908where
909 ___T: ::fidl_next::Transport,
910 ___H: TopologicalPathClientHandler<___T>,
911
912 <topological_path::GetTopologicalPath as ::fidl_next::Method>::Response:
913 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
914{
915 fn on_event(
916 handler: &mut ___H,
917 sender: &::fidl_next::ClientSender<___T, Self>,
918 ordinal: u64,
919 buffer: ___T::RecvBuffer,
920 ) {
921 match ordinal {
922 ordinal => {
923 sender.close();
924 }
925 }
926 }
927}
928
929pub trait TopologicalPathServerSender {
931 type Transport: ::fidl_next::Transport;
932}
933
934impl<___T> TopologicalPathServerSender for ::fidl_next::ServerSender<___T, TopologicalPath>
935where
936 ___T: ::fidl_next::Transport,
937{
938 type Transport = ___T;
939}
940
941pub trait TopologicalPathServerHandler<___T: ::fidl_next::Transport> {
945 #[doc = " Return the topological path for this device\n"]
946 fn get_topological_path(
947 &mut self,
948 sender: &::fidl_next::ServerSender<___T, TopologicalPath>,
949
950 responder: ::fidl_next::Responder<topological_path::GetTopologicalPath>,
951 );
952}
953
954impl<___T, ___H> ::fidl_next::ServerProtocol<___T, ___H> for TopologicalPath
955where
956 ___T: ::fidl_next::Transport,
957 ___H: TopologicalPathServerHandler<___T>,
958{
959 fn on_one_way(
960 handler: &mut ___H,
961 sender: &::fidl_next::ServerSender<___T, Self>,
962 ordinal: u64,
963 buffer: ___T::RecvBuffer,
964 ) {
965 match ordinal {
966 ordinal => {
967 sender.close();
968 }
969 }
970 }
971
972 fn on_two_way(
973 handler: &mut ___H,
974 sender: &::fidl_next::ServerSender<___T, Self>,
975 ordinal: u64,
976 buffer: ___T::RecvBuffer,
977 responder: ::fidl_next::protocol::Responder,
978 ) {
979 match ordinal {
980 6266213890697819096 => {
981 let responder = ::fidl_next::Responder::from_untyped(responder);
982
983 handler.get_topological_path(sender, responder);
984 }
985
986 ordinal => {
987 sender.close();
988 }
989 }
990 }
991}
992
993pub mod compat {
995
996 impl ::fidl_next::TakeFrom<crate::WireConnectionType> for ::fidl_fuchsia_device_fs::ConnectionType {
997 #[inline]
998 fn take_from(from: &crate::WireConnectionType) -> Self {
999 Self::from_bits_retain(from.value.into())
1000 }
1001 }
1002
1003 impl ::fidl_next::TakeFrom<crate::WireConnectorConnectRequest>
1004 for ::fidl_fuchsia_device_fs::ConnectorConnectRequest
1005 {
1006 #[inline]
1007 fn take_from(from: &crate::WireConnectorConnectRequest) -> Self {
1008 Self { server: ::fidl_next::TakeFrom::take_from(&from.server) }
1009 }
1010 }
1011
1012 #[cfg(target_os = "fuchsia")]
1013 pub type ConnectorProxy =
1016 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Connector>;
1017
1018 impl ::fidl_next::TakeFrom<crate::Connector> for ::fidl_fuchsia_device_fs::ConnectorMarker {
1019 #[inline]
1020 fn take_from(from: &crate::Connector) -> Self {
1021 Self
1022 }
1023 }
1024
1025 impl ::fidl_next::TakeFrom<crate::WireDevfsAddArgs> for ::fidl_fuchsia_device_fs::DevfsAddArgs {
1026 #[inline]
1027 fn take_from(from: &crate::WireDevfsAddArgs) -> Self {
1028 Self {
1029 connector: from.connector().map(::fidl_next::TakeFrom::take_from),
1030
1031 class_name: from.class_name().map(::fidl_next::TakeFrom::take_from),
1032
1033 inspect: from.inspect().map(::fidl_next::TakeFrom::take_from),
1034
1035 connector_supports: from.connector_supports().map(::fidl_next::TakeFrom::take_from),
1036
1037 controller_connector: from
1038 .controller_connector()
1039 .map(::fidl_next::TakeFrom::take_from),
1040
1041 __source_breaking: ::fidl::marker::SourceBreaking,
1042 }
1043 }
1044 }
1045
1046 impl ::fidl_next::TakeFrom<crate::WireTopologicalPathGetTopologicalPathResponse>
1047 for ::fidl_fuchsia_device_fs::TopologicalPathGetTopologicalPathResponse
1048 {
1049 #[inline]
1050 fn take_from(from: &crate::WireTopologicalPathGetTopologicalPathResponse) -> Self {
1051 Self { path: ::fidl_next::TakeFrom::take_from(&from.path) }
1052 }
1053 }
1054
1055 #[cfg(target_os = "fuchsia")]
1056 pub type TopologicalPathProxy =
1059 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::TopologicalPath>;
1060
1061 impl ::fidl_next::TakeFrom<crate::TopologicalPath>
1062 for ::fidl_fuchsia_device_fs::TopologicalPathMarker
1063 {
1064 #[inline]
1065 fn take_from(from: &crate::TopologicalPath) -> Self {
1066 Self
1067 }
1068 }
1069}