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_net_stack_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct StackSetDhcpClientEnabledRequest {
15 pub id: u64,
16 pub enable: bool,
17}
18
19impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
20 for StackSetDhcpClientEnabledRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct LogMarker;
26
27impl fdomain_client::fidl::ProtocolMarker for LogMarker {
28 type Proxy = LogProxy;
29 type RequestStream = LogRequestStream;
30
31 const DEBUG_NAME: &'static str = "fuchsia.net.stack.Log";
32}
33impl fdomain_client::fidl::DiscoverableProtocolMarker for LogMarker {}
34
35pub trait LogProxyInterface: Send + Sync {
36 type SetLogPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
37 fn r#set_log_packets(&self, enabled: bool) -> Self::SetLogPacketsResponseFut;
38}
39
40#[derive(Debug, Clone)]
41pub struct LogProxy {
42 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
43}
44
45impl fdomain_client::fidl::Proxy for LogProxy {
46 type Protocol = LogMarker;
47
48 fn from_channel(inner: fdomain_client::Channel) -> Self {
49 Self::new(inner)
50 }
51
52 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
53 self.client.into_channel().map_err(|client| Self { client })
54 }
55
56 fn as_channel(&self) -> &fdomain_client::Channel {
57 self.client.as_channel()
58 }
59}
60
61impl LogProxy {
62 pub fn new(channel: fdomain_client::Channel) -> Self {
64 let protocol_name = <LogMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
65 Self { client: fidl::client::Client::new(channel, protocol_name) }
66 }
67
68 pub fn take_event_stream(&self) -> LogEventStream {
74 LogEventStream { event_receiver: self.client.take_event_receiver() }
75 }
76
77 pub fn r#set_log_packets(
79 &self,
80 mut enabled: bool,
81 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
82 LogProxyInterface::r#set_log_packets(self, enabled)
83 }
84}
85
86impl LogProxyInterface for LogProxy {
87 type SetLogPacketsResponseFut =
88 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
89 fn r#set_log_packets(&self, mut enabled: bool) -> Self::SetLogPacketsResponseFut {
90 fn _decode(
91 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
92 ) -> Result<(), fidl::Error> {
93 let _response = fidl::client::decode_transaction_body::<
94 fidl::encoding::EmptyPayload,
95 fdomain_client::fidl::FDomainResourceDialect,
96 0x2176044cba5f378e,
97 >(_buf?)?;
98 Ok(_response)
99 }
100 self.client.send_query_and_decode::<LogSetLogPacketsRequest, ()>(
101 (enabled,),
102 0x2176044cba5f378e,
103 fidl::encoding::DynamicFlags::empty(),
104 _decode,
105 )
106 }
107}
108
109pub struct LogEventStream {
110 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
111}
112
113impl std::marker::Unpin for LogEventStream {}
114
115impl futures::stream::FusedStream for LogEventStream {
116 fn is_terminated(&self) -> bool {
117 self.event_receiver.is_terminated()
118 }
119}
120
121impl futures::Stream for LogEventStream {
122 type Item = Result<LogEvent, fidl::Error>;
123
124 fn poll_next(
125 mut self: std::pin::Pin<&mut Self>,
126 cx: &mut std::task::Context<'_>,
127 ) -> std::task::Poll<Option<Self::Item>> {
128 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
129 &mut self.event_receiver,
130 cx
131 )?) {
132 Some(buf) => std::task::Poll::Ready(Some(LogEvent::decode(buf))),
133 None => std::task::Poll::Ready(None),
134 }
135 }
136}
137
138#[derive(Debug)]
139pub enum LogEvent {}
140
141impl LogEvent {
142 fn decode(
144 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
145 ) -> Result<LogEvent, fidl::Error> {
146 let (bytes, _handles) = buf.split_mut();
147 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
148 debug_assert_eq!(tx_header.tx_id, 0);
149 match tx_header.ordinal {
150 _ => Err(fidl::Error::UnknownOrdinal {
151 ordinal: tx_header.ordinal,
152 protocol_name: <LogMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
153 }),
154 }
155 }
156}
157
158pub struct LogRequestStream {
160 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
161 is_terminated: bool,
162}
163
164impl std::marker::Unpin for LogRequestStream {}
165
166impl futures::stream::FusedStream for LogRequestStream {
167 fn is_terminated(&self) -> bool {
168 self.is_terminated
169 }
170}
171
172impl fdomain_client::fidl::RequestStream for LogRequestStream {
173 type Protocol = LogMarker;
174 type ControlHandle = LogControlHandle;
175
176 fn from_channel(channel: fdomain_client::Channel) -> Self {
177 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
178 }
179
180 fn control_handle(&self) -> Self::ControlHandle {
181 LogControlHandle { inner: self.inner.clone() }
182 }
183
184 fn into_inner(
185 self,
186 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
187 {
188 (self.inner, self.is_terminated)
189 }
190
191 fn from_inner(
192 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
193 is_terminated: bool,
194 ) -> Self {
195 Self { inner, is_terminated }
196 }
197}
198
199impl futures::Stream for LogRequestStream {
200 type Item = Result<LogRequest, fidl::Error>;
201
202 fn poll_next(
203 mut self: std::pin::Pin<&mut Self>,
204 cx: &mut std::task::Context<'_>,
205 ) -> std::task::Poll<Option<Self::Item>> {
206 let this = &mut *self;
207 if this.inner.check_shutdown(cx) {
208 this.is_terminated = true;
209 return std::task::Poll::Ready(None);
210 }
211 if this.is_terminated {
212 panic!("polled LogRequestStream after completion");
213 }
214 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
215 |bytes, handles| {
216 match this.inner.channel().read_etc(cx, bytes, handles) {
217 std::task::Poll::Ready(Ok(())) => {}
218 std::task::Poll::Pending => return std::task::Poll::Pending,
219 std::task::Poll::Ready(Err(None)) => {
220 this.is_terminated = true;
221 return std::task::Poll::Ready(None);
222 }
223 std::task::Poll::Ready(Err(Some(e))) => {
224 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
225 e.into(),
226 ))));
227 }
228 }
229
230 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
232
233 std::task::Poll::Ready(Some(match header.ordinal {
234 0x2176044cba5f378e => {
235 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
236 let mut req = fidl::new_empty!(
237 LogSetLogPacketsRequest,
238 fdomain_client::fidl::FDomainResourceDialect
239 );
240 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSetLogPacketsRequest>(&header, _body_bytes, handles, &mut req)?;
241 let control_handle = LogControlHandle { inner: this.inner.clone() };
242 Ok(LogRequest::SetLogPackets {
243 enabled: req.enabled,
244
245 responder: LogSetLogPacketsResponder {
246 control_handle: std::mem::ManuallyDrop::new(control_handle),
247 tx_id: header.tx_id,
248 },
249 })
250 }
251 _ => Err(fidl::Error::UnknownOrdinal {
252 ordinal: header.ordinal,
253 protocol_name:
254 <LogMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
255 }),
256 }))
257 },
258 )
259 }
260}
261
262#[derive(Debug)]
263pub enum LogRequest {
264 SetLogPackets { enabled: bool, responder: LogSetLogPacketsResponder },
266}
267
268impl LogRequest {
269 #[allow(irrefutable_let_patterns)]
270 pub fn into_set_log_packets(self) -> Option<(bool, LogSetLogPacketsResponder)> {
271 if let LogRequest::SetLogPackets { enabled, responder } = self {
272 Some((enabled, responder))
273 } else {
274 None
275 }
276 }
277
278 pub fn method_name(&self) -> &'static str {
280 match *self {
281 LogRequest::SetLogPackets { .. } => "set_log_packets",
282 }
283 }
284}
285
286#[derive(Debug, Clone)]
287pub struct LogControlHandle {
288 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
289}
290
291impl LogControlHandle {
292 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
293 self.inner.shutdown_with_epitaph(status.into())
294 }
295}
296
297impl fdomain_client::fidl::ControlHandle for LogControlHandle {
298 fn shutdown(&self) {
299 self.inner.shutdown()
300 }
301
302 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
303 self.inner.shutdown_with_epitaph(status)
304 }
305
306 fn is_closed(&self) -> bool {
307 self.inner.channel().is_closed()
308 }
309 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
310 self.inner.channel().on_closed()
311 }
312}
313
314impl LogControlHandle {}
315
316#[must_use = "FIDL methods require a response to be sent"]
317#[derive(Debug)]
318pub struct LogSetLogPacketsResponder {
319 control_handle: std::mem::ManuallyDrop<LogControlHandle>,
320 tx_id: u32,
321}
322
323impl std::ops::Drop for LogSetLogPacketsResponder {
327 fn drop(&mut self) {
328 self.control_handle.shutdown();
329 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
331 }
332}
333
334impl fdomain_client::fidl::Responder for LogSetLogPacketsResponder {
335 type ControlHandle = LogControlHandle;
336
337 fn control_handle(&self) -> &LogControlHandle {
338 &self.control_handle
339 }
340
341 fn drop_without_shutdown(mut self) {
342 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
344 std::mem::forget(self);
346 }
347}
348
349impl LogSetLogPacketsResponder {
350 pub fn send(self) -> Result<(), fidl::Error> {
354 let _result = self.send_raw();
355 if _result.is_err() {
356 self.control_handle.shutdown();
357 }
358 self.drop_without_shutdown();
359 _result
360 }
361
362 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
364 let _result = self.send_raw();
365 self.drop_without_shutdown();
366 _result
367 }
368
369 fn send_raw(&self) -> Result<(), fidl::Error> {
370 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
371 (),
372 self.tx_id,
373 0x2176044cba5f378e,
374 fidl::encoding::DynamicFlags::empty(),
375 )
376 }
377}
378
379#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
380pub struct StackMarker;
381
382impl fdomain_client::fidl::ProtocolMarker for StackMarker {
383 type Proxy = StackProxy;
384 type RequestStream = StackRequestStream;
385
386 const DEBUG_NAME: &'static str = "fuchsia.net.stack.Stack";
387}
388impl fdomain_client::fidl::DiscoverableProtocolMarker for StackMarker {}
389pub type StackSetDhcpClientEnabledResult = Result<(), Error>;
390
391pub trait StackProxyInterface: Send + Sync {
392 type SetDhcpClientEnabledResponseFut: std::future::Future<Output = Result<StackSetDhcpClientEnabledResult, fidl::Error>>
393 + Send;
394 fn r#set_dhcp_client_enabled(
395 &self,
396 id: u64,
397 enable: bool,
398 ) -> Self::SetDhcpClientEnabledResponseFut;
399}
400
401#[derive(Debug, Clone)]
402pub struct StackProxy {
403 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
404}
405
406impl fdomain_client::fidl::Proxy for StackProxy {
407 type Protocol = StackMarker;
408
409 fn from_channel(inner: fdomain_client::Channel) -> Self {
410 Self::new(inner)
411 }
412
413 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
414 self.client.into_channel().map_err(|client| Self { client })
415 }
416
417 fn as_channel(&self) -> &fdomain_client::Channel {
418 self.client.as_channel()
419 }
420}
421
422impl StackProxy {
423 pub fn new(channel: fdomain_client::Channel) -> Self {
425 let protocol_name = <StackMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
426 Self { client: fidl::client::Client::new(channel, protocol_name) }
427 }
428
429 pub fn take_event_stream(&self) -> StackEventStream {
435 StackEventStream { event_receiver: self.client.take_event_receiver() }
436 }
437
438 pub fn r#set_dhcp_client_enabled(
442 &self,
443 mut id: u64,
444 mut enable: bool,
445 ) -> fidl::client::QueryResponseFut<
446 StackSetDhcpClientEnabledResult,
447 fdomain_client::fidl::FDomainResourceDialect,
448 > {
449 StackProxyInterface::r#set_dhcp_client_enabled(self, id, enable)
450 }
451}
452
453impl StackProxyInterface for StackProxy {
454 type SetDhcpClientEnabledResponseFut = fidl::client::QueryResponseFut<
455 StackSetDhcpClientEnabledResult,
456 fdomain_client::fidl::FDomainResourceDialect,
457 >;
458 fn r#set_dhcp_client_enabled(
459 &self,
460 mut id: u64,
461 mut enable: bool,
462 ) -> Self::SetDhcpClientEnabledResponseFut {
463 fn _decode(
464 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
465 ) -> Result<StackSetDhcpClientEnabledResult, fidl::Error> {
466 let _response = fidl::client::decode_transaction_body::<
467 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
468 fdomain_client::fidl::FDomainResourceDialect,
469 0x6dead3a6025b0543,
470 >(_buf?)?;
471 Ok(_response.map(|x| x))
472 }
473 self.client.send_query_and_decode::<
474 StackSetDhcpClientEnabledRequest,
475 StackSetDhcpClientEnabledResult,
476 >(
477 (id, enable,),
478 0x6dead3a6025b0543,
479 fidl::encoding::DynamicFlags::empty(),
480 _decode,
481 )
482 }
483}
484
485pub struct StackEventStream {
486 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
487}
488
489impl std::marker::Unpin for StackEventStream {}
490
491impl futures::stream::FusedStream for StackEventStream {
492 fn is_terminated(&self) -> bool {
493 self.event_receiver.is_terminated()
494 }
495}
496
497impl futures::Stream for StackEventStream {
498 type Item = Result<StackEvent, fidl::Error>;
499
500 fn poll_next(
501 mut self: std::pin::Pin<&mut Self>,
502 cx: &mut std::task::Context<'_>,
503 ) -> std::task::Poll<Option<Self::Item>> {
504 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
505 &mut self.event_receiver,
506 cx
507 )?) {
508 Some(buf) => std::task::Poll::Ready(Some(StackEvent::decode(buf))),
509 None => std::task::Poll::Ready(None),
510 }
511 }
512}
513
514#[derive(Debug)]
515pub enum StackEvent {}
516
517impl StackEvent {
518 fn decode(
520 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
521 ) -> Result<StackEvent, fidl::Error> {
522 let (bytes, _handles) = buf.split_mut();
523 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
524 debug_assert_eq!(tx_header.tx_id, 0);
525 match tx_header.ordinal {
526 _ => Err(fidl::Error::UnknownOrdinal {
527 ordinal: tx_header.ordinal,
528 protocol_name: <StackMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
529 }),
530 }
531 }
532}
533
534pub struct StackRequestStream {
536 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
537 is_terminated: bool,
538}
539
540impl std::marker::Unpin for StackRequestStream {}
541
542impl futures::stream::FusedStream for StackRequestStream {
543 fn is_terminated(&self) -> bool {
544 self.is_terminated
545 }
546}
547
548impl fdomain_client::fidl::RequestStream for StackRequestStream {
549 type Protocol = StackMarker;
550 type ControlHandle = StackControlHandle;
551
552 fn from_channel(channel: fdomain_client::Channel) -> Self {
553 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
554 }
555
556 fn control_handle(&self) -> Self::ControlHandle {
557 StackControlHandle { inner: self.inner.clone() }
558 }
559
560 fn into_inner(
561 self,
562 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
563 {
564 (self.inner, self.is_terminated)
565 }
566
567 fn from_inner(
568 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
569 is_terminated: bool,
570 ) -> Self {
571 Self { inner, is_terminated }
572 }
573}
574
575impl futures::Stream for StackRequestStream {
576 type Item = Result<StackRequest, fidl::Error>;
577
578 fn poll_next(
579 mut self: std::pin::Pin<&mut Self>,
580 cx: &mut std::task::Context<'_>,
581 ) -> std::task::Poll<Option<Self::Item>> {
582 let this = &mut *self;
583 if this.inner.check_shutdown(cx) {
584 this.is_terminated = true;
585 return std::task::Poll::Ready(None);
586 }
587 if this.is_terminated {
588 panic!("polled StackRequestStream after completion");
589 }
590 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
591 |bytes, handles| {
592 match this.inner.channel().read_etc(cx, bytes, handles) {
593 std::task::Poll::Ready(Ok(())) => {}
594 std::task::Poll::Pending => return std::task::Poll::Pending,
595 std::task::Poll::Ready(Err(None)) => {
596 this.is_terminated = true;
597 return std::task::Poll::Ready(None);
598 }
599 std::task::Poll::Ready(Err(Some(e))) => {
600 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
601 e.into(),
602 ))));
603 }
604 }
605
606 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
608
609 std::task::Poll::Ready(Some(match header.ordinal {
610 0x6dead3a6025b0543 => {
611 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
612 let mut req = fidl::new_empty!(
613 StackSetDhcpClientEnabledRequest,
614 fdomain_client::fidl::FDomainResourceDialect
615 );
616 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StackSetDhcpClientEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
617 let control_handle = StackControlHandle { inner: this.inner.clone() };
618 Ok(StackRequest::SetDhcpClientEnabled {
619 id: req.id,
620 enable: req.enable,
621
622 responder: StackSetDhcpClientEnabledResponder {
623 control_handle: std::mem::ManuallyDrop::new(control_handle),
624 tx_id: header.tx_id,
625 },
626 })
627 }
628 _ => Err(fidl::Error::UnknownOrdinal {
629 ordinal: header.ordinal,
630 protocol_name:
631 <StackMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
632 }),
633 }))
634 },
635 )
636 }
637}
638
639#[derive(Debug)]
640pub enum StackRequest {
641 SetDhcpClientEnabled { id: u64, enable: bool, responder: StackSetDhcpClientEnabledResponder },
645}
646
647impl StackRequest {
648 #[allow(irrefutable_let_patterns)]
649 pub fn into_set_dhcp_client_enabled(
650 self,
651 ) -> Option<(u64, bool, StackSetDhcpClientEnabledResponder)> {
652 if let StackRequest::SetDhcpClientEnabled { id, enable, responder } = self {
653 Some((id, enable, responder))
654 } else {
655 None
656 }
657 }
658
659 pub fn method_name(&self) -> &'static str {
661 match *self {
662 StackRequest::SetDhcpClientEnabled { .. } => "set_dhcp_client_enabled",
663 }
664 }
665}
666
667#[derive(Debug, Clone)]
668pub struct StackControlHandle {
669 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
670}
671
672impl StackControlHandle {
673 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
674 self.inner.shutdown_with_epitaph(status.into())
675 }
676}
677
678impl fdomain_client::fidl::ControlHandle for StackControlHandle {
679 fn shutdown(&self) {
680 self.inner.shutdown()
681 }
682
683 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
684 self.inner.shutdown_with_epitaph(status)
685 }
686
687 fn is_closed(&self) -> bool {
688 self.inner.channel().is_closed()
689 }
690 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
691 self.inner.channel().on_closed()
692 }
693}
694
695impl StackControlHandle {}
696
697#[must_use = "FIDL methods require a response to be sent"]
698#[derive(Debug)]
699pub struct StackSetDhcpClientEnabledResponder {
700 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
701 tx_id: u32,
702}
703
704impl std::ops::Drop for StackSetDhcpClientEnabledResponder {
708 fn drop(&mut self) {
709 self.control_handle.shutdown();
710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
712 }
713}
714
715impl fdomain_client::fidl::Responder for StackSetDhcpClientEnabledResponder {
716 type ControlHandle = StackControlHandle;
717
718 fn control_handle(&self) -> &StackControlHandle {
719 &self.control_handle
720 }
721
722 fn drop_without_shutdown(mut self) {
723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
725 std::mem::forget(self);
727 }
728}
729
730impl StackSetDhcpClientEnabledResponder {
731 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
735 let _result = self.send_raw(result);
736 if _result.is_err() {
737 self.control_handle.shutdown();
738 }
739 self.drop_without_shutdown();
740 _result
741 }
742
743 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
745 let _result = self.send_raw(result);
746 self.drop_without_shutdown();
747 _result
748 }
749
750 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
751 self.control_handle
752 .inner
753 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
754 result,
755 self.tx_id,
756 0x6dead3a6025b0543,
757 fidl::encoding::DynamicFlags::empty(),
758 )
759 }
760}
761
762mod internal {
763 use super::*;
764
765 impl fidl::encoding::ResourceTypeMarker for StackSetDhcpClientEnabledRequest {
766 type Borrowed<'a> = &'a mut Self;
767 fn take_or_borrow<'a>(
768 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
769 ) -> Self::Borrowed<'a> {
770 value
771 }
772 }
773
774 unsafe impl fidl::encoding::TypeMarker for StackSetDhcpClientEnabledRequest {
775 type Owned = Self;
776
777 #[inline(always)]
778 fn inline_align(_context: fidl::encoding::Context) -> usize {
779 8
780 }
781
782 #[inline(always)]
783 fn inline_size(_context: fidl::encoding::Context) -> usize {
784 16
785 }
786 }
787
788 unsafe impl
789 fidl::encoding::Encode<
790 StackSetDhcpClientEnabledRequest,
791 fdomain_client::fidl::FDomainResourceDialect,
792 > for &mut StackSetDhcpClientEnabledRequest
793 {
794 #[inline]
795 unsafe fn encode(
796 self,
797 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
798 offset: usize,
799 _depth: fidl::encoding::Depth,
800 ) -> fidl::Result<()> {
801 encoder.debug_check_bounds::<StackSetDhcpClientEnabledRequest>(offset);
802 fidl::encoding::Encode::<
804 StackSetDhcpClientEnabledRequest,
805 fdomain_client::fidl::FDomainResourceDialect,
806 >::encode(
807 (
808 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
809 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),
810 ),
811 encoder,
812 offset,
813 _depth,
814 )
815 }
816 }
817 unsafe impl<
818 T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
819 T1: fidl::encoding::Encode<bool, fdomain_client::fidl::FDomainResourceDialect>,
820 >
821 fidl::encoding::Encode<
822 StackSetDhcpClientEnabledRequest,
823 fdomain_client::fidl::FDomainResourceDialect,
824 > for (T0, T1)
825 {
826 #[inline]
827 unsafe fn encode(
828 self,
829 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
830 offset: usize,
831 depth: fidl::encoding::Depth,
832 ) -> fidl::Result<()> {
833 encoder.debug_check_bounds::<StackSetDhcpClientEnabledRequest>(offset);
834 unsafe {
837 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
838 (ptr as *mut u64).write_unaligned(0);
839 }
840 self.0.encode(encoder, offset + 0, depth)?;
842 self.1.encode(encoder, offset + 8, depth)?;
843 Ok(())
844 }
845 }
846
847 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
848 for StackSetDhcpClientEnabledRequest
849 {
850 #[inline(always)]
851 fn new_empty() -> Self {
852 Self {
853 id: fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect),
854 enable: fidl::new_empty!(bool, fdomain_client::fidl::FDomainResourceDialect),
855 }
856 }
857
858 #[inline]
859 unsafe fn decode(
860 &mut self,
861 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
862 offset: usize,
863 _depth: fidl::encoding::Depth,
864 ) -> fidl::Result<()> {
865 decoder.debug_check_bounds::<Self>(offset);
866 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
868 let padval = unsafe { (ptr as *const u64).read_unaligned() };
869 let mask = 0xffffffffffffff00u64;
870 let maskedval = padval & mask;
871 if maskedval != 0 {
872 return Err(fidl::Error::NonZeroPadding {
873 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
874 });
875 }
876 fidl::decode!(
877 u64,
878 fdomain_client::fidl::FDomainResourceDialect,
879 &mut self.id,
880 decoder,
881 offset + 0,
882 _depth
883 )?;
884 fidl::decode!(
885 bool,
886 fdomain_client::fidl::FDomainResourceDialect,
887 &mut self.enable,
888 decoder,
889 offset + 8,
890 _depth
891 )?;
892 Ok(())
893 }
894 }
895}