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)]
15#[repr(u32)]
16pub enum NetstackVersion {
17 Netstack2 = 1,
18 Netstack3 = 2,
19}
20
21impl NetstackVersion {
22 #[inline]
23 pub fn from_primitive(prim: u32) -> Option<Self> {
24 match prim {
25 1 => Some(Self::Netstack2),
26 2 => Some(Self::Netstack3),
27 _ => None,
28 }
29 }
30
31 #[inline]
32 pub const fn into_primitive(self) -> u32 {
33 self as u32
34 }
35
36 #[deprecated = "Strict enums should not use `is_unknown`"]
37 #[inline]
38 pub fn is_unknown(&self) -> bool {
39 false
40 }
41}
42
43#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct ControlSetAutomatedNetstackVersionRequest {
45 pub version: Option<Box<VersionSetting>>,
46}
47
48impl fidl::Persistable for ControlSetAutomatedNetstackVersionRequest {}
49
50#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
51pub struct ControlSetUserNetstackVersionRequest {
52 pub version: Option<Box<VersionSetting>>,
53}
54
55impl fidl::Persistable for ControlSetUserNetstackVersionRequest {}
56
57#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58pub struct InEffectVersion {
59 pub current_boot: NetstackVersion,
62 pub automated: Option<Box<VersionSetting>>,
67 pub user: Option<Box<VersionSetting>>,
72}
73
74impl fidl::Persistable for InEffectVersion {}
75
76#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct StateGetNetstackVersionResponse {
78 pub in_effect_version: InEffectVersion,
79}
80
81impl fidl::Persistable for StateGetNetstackVersionResponse {}
82
83#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct VersionSetting {
87 pub version: NetstackVersion,
88}
89
90impl fidl::Persistable for VersionSetting {}
91
92#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
93pub struct ControlMarker;
94
95impl fidl::endpoints::ProtocolMarker for ControlMarker {
96 type Proxy = ControlProxy;
97 type RequestStream = ControlRequestStream;
98 #[cfg(target_os = "fuchsia")]
99 type SynchronousProxy = ControlSynchronousProxy;
100
101 const DEBUG_NAME: &'static str = "fuchsia.net.stackmigrationdeprecated.Control";
102}
103impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
104
105pub trait ControlProxyInterface: Send + Sync {
106 type SetAutomatedNetstackVersionResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
107 + Send;
108 fn r#set_automated_netstack_version(
109 &self,
110 version: Option<&VersionSetting>,
111 ) -> Self::SetAutomatedNetstackVersionResponseFut;
112 type SetUserNetstackVersionResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
113 + Send;
114 fn r#set_user_netstack_version(
115 &self,
116 version: Option<&VersionSetting>,
117 ) -> Self::SetUserNetstackVersionResponseFut;
118}
119#[derive(Debug)]
120#[cfg(target_os = "fuchsia")]
121pub struct ControlSynchronousProxy {
122 client: fidl::client::sync::Client,
123}
124
125#[cfg(target_os = "fuchsia")]
126impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
127 type Proxy = ControlProxy;
128 type Protocol = ControlMarker;
129
130 fn from_channel(inner: fidl::Channel) -> Self {
131 Self::new(inner)
132 }
133
134 fn into_channel(self) -> fidl::Channel {
135 self.client.into_channel()
136 }
137
138 fn as_channel(&self) -> &fidl::Channel {
139 self.client.as_channel()
140 }
141}
142
143#[cfg(target_os = "fuchsia")]
144impl ControlSynchronousProxy {
145 pub fn new(channel: fidl::Channel) -> Self {
146 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
147 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
148 }
149
150 pub fn into_channel(self) -> fidl::Channel {
151 self.client.into_channel()
152 }
153
154 pub fn wait_for_event(
157 &self,
158 deadline: zx::MonotonicInstant,
159 ) -> Result<ControlEvent, fidl::Error> {
160 ControlEvent::decode(self.client.wait_for_event(deadline)?)
161 }
162
163 pub fn r#set_automated_netstack_version(
170 &self,
171 mut version: Option<&VersionSetting>,
172 ___deadline: zx::MonotonicInstant,
173 ) -> Result<(), fidl::Error> {
174 let _response = self
175 .client
176 .send_query::<ControlSetAutomatedNetstackVersionRequest, fidl::encoding::EmptyPayload>(
177 (version,),
178 0x643e4cfaf3bb5fea,
179 fidl::encoding::DynamicFlags::empty(),
180 ___deadline,
181 )?;
182 Ok(_response)
183 }
184
185 pub fn r#set_user_netstack_version(
195 &self,
196 mut version: Option<&VersionSetting>,
197 ___deadline: zx::MonotonicInstant,
198 ) -> Result<(), fidl::Error> {
199 let _response = self
200 .client
201 .send_query::<ControlSetUserNetstackVersionRequest, fidl::encoding::EmptyPayload>(
202 (version,),
203 0x5ffd36d5fcea08b0,
204 fidl::encoding::DynamicFlags::empty(),
205 ___deadline,
206 )?;
207 Ok(_response)
208 }
209}
210
211#[derive(Debug, Clone)]
212pub struct ControlProxy {
213 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
214}
215
216impl fidl::endpoints::Proxy for ControlProxy {
217 type Protocol = ControlMarker;
218
219 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
220 Self::new(inner)
221 }
222
223 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
224 self.client.into_channel().map_err(|client| Self { client })
225 }
226
227 fn as_channel(&self) -> &::fidl::AsyncChannel {
228 self.client.as_channel()
229 }
230}
231
232impl ControlProxy {
233 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
235 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
236 Self { client: fidl::client::Client::new(channel, protocol_name) }
237 }
238
239 pub fn take_event_stream(&self) -> ControlEventStream {
245 ControlEventStream { event_receiver: self.client.take_event_receiver() }
246 }
247
248 pub fn r#set_automated_netstack_version(
255 &self,
256 mut version: Option<&VersionSetting>,
257 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
258 ControlProxyInterface::r#set_automated_netstack_version(self, version)
259 }
260
261 pub fn r#set_user_netstack_version(
271 &self,
272 mut version: Option<&VersionSetting>,
273 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
274 ControlProxyInterface::r#set_user_netstack_version(self, version)
275 }
276}
277
278impl ControlProxyInterface for ControlProxy {
279 type SetAutomatedNetstackVersionResponseFut =
280 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
281 fn r#set_automated_netstack_version(
282 &self,
283 mut version: Option<&VersionSetting>,
284 ) -> Self::SetAutomatedNetstackVersionResponseFut {
285 fn _decode(
286 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
287 ) -> Result<(), fidl::Error> {
288 let _response = fidl::client::decode_transaction_body::<
289 fidl::encoding::EmptyPayload,
290 fidl::encoding::DefaultFuchsiaResourceDialect,
291 0x643e4cfaf3bb5fea,
292 >(_buf?)?;
293 Ok(_response)
294 }
295 self.client.send_query_and_decode::<ControlSetAutomatedNetstackVersionRequest, ()>(
296 (version,),
297 0x643e4cfaf3bb5fea,
298 fidl::encoding::DynamicFlags::empty(),
299 _decode,
300 )
301 }
302
303 type SetUserNetstackVersionResponseFut =
304 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
305 fn r#set_user_netstack_version(
306 &self,
307 mut version: Option<&VersionSetting>,
308 ) -> Self::SetUserNetstackVersionResponseFut {
309 fn _decode(
310 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
311 ) -> Result<(), fidl::Error> {
312 let _response = fidl::client::decode_transaction_body::<
313 fidl::encoding::EmptyPayload,
314 fidl::encoding::DefaultFuchsiaResourceDialect,
315 0x5ffd36d5fcea08b0,
316 >(_buf?)?;
317 Ok(_response)
318 }
319 self.client.send_query_and_decode::<ControlSetUserNetstackVersionRequest, ()>(
320 (version,),
321 0x5ffd36d5fcea08b0,
322 fidl::encoding::DynamicFlags::empty(),
323 _decode,
324 )
325 }
326}
327
328pub struct ControlEventStream {
329 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
330}
331
332impl std::marker::Unpin for ControlEventStream {}
333
334impl futures::stream::FusedStream for ControlEventStream {
335 fn is_terminated(&self) -> bool {
336 self.event_receiver.is_terminated()
337 }
338}
339
340impl futures::Stream for ControlEventStream {
341 type Item = Result<ControlEvent, fidl::Error>;
342
343 fn poll_next(
344 mut self: std::pin::Pin<&mut Self>,
345 cx: &mut std::task::Context<'_>,
346 ) -> std::task::Poll<Option<Self::Item>> {
347 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
348 &mut self.event_receiver,
349 cx
350 )?) {
351 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
352 None => std::task::Poll::Ready(None),
353 }
354 }
355}
356
357#[derive(Debug)]
358pub enum ControlEvent {}
359
360impl ControlEvent {
361 fn decode(
363 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
364 ) -> Result<ControlEvent, fidl::Error> {
365 let (bytes, _handles) = buf.split_mut();
366 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
367 debug_assert_eq!(tx_header.tx_id, 0);
368 match tx_header.ordinal {
369 _ => Err(fidl::Error::UnknownOrdinal {
370 ordinal: tx_header.ordinal,
371 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
372 }),
373 }
374 }
375}
376
377pub struct ControlRequestStream {
379 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
380 is_terminated: bool,
381}
382
383impl std::marker::Unpin for ControlRequestStream {}
384
385impl futures::stream::FusedStream for ControlRequestStream {
386 fn is_terminated(&self) -> bool {
387 self.is_terminated
388 }
389}
390
391impl fidl::endpoints::RequestStream for ControlRequestStream {
392 type Protocol = ControlMarker;
393 type ControlHandle = ControlControlHandle;
394
395 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
396 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
397 }
398
399 fn control_handle(&self) -> Self::ControlHandle {
400 ControlControlHandle { inner: self.inner.clone() }
401 }
402
403 fn into_inner(
404 self,
405 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
406 {
407 (self.inner, self.is_terminated)
408 }
409
410 fn from_inner(
411 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
412 is_terminated: bool,
413 ) -> Self {
414 Self { inner, is_terminated }
415 }
416}
417
418impl futures::Stream for ControlRequestStream {
419 type Item = Result<ControlRequest, fidl::Error>;
420
421 fn poll_next(
422 mut self: std::pin::Pin<&mut Self>,
423 cx: &mut std::task::Context<'_>,
424 ) -> std::task::Poll<Option<Self::Item>> {
425 let this = &mut *self;
426 if this.inner.check_shutdown(cx) {
427 this.is_terminated = true;
428 return std::task::Poll::Ready(None);
429 }
430 if this.is_terminated {
431 panic!("polled ControlRequestStream after completion");
432 }
433 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
434 |bytes, handles| {
435 match this.inner.channel().read_etc(cx, bytes, handles) {
436 std::task::Poll::Ready(Ok(())) => {}
437 std::task::Poll::Pending => return std::task::Poll::Pending,
438 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
439 this.is_terminated = true;
440 return std::task::Poll::Ready(None);
441 }
442 std::task::Poll::Ready(Err(e)) => {
443 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
444 e.into(),
445 ))))
446 }
447 }
448
449 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
451
452 std::task::Poll::Ready(Some(match header.ordinal {
453 0x643e4cfaf3bb5fea => {
454 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
455 let mut req = fidl::new_empty!(
456 ControlSetAutomatedNetstackVersionRequest,
457 fidl::encoding::DefaultFuchsiaResourceDialect
458 );
459 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetAutomatedNetstackVersionRequest>(&header, _body_bytes, handles, &mut req)?;
460 let control_handle = ControlControlHandle { inner: this.inner.clone() };
461 Ok(ControlRequest::SetAutomatedNetstackVersion {
462 version: req.version,
463
464 responder: ControlSetAutomatedNetstackVersionResponder {
465 control_handle: std::mem::ManuallyDrop::new(control_handle),
466 tx_id: header.tx_id,
467 },
468 })
469 }
470 0x5ffd36d5fcea08b0 => {
471 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
472 let mut req = fidl::new_empty!(
473 ControlSetUserNetstackVersionRequest,
474 fidl::encoding::DefaultFuchsiaResourceDialect
475 );
476 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetUserNetstackVersionRequest>(&header, _body_bytes, handles, &mut req)?;
477 let control_handle = ControlControlHandle { inner: this.inner.clone() };
478 Ok(ControlRequest::SetUserNetstackVersion {
479 version: req.version,
480
481 responder: ControlSetUserNetstackVersionResponder {
482 control_handle: std::mem::ManuallyDrop::new(control_handle),
483 tx_id: header.tx_id,
484 },
485 })
486 }
487 _ => Err(fidl::Error::UnknownOrdinal {
488 ordinal: header.ordinal,
489 protocol_name:
490 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
491 }),
492 }))
493 },
494 )
495 }
496}
497
498#[derive(Debug)]
500pub enum ControlRequest {
501 SetAutomatedNetstackVersion {
508 version: Option<Box<VersionSetting>>,
509 responder: ControlSetAutomatedNetstackVersionResponder,
510 },
511 SetUserNetstackVersion {
521 version: Option<Box<VersionSetting>>,
522 responder: ControlSetUserNetstackVersionResponder,
523 },
524}
525
526impl ControlRequest {
527 #[allow(irrefutable_let_patterns)]
528 pub fn into_set_automated_netstack_version(
529 self,
530 ) -> Option<(Option<Box<VersionSetting>>, ControlSetAutomatedNetstackVersionResponder)> {
531 if let ControlRequest::SetAutomatedNetstackVersion { version, responder } = self {
532 Some((version, responder))
533 } else {
534 None
535 }
536 }
537
538 #[allow(irrefutable_let_patterns)]
539 pub fn into_set_user_netstack_version(
540 self,
541 ) -> Option<(Option<Box<VersionSetting>>, ControlSetUserNetstackVersionResponder)> {
542 if let ControlRequest::SetUserNetstackVersion { version, responder } = self {
543 Some((version, responder))
544 } else {
545 None
546 }
547 }
548
549 pub fn method_name(&self) -> &'static str {
551 match *self {
552 ControlRequest::SetAutomatedNetstackVersion { .. } => "set_automated_netstack_version",
553 ControlRequest::SetUserNetstackVersion { .. } => "set_user_netstack_version",
554 }
555 }
556}
557
558#[derive(Debug, Clone)]
559pub struct ControlControlHandle {
560 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
561}
562
563impl fidl::endpoints::ControlHandle for ControlControlHandle {
564 fn shutdown(&self) {
565 self.inner.shutdown()
566 }
567 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
568 self.inner.shutdown_with_epitaph(status)
569 }
570
571 fn is_closed(&self) -> bool {
572 self.inner.channel().is_closed()
573 }
574 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
575 self.inner.channel().on_closed()
576 }
577
578 #[cfg(target_os = "fuchsia")]
579 fn signal_peer(
580 &self,
581 clear_mask: zx::Signals,
582 set_mask: zx::Signals,
583 ) -> Result<(), zx_status::Status> {
584 use fidl::Peered;
585 self.inner.channel().signal_peer(clear_mask, set_mask)
586 }
587}
588
589impl ControlControlHandle {}
590
591#[must_use = "FIDL methods require a response to be sent"]
592#[derive(Debug)]
593pub struct ControlSetAutomatedNetstackVersionResponder {
594 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
595 tx_id: u32,
596}
597
598impl std::ops::Drop for ControlSetAutomatedNetstackVersionResponder {
602 fn drop(&mut self) {
603 self.control_handle.shutdown();
604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
606 }
607}
608
609impl fidl::endpoints::Responder for ControlSetAutomatedNetstackVersionResponder {
610 type ControlHandle = ControlControlHandle;
611
612 fn control_handle(&self) -> &ControlControlHandle {
613 &self.control_handle
614 }
615
616 fn drop_without_shutdown(mut self) {
617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
619 std::mem::forget(self);
621 }
622}
623
624impl ControlSetAutomatedNetstackVersionResponder {
625 pub fn send(self) -> Result<(), fidl::Error> {
629 let _result = self.send_raw();
630 if _result.is_err() {
631 self.control_handle.shutdown();
632 }
633 self.drop_without_shutdown();
634 _result
635 }
636
637 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
639 let _result = self.send_raw();
640 self.drop_without_shutdown();
641 _result
642 }
643
644 fn send_raw(&self) -> Result<(), fidl::Error> {
645 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
646 (),
647 self.tx_id,
648 0x643e4cfaf3bb5fea,
649 fidl::encoding::DynamicFlags::empty(),
650 )
651 }
652}
653
654#[must_use = "FIDL methods require a response to be sent"]
655#[derive(Debug)]
656pub struct ControlSetUserNetstackVersionResponder {
657 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
658 tx_id: u32,
659}
660
661impl std::ops::Drop for ControlSetUserNetstackVersionResponder {
665 fn drop(&mut self) {
666 self.control_handle.shutdown();
667 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
669 }
670}
671
672impl fidl::endpoints::Responder for ControlSetUserNetstackVersionResponder {
673 type ControlHandle = ControlControlHandle;
674
675 fn control_handle(&self) -> &ControlControlHandle {
676 &self.control_handle
677 }
678
679 fn drop_without_shutdown(mut self) {
680 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
682 std::mem::forget(self);
684 }
685}
686
687impl ControlSetUserNetstackVersionResponder {
688 pub fn send(self) -> Result<(), fidl::Error> {
692 let _result = self.send_raw();
693 if _result.is_err() {
694 self.control_handle.shutdown();
695 }
696 self.drop_without_shutdown();
697 _result
698 }
699
700 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
702 let _result = self.send_raw();
703 self.drop_without_shutdown();
704 _result
705 }
706
707 fn send_raw(&self) -> Result<(), fidl::Error> {
708 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
709 (),
710 self.tx_id,
711 0x5ffd36d5fcea08b0,
712 fidl::encoding::DynamicFlags::empty(),
713 )
714 }
715}
716
717#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
718pub struct StateMarker;
719
720impl fidl::endpoints::ProtocolMarker for StateMarker {
721 type Proxy = StateProxy;
722 type RequestStream = StateRequestStream;
723 #[cfg(target_os = "fuchsia")]
724 type SynchronousProxy = StateSynchronousProxy;
725
726 const DEBUG_NAME: &'static str = "fuchsia.net.stackmigrationdeprecated.State";
727}
728impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
729
730pub trait StateProxyInterface: Send + Sync {
731 type GetNetstackVersionResponseFut: std::future::Future<Output = Result<InEffectVersion, fidl::Error>>
732 + Send;
733 fn r#get_netstack_version(&self) -> Self::GetNetstackVersionResponseFut;
734}
735#[derive(Debug)]
736#[cfg(target_os = "fuchsia")]
737pub struct StateSynchronousProxy {
738 client: fidl::client::sync::Client,
739}
740
741#[cfg(target_os = "fuchsia")]
742impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
743 type Proxy = StateProxy;
744 type Protocol = StateMarker;
745
746 fn from_channel(inner: fidl::Channel) -> Self {
747 Self::new(inner)
748 }
749
750 fn into_channel(self) -> fidl::Channel {
751 self.client.into_channel()
752 }
753
754 fn as_channel(&self) -> &fidl::Channel {
755 self.client.as_channel()
756 }
757}
758
759#[cfg(target_os = "fuchsia")]
760impl StateSynchronousProxy {
761 pub fn new(channel: fidl::Channel) -> Self {
762 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
763 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
764 }
765
766 pub fn into_channel(self) -> fidl::Channel {
767 self.client.into_channel()
768 }
769
770 pub fn wait_for_event(
773 &self,
774 deadline: zx::MonotonicInstant,
775 ) -> Result<StateEvent, fidl::Error> {
776 StateEvent::decode(self.client.wait_for_event(deadline)?)
777 }
778
779 pub fn r#get_netstack_version(
783 &self,
784 ___deadline: zx::MonotonicInstant,
785 ) -> Result<InEffectVersion, fidl::Error> {
786 let _response = self
787 .client
788 .send_query::<fidl::encoding::EmptyPayload, StateGetNetstackVersionResponse>(
789 (),
790 0x67053bfebb619ba1,
791 fidl::encoding::DynamicFlags::empty(),
792 ___deadline,
793 )?;
794 Ok(_response.in_effect_version)
795 }
796}
797
798#[derive(Debug, Clone)]
799pub struct StateProxy {
800 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
801}
802
803impl fidl::endpoints::Proxy for StateProxy {
804 type Protocol = StateMarker;
805
806 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
807 Self::new(inner)
808 }
809
810 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
811 self.client.into_channel().map_err(|client| Self { client })
812 }
813
814 fn as_channel(&self) -> &::fidl::AsyncChannel {
815 self.client.as_channel()
816 }
817}
818
819impl StateProxy {
820 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
822 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
823 Self { client: fidl::client::Client::new(channel, protocol_name) }
824 }
825
826 pub fn take_event_stream(&self) -> StateEventStream {
832 StateEventStream { event_receiver: self.client.take_event_receiver() }
833 }
834
835 pub fn r#get_netstack_version(
839 &self,
840 ) -> fidl::client::QueryResponseFut<
841 InEffectVersion,
842 fidl::encoding::DefaultFuchsiaResourceDialect,
843 > {
844 StateProxyInterface::r#get_netstack_version(self)
845 }
846}
847
848impl StateProxyInterface for StateProxy {
849 type GetNetstackVersionResponseFut = fidl::client::QueryResponseFut<
850 InEffectVersion,
851 fidl::encoding::DefaultFuchsiaResourceDialect,
852 >;
853 fn r#get_netstack_version(&self) -> Self::GetNetstackVersionResponseFut {
854 fn _decode(
855 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
856 ) -> Result<InEffectVersion, fidl::Error> {
857 let _response = fidl::client::decode_transaction_body::<
858 StateGetNetstackVersionResponse,
859 fidl::encoding::DefaultFuchsiaResourceDialect,
860 0x67053bfebb619ba1,
861 >(_buf?)?;
862 Ok(_response.in_effect_version)
863 }
864 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InEffectVersion>(
865 (),
866 0x67053bfebb619ba1,
867 fidl::encoding::DynamicFlags::empty(),
868 _decode,
869 )
870 }
871}
872
873pub struct StateEventStream {
874 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
875}
876
877impl std::marker::Unpin for StateEventStream {}
878
879impl futures::stream::FusedStream for StateEventStream {
880 fn is_terminated(&self) -> bool {
881 self.event_receiver.is_terminated()
882 }
883}
884
885impl futures::Stream for StateEventStream {
886 type Item = Result<StateEvent, fidl::Error>;
887
888 fn poll_next(
889 mut self: std::pin::Pin<&mut Self>,
890 cx: &mut std::task::Context<'_>,
891 ) -> std::task::Poll<Option<Self::Item>> {
892 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
893 &mut self.event_receiver,
894 cx
895 )?) {
896 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
897 None => std::task::Poll::Ready(None),
898 }
899 }
900}
901
902#[derive(Debug)]
903pub enum StateEvent {}
904
905impl StateEvent {
906 fn decode(
908 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
909 ) -> Result<StateEvent, fidl::Error> {
910 let (bytes, _handles) = buf.split_mut();
911 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
912 debug_assert_eq!(tx_header.tx_id, 0);
913 match tx_header.ordinal {
914 _ => Err(fidl::Error::UnknownOrdinal {
915 ordinal: tx_header.ordinal,
916 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
917 }),
918 }
919 }
920}
921
922pub struct StateRequestStream {
924 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
925 is_terminated: bool,
926}
927
928impl std::marker::Unpin for StateRequestStream {}
929
930impl futures::stream::FusedStream for StateRequestStream {
931 fn is_terminated(&self) -> bool {
932 self.is_terminated
933 }
934}
935
936impl fidl::endpoints::RequestStream for StateRequestStream {
937 type Protocol = StateMarker;
938 type ControlHandle = StateControlHandle;
939
940 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
941 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
942 }
943
944 fn control_handle(&self) -> Self::ControlHandle {
945 StateControlHandle { inner: self.inner.clone() }
946 }
947
948 fn into_inner(
949 self,
950 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
951 {
952 (self.inner, self.is_terminated)
953 }
954
955 fn from_inner(
956 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
957 is_terminated: bool,
958 ) -> Self {
959 Self { inner, is_terminated }
960 }
961}
962
963impl futures::Stream for StateRequestStream {
964 type Item = Result<StateRequest, fidl::Error>;
965
966 fn poll_next(
967 mut self: std::pin::Pin<&mut Self>,
968 cx: &mut std::task::Context<'_>,
969 ) -> std::task::Poll<Option<Self::Item>> {
970 let this = &mut *self;
971 if this.inner.check_shutdown(cx) {
972 this.is_terminated = true;
973 return std::task::Poll::Ready(None);
974 }
975 if this.is_terminated {
976 panic!("polled StateRequestStream after completion");
977 }
978 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
979 |bytes, handles| {
980 match this.inner.channel().read_etc(cx, bytes, handles) {
981 std::task::Poll::Ready(Ok(())) => {}
982 std::task::Poll::Pending => return std::task::Poll::Pending,
983 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
984 this.is_terminated = true;
985 return std::task::Poll::Ready(None);
986 }
987 std::task::Poll::Ready(Err(e)) => {
988 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
989 e.into(),
990 ))))
991 }
992 }
993
994 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
996
997 std::task::Poll::Ready(Some(match header.ordinal {
998 0x67053bfebb619ba1 => {
999 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1000 let mut req = fidl::new_empty!(
1001 fidl::encoding::EmptyPayload,
1002 fidl::encoding::DefaultFuchsiaResourceDialect
1003 );
1004 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1005 let control_handle = StateControlHandle { inner: this.inner.clone() };
1006 Ok(StateRequest::GetNetstackVersion {
1007 responder: StateGetNetstackVersionResponder {
1008 control_handle: std::mem::ManuallyDrop::new(control_handle),
1009 tx_id: header.tx_id,
1010 },
1011 })
1012 }
1013 _ => Err(fidl::Error::UnknownOrdinal {
1014 ordinal: header.ordinal,
1015 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1016 }),
1017 }))
1018 },
1019 )
1020 }
1021}
1022
1023#[derive(Debug)]
1025pub enum StateRequest {
1026 GetNetstackVersion { responder: StateGetNetstackVersionResponder },
1030}
1031
1032impl StateRequest {
1033 #[allow(irrefutable_let_patterns)]
1034 pub fn into_get_netstack_version(self) -> Option<(StateGetNetstackVersionResponder)> {
1035 if let StateRequest::GetNetstackVersion { responder } = self {
1036 Some((responder))
1037 } else {
1038 None
1039 }
1040 }
1041
1042 pub fn method_name(&self) -> &'static str {
1044 match *self {
1045 StateRequest::GetNetstackVersion { .. } => "get_netstack_version",
1046 }
1047 }
1048}
1049
1050#[derive(Debug, Clone)]
1051pub struct StateControlHandle {
1052 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1053}
1054
1055impl fidl::endpoints::ControlHandle for StateControlHandle {
1056 fn shutdown(&self) {
1057 self.inner.shutdown()
1058 }
1059 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1060 self.inner.shutdown_with_epitaph(status)
1061 }
1062
1063 fn is_closed(&self) -> bool {
1064 self.inner.channel().is_closed()
1065 }
1066 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1067 self.inner.channel().on_closed()
1068 }
1069
1070 #[cfg(target_os = "fuchsia")]
1071 fn signal_peer(
1072 &self,
1073 clear_mask: zx::Signals,
1074 set_mask: zx::Signals,
1075 ) -> Result<(), zx_status::Status> {
1076 use fidl::Peered;
1077 self.inner.channel().signal_peer(clear_mask, set_mask)
1078 }
1079}
1080
1081impl StateControlHandle {}
1082
1083#[must_use = "FIDL methods require a response to be sent"]
1084#[derive(Debug)]
1085pub struct StateGetNetstackVersionResponder {
1086 control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1087 tx_id: u32,
1088}
1089
1090impl std::ops::Drop for StateGetNetstackVersionResponder {
1094 fn drop(&mut self) {
1095 self.control_handle.shutdown();
1096 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1098 }
1099}
1100
1101impl fidl::endpoints::Responder for StateGetNetstackVersionResponder {
1102 type ControlHandle = StateControlHandle;
1103
1104 fn control_handle(&self) -> &StateControlHandle {
1105 &self.control_handle
1106 }
1107
1108 fn drop_without_shutdown(mut self) {
1109 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1111 std::mem::forget(self);
1113 }
1114}
1115
1116impl StateGetNetstackVersionResponder {
1117 pub fn send(self, mut in_effect_version: &InEffectVersion) -> Result<(), fidl::Error> {
1121 let _result = self.send_raw(in_effect_version);
1122 if _result.is_err() {
1123 self.control_handle.shutdown();
1124 }
1125 self.drop_without_shutdown();
1126 _result
1127 }
1128
1129 pub fn send_no_shutdown_on_err(
1131 self,
1132 mut in_effect_version: &InEffectVersion,
1133 ) -> Result<(), fidl::Error> {
1134 let _result = self.send_raw(in_effect_version);
1135 self.drop_without_shutdown();
1136 _result
1137 }
1138
1139 fn send_raw(&self, mut in_effect_version: &InEffectVersion) -> Result<(), fidl::Error> {
1140 self.control_handle.inner.send::<StateGetNetstackVersionResponse>(
1141 (in_effect_version,),
1142 self.tx_id,
1143 0x67053bfebb619ba1,
1144 fidl::encoding::DynamicFlags::empty(),
1145 )
1146 }
1147}
1148
1149mod internal {
1150 use super::*;
1151 unsafe impl fidl::encoding::TypeMarker for NetstackVersion {
1152 type Owned = Self;
1153
1154 #[inline(always)]
1155 fn inline_align(_context: fidl::encoding::Context) -> usize {
1156 std::mem::align_of::<u32>()
1157 }
1158
1159 #[inline(always)]
1160 fn inline_size(_context: fidl::encoding::Context) -> usize {
1161 std::mem::size_of::<u32>()
1162 }
1163
1164 #[inline(always)]
1165 fn encode_is_copy() -> bool {
1166 true
1167 }
1168
1169 #[inline(always)]
1170 fn decode_is_copy() -> bool {
1171 false
1172 }
1173 }
1174
1175 impl fidl::encoding::ValueTypeMarker for NetstackVersion {
1176 type Borrowed<'a> = Self;
1177 #[inline(always)]
1178 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1179 *value
1180 }
1181 }
1182
1183 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1184 for NetstackVersion
1185 {
1186 #[inline]
1187 unsafe fn encode(
1188 self,
1189 encoder: &mut fidl::encoding::Encoder<'_, D>,
1190 offset: usize,
1191 _depth: fidl::encoding::Depth,
1192 ) -> fidl::Result<()> {
1193 encoder.debug_check_bounds::<Self>(offset);
1194 encoder.write_num(self.into_primitive(), offset);
1195 Ok(())
1196 }
1197 }
1198
1199 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetstackVersion {
1200 #[inline(always)]
1201 fn new_empty() -> Self {
1202 Self::Netstack2
1203 }
1204
1205 #[inline]
1206 unsafe fn decode(
1207 &mut self,
1208 decoder: &mut fidl::encoding::Decoder<'_, D>,
1209 offset: usize,
1210 _depth: fidl::encoding::Depth,
1211 ) -> fidl::Result<()> {
1212 decoder.debug_check_bounds::<Self>(offset);
1213 let prim = decoder.read_num::<u32>(offset);
1214
1215 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1216 Ok(())
1217 }
1218 }
1219
1220 impl fidl::encoding::ValueTypeMarker for ControlSetAutomatedNetstackVersionRequest {
1221 type Borrowed<'a> = &'a Self;
1222 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1223 value
1224 }
1225 }
1226
1227 unsafe impl fidl::encoding::TypeMarker for ControlSetAutomatedNetstackVersionRequest {
1228 type Owned = Self;
1229
1230 #[inline(always)]
1231 fn inline_align(_context: fidl::encoding::Context) -> usize {
1232 8
1233 }
1234
1235 #[inline(always)]
1236 fn inline_size(_context: fidl::encoding::Context) -> usize {
1237 8
1238 }
1239 }
1240
1241 unsafe impl<D: fidl::encoding::ResourceDialect>
1242 fidl::encoding::Encode<ControlSetAutomatedNetstackVersionRequest, D>
1243 for &ControlSetAutomatedNetstackVersionRequest
1244 {
1245 #[inline]
1246 unsafe fn encode(
1247 self,
1248 encoder: &mut fidl::encoding::Encoder<'_, D>,
1249 offset: usize,
1250 _depth: fidl::encoding::Depth,
1251 ) -> fidl::Result<()> {
1252 encoder.debug_check_bounds::<ControlSetAutomatedNetstackVersionRequest>(offset);
1253 fidl::encoding::Encode::<ControlSetAutomatedNetstackVersionRequest, D>::encode(
1255 (
1256 <fidl::encoding::Boxed<VersionSetting> as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
1257 ),
1258 encoder, offset, _depth
1259 )
1260 }
1261 }
1262 unsafe impl<
1263 D: fidl::encoding::ResourceDialect,
1264 T0: fidl::encoding::Encode<fidl::encoding::Boxed<VersionSetting>, D>,
1265 > fidl::encoding::Encode<ControlSetAutomatedNetstackVersionRequest, D> for (T0,)
1266 {
1267 #[inline]
1268 unsafe fn encode(
1269 self,
1270 encoder: &mut fidl::encoding::Encoder<'_, D>,
1271 offset: usize,
1272 depth: fidl::encoding::Depth,
1273 ) -> fidl::Result<()> {
1274 encoder.debug_check_bounds::<ControlSetAutomatedNetstackVersionRequest>(offset);
1275 self.0.encode(encoder, offset + 0, depth)?;
1279 Ok(())
1280 }
1281 }
1282
1283 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1284 for ControlSetAutomatedNetstackVersionRequest
1285 {
1286 #[inline(always)]
1287 fn new_empty() -> Self {
1288 Self { version: fidl::new_empty!(fidl::encoding::Boxed<VersionSetting>, D) }
1289 }
1290
1291 #[inline]
1292 unsafe fn decode(
1293 &mut self,
1294 decoder: &mut fidl::encoding::Decoder<'_, D>,
1295 offset: usize,
1296 _depth: fidl::encoding::Depth,
1297 ) -> fidl::Result<()> {
1298 decoder.debug_check_bounds::<Self>(offset);
1299 fidl::decode!(
1301 fidl::encoding::Boxed<VersionSetting>,
1302 D,
1303 &mut self.version,
1304 decoder,
1305 offset + 0,
1306 _depth
1307 )?;
1308 Ok(())
1309 }
1310 }
1311
1312 impl fidl::encoding::ValueTypeMarker for ControlSetUserNetstackVersionRequest {
1313 type Borrowed<'a> = &'a Self;
1314 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1315 value
1316 }
1317 }
1318
1319 unsafe impl fidl::encoding::TypeMarker for ControlSetUserNetstackVersionRequest {
1320 type Owned = Self;
1321
1322 #[inline(always)]
1323 fn inline_align(_context: fidl::encoding::Context) -> usize {
1324 8
1325 }
1326
1327 #[inline(always)]
1328 fn inline_size(_context: fidl::encoding::Context) -> usize {
1329 8
1330 }
1331 }
1332
1333 unsafe impl<D: fidl::encoding::ResourceDialect>
1334 fidl::encoding::Encode<ControlSetUserNetstackVersionRequest, D>
1335 for &ControlSetUserNetstackVersionRequest
1336 {
1337 #[inline]
1338 unsafe fn encode(
1339 self,
1340 encoder: &mut fidl::encoding::Encoder<'_, D>,
1341 offset: usize,
1342 _depth: fidl::encoding::Depth,
1343 ) -> fidl::Result<()> {
1344 encoder.debug_check_bounds::<ControlSetUserNetstackVersionRequest>(offset);
1345 fidl::encoding::Encode::<ControlSetUserNetstackVersionRequest, D>::encode(
1347 (
1348 <fidl::encoding::Boxed<VersionSetting> as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
1349 ),
1350 encoder, offset, _depth
1351 )
1352 }
1353 }
1354 unsafe impl<
1355 D: fidl::encoding::ResourceDialect,
1356 T0: fidl::encoding::Encode<fidl::encoding::Boxed<VersionSetting>, D>,
1357 > fidl::encoding::Encode<ControlSetUserNetstackVersionRequest, D> for (T0,)
1358 {
1359 #[inline]
1360 unsafe fn encode(
1361 self,
1362 encoder: &mut fidl::encoding::Encoder<'_, D>,
1363 offset: usize,
1364 depth: fidl::encoding::Depth,
1365 ) -> fidl::Result<()> {
1366 encoder.debug_check_bounds::<ControlSetUserNetstackVersionRequest>(offset);
1367 self.0.encode(encoder, offset + 0, depth)?;
1371 Ok(())
1372 }
1373 }
1374
1375 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1376 for ControlSetUserNetstackVersionRequest
1377 {
1378 #[inline(always)]
1379 fn new_empty() -> Self {
1380 Self { version: fidl::new_empty!(fidl::encoding::Boxed<VersionSetting>, D) }
1381 }
1382
1383 #[inline]
1384 unsafe fn decode(
1385 &mut self,
1386 decoder: &mut fidl::encoding::Decoder<'_, D>,
1387 offset: usize,
1388 _depth: fidl::encoding::Depth,
1389 ) -> fidl::Result<()> {
1390 decoder.debug_check_bounds::<Self>(offset);
1391 fidl::decode!(
1393 fidl::encoding::Boxed<VersionSetting>,
1394 D,
1395 &mut self.version,
1396 decoder,
1397 offset + 0,
1398 _depth
1399 )?;
1400 Ok(())
1401 }
1402 }
1403
1404 impl fidl::encoding::ValueTypeMarker for InEffectVersion {
1405 type Borrowed<'a> = &'a Self;
1406 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1407 value
1408 }
1409 }
1410
1411 unsafe impl fidl::encoding::TypeMarker for InEffectVersion {
1412 type Owned = Self;
1413
1414 #[inline(always)]
1415 fn inline_align(_context: fidl::encoding::Context) -> usize {
1416 8
1417 }
1418
1419 #[inline(always)]
1420 fn inline_size(_context: fidl::encoding::Context) -> usize {
1421 24
1422 }
1423 }
1424
1425 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InEffectVersion, D>
1426 for &InEffectVersion
1427 {
1428 #[inline]
1429 unsafe fn encode(
1430 self,
1431 encoder: &mut fidl::encoding::Encoder<'_, D>,
1432 offset: usize,
1433 _depth: fidl::encoding::Depth,
1434 ) -> fidl::Result<()> {
1435 encoder.debug_check_bounds::<InEffectVersion>(offset);
1436 fidl::encoding::Encode::<InEffectVersion, D>::encode(
1438 (
1439 <NetstackVersion as fidl::encoding::ValueTypeMarker>::borrow(&self.current_boot),
1440 <fidl::encoding::Boxed<VersionSetting> as fidl::encoding::ValueTypeMarker>::borrow(&self.automated),
1441 <fidl::encoding::Boxed<VersionSetting> as fidl::encoding::ValueTypeMarker>::borrow(&self.user),
1442 ),
1443 encoder, offset, _depth
1444 )
1445 }
1446 }
1447 unsafe impl<
1448 D: fidl::encoding::ResourceDialect,
1449 T0: fidl::encoding::Encode<NetstackVersion, D>,
1450 T1: fidl::encoding::Encode<fidl::encoding::Boxed<VersionSetting>, D>,
1451 T2: fidl::encoding::Encode<fidl::encoding::Boxed<VersionSetting>, D>,
1452 > fidl::encoding::Encode<InEffectVersion, D> for (T0, T1, T2)
1453 {
1454 #[inline]
1455 unsafe fn encode(
1456 self,
1457 encoder: &mut fidl::encoding::Encoder<'_, D>,
1458 offset: usize,
1459 depth: fidl::encoding::Depth,
1460 ) -> fidl::Result<()> {
1461 encoder.debug_check_bounds::<InEffectVersion>(offset);
1462 unsafe {
1465 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1466 (ptr as *mut u64).write_unaligned(0);
1467 }
1468 self.0.encode(encoder, offset + 0, depth)?;
1470 self.1.encode(encoder, offset + 8, depth)?;
1471 self.2.encode(encoder, offset + 16, depth)?;
1472 Ok(())
1473 }
1474 }
1475
1476 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InEffectVersion {
1477 #[inline(always)]
1478 fn new_empty() -> Self {
1479 Self {
1480 current_boot: fidl::new_empty!(NetstackVersion, D),
1481 automated: fidl::new_empty!(fidl::encoding::Boxed<VersionSetting>, D),
1482 user: fidl::new_empty!(fidl::encoding::Boxed<VersionSetting>, D),
1483 }
1484 }
1485
1486 #[inline]
1487 unsafe fn decode(
1488 &mut self,
1489 decoder: &mut fidl::encoding::Decoder<'_, D>,
1490 offset: usize,
1491 _depth: fidl::encoding::Depth,
1492 ) -> fidl::Result<()> {
1493 decoder.debug_check_bounds::<Self>(offset);
1494 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1496 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1497 let mask = 0xffffffff00000000u64;
1498 let maskedval = padval & mask;
1499 if maskedval != 0 {
1500 return Err(fidl::Error::NonZeroPadding {
1501 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1502 });
1503 }
1504 fidl::decode!(NetstackVersion, D, &mut self.current_boot, decoder, offset + 0, _depth)?;
1505 fidl::decode!(
1506 fidl::encoding::Boxed<VersionSetting>,
1507 D,
1508 &mut self.automated,
1509 decoder,
1510 offset + 8,
1511 _depth
1512 )?;
1513 fidl::decode!(
1514 fidl::encoding::Boxed<VersionSetting>,
1515 D,
1516 &mut self.user,
1517 decoder,
1518 offset + 16,
1519 _depth
1520 )?;
1521 Ok(())
1522 }
1523 }
1524
1525 impl fidl::encoding::ValueTypeMarker for StateGetNetstackVersionResponse {
1526 type Borrowed<'a> = &'a Self;
1527 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1528 value
1529 }
1530 }
1531
1532 unsafe impl fidl::encoding::TypeMarker for StateGetNetstackVersionResponse {
1533 type Owned = Self;
1534
1535 #[inline(always)]
1536 fn inline_align(_context: fidl::encoding::Context) -> usize {
1537 8
1538 }
1539
1540 #[inline(always)]
1541 fn inline_size(_context: fidl::encoding::Context) -> usize {
1542 24
1543 }
1544 }
1545
1546 unsafe impl<D: fidl::encoding::ResourceDialect>
1547 fidl::encoding::Encode<StateGetNetstackVersionResponse, D>
1548 for &StateGetNetstackVersionResponse
1549 {
1550 #[inline]
1551 unsafe fn encode(
1552 self,
1553 encoder: &mut fidl::encoding::Encoder<'_, D>,
1554 offset: usize,
1555 _depth: fidl::encoding::Depth,
1556 ) -> fidl::Result<()> {
1557 encoder.debug_check_bounds::<StateGetNetstackVersionResponse>(offset);
1558 fidl::encoding::Encode::<StateGetNetstackVersionResponse, D>::encode(
1560 (<InEffectVersion as fidl::encoding::ValueTypeMarker>::borrow(
1561 &self.in_effect_version,
1562 ),),
1563 encoder,
1564 offset,
1565 _depth,
1566 )
1567 }
1568 }
1569 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InEffectVersion, D>>
1570 fidl::encoding::Encode<StateGetNetstackVersionResponse, D> for (T0,)
1571 {
1572 #[inline]
1573 unsafe fn encode(
1574 self,
1575 encoder: &mut fidl::encoding::Encoder<'_, D>,
1576 offset: usize,
1577 depth: fidl::encoding::Depth,
1578 ) -> fidl::Result<()> {
1579 encoder.debug_check_bounds::<StateGetNetstackVersionResponse>(offset);
1580 self.0.encode(encoder, offset + 0, depth)?;
1584 Ok(())
1585 }
1586 }
1587
1588 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1589 for StateGetNetstackVersionResponse
1590 {
1591 #[inline(always)]
1592 fn new_empty() -> Self {
1593 Self { in_effect_version: fidl::new_empty!(InEffectVersion, D) }
1594 }
1595
1596 #[inline]
1597 unsafe fn decode(
1598 &mut self,
1599 decoder: &mut fidl::encoding::Decoder<'_, D>,
1600 offset: usize,
1601 _depth: fidl::encoding::Depth,
1602 ) -> fidl::Result<()> {
1603 decoder.debug_check_bounds::<Self>(offset);
1604 fidl::decode!(
1606 InEffectVersion,
1607 D,
1608 &mut self.in_effect_version,
1609 decoder,
1610 offset + 0,
1611 _depth
1612 )?;
1613 Ok(())
1614 }
1615 }
1616
1617 impl fidl::encoding::ValueTypeMarker for VersionSetting {
1618 type Borrowed<'a> = &'a Self;
1619 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1620 value
1621 }
1622 }
1623
1624 unsafe impl fidl::encoding::TypeMarker for VersionSetting {
1625 type Owned = Self;
1626
1627 #[inline(always)]
1628 fn inline_align(_context: fidl::encoding::Context) -> usize {
1629 4
1630 }
1631
1632 #[inline(always)]
1633 fn inline_size(_context: fidl::encoding::Context) -> usize {
1634 4
1635 }
1636 }
1637
1638 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VersionSetting, D>
1639 for &VersionSetting
1640 {
1641 #[inline]
1642 unsafe fn encode(
1643 self,
1644 encoder: &mut fidl::encoding::Encoder<'_, D>,
1645 offset: usize,
1646 _depth: fidl::encoding::Depth,
1647 ) -> fidl::Result<()> {
1648 encoder.debug_check_bounds::<VersionSetting>(offset);
1649 fidl::encoding::Encode::<VersionSetting, D>::encode(
1651 (<NetstackVersion as fidl::encoding::ValueTypeMarker>::borrow(&self.version),),
1652 encoder,
1653 offset,
1654 _depth,
1655 )
1656 }
1657 }
1658 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NetstackVersion, D>>
1659 fidl::encoding::Encode<VersionSetting, D> for (T0,)
1660 {
1661 #[inline]
1662 unsafe fn encode(
1663 self,
1664 encoder: &mut fidl::encoding::Encoder<'_, D>,
1665 offset: usize,
1666 depth: fidl::encoding::Depth,
1667 ) -> fidl::Result<()> {
1668 encoder.debug_check_bounds::<VersionSetting>(offset);
1669 self.0.encode(encoder, offset + 0, depth)?;
1673 Ok(())
1674 }
1675 }
1676
1677 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VersionSetting {
1678 #[inline(always)]
1679 fn new_empty() -> Self {
1680 Self { version: fidl::new_empty!(NetstackVersion, D) }
1681 }
1682
1683 #[inline]
1684 unsafe fn decode(
1685 &mut self,
1686 decoder: &mut fidl::encoding::Decoder<'_, D>,
1687 offset: usize,
1688 _depth: fidl::encoding::Depth,
1689 ) -> fidl::Result<()> {
1690 decoder.debug_check_bounds::<Self>(offset);
1691 fidl::decode!(NetstackVersion, D, &mut self.version, decoder, offset + 0, _depth)?;
1693 Ok(())
1694 }
1695 }
1696}