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_interfaces_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, PartialEq)]
14pub struct StateGetWatcherRequest {
15 pub options: WatcherOptions,
17 pub watcher: fdomain_client::fidl::ServerEnd<WatcherMarker>,
18}
19
20impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for StateGetWatcherRequest {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct StateMarker;
24
25impl fdomain_client::fidl::ProtocolMarker for StateMarker {
26 type Proxy = StateProxy;
27 type RequestStream = StateRequestStream;
28
29 const DEBUG_NAME: &'static str = "fuchsia.net.interfaces.State";
30}
31impl fdomain_client::fidl::DiscoverableProtocolMarker for StateMarker {}
32
33pub trait StateProxyInterface: Send + Sync {
34 fn r#get_watcher(
35 &self,
36 options: &WatcherOptions,
37 watcher: fdomain_client::fidl::ServerEnd<WatcherMarker>,
38 ) -> Result<(), fidl::Error>;
39}
40
41#[derive(Debug, Clone)]
42pub struct StateProxy {
43 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
44}
45
46impl fdomain_client::fidl::Proxy for StateProxy {
47 type Protocol = StateMarker;
48
49 fn from_channel(inner: fdomain_client::Channel) -> Self {
50 Self::new(inner)
51 }
52
53 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
54 self.client.into_channel().map_err(|client| Self { client })
55 }
56
57 fn as_channel(&self) -> &fdomain_client::Channel {
58 self.client.as_channel()
59 }
60}
61
62impl StateProxy {
63 pub fn new(channel: fdomain_client::Channel) -> Self {
65 let protocol_name = <StateMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
66 Self { client: fidl::client::Client::new(channel, protocol_name) }
67 }
68
69 pub fn take_event_stream(&self) -> StateEventStream {
75 StateEventStream { event_receiver: self.client.take_event_receiver() }
76 }
77
78 pub fn r#get_watcher(
88 &self,
89 mut options: &WatcherOptions,
90 mut watcher: fdomain_client::fidl::ServerEnd<WatcherMarker>,
91 ) -> Result<(), fidl::Error> {
92 StateProxyInterface::r#get_watcher(self, options, watcher)
93 }
94}
95
96impl StateProxyInterface for StateProxy {
97 fn r#get_watcher(
98 &self,
99 mut options: &WatcherOptions,
100 mut watcher: fdomain_client::fidl::ServerEnd<WatcherMarker>,
101 ) -> Result<(), fidl::Error> {
102 self.client.send::<StateGetWatcherRequest>(
103 (options, watcher),
104 0x4fe223c98b263ae3,
105 fidl::encoding::DynamicFlags::empty(),
106 )
107 }
108}
109
110pub struct StateEventStream {
111 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
112}
113
114impl std::marker::Unpin for StateEventStream {}
115
116impl futures::stream::FusedStream for StateEventStream {
117 fn is_terminated(&self) -> bool {
118 self.event_receiver.is_terminated()
119 }
120}
121
122impl futures::Stream for StateEventStream {
123 type Item = Result<StateEvent, fidl::Error>;
124
125 fn poll_next(
126 mut self: std::pin::Pin<&mut Self>,
127 cx: &mut std::task::Context<'_>,
128 ) -> std::task::Poll<Option<Self::Item>> {
129 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
130 &mut self.event_receiver,
131 cx
132 )?) {
133 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
134 None => std::task::Poll::Ready(None),
135 }
136 }
137}
138
139#[derive(Debug)]
140pub enum StateEvent {}
141
142impl StateEvent {
143 fn decode(
145 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
146 ) -> Result<StateEvent, fidl::Error> {
147 let (bytes, _handles) = buf.split_mut();
148 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
149 debug_assert_eq!(tx_header.tx_id, 0);
150 match tx_header.ordinal {
151 _ => Err(fidl::Error::UnknownOrdinal {
152 ordinal: tx_header.ordinal,
153 protocol_name: <StateMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
154 }),
155 }
156 }
157}
158
159pub struct StateRequestStream {
161 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
162 is_terminated: bool,
163}
164
165impl std::marker::Unpin for StateRequestStream {}
166
167impl futures::stream::FusedStream for StateRequestStream {
168 fn is_terminated(&self) -> bool {
169 self.is_terminated
170 }
171}
172
173impl fdomain_client::fidl::RequestStream for StateRequestStream {
174 type Protocol = StateMarker;
175 type ControlHandle = StateControlHandle;
176
177 fn from_channel(channel: fdomain_client::Channel) -> Self {
178 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
179 }
180
181 fn control_handle(&self) -> Self::ControlHandle {
182 StateControlHandle { inner: self.inner.clone() }
183 }
184
185 fn into_inner(
186 self,
187 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
188 {
189 (self.inner, self.is_terminated)
190 }
191
192 fn from_inner(
193 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
194 is_terminated: bool,
195 ) -> Self {
196 Self { inner, is_terminated }
197 }
198}
199
200impl futures::Stream for StateRequestStream {
201 type Item = Result<StateRequest, fidl::Error>;
202
203 fn poll_next(
204 mut self: std::pin::Pin<&mut Self>,
205 cx: &mut std::task::Context<'_>,
206 ) -> std::task::Poll<Option<Self::Item>> {
207 let this = &mut *self;
208 if this.inner.check_shutdown(cx) {
209 this.is_terminated = true;
210 return std::task::Poll::Ready(None);
211 }
212 if this.is_terminated {
213 panic!("polled StateRequestStream after completion");
214 }
215 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
216 |bytes, handles| {
217 match this.inner.channel().read_etc(cx, bytes, handles) {
218 std::task::Poll::Ready(Ok(())) => {}
219 std::task::Poll::Pending => return std::task::Poll::Pending,
220 std::task::Poll::Ready(Err(None)) => {
221 this.is_terminated = true;
222 return std::task::Poll::Ready(None);
223 }
224 std::task::Poll::Ready(Err(Some(e))) => {
225 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
226 e.into(),
227 ))));
228 }
229 }
230
231 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
233
234 std::task::Poll::Ready(Some(match header.ordinal {
235 0x4fe223c98b263ae3 => {
236 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
237 let mut req = fidl::new_empty!(
238 StateGetWatcherRequest,
239 fdomain_client::fidl::FDomainResourceDialect
240 );
241 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateGetWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
242 let control_handle = StateControlHandle { inner: this.inner.clone() };
243 Ok(StateRequest::GetWatcher {
244 options: req.options,
245 watcher: req.watcher,
246
247 control_handle,
248 })
249 }
250 _ => Err(fidl::Error::UnknownOrdinal {
251 ordinal: header.ordinal,
252 protocol_name:
253 <StateMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
254 }),
255 }))
256 },
257 )
258 }
259}
260
261#[derive(Debug)]
263pub enum StateRequest {
264 GetWatcher {
274 options: WatcherOptions,
275 watcher: fdomain_client::fidl::ServerEnd<WatcherMarker>,
276 control_handle: StateControlHandle,
277 },
278}
279
280impl StateRequest {
281 #[allow(irrefutable_let_patterns)]
282 pub fn into_get_watcher(
283 self,
284 ) -> Option<(WatcherOptions, fdomain_client::fidl::ServerEnd<WatcherMarker>, StateControlHandle)>
285 {
286 if let StateRequest::GetWatcher { options, watcher, control_handle } = self {
287 Some((options, watcher, control_handle))
288 } else {
289 None
290 }
291 }
292
293 pub fn method_name(&self) -> &'static str {
295 match *self {
296 StateRequest::GetWatcher { .. } => "get_watcher",
297 }
298 }
299}
300
301#[derive(Debug, Clone)]
302pub struct StateControlHandle {
303 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
304}
305
306impl StateControlHandle {
307 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
308 self.inner.shutdown_with_epitaph(status.into())
309 }
310}
311
312impl fdomain_client::fidl::ControlHandle for StateControlHandle {
313 fn shutdown(&self) {
314 self.inner.shutdown()
315 }
316
317 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
318 self.inner.shutdown_with_epitaph(status)
319 }
320
321 fn is_closed(&self) -> bool {
322 self.inner.channel().is_closed()
323 }
324 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
325 self.inner.channel().on_closed()
326 }
327}
328
329impl StateControlHandle {}
330
331#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
332pub struct WatcherMarker;
333
334impl fdomain_client::fidl::ProtocolMarker for WatcherMarker {
335 type Proxy = WatcherProxy;
336 type RequestStream = WatcherRequestStream;
337
338 const DEBUG_NAME: &'static str = "(anonymous) Watcher";
339}
340
341pub trait WatcherProxyInterface: Send + Sync {
342 type WatchResponseFut: std::future::Future<Output = Result<Event, fidl::Error>> + Send;
343 fn r#watch(&self) -> Self::WatchResponseFut;
344}
345
346#[derive(Debug, Clone)]
347pub struct WatcherProxy {
348 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
349}
350
351impl fdomain_client::fidl::Proxy for WatcherProxy {
352 type Protocol = WatcherMarker;
353
354 fn from_channel(inner: fdomain_client::Channel) -> Self {
355 Self::new(inner)
356 }
357
358 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
359 self.client.into_channel().map_err(|client| Self { client })
360 }
361
362 fn as_channel(&self) -> &fdomain_client::Channel {
363 self.client.as_channel()
364 }
365}
366
367impl WatcherProxy {
368 pub fn new(channel: fdomain_client::Channel) -> Self {
370 let protocol_name = <WatcherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
371 Self { client: fidl::client::Client::new(channel, protocol_name) }
372 }
373
374 pub fn take_event_stream(&self) -> WatcherEventStream {
380 WatcherEventStream { event_receiver: self.client.take_event_receiver() }
381 }
382
383 pub fn r#watch(
403 &self,
404 ) -> fidl::client::QueryResponseFut<Event, fdomain_client::fidl::FDomainResourceDialect> {
405 WatcherProxyInterface::r#watch(self)
406 }
407}
408
409impl WatcherProxyInterface for WatcherProxy {
410 type WatchResponseFut =
411 fidl::client::QueryResponseFut<Event, fdomain_client::fidl::FDomainResourceDialect>;
412 fn r#watch(&self) -> Self::WatchResponseFut {
413 fn _decode(
414 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
415 ) -> Result<Event, fidl::Error> {
416 let _response = fidl::client::decode_transaction_body::<
417 WatcherWatchResponse,
418 fdomain_client::fidl::FDomainResourceDialect,
419 0x550767aa9faeeef3,
420 >(_buf?)?;
421 Ok(_response.event)
422 }
423 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Event>(
424 (),
425 0x550767aa9faeeef3,
426 fidl::encoding::DynamicFlags::empty(),
427 _decode,
428 )
429 }
430}
431
432pub struct WatcherEventStream {
433 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
434}
435
436impl std::marker::Unpin for WatcherEventStream {}
437
438impl futures::stream::FusedStream for WatcherEventStream {
439 fn is_terminated(&self) -> bool {
440 self.event_receiver.is_terminated()
441 }
442}
443
444impl futures::Stream for WatcherEventStream {
445 type Item = Result<WatcherEvent, fidl::Error>;
446
447 fn poll_next(
448 mut self: std::pin::Pin<&mut Self>,
449 cx: &mut std::task::Context<'_>,
450 ) -> std::task::Poll<Option<Self::Item>> {
451 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
452 &mut self.event_receiver,
453 cx
454 )?) {
455 Some(buf) => std::task::Poll::Ready(Some(WatcherEvent::decode(buf))),
456 None => std::task::Poll::Ready(None),
457 }
458 }
459}
460
461#[derive(Debug)]
462pub enum WatcherEvent {}
463
464impl WatcherEvent {
465 fn decode(
467 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
468 ) -> Result<WatcherEvent, fidl::Error> {
469 let (bytes, _handles) = buf.split_mut();
470 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
471 debug_assert_eq!(tx_header.tx_id, 0);
472 match tx_header.ordinal {
473 _ => Err(fidl::Error::UnknownOrdinal {
474 ordinal: tx_header.ordinal,
475 protocol_name: <WatcherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
476 }),
477 }
478 }
479}
480
481pub struct WatcherRequestStream {
483 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
484 is_terminated: bool,
485}
486
487impl std::marker::Unpin for WatcherRequestStream {}
488
489impl futures::stream::FusedStream for WatcherRequestStream {
490 fn is_terminated(&self) -> bool {
491 self.is_terminated
492 }
493}
494
495impl fdomain_client::fidl::RequestStream for WatcherRequestStream {
496 type Protocol = WatcherMarker;
497 type ControlHandle = WatcherControlHandle;
498
499 fn from_channel(channel: fdomain_client::Channel) -> Self {
500 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
501 }
502
503 fn control_handle(&self) -> Self::ControlHandle {
504 WatcherControlHandle { inner: self.inner.clone() }
505 }
506
507 fn into_inner(
508 self,
509 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
510 {
511 (self.inner, self.is_terminated)
512 }
513
514 fn from_inner(
515 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
516 is_terminated: bool,
517 ) -> Self {
518 Self { inner, is_terminated }
519 }
520}
521
522impl futures::Stream for WatcherRequestStream {
523 type Item = Result<WatcherRequest, fidl::Error>;
524
525 fn poll_next(
526 mut self: std::pin::Pin<&mut Self>,
527 cx: &mut std::task::Context<'_>,
528 ) -> std::task::Poll<Option<Self::Item>> {
529 let this = &mut *self;
530 if this.inner.check_shutdown(cx) {
531 this.is_terminated = true;
532 return std::task::Poll::Ready(None);
533 }
534 if this.is_terminated {
535 panic!("polled WatcherRequestStream after completion");
536 }
537 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
538 |bytes, handles| {
539 match this.inner.channel().read_etc(cx, bytes, handles) {
540 std::task::Poll::Ready(Ok(())) => {}
541 std::task::Poll::Pending => return std::task::Poll::Pending,
542 std::task::Poll::Ready(Err(None)) => {
543 this.is_terminated = true;
544 return std::task::Poll::Ready(None);
545 }
546 std::task::Poll::Ready(Err(Some(e))) => {
547 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
548 e.into(),
549 ))));
550 }
551 }
552
553 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
555
556 std::task::Poll::Ready(Some(match header.ordinal {
557 0x550767aa9faeeef3 => {
558 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
559 let mut req = fidl::new_empty!(
560 fidl::encoding::EmptyPayload,
561 fdomain_client::fidl::FDomainResourceDialect
562 );
563 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
564 let control_handle = WatcherControlHandle { inner: this.inner.clone() };
565 Ok(WatcherRequest::Watch {
566 responder: WatcherWatchResponder {
567 control_handle: std::mem::ManuallyDrop::new(control_handle),
568 tx_id: header.tx_id,
569 },
570 })
571 }
572 _ => Err(fidl::Error::UnknownOrdinal {
573 ordinal: header.ordinal,
574 protocol_name:
575 <WatcherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
576 }),
577 }))
578 },
579 )
580 }
581}
582
583#[derive(Debug)]
586pub enum WatcherRequest {
587 Watch { responder: WatcherWatchResponder },
607}
608
609impl WatcherRequest {
610 #[allow(irrefutable_let_patterns)]
611 pub fn into_watch(self) -> Option<(WatcherWatchResponder)> {
612 if let WatcherRequest::Watch { responder } = self { Some((responder)) } else { None }
613 }
614
615 pub fn method_name(&self) -> &'static str {
617 match *self {
618 WatcherRequest::Watch { .. } => "watch",
619 }
620 }
621}
622
623#[derive(Debug, Clone)]
624pub struct WatcherControlHandle {
625 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
626}
627
628impl WatcherControlHandle {
629 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
630 self.inner.shutdown_with_epitaph(status.into())
631 }
632}
633
634impl fdomain_client::fidl::ControlHandle for WatcherControlHandle {
635 fn shutdown(&self) {
636 self.inner.shutdown()
637 }
638
639 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
640 self.inner.shutdown_with_epitaph(status)
641 }
642
643 fn is_closed(&self) -> bool {
644 self.inner.channel().is_closed()
645 }
646 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
647 self.inner.channel().on_closed()
648 }
649}
650
651impl WatcherControlHandle {}
652
653#[must_use = "FIDL methods require a response to be sent"]
654#[derive(Debug)]
655pub struct WatcherWatchResponder {
656 control_handle: std::mem::ManuallyDrop<WatcherControlHandle>,
657 tx_id: u32,
658}
659
660impl std::ops::Drop for WatcherWatchResponder {
664 fn drop(&mut self) {
665 self.control_handle.shutdown();
666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
668 }
669}
670
671impl fdomain_client::fidl::Responder for WatcherWatchResponder {
672 type ControlHandle = WatcherControlHandle;
673
674 fn control_handle(&self) -> &WatcherControlHandle {
675 &self.control_handle
676 }
677
678 fn drop_without_shutdown(mut self) {
679 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
681 std::mem::forget(self);
683 }
684}
685
686impl WatcherWatchResponder {
687 pub fn send(self, mut event: &Event) -> Result<(), fidl::Error> {
691 let _result = self.send_raw(event);
692 if _result.is_err() {
693 self.control_handle.shutdown();
694 }
695 self.drop_without_shutdown();
696 _result
697 }
698
699 pub fn send_no_shutdown_on_err(self, mut event: &Event) -> Result<(), fidl::Error> {
701 let _result = self.send_raw(event);
702 self.drop_without_shutdown();
703 _result
704 }
705
706 fn send_raw(&self, mut event: &Event) -> Result<(), fidl::Error> {
707 self.control_handle.inner.send::<WatcherWatchResponse>(
708 (event,),
709 self.tx_id,
710 0x550767aa9faeeef3,
711 fidl::encoding::DynamicFlags::empty(),
712 )
713 }
714}
715
716mod internal {
717 use super::*;
718
719 impl fidl::encoding::ResourceTypeMarker for StateGetWatcherRequest {
720 type Borrowed<'a> = &'a mut Self;
721 fn take_or_borrow<'a>(
722 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
723 ) -> Self::Borrowed<'a> {
724 value
725 }
726 }
727
728 unsafe impl fidl::encoding::TypeMarker for StateGetWatcherRequest {
729 type Owned = Self;
730
731 #[inline(always)]
732 fn inline_align(_context: fidl::encoding::Context) -> usize {
733 8
734 }
735
736 #[inline(always)]
737 fn inline_size(_context: fidl::encoding::Context) -> usize {
738 24
739 }
740 }
741
742 unsafe impl
743 fidl::encoding::Encode<StateGetWatcherRequest, fdomain_client::fidl::FDomainResourceDialect>
744 for &mut StateGetWatcherRequest
745 {
746 #[inline]
747 unsafe fn encode(
748 self,
749 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
750 offset: usize,
751 _depth: fidl::encoding::Depth,
752 ) -> fidl::Result<()> {
753 encoder.debug_check_bounds::<StateGetWatcherRequest>(offset);
754 fidl::encoding::Encode::<StateGetWatcherRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
756 (
757 <WatcherOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
758 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
759 ),
760 encoder, offset, _depth
761 )
762 }
763 }
764 unsafe impl<
765 T0: fidl::encoding::Encode<WatcherOptions, fdomain_client::fidl::FDomainResourceDialect>,
766 T1: fidl::encoding::Encode<
767 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherMarker>>,
768 fdomain_client::fidl::FDomainResourceDialect,
769 >,
770 >
771 fidl::encoding::Encode<StateGetWatcherRequest, fdomain_client::fidl::FDomainResourceDialect>
772 for (T0, T1)
773 {
774 #[inline]
775 unsafe fn encode(
776 self,
777 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
778 offset: usize,
779 depth: fidl::encoding::Depth,
780 ) -> fidl::Result<()> {
781 encoder.debug_check_bounds::<StateGetWatcherRequest>(offset);
782 unsafe {
785 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
786 (ptr as *mut u64).write_unaligned(0);
787 }
788 self.0.encode(encoder, offset + 0, depth)?;
790 self.1.encode(encoder, offset + 16, depth)?;
791 Ok(())
792 }
793 }
794
795 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
796 for StateGetWatcherRequest
797 {
798 #[inline(always)]
799 fn new_empty() -> Self {
800 Self {
801 options: fidl::new_empty!(
802 WatcherOptions,
803 fdomain_client::fidl::FDomainResourceDialect
804 ),
805 watcher: fidl::new_empty!(
806 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherMarker>>,
807 fdomain_client::fidl::FDomainResourceDialect
808 ),
809 }
810 }
811
812 #[inline]
813 unsafe fn decode(
814 &mut self,
815 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
816 offset: usize,
817 _depth: fidl::encoding::Depth,
818 ) -> fidl::Result<()> {
819 decoder.debug_check_bounds::<Self>(offset);
820 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
822 let padval = unsafe { (ptr as *const u64).read_unaligned() };
823 let mask = 0xffffffff00000000u64;
824 let maskedval = padval & mask;
825 if maskedval != 0 {
826 return Err(fidl::Error::NonZeroPadding {
827 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
828 });
829 }
830 fidl::decode!(
831 WatcherOptions,
832 fdomain_client::fidl::FDomainResourceDialect,
833 &mut self.options,
834 decoder,
835 offset + 0,
836 _depth
837 )?;
838 fidl::decode!(
839 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherMarker>>,
840 fdomain_client::fidl::FDomainResourceDialect,
841 &mut self.watcher,
842 decoder,
843 offset + 16,
844 _depth
845 )?;
846 Ok(())
847 }
848 }
849}