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 fdomain_client::fidl::ControlHandle for ConnectorControlHandle {
304 fn shutdown(&self) {
305 self.inner.shutdown()
306 }
307
308 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
309 self.inner.shutdown_with_epitaph(status)
310 }
311
312 fn is_closed(&self) -> bool {
313 self.inner.channel().is_closed()
314 }
315 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
316 self.inner.channel().on_closed()
317 }
318}
319
320impl ConnectorControlHandle {}
321
322#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
323pub struct TopologicalPathMarker;
324
325impl fdomain_client::fidl::ProtocolMarker for TopologicalPathMarker {
326 type Proxy = TopologicalPathProxy;
327 type RequestStream = TopologicalPathRequestStream;
328
329 const DEBUG_NAME: &'static str = "(anonymous) TopologicalPath";
330}
331pub type TopologicalPathGetTopologicalPathResult = Result<String, i32>;
332
333pub trait TopologicalPathProxyInterface: Send + Sync {
334 type GetTopologicalPathResponseFut: std::future::Future<Output = Result<TopologicalPathGetTopologicalPathResult, fidl::Error>>
335 + Send;
336 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut;
337}
338
339#[derive(Debug, Clone)]
340pub struct TopologicalPathProxy {
341 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
342}
343
344impl fdomain_client::fidl::Proxy for TopologicalPathProxy {
345 type Protocol = TopologicalPathMarker;
346
347 fn from_channel(inner: fdomain_client::Channel) -> Self {
348 Self::new(inner)
349 }
350
351 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
352 self.client.into_channel().map_err(|client| Self { client })
353 }
354
355 fn as_channel(&self) -> &fdomain_client::Channel {
356 self.client.as_channel()
357 }
358}
359
360impl TopologicalPathProxy {
361 pub fn new(channel: fdomain_client::Channel) -> Self {
363 let protocol_name =
364 <TopologicalPathMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
365 Self { client: fidl::client::Client::new(channel, protocol_name) }
366 }
367
368 pub fn take_event_stream(&self) -> TopologicalPathEventStream {
374 TopologicalPathEventStream { event_receiver: self.client.take_event_receiver() }
375 }
376
377 pub fn r#get_topological_path(
379 &self,
380 ) -> fidl::client::QueryResponseFut<
381 TopologicalPathGetTopologicalPathResult,
382 fdomain_client::fidl::FDomainResourceDialect,
383 > {
384 TopologicalPathProxyInterface::r#get_topological_path(self)
385 }
386}
387
388impl TopologicalPathProxyInterface for TopologicalPathProxy {
389 type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
390 TopologicalPathGetTopologicalPathResult,
391 fdomain_client::fidl::FDomainResourceDialect,
392 >;
393 fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
394 fn _decode(
395 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
396 ) -> Result<TopologicalPathGetTopologicalPathResult, fidl::Error> {
397 let _response = fidl::client::decode_transaction_body::<
398 fidl::encoding::ResultType<TopologicalPathGetTopologicalPathResponse, i32>,
399 fdomain_client::fidl::FDomainResourceDialect,
400 0x56f6105571a973d8,
401 >(_buf?)?;
402 Ok(_response.map(|x| x.path))
403 }
404 self.client.send_query_and_decode::<
405 fidl::encoding::EmptyPayload,
406 TopologicalPathGetTopologicalPathResult,
407 >(
408 (),
409 0x56f6105571a973d8,
410 fidl::encoding::DynamicFlags::empty(),
411 _decode,
412 )
413 }
414}
415
416pub struct TopologicalPathEventStream {
417 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
418}
419
420impl std::marker::Unpin for TopologicalPathEventStream {}
421
422impl futures::stream::FusedStream for TopologicalPathEventStream {
423 fn is_terminated(&self) -> bool {
424 self.event_receiver.is_terminated()
425 }
426}
427
428impl futures::Stream for TopologicalPathEventStream {
429 type Item = Result<TopologicalPathEvent, fidl::Error>;
430
431 fn poll_next(
432 mut self: std::pin::Pin<&mut Self>,
433 cx: &mut std::task::Context<'_>,
434 ) -> std::task::Poll<Option<Self::Item>> {
435 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
436 &mut self.event_receiver,
437 cx
438 )?) {
439 Some(buf) => std::task::Poll::Ready(Some(TopologicalPathEvent::decode(buf))),
440 None => std::task::Poll::Ready(None),
441 }
442 }
443}
444
445#[derive(Debug)]
446pub enum TopologicalPathEvent {}
447
448impl TopologicalPathEvent {
449 fn decode(
451 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
452 ) -> Result<TopologicalPathEvent, fidl::Error> {
453 let (bytes, _handles) = buf.split_mut();
454 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
455 debug_assert_eq!(tx_header.tx_id, 0);
456 match tx_header.ordinal {
457 _ => Err(fidl::Error::UnknownOrdinal {
458 ordinal: tx_header.ordinal,
459 protocol_name:
460 <TopologicalPathMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
461 }),
462 }
463 }
464}
465
466pub struct TopologicalPathRequestStream {
468 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
469 is_terminated: bool,
470}
471
472impl std::marker::Unpin for TopologicalPathRequestStream {}
473
474impl futures::stream::FusedStream for TopologicalPathRequestStream {
475 fn is_terminated(&self) -> bool {
476 self.is_terminated
477 }
478}
479
480impl fdomain_client::fidl::RequestStream for TopologicalPathRequestStream {
481 type Protocol = TopologicalPathMarker;
482 type ControlHandle = TopologicalPathControlHandle;
483
484 fn from_channel(channel: fdomain_client::Channel) -> Self {
485 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
486 }
487
488 fn control_handle(&self) -> Self::ControlHandle {
489 TopologicalPathControlHandle { inner: self.inner.clone() }
490 }
491
492 fn into_inner(
493 self,
494 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
495 {
496 (self.inner, self.is_terminated)
497 }
498
499 fn from_inner(
500 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
501 is_terminated: bool,
502 ) -> Self {
503 Self { inner, is_terminated }
504 }
505}
506
507impl futures::Stream for TopologicalPathRequestStream {
508 type Item = Result<TopologicalPathRequest, fidl::Error>;
509
510 fn poll_next(
511 mut self: std::pin::Pin<&mut Self>,
512 cx: &mut std::task::Context<'_>,
513 ) -> std::task::Poll<Option<Self::Item>> {
514 let this = &mut *self;
515 if this.inner.check_shutdown(cx) {
516 this.is_terminated = true;
517 return std::task::Poll::Ready(None);
518 }
519 if this.is_terminated {
520 panic!("polled TopologicalPathRequestStream after completion");
521 }
522 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
523 |bytes, handles| {
524 match this.inner.channel().read_etc(cx, bytes, handles) {
525 std::task::Poll::Ready(Ok(())) => {}
526 std::task::Poll::Pending => return std::task::Poll::Pending,
527 std::task::Poll::Ready(Err(None)) => {
528 this.is_terminated = true;
529 return std::task::Poll::Ready(None);
530 }
531 std::task::Poll::Ready(Err(Some(e))) => {
532 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
533 e.into(),
534 ))));
535 }
536 }
537
538 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
540
541 std::task::Poll::Ready(Some(match header.ordinal {
542 0x56f6105571a973d8 => {
543 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
544 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
545 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
546 let control_handle = TopologicalPathControlHandle {
547 inner: this.inner.clone(),
548 };
549 Ok(TopologicalPathRequest::GetTopologicalPath {
550 responder: TopologicalPathGetTopologicalPathResponder {
551 control_handle: std::mem::ManuallyDrop::new(control_handle),
552 tx_id: header.tx_id,
553 },
554 })
555 }
556 _ => Err(fidl::Error::UnknownOrdinal {
557 ordinal: header.ordinal,
558 protocol_name: <TopologicalPathMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
559 }),
560 }))
561 },
562 )
563 }
564}
565
566#[derive(Debug)]
567pub enum TopologicalPathRequest {
568 GetTopologicalPath { responder: TopologicalPathGetTopologicalPathResponder },
570}
571
572impl TopologicalPathRequest {
573 #[allow(irrefutable_let_patterns)]
574 pub fn into_get_topological_path(self) -> Option<(TopologicalPathGetTopologicalPathResponder)> {
575 if let TopologicalPathRequest::GetTopologicalPath { responder } = self {
576 Some((responder))
577 } else {
578 None
579 }
580 }
581
582 pub fn method_name(&self) -> &'static str {
584 match *self {
585 TopologicalPathRequest::GetTopologicalPath { .. } => "get_topological_path",
586 }
587 }
588}
589
590#[derive(Debug, Clone)]
591pub struct TopologicalPathControlHandle {
592 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
593}
594
595impl fdomain_client::fidl::ControlHandle for TopologicalPathControlHandle {
596 fn shutdown(&self) {
597 self.inner.shutdown()
598 }
599
600 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
601 self.inner.shutdown_with_epitaph(status)
602 }
603
604 fn is_closed(&self) -> bool {
605 self.inner.channel().is_closed()
606 }
607 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
608 self.inner.channel().on_closed()
609 }
610}
611
612impl TopologicalPathControlHandle {}
613
614#[must_use = "FIDL methods require a response to be sent"]
615#[derive(Debug)]
616pub struct TopologicalPathGetTopologicalPathResponder {
617 control_handle: std::mem::ManuallyDrop<TopologicalPathControlHandle>,
618 tx_id: u32,
619}
620
621impl std::ops::Drop for TopologicalPathGetTopologicalPathResponder {
625 fn drop(&mut self) {
626 self.control_handle.shutdown();
627 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
629 }
630}
631
632impl fdomain_client::fidl::Responder for TopologicalPathGetTopologicalPathResponder {
633 type ControlHandle = TopologicalPathControlHandle;
634
635 fn control_handle(&self) -> &TopologicalPathControlHandle {
636 &self.control_handle
637 }
638
639 fn drop_without_shutdown(mut self) {
640 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
642 std::mem::forget(self);
644 }
645}
646
647impl TopologicalPathGetTopologicalPathResponder {
648 pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
652 let _result = self.send_raw(result);
653 if _result.is_err() {
654 self.control_handle.shutdown();
655 }
656 self.drop_without_shutdown();
657 _result
658 }
659
660 pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
662 let _result = self.send_raw(result);
663 self.drop_without_shutdown();
664 _result
665 }
666
667 fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
668 self.control_handle.inner.send::<fidl::encoding::ResultType<
669 TopologicalPathGetTopologicalPathResponse,
670 i32,
671 >>(
672 result.map(|path| (path,)),
673 self.tx_id,
674 0x56f6105571a973d8,
675 fidl::encoding::DynamicFlags::empty(),
676 )
677 }
678}
679
680mod internal {
681 use super::*;
682
683 impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
684 type Borrowed<'a> = &'a mut Self;
685 fn take_or_borrow<'a>(
686 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
687 ) -> Self::Borrowed<'a> {
688 value
689 }
690 }
691
692 unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
693 type Owned = Self;
694
695 #[inline(always)]
696 fn inline_align(_context: fidl::encoding::Context) -> usize {
697 4
698 }
699
700 #[inline(always)]
701 fn inline_size(_context: fidl::encoding::Context) -> usize {
702 4
703 }
704 }
705
706 unsafe impl
707 fidl::encoding::Encode<
708 ConnectorConnectRequest,
709 fdomain_client::fidl::FDomainResourceDialect,
710 > for &mut ConnectorConnectRequest
711 {
712 #[inline]
713 unsafe fn encode(
714 self,
715 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
716 offset: usize,
717 _depth: fidl::encoding::Depth,
718 ) -> fidl::Result<()> {
719 encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
720 fidl::encoding::Encode::<
722 ConnectorConnectRequest,
723 fdomain_client::fidl::FDomainResourceDialect,
724 >::encode(
725 (<fidl::encoding::HandleType<
726 fdomain_client::Channel,
727 { fidl::ObjectType::CHANNEL.into_raw() },
728 2147483648,
729 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
730 &mut self.server
731 ),),
732 encoder,
733 offset,
734 _depth,
735 )
736 }
737 }
738 unsafe impl<
739 T0: fidl::encoding::Encode<
740 fidl::encoding::HandleType<
741 fdomain_client::Channel,
742 { fidl::ObjectType::CHANNEL.into_raw() },
743 2147483648,
744 >,
745 fdomain_client::fidl::FDomainResourceDialect,
746 >,
747 >
748 fidl::encoding::Encode<
749 ConnectorConnectRequest,
750 fdomain_client::fidl::FDomainResourceDialect,
751 > for (T0,)
752 {
753 #[inline]
754 unsafe fn encode(
755 self,
756 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
757 offset: usize,
758 depth: fidl::encoding::Depth,
759 ) -> fidl::Result<()> {
760 encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
761 self.0.encode(encoder, offset + 0, depth)?;
765 Ok(())
766 }
767 }
768
769 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
770 for ConnectorConnectRequest
771 {
772 #[inline(always)]
773 fn new_empty() -> Self {
774 Self {
775 server: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
776 }
777 }
778
779 #[inline]
780 unsafe fn decode(
781 &mut self,
782 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
783 offset: usize,
784 _depth: fidl::encoding::Depth,
785 ) -> fidl::Result<()> {
786 decoder.debug_check_bounds::<Self>(offset);
787 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)?;
789 Ok(())
790 }
791 }
792
793 impl DevfsAddArgs {
794 #[inline(always)]
795 fn max_ordinal_present(&self) -> u64 {
796 if let Some(_) = self.controller_connector {
797 return 5;
798 }
799 if let Some(_) = self.connector_supports {
800 return 4;
801 }
802 if let Some(_) = self.inspect {
803 return 3;
804 }
805 if let Some(_) = self.class_name {
806 return 2;
807 }
808 if let Some(_) = self.connector {
809 return 1;
810 }
811 0
812 }
813 }
814
815 impl fidl::encoding::ResourceTypeMarker for DevfsAddArgs {
816 type Borrowed<'a> = &'a mut Self;
817 fn take_or_borrow<'a>(
818 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
819 ) -> Self::Borrowed<'a> {
820 value
821 }
822 }
823
824 unsafe impl fidl::encoding::TypeMarker for DevfsAddArgs {
825 type Owned = Self;
826
827 #[inline(always)]
828 fn inline_align(_context: fidl::encoding::Context) -> usize {
829 8
830 }
831
832 #[inline(always)]
833 fn inline_size(_context: fidl::encoding::Context) -> usize {
834 16
835 }
836 }
837
838 unsafe impl fidl::encoding::Encode<DevfsAddArgs, fdomain_client::fidl::FDomainResourceDialect>
839 for &mut DevfsAddArgs
840 {
841 unsafe fn encode(
842 self,
843 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
844 offset: usize,
845 mut depth: fidl::encoding::Depth,
846 ) -> fidl::Result<()> {
847 encoder.debug_check_bounds::<DevfsAddArgs>(offset);
848 let max_ordinal: u64 = self.max_ordinal_present();
850 encoder.write_num(max_ordinal, offset);
851 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
852 if max_ordinal == 0 {
854 return Ok(());
855 }
856 depth.increment()?;
857 let envelope_size = 8;
858 let bytes_len = max_ordinal as usize * envelope_size;
859 #[allow(unused_variables)]
860 let offset = encoder.out_of_line_offset(bytes_len);
861 let mut _prev_end_offset: usize = 0;
862 if 1 > max_ordinal {
863 return Ok(());
864 }
865
866 let cur_offset: usize = (1 - 1) * envelope_size;
869
870 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
872
873 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>, fdomain_client::fidl::FDomainResourceDialect>(
878 self.connector.as_mut().map(<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
879 encoder, offset + cur_offset, depth
880 )?;
881
882 _prev_end_offset = cur_offset + envelope_size;
883 if 2 > max_ordinal {
884 return Ok(());
885 }
886
887 let cur_offset: usize = (2 - 1) * envelope_size;
890
891 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
893
894 fidl::encoding::encode_in_envelope_optional::<
899 fidl::encoding::BoundedString<255>,
900 fdomain_client::fidl::FDomainResourceDialect,
901 >(
902 self.class_name.as_ref().map(
903 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
904 ),
905 encoder,
906 offset + cur_offset,
907 depth,
908 )?;
909
910 _prev_end_offset = cur_offset + envelope_size;
911 if 3 > max_ordinal {
912 return Ok(());
913 }
914
915 let cur_offset: usize = (3 - 1) * envelope_size;
918
919 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
921
922 fidl::encoding::encode_in_envelope_optional::<
927 fidl::encoding::HandleType<
928 fdomain_client::Vmo,
929 { fidl::ObjectType::VMO.into_raw() },
930 2147483648,
931 >,
932 fdomain_client::fidl::FDomainResourceDialect,
933 >(
934 self.inspect.as_mut().map(
935 <fidl::encoding::HandleType<
936 fdomain_client::Vmo,
937 { fidl::ObjectType::VMO.into_raw() },
938 2147483648,
939 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
940 ),
941 encoder,
942 offset + cur_offset,
943 depth,
944 )?;
945
946 _prev_end_offset = cur_offset + envelope_size;
947 if 4 > max_ordinal {
948 return Ok(());
949 }
950
951 let cur_offset: usize = (4 - 1) * envelope_size;
954
955 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
957
958 fidl::encoding::encode_in_envelope_optional::<
963 ConnectionType,
964 fdomain_client::fidl::FDomainResourceDialect,
965 >(
966 self.connector_supports
967 .as_ref()
968 .map(<ConnectionType as fidl::encoding::ValueTypeMarker>::borrow),
969 encoder,
970 offset + cur_offset,
971 depth,
972 )?;
973
974 _prev_end_offset = cur_offset + envelope_size;
975 if 5 > max_ordinal {
976 return Ok(());
977 }
978
979 let cur_offset: usize = (5 - 1) * envelope_size;
982
983 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
985
986 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>, fdomain_client::fidl::FDomainResourceDialect>(
991 self.controller_connector.as_mut().map(<fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
992 encoder, offset + cur_offset, depth
993 )?;
994
995 _prev_end_offset = cur_offset + envelope_size;
996
997 Ok(())
998 }
999 }
1000
1001 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for DevfsAddArgs {
1002 #[inline(always)]
1003 fn new_empty() -> Self {
1004 Self::default()
1005 }
1006
1007 unsafe fn decode(
1008 &mut self,
1009 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1010 offset: usize,
1011 mut depth: fidl::encoding::Depth,
1012 ) -> fidl::Result<()> {
1013 decoder.debug_check_bounds::<Self>(offset);
1014 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1015 None => return Err(fidl::Error::NotNullable),
1016 Some(len) => len,
1017 };
1018 if len == 0 {
1020 return Ok(());
1021 };
1022 depth.increment()?;
1023 let envelope_size = 8;
1024 let bytes_len = len * envelope_size;
1025 let offset = decoder.out_of_line_offset(bytes_len)?;
1026 let mut _next_ordinal_to_read = 0;
1028 let mut next_offset = offset;
1029 let end_offset = offset + bytes_len;
1030 _next_ordinal_to_read += 1;
1031 if next_offset >= end_offset {
1032 return Ok(());
1033 }
1034
1035 while _next_ordinal_to_read < 1 {
1037 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1038 _next_ordinal_to_read += 1;
1039 next_offset += envelope_size;
1040 }
1041
1042 let next_out_of_line = decoder.next_out_of_line();
1043 let handles_before = decoder.remaining_handles();
1044 if let Some((inlined, num_bytes, num_handles)) =
1045 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1046 {
1047 let member_inline_size = <fidl::encoding::Endpoint<
1048 fdomain_client::fidl::ClientEnd<ConnectorMarker>,
1049 > as fidl::encoding::TypeMarker>::inline_size(
1050 decoder.context
1051 );
1052 if inlined != (member_inline_size <= 4) {
1053 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1054 }
1055 let inner_offset;
1056 let mut inner_depth = depth.clone();
1057 if inlined {
1058 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1059 inner_offset = next_offset;
1060 } else {
1061 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1062 inner_depth.increment()?;
1063 }
1064 let val_ref = self.connector.get_or_insert_with(|| {
1065 fidl::new_empty!(
1066 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1067 fdomain_client::fidl::FDomainResourceDialect
1068 )
1069 });
1070 fidl::decode!(
1071 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1072 fdomain_client::fidl::FDomainResourceDialect,
1073 val_ref,
1074 decoder,
1075 inner_offset,
1076 inner_depth
1077 )?;
1078 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1079 {
1080 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1081 }
1082 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1083 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1084 }
1085 }
1086
1087 next_offset += envelope_size;
1088 _next_ordinal_to_read += 1;
1089 if next_offset >= end_offset {
1090 return Ok(());
1091 }
1092
1093 while _next_ordinal_to_read < 2 {
1095 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1096 _next_ordinal_to_read += 1;
1097 next_offset += envelope_size;
1098 }
1099
1100 let next_out_of_line = decoder.next_out_of_line();
1101 let handles_before = decoder.remaining_handles();
1102 if let Some((inlined, num_bytes, num_handles)) =
1103 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1104 {
1105 let member_inline_size =
1106 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1107 decoder.context,
1108 );
1109 if inlined != (member_inline_size <= 4) {
1110 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1111 }
1112 let inner_offset;
1113 let mut inner_depth = depth.clone();
1114 if inlined {
1115 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1116 inner_offset = next_offset;
1117 } else {
1118 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1119 inner_depth.increment()?;
1120 }
1121 let val_ref = self.class_name.get_or_insert_with(|| {
1122 fidl::new_empty!(
1123 fidl::encoding::BoundedString<255>,
1124 fdomain_client::fidl::FDomainResourceDialect
1125 )
1126 });
1127 fidl::decode!(
1128 fidl::encoding::BoundedString<255>,
1129 fdomain_client::fidl::FDomainResourceDialect,
1130 val_ref,
1131 decoder,
1132 inner_offset,
1133 inner_depth
1134 )?;
1135 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1136 {
1137 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1138 }
1139 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1140 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1141 }
1142 }
1143
1144 next_offset += envelope_size;
1145 _next_ordinal_to_read += 1;
1146 if next_offset >= end_offset {
1147 return Ok(());
1148 }
1149
1150 while _next_ordinal_to_read < 3 {
1152 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1153 _next_ordinal_to_read += 1;
1154 next_offset += envelope_size;
1155 }
1156
1157 let next_out_of_line = decoder.next_out_of_line();
1158 let handles_before = decoder.remaining_handles();
1159 if let Some((inlined, num_bytes, num_handles)) =
1160 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1161 {
1162 let member_inline_size = <fidl::encoding::HandleType<
1163 fdomain_client::Vmo,
1164 { fidl::ObjectType::VMO.into_raw() },
1165 2147483648,
1166 > as fidl::encoding::TypeMarker>::inline_size(
1167 decoder.context
1168 );
1169 if inlined != (member_inline_size <= 4) {
1170 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1171 }
1172 let inner_offset;
1173 let mut inner_depth = depth.clone();
1174 if inlined {
1175 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1176 inner_offset = next_offset;
1177 } else {
1178 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1179 inner_depth.increment()?;
1180 }
1181 let val_ref =
1182 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));
1183 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)?;
1184 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1185 {
1186 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1187 }
1188 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1189 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1190 }
1191 }
1192
1193 next_offset += envelope_size;
1194 _next_ordinal_to_read += 1;
1195 if next_offset >= end_offset {
1196 return Ok(());
1197 }
1198
1199 while _next_ordinal_to_read < 4 {
1201 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1202 _next_ordinal_to_read += 1;
1203 next_offset += envelope_size;
1204 }
1205
1206 let next_out_of_line = decoder.next_out_of_line();
1207 let handles_before = decoder.remaining_handles();
1208 if let Some((inlined, num_bytes, num_handles)) =
1209 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1210 {
1211 let member_inline_size =
1212 <ConnectionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1213 if inlined != (member_inline_size <= 4) {
1214 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1215 }
1216 let inner_offset;
1217 let mut inner_depth = depth.clone();
1218 if inlined {
1219 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1220 inner_offset = next_offset;
1221 } else {
1222 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1223 inner_depth.increment()?;
1224 }
1225 let val_ref = self.connector_supports.get_or_insert_with(|| {
1226 fidl::new_empty!(ConnectionType, fdomain_client::fidl::FDomainResourceDialect)
1227 });
1228 fidl::decode!(
1229 ConnectionType,
1230 fdomain_client::fidl::FDomainResourceDialect,
1231 val_ref,
1232 decoder,
1233 inner_offset,
1234 inner_depth
1235 )?;
1236 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1237 {
1238 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1239 }
1240 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1241 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1242 }
1243 }
1244
1245 next_offset += envelope_size;
1246 _next_ordinal_to_read += 1;
1247 if next_offset >= end_offset {
1248 return Ok(());
1249 }
1250
1251 while _next_ordinal_to_read < 5 {
1253 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1254 _next_ordinal_to_read += 1;
1255 next_offset += envelope_size;
1256 }
1257
1258 let next_out_of_line = decoder.next_out_of_line();
1259 let handles_before = decoder.remaining_handles();
1260 if let Some((inlined, num_bytes, num_handles)) =
1261 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1262 {
1263 let member_inline_size = <fidl::encoding::Endpoint<
1264 fdomain_client::fidl::ClientEnd<ConnectorMarker>,
1265 > as fidl::encoding::TypeMarker>::inline_size(
1266 decoder.context
1267 );
1268 if inlined != (member_inline_size <= 4) {
1269 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1270 }
1271 let inner_offset;
1272 let mut inner_depth = depth.clone();
1273 if inlined {
1274 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1275 inner_offset = next_offset;
1276 } else {
1277 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1278 inner_depth.increment()?;
1279 }
1280 let val_ref = self.controller_connector.get_or_insert_with(|| {
1281 fidl::new_empty!(
1282 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1283 fdomain_client::fidl::FDomainResourceDialect
1284 )
1285 });
1286 fidl::decode!(
1287 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<ConnectorMarker>>,
1288 fdomain_client::fidl::FDomainResourceDialect,
1289 val_ref,
1290 decoder,
1291 inner_offset,
1292 inner_depth
1293 )?;
1294 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1295 {
1296 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1297 }
1298 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1299 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1300 }
1301 }
1302
1303 next_offset += envelope_size;
1304
1305 while next_offset < end_offset {
1307 _next_ordinal_to_read += 1;
1308 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1309 next_offset += envelope_size;
1310 }
1311
1312 Ok(())
1313 }
1314 }
1315}