1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub enum Error {
16 Unsupported,
19 InvalidArguments,
21 NotFound,
23 AlreadyExists,
26 BadRule,
29 RetryExceeded,
32 #[doc(hidden)]
33 __SourceBreaking { unknown_ordinal: u32 },
34}
35
36#[macro_export]
38macro_rules! ErrorUnknown {
39 () => {
40 _
41 };
42}
43
44impl Error {
45 #[inline]
46 pub fn from_primitive(prim: u32) -> Option<Self> {
47 match prim {
48 0 => Some(Self::Unsupported),
49 1 => Some(Self::InvalidArguments),
50 2 => Some(Self::NotFound),
51 3 => Some(Self::AlreadyExists),
52 4 => Some(Self::BadRule),
53 5 => Some(Self::RetryExceeded),
54 _ => None,
55 }
56 }
57
58 #[inline]
59 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
60 match prim {
61 0 => Self::Unsupported,
62 1 => Self::InvalidArguments,
63 2 => Self::NotFound,
64 3 => Self::AlreadyExists,
65 4 => Self::BadRule,
66 5 => Self::RetryExceeded,
67 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
68 }
69 }
70
71 #[inline]
72 pub fn unknown() -> Self {
73 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
74 }
75
76 #[inline]
77 pub const fn into_primitive(self) -> u32 {
78 match self {
79 Self::Unsupported => 0,
80 Self::InvalidArguments => 1,
81 Self::NotFound => 2,
82 Self::AlreadyExists => 3,
83 Self::BadRule => 4,
84 Self::RetryExceeded => 5,
85 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
86 }
87 }
88
89 #[inline]
90 pub fn is_unknown(&self) -> bool {
91 match self {
92 Self::__SourceBreaking { unknown_ordinal: _ } => true,
93 _ => false,
94 }
95 }
96}
97
98#[derive(Clone, Debug, PartialEq)]
99pub struct ControlConfig {
100 pub src_subnet: fidl_fuchsia_net::Subnet,
102 pub output_interface: u64,
104}
105
106impl fidl::Persistable for ControlConfig {}
107
108#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
109pub struct ControlSetEnabledRequest {
110 pub enabled: bool,
111}
112
113impl fidl::Persistable for ControlSetEnabledRequest {}
114
115#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
116pub struct ControlSetEnabledResponse {
117 pub was_enabled: bool,
118}
119
120impl fidl::Persistable for ControlSetEnabledResponse {}
121
122#[derive(Debug, PartialEq)]
123pub struct FactoryCreateRequest {
124 pub config: ControlConfig,
125 pub control: fidl::endpoints::ServerEnd<ControlMarker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FactoryCreateRequest {}
129
130#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
131pub struct ControlMarker;
132
133impl fidl::endpoints::ProtocolMarker for ControlMarker {
134 type Proxy = ControlProxy;
135 type RequestStream = ControlRequestStream;
136 #[cfg(target_os = "fuchsia")]
137 type SynchronousProxy = ControlSynchronousProxy;
138
139 const DEBUG_NAME: &'static str = "(anonymous) Control";
140}
141pub type ControlSetEnabledResult = Result<bool, Error>;
142
143pub trait ControlProxyInterface: Send + Sync {
144 type SetEnabledResponseFut: std::future::Future<Output = Result<ControlSetEnabledResult, fidl::Error>>
145 + Send;
146 fn r#set_enabled(&self, enabled: bool) -> Self::SetEnabledResponseFut;
147}
148#[derive(Debug)]
149#[cfg(target_os = "fuchsia")]
150pub struct ControlSynchronousProxy {
151 client: fidl::client::sync::Client,
152}
153
154#[cfg(target_os = "fuchsia")]
155impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
156 type Proxy = ControlProxy;
157 type Protocol = ControlMarker;
158
159 fn from_channel(inner: fidl::Channel) -> Self {
160 Self::new(inner)
161 }
162
163 fn into_channel(self) -> fidl::Channel {
164 self.client.into_channel()
165 }
166
167 fn as_channel(&self) -> &fidl::Channel {
168 self.client.as_channel()
169 }
170}
171
172#[cfg(target_os = "fuchsia")]
173impl ControlSynchronousProxy {
174 pub fn new(channel: fidl::Channel) -> Self {
175 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
176 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
177 }
178
179 pub fn into_channel(self) -> fidl::Channel {
180 self.client.into_channel()
181 }
182
183 pub fn wait_for_event(
186 &self,
187 deadline: zx::MonotonicInstant,
188 ) -> Result<ControlEvent, fidl::Error> {
189 ControlEvent::decode(self.client.wait_for_event(deadline)?)
190 }
191
192 pub fn r#set_enabled(
199 &self,
200 mut enabled: bool,
201 ___deadline: zx::MonotonicInstant,
202 ) -> Result<ControlSetEnabledResult, fidl::Error> {
203 let _response = self.client.send_query::<
204 ControlSetEnabledRequest,
205 fidl::encoding::ResultType<ControlSetEnabledResponse, Error>,
206 >(
207 (enabled,),
208 0x13b7914afdb709a6,
209 fidl::encoding::DynamicFlags::empty(),
210 ___deadline,
211 )?;
212 Ok(_response.map(|x| x.was_enabled))
213 }
214}
215
216#[derive(Debug, Clone)]
217pub struct ControlProxy {
218 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
219}
220
221impl fidl::endpoints::Proxy for ControlProxy {
222 type Protocol = ControlMarker;
223
224 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
225 Self::new(inner)
226 }
227
228 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
229 self.client.into_channel().map_err(|client| Self { client })
230 }
231
232 fn as_channel(&self) -> &::fidl::AsyncChannel {
233 self.client.as_channel()
234 }
235}
236
237impl ControlProxy {
238 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
240 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
241 Self { client: fidl::client::Client::new(channel, protocol_name) }
242 }
243
244 pub fn take_event_stream(&self) -> ControlEventStream {
250 ControlEventStream { event_receiver: self.client.take_event_receiver() }
251 }
252
253 pub fn r#set_enabled(
260 &self,
261 mut enabled: bool,
262 ) -> fidl::client::QueryResponseFut<
263 ControlSetEnabledResult,
264 fidl::encoding::DefaultFuchsiaResourceDialect,
265 > {
266 ControlProxyInterface::r#set_enabled(self, enabled)
267 }
268}
269
270impl ControlProxyInterface for ControlProxy {
271 type SetEnabledResponseFut = fidl::client::QueryResponseFut<
272 ControlSetEnabledResult,
273 fidl::encoding::DefaultFuchsiaResourceDialect,
274 >;
275 fn r#set_enabled(&self, mut enabled: bool) -> Self::SetEnabledResponseFut {
276 fn _decode(
277 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
278 ) -> Result<ControlSetEnabledResult, fidl::Error> {
279 let _response = fidl::client::decode_transaction_body::<
280 fidl::encoding::ResultType<ControlSetEnabledResponse, Error>,
281 fidl::encoding::DefaultFuchsiaResourceDialect,
282 0x13b7914afdb709a6,
283 >(_buf?)?;
284 Ok(_response.map(|x| x.was_enabled))
285 }
286 self.client.send_query_and_decode::<ControlSetEnabledRequest, ControlSetEnabledResult>(
287 (enabled,),
288 0x13b7914afdb709a6,
289 fidl::encoding::DynamicFlags::empty(),
290 _decode,
291 )
292 }
293}
294
295pub struct ControlEventStream {
296 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
297}
298
299impl std::marker::Unpin for ControlEventStream {}
300
301impl futures::stream::FusedStream for ControlEventStream {
302 fn is_terminated(&self) -> bool {
303 self.event_receiver.is_terminated()
304 }
305}
306
307impl futures::Stream for ControlEventStream {
308 type Item = Result<ControlEvent, fidl::Error>;
309
310 fn poll_next(
311 mut self: std::pin::Pin<&mut Self>,
312 cx: &mut std::task::Context<'_>,
313 ) -> std::task::Poll<Option<Self::Item>> {
314 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
315 &mut self.event_receiver,
316 cx
317 )?) {
318 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
319 None => std::task::Poll::Ready(None),
320 }
321 }
322}
323
324#[derive(Debug)]
325pub enum ControlEvent {}
326
327impl ControlEvent {
328 fn decode(
330 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
331 ) -> Result<ControlEvent, fidl::Error> {
332 let (bytes, _handles) = buf.split_mut();
333 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
334 debug_assert_eq!(tx_header.tx_id, 0);
335 match tx_header.ordinal {
336 _ => Err(fidl::Error::UnknownOrdinal {
337 ordinal: tx_header.ordinal,
338 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
339 }),
340 }
341 }
342}
343
344pub struct ControlRequestStream {
346 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
347 is_terminated: bool,
348}
349
350impl std::marker::Unpin for ControlRequestStream {}
351
352impl futures::stream::FusedStream for ControlRequestStream {
353 fn is_terminated(&self) -> bool {
354 self.is_terminated
355 }
356}
357
358impl fidl::endpoints::RequestStream for ControlRequestStream {
359 type Protocol = ControlMarker;
360 type ControlHandle = ControlControlHandle;
361
362 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
363 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
364 }
365
366 fn control_handle(&self) -> Self::ControlHandle {
367 ControlControlHandle { inner: self.inner.clone() }
368 }
369
370 fn into_inner(
371 self,
372 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
373 {
374 (self.inner, self.is_terminated)
375 }
376
377 fn from_inner(
378 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
379 is_terminated: bool,
380 ) -> Self {
381 Self { inner, is_terminated }
382 }
383}
384
385impl futures::Stream for ControlRequestStream {
386 type Item = Result<ControlRequest, fidl::Error>;
387
388 fn poll_next(
389 mut self: std::pin::Pin<&mut Self>,
390 cx: &mut std::task::Context<'_>,
391 ) -> std::task::Poll<Option<Self::Item>> {
392 let this = &mut *self;
393 if this.inner.check_shutdown(cx) {
394 this.is_terminated = true;
395 return std::task::Poll::Ready(None);
396 }
397 if this.is_terminated {
398 panic!("polled ControlRequestStream after completion");
399 }
400 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
401 |bytes, handles| {
402 match this.inner.channel().read_etc(cx, bytes, handles) {
403 std::task::Poll::Ready(Ok(())) => {}
404 std::task::Poll::Pending => return std::task::Poll::Pending,
405 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
406 this.is_terminated = true;
407 return std::task::Poll::Ready(None);
408 }
409 std::task::Poll::Ready(Err(e)) => {
410 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
411 e.into(),
412 ))))
413 }
414 }
415
416 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
418
419 std::task::Poll::Ready(Some(match header.ordinal {
420 0x13b7914afdb709a6 => {
421 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
422 let mut req = fidl::new_empty!(
423 ControlSetEnabledRequest,
424 fidl::encoding::DefaultFuchsiaResourceDialect
425 );
426 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
427 let control_handle = ControlControlHandle { inner: this.inner.clone() };
428 Ok(ControlRequest::SetEnabled {
429 enabled: req.enabled,
430
431 responder: ControlSetEnabledResponder {
432 control_handle: std::mem::ManuallyDrop::new(control_handle),
433 tx_id: header.tx_id,
434 },
435 })
436 }
437 _ => Err(fidl::Error::UnknownOrdinal {
438 ordinal: header.ordinal,
439 protocol_name:
440 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
441 }),
442 }))
443 },
444 )
445 }
446}
447
448#[derive(Debug)]
454pub enum ControlRequest {
455 SetEnabled { enabled: bool, responder: ControlSetEnabledResponder },
462}
463
464impl ControlRequest {
465 #[allow(irrefutable_let_patterns)]
466 pub fn into_set_enabled(self) -> Option<(bool, ControlSetEnabledResponder)> {
467 if let ControlRequest::SetEnabled { enabled, responder } = self {
468 Some((enabled, responder))
469 } else {
470 None
471 }
472 }
473
474 pub fn method_name(&self) -> &'static str {
476 match *self {
477 ControlRequest::SetEnabled { .. } => "set_enabled",
478 }
479 }
480}
481
482#[derive(Debug, Clone)]
483pub struct ControlControlHandle {
484 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
485}
486
487impl fidl::endpoints::ControlHandle for ControlControlHandle {
488 fn shutdown(&self) {
489 self.inner.shutdown()
490 }
491 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
492 self.inner.shutdown_with_epitaph(status)
493 }
494
495 fn is_closed(&self) -> bool {
496 self.inner.channel().is_closed()
497 }
498 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
499 self.inner.channel().on_closed()
500 }
501
502 #[cfg(target_os = "fuchsia")]
503 fn signal_peer(
504 &self,
505 clear_mask: zx::Signals,
506 set_mask: zx::Signals,
507 ) -> Result<(), zx_status::Status> {
508 use fidl::Peered;
509 self.inner.channel().signal_peer(clear_mask, set_mask)
510 }
511}
512
513impl ControlControlHandle {}
514
515#[must_use = "FIDL methods require a response to be sent"]
516#[derive(Debug)]
517pub struct ControlSetEnabledResponder {
518 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
519 tx_id: u32,
520}
521
522impl std::ops::Drop for ControlSetEnabledResponder {
526 fn drop(&mut self) {
527 self.control_handle.shutdown();
528 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
530 }
531}
532
533impl fidl::endpoints::Responder for ControlSetEnabledResponder {
534 type ControlHandle = ControlControlHandle;
535
536 fn control_handle(&self) -> &ControlControlHandle {
537 &self.control_handle
538 }
539
540 fn drop_without_shutdown(mut self) {
541 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
543 std::mem::forget(self);
545 }
546}
547
548impl ControlSetEnabledResponder {
549 pub fn send(self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
553 let _result = self.send_raw(result);
554 if _result.is_err() {
555 self.control_handle.shutdown();
556 }
557 self.drop_without_shutdown();
558 _result
559 }
560
561 pub fn send_no_shutdown_on_err(
563 self,
564 mut result: Result<bool, Error>,
565 ) -> Result<(), fidl::Error> {
566 let _result = self.send_raw(result);
567 self.drop_without_shutdown();
568 _result
569 }
570
571 fn send_raw(&self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
572 self.control_handle
573 .inner
574 .send::<fidl::encoding::ResultType<ControlSetEnabledResponse, Error>>(
575 result.map(|was_enabled| (was_enabled,)),
576 self.tx_id,
577 0x13b7914afdb709a6,
578 fidl::encoding::DynamicFlags::empty(),
579 )
580 }
581}
582
583#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
584pub struct FactoryMarker;
585
586impl fidl::endpoints::ProtocolMarker for FactoryMarker {
587 type Proxy = FactoryProxy;
588 type RequestStream = FactoryRequestStream;
589 #[cfg(target_os = "fuchsia")]
590 type SynchronousProxy = FactorySynchronousProxy;
591
592 const DEBUG_NAME: &'static str = "fuchsia.net.masquerade.Factory";
593}
594impl fidl::endpoints::DiscoverableProtocolMarker for FactoryMarker {}
595pub type FactoryCreateResult = Result<(), Error>;
596
597pub trait FactoryProxyInterface: Send + Sync {
598 type CreateResponseFut: std::future::Future<Output = Result<FactoryCreateResult, fidl::Error>>
599 + Send;
600 fn r#create(
601 &self,
602 config: &ControlConfig,
603 control: fidl::endpoints::ServerEnd<ControlMarker>,
604 ) -> Self::CreateResponseFut;
605}
606#[derive(Debug)]
607#[cfg(target_os = "fuchsia")]
608pub struct FactorySynchronousProxy {
609 client: fidl::client::sync::Client,
610}
611
612#[cfg(target_os = "fuchsia")]
613impl fidl::endpoints::SynchronousProxy for FactorySynchronousProxy {
614 type Proxy = FactoryProxy;
615 type Protocol = FactoryMarker;
616
617 fn from_channel(inner: fidl::Channel) -> Self {
618 Self::new(inner)
619 }
620
621 fn into_channel(self) -> fidl::Channel {
622 self.client.into_channel()
623 }
624
625 fn as_channel(&self) -> &fidl::Channel {
626 self.client.as_channel()
627 }
628}
629
630#[cfg(target_os = "fuchsia")]
631impl FactorySynchronousProxy {
632 pub fn new(channel: fidl::Channel) -> Self {
633 let protocol_name = <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
634 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
635 }
636
637 pub fn into_channel(self) -> fidl::Channel {
638 self.client.into_channel()
639 }
640
641 pub fn wait_for_event(
644 &self,
645 deadline: zx::MonotonicInstant,
646 ) -> Result<FactoryEvent, fidl::Error> {
647 FactoryEvent::decode(self.client.wait_for_event(deadline)?)
648 }
649
650 pub fn r#create(
665 &self,
666 mut config: &ControlConfig,
667 mut control: fidl::endpoints::ServerEnd<ControlMarker>,
668 ___deadline: zx::MonotonicInstant,
669 ) -> Result<FactoryCreateResult, fidl::Error> {
670 let _response = self.client.send_query::<FactoryCreateRequest, fidl::encoding::ResultType<
671 fidl::encoding::EmptyStruct,
672 Error,
673 >>(
674 (config, control),
675 0x65f64a124fd0170e,
676 fidl::encoding::DynamicFlags::empty(),
677 ___deadline,
678 )?;
679 Ok(_response.map(|x| x))
680 }
681}
682
683#[derive(Debug, Clone)]
684pub struct FactoryProxy {
685 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
686}
687
688impl fidl::endpoints::Proxy for FactoryProxy {
689 type Protocol = FactoryMarker;
690
691 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
692 Self::new(inner)
693 }
694
695 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
696 self.client.into_channel().map_err(|client| Self { client })
697 }
698
699 fn as_channel(&self) -> &::fidl::AsyncChannel {
700 self.client.as_channel()
701 }
702}
703
704impl FactoryProxy {
705 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
707 let protocol_name = <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
708 Self { client: fidl::client::Client::new(channel, protocol_name) }
709 }
710
711 pub fn take_event_stream(&self) -> FactoryEventStream {
717 FactoryEventStream { event_receiver: self.client.take_event_receiver() }
718 }
719
720 pub fn r#create(
735 &self,
736 mut config: &ControlConfig,
737 mut control: fidl::endpoints::ServerEnd<ControlMarker>,
738 ) -> fidl::client::QueryResponseFut<
739 FactoryCreateResult,
740 fidl::encoding::DefaultFuchsiaResourceDialect,
741 > {
742 FactoryProxyInterface::r#create(self, config, control)
743 }
744}
745
746impl FactoryProxyInterface for FactoryProxy {
747 type CreateResponseFut = fidl::client::QueryResponseFut<
748 FactoryCreateResult,
749 fidl::encoding::DefaultFuchsiaResourceDialect,
750 >;
751 fn r#create(
752 &self,
753 mut config: &ControlConfig,
754 mut control: fidl::endpoints::ServerEnd<ControlMarker>,
755 ) -> Self::CreateResponseFut {
756 fn _decode(
757 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
758 ) -> Result<FactoryCreateResult, fidl::Error> {
759 let _response = fidl::client::decode_transaction_body::<
760 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
761 fidl::encoding::DefaultFuchsiaResourceDialect,
762 0x65f64a124fd0170e,
763 >(_buf?)?;
764 Ok(_response.map(|x| x))
765 }
766 self.client.send_query_and_decode::<FactoryCreateRequest, FactoryCreateResult>(
767 (config, control),
768 0x65f64a124fd0170e,
769 fidl::encoding::DynamicFlags::empty(),
770 _decode,
771 )
772 }
773}
774
775pub struct FactoryEventStream {
776 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
777}
778
779impl std::marker::Unpin for FactoryEventStream {}
780
781impl futures::stream::FusedStream for FactoryEventStream {
782 fn is_terminated(&self) -> bool {
783 self.event_receiver.is_terminated()
784 }
785}
786
787impl futures::Stream for FactoryEventStream {
788 type Item = Result<FactoryEvent, fidl::Error>;
789
790 fn poll_next(
791 mut self: std::pin::Pin<&mut Self>,
792 cx: &mut std::task::Context<'_>,
793 ) -> std::task::Poll<Option<Self::Item>> {
794 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
795 &mut self.event_receiver,
796 cx
797 )?) {
798 Some(buf) => std::task::Poll::Ready(Some(FactoryEvent::decode(buf))),
799 None => std::task::Poll::Ready(None),
800 }
801 }
802}
803
804#[derive(Debug)]
805pub enum FactoryEvent {}
806
807impl FactoryEvent {
808 fn decode(
810 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
811 ) -> Result<FactoryEvent, fidl::Error> {
812 let (bytes, _handles) = buf.split_mut();
813 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
814 debug_assert_eq!(tx_header.tx_id, 0);
815 match tx_header.ordinal {
816 _ => Err(fidl::Error::UnknownOrdinal {
817 ordinal: tx_header.ordinal,
818 protocol_name: <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
819 }),
820 }
821 }
822}
823
824pub struct FactoryRequestStream {
826 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
827 is_terminated: bool,
828}
829
830impl std::marker::Unpin for FactoryRequestStream {}
831
832impl futures::stream::FusedStream for FactoryRequestStream {
833 fn is_terminated(&self) -> bool {
834 self.is_terminated
835 }
836}
837
838impl fidl::endpoints::RequestStream for FactoryRequestStream {
839 type Protocol = FactoryMarker;
840 type ControlHandle = FactoryControlHandle;
841
842 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
843 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
844 }
845
846 fn control_handle(&self) -> Self::ControlHandle {
847 FactoryControlHandle { inner: self.inner.clone() }
848 }
849
850 fn into_inner(
851 self,
852 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
853 {
854 (self.inner, self.is_terminated)
855 }
856
857 fn from_inner(
858 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
859 is_terminated: bool,
860 ) -> Self {
861 Self { inner, is_terminated }
862 }
863}
864
865impl futures::Stream for FactoryRequestStream {
866 type Item = Result<FactoryRequest, fidl::Error>;
867
868 fn poll_next(
869 mut self: std::pin::Pin<&mut Self>,
870 cx: &mut std::task::Context<'_>,
871 ) -> std::task::Poll<Option<Self::Item>> {
872 let this = &mut *self;
873 if this.inner.check_shutdown(cx) {
874 this.is_terminated = true;
875 return std::task::Poll::Ready(None);
876 }
877 if this.is_terminated {
878 panic!("polled FactoryRequestStream after completion");
879 }
880 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
881 |bytes, handles| {
882 match this.inner.channel().read_etc(cx, bytes, handles) {
883 std::task::Poll::Ready(Ok(())) => {}
884 std::task::Poll::Pending => return std::task::Poll::Pending,
885 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
886 this.is_terminated = true;
887 return std::task::Poll::Ready(None);
888 }
889 std::task::Poll::Ready(Err(e)) => {
890 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
891 e.into(),
892 ))))
893 }
894 }
895
896 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
898
899 std::task::Poll::Ready(Some(match header.ordinal {
900 0x65f64a124fd0170e => {
901 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
902 let mut req = fidl::new_empty!(
903 FactoryCreateRequest,
904 fidl::encoding::DefaultFuchsiaResourceDialect
905 );
906 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryCreateRequest>(&header, _body_bytes, handles, &mut req)?;
907 let control_handle = FactoryControlHandle { inner: this.inner.clone() };
908 Ok(FactoryRequest::Create {
909 config: req.config,
910 control: req.control,
911
912 responder: FactoryCreateResponder {
913 control_handle: std::mem::ManuallyDrop::new(control_handle),
914 tx_id: header.tx_id,
915 },
916 })
917 }
918 _ => Err(fidl::Error::UnknownOrdinal {
919 ordinal: header.ordinal,
920 protocol_name:
921 <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
922 }),
923 }))
924 },
925 )
926 }
927}
928
929#[derive(Debug)]
934pub enum FactoryRequest {
935 Create {
950 config: ControlConfig,
951 control: fidl::endpoints::ServerEnd<ControlMarker>,
952 responder: FactoryCreateResponder,
953 },
954}
955
956impl FactoryRequest {
957 #[allow(irrefutable_let_patterns)]
958 pub fn into_create(
959 self,
960 ) -> Option<(ControlConfig, fidl::endpoints::ServerEnd<ControlMarker>, FactoryCreateResponder)>
961 {
962 if let FactoryRequest::Create { config, control, responder } = self {
963 Some((config, control, responder))
964 } else {
965 None
966 }
967 }
968
969 pub fn method_name(&self) -> &'static str {
971 match *self {
972 FactoryRequest::Create { .. } => "create",
973 }
974 }
975}
976
977#[derive(Debug, Clone)]
978pub struct FactoryControlHandle {
979 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
980}
981
982impl fidl::endpoints::ControlHandle for FactoryControlHandle {
983 fn shutdown(&self) {
984 self.inner.shutdown()
985 }
986 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
987 self.inner.shutdown_with_epitaph(status)
988 }
989
990 fn is_closed(&self) -> bool {
991 self.inner.channel().is_closed()
992 }
993 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
994 self.inner.channel().on_closed()
995 }
996
997 #[cfg(target_os = "fuchsia")]
998 fn signal_peer(
999 &self,
1000 clear_mask: zx::Signals,
1001 set_mask: zx::Signals,
1002 ) -> Result<(), zx_status::Status> {
1003 use fidl::Peered;
1004 self.inner.channel().signal_peer(clear_mask, set_mask)
1005 }
1006}
1007
1008impl FactoryControlHandle {}
1009
1010#[must_use = "FIDL methods require a response to be sent"]
1011#[derive(Debug)]
1012pub struct FactoryCreateResponder {
1013 control_handle: std::mem::ManuallyDrop<FactoryControlHandle>,
1014 tx_id: u32,
1015}
1016
1017impl std::ops::Drop for FactoryCreateResponder {
1021 fn drop(&mut self) {
1022 self.control_handle.shutdown();
1023 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025 }
1026}
1027
1028impl fidl::endpoints::Responder for FactoryCreateResponder {
1029 type ControlHandle = FactoryControlHandle;
1030
1031 fn control_handle(&self) -> &FactoryControlHandle {
1032 &self.control_handle
1033 }
1034
1035 fn drop_without_shutdown(mut self) {
1036 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1038 std::mem::forget(self);
1040 }
1041}
1042
1043impl FactoryCreateResponder {
1044 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1048 let _result = self.send_raw(result);
1049 if _result.is_err() {
1050 self.control_handle.shutdown();
1051 }
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1058 let _result = self.send_raw(result);
1059 self.drop_without_shutdown();
1060 _result
1061 }
1062
1063 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1064 self.control_handle
1065 .inner
1066 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1067 result,
1068 self.tx_id,
1069 0x65f64a124fd0170e,
1070 fidl::encoding::DynamicFlags::empty(),
1071 )
1072 }
1073}
1074
1075mod internal {
1076 use super::*;
1077 unsafe impl fidl::encoding::TypeMarker for Error {
1078 type Owned = Self;
1079
1080 #[inline(always)]
1081 fn inline_align(_context: fidl::encoding::Context) -> usize {
1082 std::mem::align_of::<u32>()
1083 }
1084
1085 #[inline(always)]
1086 fn inline_size(_context: fidl::encoding::Context) -> usize {
1087 std::mem::size_of::<u32>()
1088 }
1089
1090 #[inline(always)]
1091 fn encode_is_copy() -> bool {
1092 false
1093 }
1094
1095 #[inline(always)]
1096 fn decode_is_copy() -> bool {
1097 false
1098 }
1099 }
1100
1101 impl fidl::encoding::ValueTypeMarker for Error {
1102 type Borrowed<'a> = Self;
1103 #[inline(always)]
1104 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1105 *value
1106 }
1107 }
1108
1109 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
1110 #[inline]
1111 unsafe fn encode(
1112 self,
1113 encoder: &mut fidl::encoding::Encoder<'_, D>,
1114 offset: usize,
1115 _depth: fidl::encoding::Depth,
1116 ) -> fidl::Result<()> {
1117 encoder.debug_check_bounds::<Self>(offset);
1118 encoder.write_num(self.into_primitive(), offset);
1119 Ok(())
1120 }
1121 }
1122
1123 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
1124 #[inline(always)]
1125 fn new_empty() -> Self {
1126 Self::unknown()
1127 }
1128
1129 #[inline]
1130 unsafe fn decode(
1131 &mut self,
1132 decoder: &mut fidl::encoding::Decoder<'_, D>,
1133 offset: usize,
1134 _depth: fidl::encoding::Depth,
1135 ) -> fidl::Result<()> {
1136 decoder.debug_check_bounds::<Self>(offset);
1137 let prim = decoder.read_num::<u32>(offset);
1138
1139 *self = Self::from_primitive_allow_unknown(prim);
1140 Ok(())
1141 }
1142 }
1143
1144 impl fidl::encoding::ValueTypeMarker for ControlConfig {
1145 type Borrowed<'a> = &'a Self;
1146 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1147 value
1148 }
1149 }
1150
1151 unsafe impl fidl::encoding::TypeMarker for ControlConfig {
1152 type Owned = Self;
1153
1154 #[inline(always)]
1155 fn inline_align(_context: fidl::encoding::Context) -> usize {
1156 8
1157 }
1158
1159 #[inline(always)]
1160 fn inline_size(_context: fidl::encoding::Context) -> usize {
1161 32
1162 }
1163 }
1164
1165 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ControlConfig, D>
1166 for &ControlConfig
1167 {
1168 #[inline]
1169 unsafe fn encode(
1170 self,
1171 encoder: &mut fidl::encoding::Encoder<'_, D>,
1172 offset: usize,
1173 _depth: fidl::encoding::Depth,
1174 ) -> fidl::Result<()> {
1175 encoder.debug_check_bounds::<ControlConfig>(offset);
1176 fidl::encoding::Encode::<ControlConfig, D>::encode(
1178 (
1179 <fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(
1180 &self.src_subnet,
1181 ),
1182 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.output_interface),
1183 ),
1184 encoder,
1185 offset,
1186 _depth,
1187 )
1188 }
1189 }
1190 unsafe impl<
1191 D: fidl::encoding::ResourceDialect,
1192 T0: fidl::encoding::Encode<fidl_fuchsia_net::Subnet, D>,
1193 T1: fidl::encoding::Encode<u64, D>,
1194 > fidl::encoding::Encode<ControlConfig, D> for (T0, T1)
1195 {
1196 #[inline]
1197 unsafe fn encode(
1198 self,
1199 encoder: &mut fidl::encoding::Encoder<'_, D>,
1200 offset: usize,
1201 depth: fidl::encoding::Depth,
1202 ) -> fidl::Result<()> {
1203 encoder.debug_check_bounds::<ControlConfig>(offset);
1204 self.0.encode(encoder, offset + 0, depth)?;
1208 self.1.encode(encoder, offset + 24, depth)?;
1209 Ok(())
1210 }
1211 }
1212
1213 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControlConfig {
1214 #[inline(always)]
1215 fn new_empty() -> Self {
1216 Self {
1217 src_subnet: fidl::new_empty!(fidl_fuchsia_net::Subnet, D),
1218 output_interface: fidl::new_empty!(u64, D),
1219 }
1220 }
1221
1222 #[inline]
1223 unsafe fn decode(
1224 &mut self,
1225 decoder: &mut fidl::encoding::Decoder<'_, D>,
1226 offset: usize,
1227 _depth: fidl::encoding::Depth,
1228 ) -> fidl::Result<()> {
1229 decoder.debug_check_bounds::<Self>(offset);
1230 fidl::decode!(
1232 fidl_fuchsia_net::Subnet,
1233 D,
1234 &mut self.src_subnet,
1235 decoder,
1236 offset + 0,
1237 _depth
1238 )?;
1239 fidl::decode!(u64, D, &mut self.output_interface, decoder, offset + 24, _depth)?;
1240 Ok(())
1241 }
1242 }
1243
1244 impl fidl::encoding::ValueTypeMarker for ControlSetEnabledRequest {
1245 type Borrowed<'a> = &'a Self;
1246 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1247 value
1248 }
1249 }
1250
1251 unsafe impl fidl::encoding::TypeMarker for ControlSetEnabledRequest {
1252 type Owned = Self;
1253
1254 #[inline(always)]
1255 fn inline_align(_context: fidl::encoding::Context) -> usize {
1256 1
1257 }
1258
1259 #[inline(always)]
1260 fn inline_size(_context: fidl::encoding::Context) -> usize {
1261 1
1262 }
1263 }
1264
1265 unsafe impl<D: fidl::encoding::ResourceDialect>
1266 fidl::encoding::Encode<ControlSetEnabledRequest, D> for &ControlSetEnabledRequest
1267 {
1268 #[inline]
1269 unsafe fn encode(
1270 self,
1271 encoder: &mut fidl::encoding::Encoder<'_, D>,
1272 offset: usize,
1273 _depth: fidl::encoding::Depth,
1274 ) -> fidl::Result<()> {
1275 encoder.debug_check_bounds::<ControlSetEnabledRequest>(offset);
1276 fidl::encoding::Encode::<ControlSetEnabledRequest, D>::encode(
1278 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
1279 encoder,
1280 offset,
1281 _depth,
1282 )
1283 }
1284 }
1285 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1286 fidl::encoding::Encode<ControlSetEnabledRequest, D> for (T0,)
1287 {
1288 #[inline]
1289 unsafe fn encode(
1290 self,
1291 encoder: &mut fidl::encoding::Encoder<'_, D>,
1292 offset: usize,
1293 depth: fidl::encoding::Depth,
1294 ) -> fidl::Result<()> {
1295 encoder.debug_check_bounds::<ControlSetEnabledRequest>(offset);
1296 self.0.encode(encoder, offset + 0, depth)?;
1300 Ok(())
1301 }
1302 }
1303
1304 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1305 for ControlSetEnabledRequest
1306 {
1307 #[inline(always)]
1308 fn new_empty() -> Self {
1309 Self { enabled: fidl::new_empty!(bool, D) }
1310 }
1311
1312 #[inline]
1313 unsafe fn decode(
1314 &mut self,
1315 decoder: &mut fidl::encoding::Decoder<'_, D>,
1316 offset: usize,
1317 _depth: fidl::encoding::Depth,
1318 ) -> fidl::Result<()> {
1319 decoder.debug_check_bounds::<Self>(offset);
1320 fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
1322 Ok(())
1323 }
1324 }
1325
1326 impl fidl::encoding::ValueTypeMarker for ControlSetEnabledResponse {
1327 type Borrowed<'a> = &'a Self;
1328 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1329 value
1330 }
1331 }
1332
1333 unsafe impl fidl::encoding::TypeMarker for ControlSetEnabledResponse {
1334 type Owned = Self;
1335
1336 #[inline(always)]
1337 fn inline_align(_context: fidl::encoding::Context) -> usize {
1338 1
1339 }
1340
1341 #[inline(always)]
1342 fn inline_size(_context: fidl::encoding::Context) -> usize {
1343 1
1344 }
1345 }
1346
1347 unsafe impl<D: fidl::encoding::ResourceDialect>
1348 fidl::encoding::Encode<ControlSetEnabledResponse, D> for &ControlSetEnabledResponse
1349 {
1350 #[inline]
1351 unsafe fn encode(
1352 self,
1353 encoder: &mut fidl::encoding::Encoder<'_, D>,
1354 offset: usize,
1355 _depth: fidl::encoding::Depth,
1356 ) -> fidl::Result<()> {
1357 encoder.debug_check_bounds::<ControlSetEnabledResponse>(offset);
1358 fidl::encoding::Encode::<ControlSetEnabledResponse, D>::encode(
1360 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.was_enabled),),
1361 encoder,
1362 offset,
1363 _depth,
1364 )
1365 }
1366 }
1367 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1368 fidl::encoding::Encode<ControlSetEnabledResponse, D> for (T0,)
1369 {
1370 #[inline]
1371 unsafe fn encode(
1372 self,
1373 encoder: &mut fidl::encoding::Encoder<'_, D>,
1374 offset: usize,
1375 depth: fidl::encoding::Depth,
1376 ) -> fidl::Result<()> {
1377 encoder.debug_check_bounds::<ControlSetEnabledResponse>(offset);
1378 self.0.encode(encoder, offset + 0, depth)?;
1382 Ok(())
1383 }
1384 }
1385
1386 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1387 for ControlSetEnabledResponse
1388 {
1389 #[inline(always)]
1390 fn new_empty() -> Self {
1391 Self { was_enabled: fidl::new_empty!(bool, D) }
1392 }
1393
1394 #[inline]
1395 unsafe fn decode(
1396 &mut self,
1397 decoder: &mut fidl::encoding::Decoder<'_, D>,
1398 offset: usize,
1399 _depth: fidl::encoding::Depth,
1400 ) -> fidl::Result<()> {
1401 decoder.debug_check_bounds::<Self>(offset);
1402 fidl::decode!(bool, D, &mut self.was_enabled, decoder, offset + 0, _depth)?;
1404 Ok(())
1405 }
1406 }
1407
1408 impl fidl::encoding::ResourceTypeMarker for FactoryCreateRequest {
1409 type Borrowed<'a> = &'a mut Self;
1410 fn take_or_borrow<'a>(
1411 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1412 ) -> Self::Borrowed<'a> {
1413 value
1414 }
1415 }
1416
1417 unsafe impl fidl::encoding::TypeMarker for FactoryCreateRequest {
1418 type Owned = Self;
1419
1420 #[inline(always)]
1421 fn inline_align(_context: fidl::encoding::Context) -> usize {
1422 8
1423 }
1424
1425 #[inline(always)]
1426 fn inline_size(_context: fidl::encoding::Context) -> usize {
1427 40
1428 }
1429 }
1430
1431 unsafe impl
1432 fidl::encoding::Encode<FactoryCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1433 for &mut FactoryCreateRequest
1434 {
1435 #[inline]
1436 unsafe fn encode(
1437 self,
1438 encoder: &mut fidl::encoding::Encoder<
1439 '_,
1440 fidl::encoding::DefaultFuchsiaResourceDialect,
1441 >,
1442 offset: usize,
1443 _depth: fidl::encoding::Depth,
1444 ) -> fidl::Result<()> {
1445 encoder.debug_check_bounds::<FactoryCreateRequest>(offset);
1446 fidl::encoding::Encode::<FactoryCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1448 (
1449 <ControlConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1450 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
1451 ),
1452 encoder, offset, _depth
1453 )
1454 }
1455 }
1456 unsafe impl<
1457 T0: fidl::encoding::Encode<ControlConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
1458 T1: fidl::encoding::Encode<
1459 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
1460 fidl::encoding::DefaultFuchsiaResourceDialect,
1461 >,
1462 >
1463 fidl::encoding::Encode<FactoryCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1464 for (T0, T1)
1465 {
1466 #[inline]
1467 unsafe fn encode(
1468 self,
1469 encoder: &mut fidl::encoding::Encoder<
1470 '_,
1471 fidl::encoding::DefaultFuchsiaResourceDialect,
1472 >,
1473 offset: usize,
1474 depth: fidl::encoding::Depth,
1475 ) -> fidl::Result<()> {
1476 encoder.debug_check_bounds::<FactoryCreateRequest>(offset);
1477 unsafe {
1480 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
1481 (ptr as *mut u64).write_unaligned(0);
1482 }
1483 self.0.encode(encoder, offset + 0, depth)?;
1485 self.1.encode(encoder, offset + 32, depth)?;
1486 Ok(())
1487 }
1488 }
1489
1490 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1491 for FactoryCreateRequest
1492 {
1493 #[inline(always)]
1494 fn new_empty() -> Self {
1495 Self {
1496 config: fidl::new_empty!(
1497 ControlConfig,
1498 fidl::encoding::DefaultFuchsiaResourceDialect
1499 ),
1500 control: fidl::new_empty!(
1501 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
1502 fidl::encoding::DefaultFuchsiaResourceDialect
1503 ),
1504 }
1505 }
1506
1507 #[inline]
1508 unsafe fn decode(
1509 &mut self,
1510 decoder: &mut fidl::encoding::Decoder<
1511 '_,
1512 fidl::encoding::DefaultFuchsiaResourceDialect,
1513 >,
1514 offset: usize,
1515 _depth: fidl::encoding::Depth,
1516 ) -> fidl::Result<()> {
1517 decoder.debug_check_bounds::<Self>(offset);
1518 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
1520 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1521 let mask = 0xffffffff00000000u64;
1522 let maskedval = padval & mask;
1523 if maskedval != 0 {
1524 return Err(fidl::Error::NonZeroPadding {
1525 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
1526 });
1527 }
1528 fidl::decode!(
1529 ControlConfig,
1530 fidl::encoding::DefaultFuchsiaResourceDialect,
1531 &mut self.config,
1532 decoder,
1533 offset + 0,
1534 _depth
1535 )?;
1536 fidl::decode!(
1537 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
1538 fidl::encoding::DefaultFuchsiaResourceDialect,
1539 &mut self.control,
1540 decoder,
1541 offset + 32,
1542 _depth
1543 )?;
1544 Ok(())
1545 }
1546 }
1547}