1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_device_fs_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ConnectorConnectRequest {
15 pub server: fdomain_client::Channel,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for ConnectorConnectRequest {}
19
20#[derive(Debug, Default, PartialEq)]
21pub struct DevfsAddArgs {
22 pub connector: Option<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
26 pub class_name: Option<String>,
31 pub inspect: Option<fdomain_client::Vmo>,
34 pub connector_supports: Option<ConnectionType>,
39 pub controller_connector: Option<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
45 #[doc(hidden)]
46 pub __source_breaking: fidl::marker::SourceBreaking,
47}
48
49impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DevfsAddArgs {}
50
51#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
52pub struct ConnectorMarker;
53
54impl fdomain_client::fidl::ProtocolMarker for ConnectorMarker {
55 type Proxy = ConnectorProxy;
56 type RequestStream = ConnectorRequestStream;
57
58 const DEBUG_NAME: &'static str = "(anonymous) Connector";
59}
60
61pub trait ConnectorProxyInterface: Send + Sync {
62 fn r#connect(&self, server: fdomain_client::Channel) -> Result<(), fidl::Error>;
63}
64
65#[derive(Debug, Clone)]
66pub struct ConnectorProxy {
67 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
68}
69
70impl fdomain_client::fidl::Proxy for ConnectorProxy {
71 type Protocol = ConnectorMarker;
72
73 fn from_channel(inner: fdomain_client::Channel) -> Self {
74 Self::new(inner)
75 }
76
77 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
78 self.client.into_channel().map_err(|client| Self { client })
79 }
80
81 fn as_channel(&self) -> &fdomain_client::Channel {
82 self.client.as_channel()
83 }
84}
85
86impl ConnectorProxy {
87 pub fn new(channel: fdomain_client::Channel) -> Self {
89 let protocol_name = <ConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
90 Self { client: fidl::client::Client::new(channel, protocol_name) }
91 }
92
93 pub fn take_event_stream(&self) -> ConnectorEventStream {
99 ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
100 }
101
102 pub fn r#connect(&self, mut server: fdomain_client::Channel) -> Result<(), fidl::Error> {
108 ConnectorProxyInterface::r#connect(self, server)
109 }
110}
111
112impl ConnectorProxyInterface for ConnectorProxy {
113 fn r#connect(&self, mut server: fdomain_client::Channel) -> Result<(), fidl::Error> {
114 self.client.send::<ConnectorConnectRequest>(
115 (server,),
116 0x2bfd50a6209194f9,
117 fidl::encoding::DynamicFlags::empty(),
118 )
119 }
120}
121
122pub struct ConnectorEventStream {
123 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
124}
125
126impl std::marker::Unpin for ConnectorEventStream {}
127
128impl futures::stream::FusedStream for ConnectorEventStream {
129 fn is_terminated(&self) -> bool {
130 self.event_receiver.is_terminated()
131 }
132}
133
134impl futures::Stream for ConnectorEventStream {
135 type Item = Result<ConnectorEvent, fidl::Error>;
136
137 fn poll_next(
138 mut self: std::pin::Pin<&mut Self>,
139 cx: &mut std::task::Context<'_>,
140 ) -> std::task::Poll<Option<Self::Item>> {
141 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
142 &mut self.event_receiver,
143 cx
144 )?) {
145 Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
146 None => std::task::Poll::Ready(None),
147 }
148 }
149}
150
151#[derive(Debug)]
152pub enum ConnectorEvent {}
153
154impl ConnectorEvent {
155 fn decode(
157 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
158 ) -> Result<ConnectorEvent, fidl::Error> {
159 let (bytes, _handles) = buf.split_mut();
160 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
161 debug_assert_eq!(tx_header.tx_id, 0);
162 match tx_header.ordinal {
163 _ => Err(fidl::Error::UnknownOrdinal {
164 ordinal: tx_header.ordinal,
165 protocol_name:
166 <ConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
167 }),
168 }
169 }
170}
171
172pub struct ConnectorRequestStream {
174 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
175 is_terminated: bool,
176}
177
178impl std::marker::Unpin for ConnectorRequestStream {}
179
180impl futures::stream::FusedStream for ConnectorRequestStream {
181 fn is_terminated(&self) -> bool {
182 self.is_terminated
183 }
184}
185
186impl fdomain_client::fidl::RequestStream for ConnectorRequestStream {
187 type Protocol = ConnectorMarker;
188 type ControlHandle = ConnectorControlHandle;
189
190 fn from_channel(channel: fdomain_client::Channel) -> Self {
191 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
192 }
193
194 fn control_handle(&self) -> Self::ControlHandle {
195 ConnectorControlHandle { inner: self.inner.clone() }
196 }
197
198 fn into_inner(
199 self,
200 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
201 {
202 (self.inner, self.is_terminated)
203 }
204
205 fn from_inner(
206 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
207 is_terminated: bool,
208 ) -> Self {
209 Self { inner, is_terminated }
210 }
211}
212
213impl futures::Stream for ConnectorRequestStream {
214 type Item = Result<ConnectorRequest, fidl::Error>;
215
216 fn poll_next(
217 mut self: std::pin::Pin<&mut Self>,
218 cx: &mut std::task::Context<'_>,
219 ) -> std::task::Poll<Option<Self::Item>> {
220 let this = &mut *self;
221 if this.inner.check_shutdown(cx) {
222 this.is_terminated = true;
223 return std::task::Poll::Ready(None);
224 }
225 if this.is_terminated {
226 panic!("polled ConnectorRequestStream after completion");
227 }
228 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
229 |bytes, handles| {
230 match this.inner.channel().read_etc(cx, bytes, handles) {
231 std::task::Poll::Ready(Ok(())) => {}
232 std::task::Poll::Pending => return std::task::Poll::Pending,
233 std::task::Poll::Ready(Err(None)) => {
234 this.is_terminated = true;
235 return std::task::Poll::Ready(None);
236 }
237 std::task::Poll::Ready(Err(Some(e))) => {
238 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
239 e.into(),
240 ))));
241 }
242 }
243
244 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
246
247 std::task::Poll::Ready(Some(match header.ordinal {
248 0x2bfd50a6209194f9 => {
249 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
250 let mut req = fidl::new_empty!(
251 ConnectorConnectRequest,
252 fdomain_client::fidl::FDomainResourceDialect
253 );
254 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
255 let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
256 Ok(ConnectorRequest::Connect { server: req.server, control_handle })
257 }
258 _ => Err(fidl::Error::UnknownOrdinal {
259 ordinal: header.ordinal,
260 protocol_name:
261 <ConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
262 }),
263 }))
264 },
265 )
266 }
267}
268
269#[derive(Debug)]
271pub enum ConnectorRequest {
272 Connect { server: fdomain_client::Channel, control_handle: ConnectorControlHandle },
278}
279
280impl ConnectorRequest {
281 #[allow(irrefutable_let_patterns)]
282 pub fn into_connect(self) -> Option<(fdomain_client::Channel, ConnectorControlHandle)> {
283 if let ConnectorRequest::Connect { server, control_handle } = self {
284 Some((server, control_handle))
285 } else {
286 None
287 }
288 }
289
290 pub fn method_name(&self) -> &'static str {
292 match *self {
293 ConnectorRequest::Connect { .. } => "connect",
294 }
295 }
296}
297
298#[derive(Debug, Clone)]
299pub struct ConnectorControlHandle {
300 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
301}
302
303impl ConnectorControlHandle {
304 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
305 self.inner.shutdown_with_epitaph(status.into())
306 }
307}
308
309impl fdomain_client::fidl::ControlHandle for ConnectorControlHandle {
310 fn shutdown(&self) {
311 self.inner.shutdown()
312 }
313
314 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
315 self.inner.shutdown_with_epitaph(status)
316 }
317
318 fn is_closed(&self) -> bool {
319 self.inner.channel().is_closed()
320 }
321 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
322 self.inner.channel().on_closed()
323 }
324}
325
326impl ConnectorControlHandle {}
327
328#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
329pub struct TopologicalPathMarker;
330
331impl fdomain_client::fidl::ProtocolMarker for TopologicalPathMarker {
332 type Proxy = TopologicalPathProxy;
333 type RequestStream = TopologicalPathRequestStream;
334
335 const DEBUG_NAME: &'static str = "(anonymous) TopologicalPath";
336}
337pub type TopologicalPathGetTopologicalPathResult = Result<String, i32>;
338
339pub trait TopologicalPathProxyInterface: Send + Sync {
340 type GetTopologicalPathResponseFut: std::future::Future<Output = Result<TopologicalPathGetTopologicalPathResult, fidl::Error>>
341 + Send;
342 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut;
343}
344
345#[derive(Debug, Clone)]
346pub struct TopologicalPathProxy {
347 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
348}
349
350impl fdomain_client::fidl::Proxy for TopologicalPathProxy {
351 type Protocol = TopologicalPathMarker;
352
353 fn from_channel(inner: fdomain_client::Channel) -> Self {
354 Self::new(inner)
355 }
356
357 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
358 self.client.into_channel().map_err(|client| Self { client })
359 }
360
361 fn as_channel(&self) -> &fdomain_client::Channel {
362 self.client.as_channel()
363 }
364}
365
366impl TopologicalPathProxy {
367 pub fn new(channel: fdomain_client::Channel) -> Self {
369 let protocol_name =
370 <TopologicalPathMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
371 Self { client: fidl::client::Client::new(channel, protocol_name) }
372 }
373
374 pub fn take_event_stream(&self) -> TopologicalPathEventStream {
380 TopologicalPathEventStream { event_receiver: self.client.take_event_receiver() }
381 }
382
383 pub fn r#get_topological_path(
385 &self,
386 ) -> fidl::client::QueryResponseFut<
387 TopologicalPathGetTopologicalPathResult,
388 fdomain_client::fidl::FDomainResourceDialect,
389 > {
390 TopologicalPathProxyInterface::r#get_topological_path(self)
391 }
392}
393
394impl TopologicalPathProxyInterface for TopologicalPathProxy {
395 type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
396 TopologicalPathGetTopologicalPathResult,
397 fdomain_client::fidl::FDomainResourceDialect,
398 >;
399 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
400 fn _decode(
401 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
402 ) -> Result<TopologicalPathGetTopologicalPathResult, fidl::Error> {
403 let _response = fidl::client::decode_transaction_body::<
404 fidl::encoding::ResultType<TopologicalPathGetTopologicalPathResponse, i32>,
405 fdomain_client::fidl::FDomainResourceDialect,
406 0x56f6105571a973d8,
407 >(_buf?)?;
408 Ok(_response.map(|x| x.path))
409 }
410 self.client.send_query_and_decode::<
411 fidl::encoding::EmptyPayload,
412 TopologicalPathGetTopologicalPathResult,
413 >(
414 (),
415 0x56f6105571a973d8,
416 fidl::encoding::DynamicFlags::empty(),
417 _decode,
418 )
419 }
420}
421
422pub struct TopologicalPathEventStream {
423 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
424}
425
426impl std::marker::Unpin for TopologicalPathEventStream {}
427
428impl futures::stream::FusedStream for TopologicalPathEventStream {
429 fn is_terminated(&self) -> bool {
430 self.event_receiver.is_terminated()
431 }
432}
433
434impl futures::Stream for TopologicalPathEventStream {
435 type Item = Result<TopologicalPathEvent, fidl::Error>;
436
437 fn poll_next(
438 mut self: std::pin::Pin<&mut Self>,
439 cx: &mut std::task::Context<'_>,
440 ) -> std::task::Poll<Option<Self::Item>> {
441 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
442 &mut self.event_receiver,
443 cx
444 )?) {
445 Some(buf) => std::task::Poll::Ready(Some(TopologicalPathEvent::decode(buf))),
446 None => std::task::Poll::Ready(None),
447 }
448 }
449}
450
451#[derive(Debug)]
452pub enum TopologicalPathEvent {}
453
454impl TopologicalPathEvent {
455 fn decode(
457 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
458 ) -> Result<TopologicalPathEvent, fidl::Error> {
459 let (bytes, _handles) = buf.split_mut();
460 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
461 debug_assert_eq!(tx_header.tx_id, 0);
462 match tx_header.ordinal {
463 _ => Err(fidl::Error::UnknownOrdinal {
464 ordinal: tx_header.ordinal,
465 protocol_name:
466 <TopologicalPathMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
467 }),
468 }
469 }
470}
471
472pub struct TopologicalPathRequestStream {
474 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
475 is_terminated: bool,
476}
477
478impl std::marker::Unpin for TopologicalPathRequestStream {}
479
480impl futures::stream::FusedStream for TopologicalPathRequestStream {
481 fn is_terminated(&self) -> bool {
482 self.is_terminated
483 }
484}
485
486impl fdomain_client::fidl::RequestStream for TopologicalPathRequestStream {
487 type Protocol = TopologicalPathMarker;
488 type ControlHandle = TopologicalPathControlHandle;
489
490 fn from_channel(channel: fdomain_client::Channel) -> Self {
491 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
492 }
493
494 fn control_handle(&self) -> Self::ControlHandle {
495 TopologicalPathControlHandle { inner: self.inner.clone() }
496 }
497
498 fn into_inner(
499 self,
500 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
501 {
502 (self.inner, self.is_terminated)
503 }
504
505 fn from_inner(
506 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
507 is_terminated: bool,
508 ) -> Self {
509 Self { inner, is_terminated }
510 }
511}
512
513impl futures::Stream for TopologicalPathRequestStream {
514 type Item = Result<TopologicalPathRequest, fidl::Error>;
515
516 fn poll_next(
517 mut self: std::pin::Pin<&mut Self>,
518 cx: &mut std::task::Context<'_>,
519 ) -> std::task::Poll<Option<Self::Item>> {
520 let this = &mut *self;
521 if this.inner.check_shutdown(cx) {
522 this.is_terminated = true;
523 return std::task::Poll::Ready(None);
524 }
525 if this.is_terminated {
526 panic!("polled TopologicalPathRequestStream after completion");
527 }
528 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
529 |bytes, handles| {
530 match this.inner.channel().read_etc(cx, bytes, handles) {
531 std::task::Poll::Ready(Ok(())) => {}
532 std::task::Poll::Pending => return std::task::Poll::Pending,
533 std::task::Poll::Ready(Err(None)) => {
534 this.is_terminated = true;
535 return std::task::Poll::Ready(None);
536 }
537 std::task::Poll::Ready(Err(Some(e))) => {
538 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
539 e.into(),
540 ))));
541 }
542 }
543
544 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
546
547 std::task::Poll::Ready(Some(match header.ordinal {
548 0x56f6105571a973d8 => {
549 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
550 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
551 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
552 let control_handle = TopologicalPathControlHandle {
553 inner: this.inner.clone(),
554 };
555 Ok(TopologicalPathRequest::GetTopologicalPath {
556 responder: TopologicalPathGetTopologicalPathResponder {
557 control_handle: std::mem::ManuallyDrop::new(control_handle),
558 tx_id: header.tx_id,
559 },
560 })
561 }
562 _ => Err(fidl::Error::UnknownOrdinal {
563 ordinal: header.ordinal,
564 protocol_name: <TopologicalPathMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
565 }),
566 }))
567 },
568 )
569 }
570}
571
572#[derive(Debug)]
573pub enum TopologicalPathRequest {
574 GetTopologicalPath { responder: TopologicalPathGetTopologicalPathResponder },
576}
577
578impl TopologicalPathRequest {
579 #[allow(irrefutable_let_patterns)]
580 pub fn into_get_topological_path(self) -> Option<(TopologicalPathGetTopologicalPathResponder)> {
581 if let TopologicalPathRequest::GetTopologicalPath { responder } = self {
582 Some((responder))
583 } else {
584 None
585 }
586 }
587
588 pub fn method_name(&self) -> &'static str {
590 match *self {
591 TopologicalPathRequest::GetTopologicalPath { .. } => "get_topological_path",
592 }
593 }
594}
595
596#[derive(Debug, Clone)]
597pub struct TopologicalPathControlHandle {
598 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
599}
600
601impl TopologicalPathControlHandle {
602 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
603 self.inner.shutdown_with_epitaph(status.into())
604 }
605}
606
607impl fdomain_client::fidl::ControlHandle for TopologicalPathControlHandle {
608 fn shutdown(&self) {
609 self.inner.shutdown()
610 }
611
612 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
613 self.inner.shutdown_with_epitaph(status)
614 }
615
616 fn is_closed(&self) -> bool {
617 self.inner.channel().is_closed()
618 }
619 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
620 self.inner.channel().on_closed()
621 }
622}
623
624impl TopologicalPathControlHandle {}
625
626#[must_use = "FIDL methods require a response to be sent"]
627#[derive(Debug)]
628pub struct TopologicalPathGetTopologicalPathResponder {
629 control_handle: std::mem::ManuallyDrop<TopologicalPathControlHandle>,
630 tx_id: u32,
631}
632
633impl std::ops::Drop for TopologicalPathGetTopologicalPathResponder {
637 fn drop(&mut self) {
638 self.control_handle.shutdown();
639 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
641 }
642}
643
644impl fdomain_client::fidl::Responder for TopologicalPathGetTopologicalPathResponder {
645 type ControlHandle = TopologicalPathControlHandle;
646
647 fn control_handle(&self) -> &TopologicalPathControlHandle {
648 &self.control_handle
649 }
650
651 fn drop_without_shutdown(mut self) {
652 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
654 std::mem::forget(self);
656 }
657}
658
659impl TopologicalPathGetTopologicalPathResponder {
660 pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
664 let _result = self.send_raw(result);
665 if _result.is_err() {
666 self.control_handle.shutdown();
667 }
668 self.drop_without_shutdown();
669 _result
670 }
671
672 pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
674 let _result = self.send_raw(result);
675 self.drop_without_shutdown();
676 _result
677 }
678
679 fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
680 self.control_handle.inner.send::<fidl::encoding::ResultType<
681 TopologicalPathGetTopologicalPathResponse,
682 i32,
683 >>(
684 result.map(|path| (path,)),
685 self.tx_id,
686 0x56f6105571a973d8,
687 fidl::encoding::DynamicFlags::empty(),
688 )
689 }
690}
691
692mod internal {
693 use super::*;
694
695 impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
696 type Borrowed<'a> = &'a mut Self;
697 fn take_or_borrow<'a>(
698 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
699 ) -> Self::Borrowed<'a> {
700 value
701 }
702 }
703
704 unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
705 type Owned = Self;
706
707 #[inline(always)]
708 fn inline_align(_context: fidl::encoding::Context) -> usize {
709 4
710 }
711
712 #[inline(always)]
713 fn inline_size(_context: fidl::encoding::Context) -> usize {
714 4
715 }
716 }
717
718 unsafe impl
719 fidl::encoding::Encode<
720 ConnectorConnectRequest,
721 fdomain_client::fidl::FDomainResourceDialect,
722 > for &mut ConnectorConnectRequest
723 {
724 #[inline]
725 unsafe fn encode(
726 self,
727 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
728 offset: usize,
729 _depth: fidl::encoding::Depth,
730 ) -> fidl::Result<()> {
731 encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
732 fidl::encoding::Encode::<
734 ConnectorConnectRequest,
735 fdomain_client::fidl::FDomainResourceDialect,
736 >::encode(
737 (<fidl::encoding::HandleType<
738 fdomain_client::Channel,
739 { fidl::ObjectType::CHANNEL.into_raw() },
740 2147483648,
741 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
742 &mut self.server
743 ),),
744 encoder,
745 offset,
746 _depth,
747 )
748 }
749 }
750 unsafe impl<
751 T0: fidl::encoding::Encode<
752 fidl::encoding::HandleType<
753 fdomain_client::Channel,
754 { fidl::ObjectType::CHANNEL.into_raw() },
755 2147483648,
756 >,
757 fdomain_client::fidl::FDomainResourceDialect,
758 >,
759 >
760 fidl::encoding::Encode<
761 ConnectorConnectRequest,
762 fdomain_client::fidl::FDomainResourceDialect,
763 > for (T0,)
764 {
765 #[inline]
766 unsafe fn encode(
767 self,
768 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
769 offset: usize,
770 depth: fidl::encoding::Depth,
771 ) -> fidl::Result<()> {
772 encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
773 self.0.encode(encoder, offset + 0, depth)?;
777 Ok(())
778 }
779 }
780
781 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
782 for ConnectorConnectRequest
783 {
784 #[inline(always)]
785 fn new_empty() -> Self {
786 Self {
787 server: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
788 }
789 }
790
791 #[inline]
792 unsafe fn decode(
793 &mut self,
794 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
795 offset: usize,
796 _depth: fidl::encoding::Depth,
797 ) -> fidl::Result<()> {
798 decoder.debug_check_bounds::<Self>(offset);
799 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
801 Ok(())
802 }
803 }
804
805 impl DevfsAddArgs {
806 #[inline(always)]
807 fn max_ordinal_present(&self) -> u64 {
808 if let Some(_) = self.controller_connector {
809 return 5;
810 }
811 if let Some(_) = self.connector_supports {
812 return 4;
813 }
814 if let Some(_) = self.inspect {
815 return 3;
816 }
817 if let Some(_) = self.class_name {
818 return 2;
819 }
820 if let Some(_) = self.connector {
821 return 1;
822 }
823 0
824 }
825 }
826
827 impl fidl::encoding::ResourceTypeMarker for DevfsAddArgs {
828 type Borrowed<'a> = &'a mut Self;
829 fn take_or_borrow<'a>(
830 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
831 ) -> Self::Borrowed<'a> {
832 value
833 }
834 }
835
836 unsafe impl fidl::encoding::TypeMarker for DevfsAddArgs {
837 type Owned = Self;
838
839 #[inline(always)]
840 fn inline_align(_context: fidl::encoding::Context) -> usize {
841 8
842 }
843
844 #[inline(always)]
845 fn inline_size(_context: fidl::encoding::Context) -> usize {
846 16
847 }
848 }
849
850 unsafe impl fidl::encoding::Encode<DevfsAddArgs, fdomain_client::fidl::FDomainResourceDialect>
851 for &mut DevfsAddArgs
852 {
853 unsafe fn encode(
854 self,
855 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
856 offset: usize,
857 mut depth: fidl::encoding::Depth,
858 ) -> fidl::Result<()> {
859 encoder.debug_check_bounds::<DevfsAddArgs>(offset);
860 let max_ordinal: u64 = self.max_ordinal_present();
862 encoder.write_num(max_ordinal, offset);
863 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
864 if max_ordinal == 0 {
866 return Ok(());
867 }
868 depth.increment()?;
869 let envelope_size = 8;
870 let bytes_len = max_ordinal as usize * envelope_size;
871 #[allow(unused_variables)]
872 let offset = encoder.out_of_line_offset(bytes_len);
873 let mut _prev_end_offset: usize = 0;
874 if 1 > max_ordinal {
875 return Ok(());
876 }
877
878 let cur_offset: usize = (1 - 1) * envelope_size;
881
882 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
884
885 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>, fdomain_client::fidl::FDomainResourceDialect>(
890 self.connector.as_mut().map(<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
891 encoder, offset + cur_offset, depth
892 )?;
893
894 _prev_end_offset = cur_offset + envelope_size;
895 if 2 > max_ordinal {
896 return Ok(());
897 }
898
899 let cur_offset: usize = (2 - 1) * envelope_size;
902
903 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
905
906 fidl::encoding::encode_in_envelope_optional::<
911 fidl::encoding::BoundedString<255>,
912 fdomain_client::fidl::FDomainResourceDialect,
913 >(
914 self.class_name.as_ref().map(
915 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
916 ),
917 encoder,
918 offset + cur_offset,
919 depth,
920 )?;
921
922 _prev_end_offset = cur_offset + envelope_size;
923 if 3 > max_ordinal {
924 return Ok(());
925 }
926
927 let cur_offset: usize = (3 - 1) * envelope_size;
930
931 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
933
934 fidl::encoding::encode_in_envelope_optional::<
939 fidl::encoding::HandleType<
940 fdomain_client::Vmo,
941 { fidl::ObjectType::VMO.into_raw() },
942 2147483648,
943 >,
944 fdomain_client::fidl::FDomainResourceDialect,
945 >(
946 self.inspect.as_mut().map(
947 <fidl::encoding::HandleType<
948 fdomain_client::Vmo,
949 { fidl::ObjectType::VMO.into_raw() },
950 2147483648,
951 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
952 ),
953 encoder,
954 offset + cur_offset,
955 depth,
956 )?;
957
958 _prev_end_offset = cur_offset + envelope_size;
959 if 4 > max_ordinal {
960 return Ok(());
961 }
962
963 let cur_offset: usize = (4 - 1) * envelope_size;
966
967 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
969
970 fidl::encoding::encode_in_envelope_optional::<
975 ConnectionType,
976 fdomain_client::fidl::FDomainResourceDialect,
977 >(
978 self.connector_supports
979 .as_ref()
980 .map(<ConnectionType as fidl::encoding::ValueTypeMarker>::borrow),
981 encoder,
982 offset + cur_offset,
983 depth,
984 )?;
985
986 _prev_end_offset = cur_offset + envelope_size;
987 if 5 > max_ordinal {
988 return Ok(());
989 }
990
991 let cur_offset: usize = (5 - 1) * envelope_size;
994
995 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
997
998 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>, fdomain_client::fidl::FDomainResourceDialect>(
1003 self.controller_connector.as_mut().map(<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1004 encoder, offset + cur_offset, depth
1005 )?;
1006
1007 _prev_end_offset = cur_offset + envelope_size;
1008
1009 Ok(())
1010 }
1011 }
1012
1013 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for DevfsAddArgs {
1014 #[inline(always)]
1015 fn new_empty() -> Self {
1016 Self::default()
1017 }
1018
1019 unsafe fn decode(
1020 &mut self,
1021 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1022 offset: usize,
1023 mut depth: fidl::encoding::Depth,
1024 ) -> fidl::Result<()> {
1025 decoder.debug_check_bounds::<Self>(offset);
1026 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1027 None => return Err(fidl::Error::NotNullable),
1028 Some(len) => len,
1029 };
1030 if len == 0 {
1032 return Ok(());
1033 };
1034 depth.increment()?;
1035 let envelope_size = 8;
1036 let bytes_len = len * envelope_size;
1037 let offset = decoder.out_of_line_offset(bytes_len)?;
1038 let mut _next_ordinal_to_read = 0;
1040 let mut next_offset = offset;
1041 let end_offset = offset + bytes_len;
1042 _next_ordinal_to_read += 1;
1043 if next_offset >= end_offset {
1044 return Ok(());
1045 }
1046
1047 while _next_ordinal_to_read < 1 {
1049 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1050 _next_ordinal_to_read += 1;
1051 next_offset += envelope_size;
1052 }
1053
1054 let next_out_of_line = decoder.next_out_of_line();
1055 let handles_before = decoder.remaining_handles();
1056 if let Some((inlined, num_bytes, num_handles)) =
1057 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1058 {
1059 let member_inline_size = <fidl::encoding::Endpoint<
1060 fdomain_client::fidl::ClientEnd<ConnectorMarker>,
1061 > as fidl::encoding::TypeMarker>::inline_size(
1062 decoder.context
1063 );
1064 if inlined != (member_inline_size <= 4) {
1065 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1066 }
1067 let inner_offset;
1068 let mut inner_depth = depth.clone();
1069 if inlined {
1070 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1071 inner_offset = next_offset;
1072 } else {
1073 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1074 inner_depth.increment()?;
1075 }
1076 let val_ref = self.connector.get_or_insert_with(|| {
1077 fidl::new_empty!(
1078 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1079 fdomain_client::fidl::FDomainResourceDialect
1080 )
1081 });
1082 fidl::decode!(
1083 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1084 fdomain_client::fidl::FDomainResourceDialect,
1085 val_ref,
1086 decoder,
1087 inner_offset,
1088 inner_depth
1089 )?;
1090 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1091 {
1092 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1093 }
1094 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1095 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1096 }
1097 }
1098
1099 next_offset += envelope_size;
1100 _next_ordinal_to_read += 1;
1101 if next_offset >= end_offset {
1102 return Ok(());
1103 }
1104
1105 while _next_ordinal_to_read < 2 {
1107 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1108 _next_ordinal_to_read += 1;
1109 next_offset += envelope_size;
1110 }
1111
1112 let next_out_of_line = decoder.next_out_of_line();
1113 let handles_before = decoder.remaining_handles();
1114 if let Some((inlined, num_bytes, num_handles)) =
1115 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1116 {
1117 let member_inline_size =
1118 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1119 decoder.context,
1120 );
1121 if inlined != (member_inline_size <= 4) {
1122 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1123 }
1124 let inner_offset;
1125 let mut inner_depth = depth.clone();
1126 if inlined {
1127 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1128 inner_offset = next_offset;
1129 } else {
1130 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1131 inner_depth.increment()?;
1132 }
1133 let val_ref = self.class_name.get_or_insert_with(|| {
1134 fidl::new_empty!(
1135 fidl::encoding::BoundedString<255>,
1136 fdomain_client::fidl::FDomainResourceDialect
1137 )
1138 });
1139 fidl::decode!(
1140 fidl::encoding::BoundedString<255>,
1141 fdomain_client::fidl::FDomainResourceDialect,
1142 val_ref,
1143 decoder,
1144 inner_offset,
1145 inner_depth
1146 )?;
1147 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1148 {
1149 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1150 }
1151 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1152 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1153 }
1154 }
1155
1156 next_offset += envelope_size;
1157 _next_ordinal_to_read += 1;
1158 if next_offset >= end_offset {
1159 return Ok(());
1160 }
1161
1162 while _next_ordinal_to_read < 3 {
1164 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1165 _next_ordinal_to_read += 1;
1166 next_offset += envelope_size;
1167 }
1168
1169 let next_out_of_line = decoder.next_out_of_line();
1170 let handles_before = decoder.remaining_handles();
1171 if let Some((inlined, num_bytes, num_handles)) =
1172 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1173 {
1174 let member_inline_size = <fidl::encoding::HandleType<
1175 fdomain_client::Vmo,
1176 { fidl::ObjectType::VMO.into_raw() },
1177 2147483648,
1178 > as fidl::encoding::TypeMarker>::inline_size(
1179 decoder.context
1180 );
1181 if inlined != (member_inline_size <= 4) {
1182 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1183 }
1184 let inner_offset;
1185 let mut inner_depth = depth.clone();
1186 if inlined {
1187 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1188 inner_offset = next_offset;
1189 } else {
1190 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1191 inner_depth.increment()?;
1192 }
1193 let val_ref =
1194 self.inspect.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
1195 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1196 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1197 {
1198 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1199 }
1200 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1201 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1202 }
1203 }
1204
1205 next_offset += envelope_size;
1206 _next_ordinal_to_read += 1;
1207 if next_offset >= end_offset {
1208 return Ok(());
1209 }
1210
1211 while _next_ordinal_to_read < 4 {
1213 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1214 _next_ordinal_to_read += 1;
1215 next_offset += envelope_size;
1216 }
1217
1218 let next_out_of_line = decoder.next_out_of_line();
1219 let handles_before = decoder.remaining_handles();
1220 if let Some((inlined, num_bytes, num_handles)) =
1221 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1222 {
1223 let member_inline_size =
1224 <ConnectionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1225 if inlined != (member_inline_size <= 4) {
1226 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1227 }
1228 let inner_offset;
1229 let mut inner_depth = depth.clone();
1230 if inlined {
1231 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1232 inner_offset = next_offset;
1233 } else {
1234 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1235 inner_depth.increment()?;
1236 }
1237 let val_ref = self.connector_supports.get_or_insert_with(|| {
1238 fidl::new_empty!(ConnectionType, fdomain_client::fidl::FDomainResourceDialect)
1239 });
1240 fidl::decode!(
1241 ConnectionType,
1242 fdomain_client::fidl::FDomainResourceDialect,
1243 val_ref,
1244 decoder,
1245 inner_offset,
1246 inner_depth
1247 )?;
1248 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1249 {
1250 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1251 }
1252 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1253 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1254 }
1255 }
1256
1257 next_offset += envelope_size;
1258 _next_ordinal_to_read += 1;
1259 if next_offset >= end_offset {
1260 return Ok(());
1261 }
1262
1263 while _next_ordinal_to_read < 5 {
1265 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1266 _next_ordinal_to_read += 1;
1267 next_offset += envelope_size;
1268 }
1269
1270 let next_out_of_line = decoder.next_out_of_line();
1271 let handles_before = decoder.remaining_handles();
1272 if let Some((inlined, num_bytes, num_handles)) =
1273 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1274 {
1275 let member_inline_size = <fidl::encoding::Endpoint<
1276 fdomain_client::fidl::ClientEnd<ConnectorMarker>,
1277 > as fidl::encoding::TypeMarker>::inline_size(
1278 decoder.context
1279 );
1280 if inlined != (member_inline_size <= 4) {
1281 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1282 }
1283 let inner_offset;
1284 let mut inner_depth = depth.clone();
1285 if inlined {
1286 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1287 inner_offset = next_offset;
1288 } else {
1289 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1290 inner_depth.increment()?;
1291 }
1292 let val_ref = self.controller_connector.get_or_insert_with(|| {
1293 fidl::new_empty!(
1294 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1295 fdomain_client::fidl::FDomainResourceDialect
1296 )
1297 });
1298 fidl::decode!(
1299 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1300 fdomain_client::fidl::FDomainResourceDialect,
1301 val_ref,
1302 decoder,
1303 inner_offset,
1304 inner_depth
1305 )?;
1306 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1307 {
1308 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1309 }
1310 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1311 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1312 }
1313 }
1314
1315 next_offset += envelope_size;
1316
1317 while next_offset < end_offset {
1319 _next_ordinal_to_read += 1;
1320 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1321 next_offset += envelope_size;
1322 }
1323
1324 Ok(())
1325 }
1326 }
1327}