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 _};
10pub use fidl_fuchsia_net_filter__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControlOpenControllerRequest {
16 pub id: String,
17 pub request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ControlOpenControllerRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct ControlReopenDetachedControllerRequest {
27 pub key: ControllerKey,
28 pub request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for ControlReopenDetachedControllerRequest
33{
34}
35
36#[derive(Debug, PartialEq)]
37pub struct NamespaceControllerPushChangesRequest {
38 pub changes: Vec<Change>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for NamespaceControllerPushChangesRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct StateGetWatcherRequest {
49 pub options: WatcherOptions,
50 pub request: fidl::endpoints::ServerEnd<WatcherMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StateGetWatcherRequest {}
54
55#[derive(Debug, Default, PartialEq)]
56pub struct AttachEbpfProgramOptions {
57 pub hook: Option<SocketHook>,
58 pub program: Option<fidl_fuchsia_ebpf::VerifiedProgram>,
59 #[doc(hidden)]
60 pub __source_breaking: fidl::marker::SourceBreaking,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AttachEbpfProgramOptions {}
64
65#[derive(Debug, Default, PartialEq)]
66pub struct CommitOptions {
67 pub idempotent: Option<bool>,
76 #[doc(hidden)]
77 pub __source_breaking: fidl::marker::SourceBreaking,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CommitOptions {}
81
82#[derive(Debug)]
83pub enum ChangeValidationResult {
84 Ok(Empty),
86 TooManyChanges(Empty),
92 ErrorOnChange(Vec<ChangeValidationError>),
102 #[doc(hidden)]
103 __SourceBreaking { unknown_ordinal: u64 },
104}
105
106#[macro_export]
108macro_rules! ChangeValidationResultUnknown {
109 () => {
110 _
111 };
112}
113
114impl PartialEq for ChangeValidationResult {
116 fn eq(&self, other: &Self) -> bool {
117 match (self, other) {
118 (Self::Ok(x), Self::Ok(y)) => *x == *y,
119 (Self::TooManyChanges(x), Self::TooManyChanges(y)) => *x == *y,
120 (Self::ErrorOnChange(x), Self::ErrorOnChange(y)) => *x == *y,
121 _ => false,
122 }
123 }
124}
125
126impl ChangeValidationResult {
127 #[inline]
128 pub fn ordinal(&self) -> u64 {
129 match *self {
130 Self::Ok(_) => 1,
131 Self::TooManyChanges(_) => 2,
132 Self::ErrorOnChange(_) => 3,
133 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
134 }
135 }
136
137 #[inline]
138 pub fn unknown_variant_for_testing() -> Self {
139 Self::__SourceBreaking { unknown_ordinal: 0 }
140 }
141
142 #[inline]
143 pub fn is_unknown(&self) -> bool {
144 match self {
145 Self::__SourceBreaking { .. } => true,
146 _ => false,
147 }
148 }
149}
150
151impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ChangeValidationResult {}
152
153#[derive(Debug)]
154pub enum CommitResult {
155 Ok(Empty),
157 RuleWithInvalidMatcher(RuleId),
165 RuleWithInvalidAction(RuleId),
170 CyclicalRoutineGraph(RoutineId),
176 ErrorOnChange(Vec<CommitError>),
182 TransparentProxyWithInvalidMatcher(RuleId),
186 RedirectWithInvalidMatcher(RuleId),
191 MasqueradeWithInvalidMatcher(RuleId),
196 #[doc(hidden)]
197 __SourceBreaking { unknown_ordinal: u64 },
198}
199
200#[macro_export]
202macro_rules! CommitResultUnknown {
203 () => {
204 _
205 };
206}
207
208impl PartialEq for CommitResult {
210 fn eq(&self, other: &Self) -> bool {
211 match (self, other) {
212 (Self::Ok(x), Self::Ok(y)) => *x == *y,
213 (Self::RuleWithInvalidMatcher(x), Self::RuleWithInvalidMatcher(y)) => *x == *y,
214 (Self::RuleWithInvalidAction(x), Self::RuleWithInvalidAction(y)) => *x == *y,
215 (Self::CyclicalRoutineGraph(x), Self::CyclicalRoutineGraph(y)) => *x == *y,
216 (Self::ErrorOnChange(x), Self::ErrorOnChange(y)) => *x == *y,
217 (
218 Self::TransparentProxyWithInvalidMatcher(x),
219 Self::TransparentProxyWithInvalidMatcher(y),
220 ) => *x == *y,
221 (Self::RedirectWithInvalidMatcher(x), Self::RedirectWithInvalidMatcher(y)) => *x == *y,
222 (Self::MasqueradeWithInvalidMatcher(x), Self::MasqueradeWithInvalidMatcher(y)) => {
223 *x == *y
224 }
225 _ => false,
226 }
227 }
228}
229
230impl CommitResult {
231 #[inline]
232 pub fn ordinal(&self) -> u64 {
233 match *self {
234 Self::Ok(_) => 1,
235 Self::RuleWithInvalidMatcher(_) => 2,
236 Self::RuleWithInvalidAction(_) => 3,
237 Self::CyclicalRoutineGraph(_) => 4,
238 Self::ErrorOnChange(_) => 5,
239 Self::TransparentProxyWithInvalidMatcher(_) => 6,
240 Self::RedirectWithInvalidMatcher(_) => 7,
241 Self::MasqueradeWithInvalidMatcher(_) => 8,
242 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
243 }
244 }
245
246 #[inline]
247 pub fn unknown_variant_for_testing() -> Self {
248 Self::__SourceBreaking { unknown_ordinal: 0 }
249 }
250
251 #[inline]
252 pub fn is_unknown(&self) -> bool {
253 match self {
254 Self::__SourceBreaking { .. } => true,
255 _ => false,
256 }
257 }
258}
259
260impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CommitResult {}
261
262#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
263pub struct ControlMarker;
264
265impl fidl::endpoints::ProtocolMarker for ControlMarker {
266 type Proxy = ControlProxy;
267 type RequestStream = ControlRequestStream;
268 #[cfg(target_os = "fuchsia")]
269 type SynchronousProxy = ControlSynchronousProxy;
270
271 const DEBUG_NAME: &'static str = "fuchsia.net.filter.Control";
272}
273impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
274
275pub trait ControlProxyInterface: Send + Sync {
276 fn r#open_controller(
277 &self,
278 id: &str,
279 request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
280 ) -> Result<(), fidl::Error>;
281 fn r#reopen_detached_controller(
282 &self,
283 key: &ControllerKey,
284 request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
285 ) -> Result<(), fidl::Error>;
286}
287#[derive(Debug)]
288#[cfg(target_os = "fuchsia")]
289pub struct ControlSynchronousProxy {
290 client: fidl::client::sync::Client,
291}
292
293#[cfg(target_os = "fuchsia")]
294impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
295 type Proxy = ControlProxy;
296 type Protocol = ControlMarker;
297
298 fn from_channel(inner: fidl::Channel) -> Self {
299 Self::new(inner)
300 }
301
302 fn into_channel(self) -> fidl::Channel {
303 self.client.into_channel()
304 }
305
306 fn as_channel(&self) -> &fidl::Channel {
307 self.client.as_channel()
308 }
309}
310
311#[cfg(target_os = "fuchsia")]
312impl ControlSynchronousProxy {
313 pub fn new(channel: fidl::Channel) -> Self {
314 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
315 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
316 }
317
318 pub fn into_channel(self) -> fidl::Channel {
319 self.client.into_channel()
320 }
321
322 pub fn wait_for_event(
325 &self,
326 deadline: zx::MonotonicInstant,
327 ) -> Result<ControlEvent, fidl::Error> {
328 ControlEvent::decode(self.client.wait_for_event(deadline)?)
329 }
330
331 pub fn r#open_controller(
333 &self,
334 mut id: &str,
335 mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
336 ) -> Result<(), fidl::Error> {
337 self.client.send::<ControlOpenControllerRequest>(
338 (id, request),
339 0x2e1014a4c918d0e6,
340 fidl::encoding::DynamicFlags::empty(),
341 )
342 }
343
344 pub fn r#reopen_detached_controller(
357 &self,
358 mut key: &ControllerKey,
359 mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
360 ) -> Result<(), fidl::Error> {
361 self.client.send::<ControlReopenDetachedControllerRequest>(
362 (key, request),
363 0x59cf56d70942967a,
364 fidl::encoding::DynamicFlags::empty(),
365 )
366 }
367}
368
369#[cfg(target_os = "fuchsia")]
370impl From<ControlSynchronousProxy> for zx::Handle {
371 fn from(value: ControlSynchronousProxy) -> Self {
372 value.into_channel().into()
373 }
374}
375
376#[cfg(target_os = "fuchsia")]
377impl From<fidl::Channel> for ControlSynchronousProxy {
378 fn from(value: fidl::Channel) -> Self {
379 Self::new(value)
380 }
381}
382
383#[cfg(target_os = "fuchsia")]
384impl fidl::endpoints::FromClient for ControlSynchronousProxy {
385 type Protocol = ControlMarker;
386
387 fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
388 Self::new(value.into_channel())
389 }
390}
391
392#[derive(Debug, Clone)]
393pub struct ControlProxy {
394 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
395}
396
397impl fidl::endpoints::Proxy for ControlProxy {
398 type Protocol = ControlMarker;
399
400 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
401 Self::new(inner)
402 }
403
404 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
405 self.client.into_channel().map_err(|client| Self { client })
406 }
407
408 fn as_channel(&self) -> &::fidl::AsyncChannel {
409 self.client.as_channel()
410 }
411}
412
413impl ControlProxy {
414 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
416 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
417 Self { client: fidl::client::Client::new(channel, protocol_name) }
418 }
419
420 pub fn take_event_stream(&self) -> ControlEventStream {
426 ControlEventStream { event_receiver: self.client.take_event_receiver() }
427 }
428
429 pub fn r#open_controller(
431 &self,
432 mut id: &str,
433 mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
434 ) -> Result<(), fidl::Error> {
435 ControlProxyInterface::r#open_controller(self, id, request)
436 }
437
438 pub fn r#reopen_detached_controller(
451 &self,
452 mut key: &ControllerKey,
453 mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
454 ) -> Result<(), fidl::Error> {
455 ControlProxyInterface::r#reopen_detached_controller(self, key, request)
456 }
457}
458
459impl ControlProxyInterface for ControlProxy {
460 fn r#open_controller(
461 &self,
462 mut id: &str,
463 mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
464 ) -> Result<(), fidl::Error> {
465 self.client.send::<ControlOpenControllerRequest>(
466 (id, request),
467 0x2e1014a4c918d0e6,
468 fidl::encoding::DynamicFlags::empty(),
469 )
470 }
471
472 fn r#reopen_detached_controller(
473 &self,
474 mut key: &ControllerKey,
475 mut request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
476 ) -> Result<(), fidl::Error> {
477 self.client.send::<ControlReopenDetachedControllerRequest>(
478 (key, request),
479 0x59cf56d70942967a,
480 fidl::encoding::DynamicFlags::empty(),
481 )
482 }
483}
484
485pub struct ControlEventStream {
486 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
487}
488
489impl std::marker::Unpin for ControlEventStream {}
490
491impl futures::stream::FusedStream for ControlEventStream {
492 fn is_terminated(&self) -> bool {
493 self.event_receiver.is_terminated()
494 }
495}
496
497impl futures::Stream for ControlEventStream {
498 type Item = Result<ControlEvent, 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(ControlEvent::decode(buf))),
509 None => std::task::Poll::Ready(None),
510 }
511 }
512}
513
514#[derive(Debug)]
515pub enum ControlEvent {}
516
517impl ControlEvent {
518 fn decode(
520 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
521 ) -> Result<ControlEvent, 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: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
529 }),
530 }
531 }
532}
533
534pub struct ControlRequestStream {
536 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
537 is_terminated: bool,
538}
539
540impl std::marker::Unpin for ControlRequestStream {}
541
542impl futures::stream::FusedStream for ControlRequestStream {
543 fn is_terminated(&self) -> bool {
544 self.is_terminated
545 }
546}
547
548impl fidl::endpoints::RequestStream for ControlRequestStream {
549 type Protocol = ControlMarker;
550 type ControlHandle = ControlControlHandle;
551
552 fn from_channel(channel: ::fidl::AsyncChannel) -> 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 ControlControlHandle { inner: self.inner.clone() }
558 }
559
560 fn into_inner(
561 self,
562 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
563 {
564 (self.inner, self.is_terminated)
565 }
566
567 fn from_inner(
568 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
569 is_terminated: bool,
570 ) -> Self {
571 Self { inner, is_terminated }
572 }
573}
574
575impl futures::Stream for ControlRequestStream {
576 type Item = Result<ControlRequest, 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 ControlRequestStream after completion");
589 }
590 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
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(zx_status::Status::PEER_CLOSED)) => {
596 this.is_terminated = true;
597 return std::task::Poll::Ready(None);
598 }
599 std::task::Poll::Ready(Err(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 0x2e1014a4c918d0e6 => {
611 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
612 let mut req = fidl::new_empty!(
613 ControlOpenControllerRequest,
614 fidl::encoding::DefaultFuchsiaResourceDialect
615 );
616 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
617 let control_handle = ControlControlHandle { inner: this.inner.clone() };
618 Ok(ControlRequest::OpenController {
619 id: req.id,
620 request: req.request,
621
622 control_handle,
623 })
624 }
625 0x59cf56d70942967a => {
626 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
627 let mut req = fidl::new_empty!(
628 ControlReopenDetachedControllerRequest,
629 fidl::encoding::DefaultFuchsiaResourceDialect
630 );
631 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlReopenDetachedControllerRequest>(&header, _body_bytes, handles, &mut req)?;
632 let control_handle = ControlControlHandle { inner: this.inner.clone() };
633 Ok(ControlRequest::ReopenDetachedController {
634 key: req.key,
635 request: req.request,
636
637 control_handle,
638 })
639 }
640 _ => Err(fidl::Error::UnknownOrdinal {
641 ordinal: header.ordinal,
642 protocol_name:
643 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
644 }),
645 }))
646 },
647 )
648 }
649}
650
651#[derive(Debug)]
653pub enum ControlRequest {
654 OpenController {
656 id: String,
657 request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
658 control_handle: ControlControlHandle,
659 },
660 ReopenDetachedController {
673 key: ControllerKey,
674 request: fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
675 control_handle: ControlControlHandle,
676 },
677}
678
679impl ControlRequest {
680 #[allow(irrefutable_let_patterns)]
681 pub fn into_open_controller(
682 self,
683 ) -> Option<(String, fidl::endpoints::ServerEnd<NamespaceControllerMarker>, ControlControlHandle)>
684 {
685 if let ControlRequest::OpenController { id, request, control_handle } = self {
686 Some((id, request, control_handle))
687 } else {
688 None
689 }
690 }
691
692 #[allow(irrefutable_let_patterns)]
693 pub fn into_reopen_detached_controller(
694 self,
695 ) -> Option<(
696 ControllerKey,
697 fidl::endpoints::ServerEnd<NamespaceControllerMarker>,
698 ControlControlHandle,
699 )> {
700 if let ControlRequest::ReopenDetachedController { key, request, control_handle } = self {
701 Some((key, request, control_handle))
702 } else {
703 None
704 }
705 }
706
707 pub fn method_name(&self) -> &'static str {
709 match *self {
710 ControlRequest::OpenController { .. } => "open_controller",
711 ControlRequest::ReopenDetachedController { .. } => "reopen_detached_controller",
712 }
713 }
714}
715
716#[derive(Debug, Clone)]
717pub struct ControlControlHandle {
718 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
719}
720
721impl fidl::endpoints::ControlHandle for ControlControlHandle {
722 fn shutdown(&self) {
723 self.inner.shutdown()
724 }
725 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
726 self.inner.shutdown_with_epitaph(status)
727 }
728
729 fn is_closed(&self) -> bool {
730 self.inner.channel().is_closed()
731 }
732 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
733 self.inner.channel().on_closed()
734 }
735
736 #[cfg(target_os = "fuchsia")]
737 fn signal_peer(
738 &self,
739 clear_mask: zx::Signals,
740 set_mask: zx::Signals,
741 ) -> Result<(), zx_status::Status> {
742 use fidl::Peered;
743 self.inner.channel().signal_peer(clear_mask, set_mask)
744 }
745}
746
747impl ControlControlHandle {}
748
749#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
750pub struct NamespaceControllerMarker;
751
752impl fidl::endpoints::ProtocolMarker for NamespaceControllerMarker {
753 type Proxy = NamespaceControllerProxy;
754 type RequestStream = NamespaceControllerRequestStream;
755 #[cfg(target_os = "fuchsia")]
756 type SynchronousProxy = NamespaceControllerSynchronousProxy;
757
758 const DEBUG_NAME: &'static str = "(anonymous) NamespaceController";
759}
760
761pub trait NamespaceControllerProxyInterface: Send + Sync {
762 type DetachResponseFut: std::future::Future<Output = Result<[u8; 16], fidl::Error>> + Send;
763 fn r#detach(&self) -> Self::DetachResponseFut;
764 type PushChangesResponseFut: std::future::Future<Output = Result<ChangeValidationResult, fidl::Error>>
765 + Send;
766 fn r#push_changes(&self, changes: &[Change]) -> Self::PushChangesResponseFut;
767 type CommitResponseFut: std::future::Future<Output = Result<CommitResult, fidl::Error>> + Send;
768 fn r#commit(&self, payload: CommitOptions) -> Self::CommitResponseFut;
769}
770#[derive(Debug)]
771#[cfg(target_os = "fuchsia")]
772pub struct NamespaceControllerSynchronousProxy {
773 client: fidl::client::sync::Client,
774}
775
776#[cfg(target_os = "fuchsia")]
777impl fidl::endpoints::SynchronousProxy for NamespaceControllerSynchronousProxy {
778 type Proxy = NamespaceControllerProxy;
779 type Protocol = NamespaceControllerMarker;
780
781 fn from_channel(inner: fidl::Channel) -> Self {
782 Self::new(inner)
783 }
784
785 fn into_channel(self) -> fidl::Channel {
786 self.client.into_channel()
787 }
788
789 fn as_channel(&self) -> &fidl::Channel {
790 self.client.as_channel()
791 }
792}
793
794#[cfg(target_os = "fuchsia")]
795impl NamespaceControllerSynchronousProxy {
796 pub fn new(channel: fidl::Channel) -> Self {
797 let protocol_name =
798 <NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
799 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
800 }
801
802 pub fn into_channel(self) -> fidl::Channel {
803 self.client.into_channel()
804 }
805
806 pub fn wait_for_event(
809 &self,
810 deadline: zx::MonotonicInstant,
811 ) -> Result<NamespaceControllerEvent, fidl::Error> {
812 NamespaceControllerEvent::decode(self.client.wait_for_event(deadline)?)
813 }
814
815 pub fn r#detach(&self, ___deadline: zx::MonotonicInstant) -> Result<[u8; 16], fidl::Error> {
837 let _response = self.client.send_query::<fidl::encoding::EmptyPayload, ControllerKey>(
838 (),
839 0x15db86969aaa7c37,
840 fidl::encoding::DynamicFlags::empty(),
841 ___deadline,
842 )?;
843 Ok(_response.uuid)
844 }
845
846 pub fn r#push_changes(
851 &self,
852 mut changes: &[Change],
853 ___deadline: zx::MonotonicInstant,
854 ) -> Result<ChangeValidationResult, fidl::Error> {
855 let _response = self
856 .client
857 .send_query::<NamespaceControllerPushChangesRequest, ChangeValidationResult>(
858 (changes,),
859 0x2c814d42c2783ee6,
860 fidl::encoding::DynamicFlags::empty(),
861 ___deadline,
862 )?;
863 Ok(_response)
864 }
865
866 pub fn r#commit(
869 &self,
870 mut payload: CommitOptions,
871 ___deadline: zx::MonotonicInstant,
872 ) -> Result<CommitResult, fidl::Error> {
873 let _response = self.client.send_query::<CommitOptions, CommitResult>(
874 &mut payload,
875 0x49ed5545357963e4,
876 fidl::encoding::DynamicFlags::empty(),
877 ___deadline,
878 )?;
879 Ok(_response)
880 }
881}
882
883#[cfg(target_os = "fuchsia")]
884impl From<NamespaceControllerSynchronousProxy> for zx::Handle {
885 fn from(value: NamespaceControllerSynchronousProxy) -> Self {
886 value.into_channel().into()
887 }
888}
889
890#[cfg(target_os = "fuchsia")]
891impl From<fidl::Channel> for NamespaceControllerSynchronousProxy {
892 fn from(value: fidl::Channel) -> Self {
893 Self::new(value)
894 }
895}
896
897#[cfg(target_os = "fuchsia")]
898impl fidl::endpoints::FromClient for NamespaceControllerSynchronousProxy {
899 type Protocol = NamespaceControllerMarker;
900
901 fn from_client(value: fidl::endpoints::ClientEnd<NamespaceControllerMarker>) -> Self {
902 Self::new(value.into_channel())
903 }
904}
905
906#[derive(Debug, Clone)]
907pub struct NamespaceControllerProxy {
908 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
909}
910
911impl fidl::endpoints::Proxy for NamespaceControllerProxy {
912 type Protocol = NamespaceControllerMarker;
913
914 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
915 Self::new(inner)
916 }
917
918 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
919 self.client.into_channel().map_err(|client| Self { client })
920 }
921
922 fn as_channel(&self) -> &::fidl::AsyncChannel {
923 self.client.as_channel()
924 }
925}
926
927impl NamespaceControllerProxy {
928 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
930 let protocol_name =
931 <NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
932 Self { client: fidl::client::Client::new(channel, protocol_name) }
933 }
934
935 pub fn take_event_stream(&self) -> NamespaceControllerEventStream {
941 NamespaceControllerEventStream { event_receiver: self.client.take_event_receiver() }
942 }
943
944 pub fn r#detach(
966 &self,
967 ) -> fidl::client::QueryResponseFut<[u8; 16], fidl::encoding::DefaultFuchsiaResourceDialect>
968 {
969 NamespaceControllerProxyInterface::r#detach(self)
970 }
971
972 pub fn r#push_changes(
977 &self,
978 mut changes: &[Change],
979 ) -> fidl::client::QueryResponseFut<
980 ChangeValidationResult,
981 fidl::encoding::DefaultFuchsiaResourceDialect,
982 > {
983 NamespaceControllerProxyInterface::r#push_changes(self, changes)
984 }
985
986 pub fn r#commit(
989 &self,
990 mut payload: CommitOptions,
991 ) -> fidl::client::QueryResponseFut<CommitResult, fidl::encoding::DefaultFuchsiaResourceDialect>
992 {
993 NamespaceControllerProxyInterface::r#commit(self, payload)
994 }
995}
996
997impl NamespaceControllerProxyInterface for NamespaceControllerProxy {
998 type DetachResponseFut =
999 fidl::client::QueryResponseFut<[u8; 16], fidl::encoding::DefaultFuchsiaResourceDialect>;
1000 fn r#detach(&self) -> Self::DetachResponseFut {
1001 fn _decode(
1002 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1003 ) -> Result<[u8; 16], fidl::Error> {
1004 let _response = fidl::client::decode_transaction_body::<
1005 ControllerKey,
1006 fidl::encoding::DefaultFuchsiaResourceDialect,
1007 0x15db86969aaa7c37,
1008 >(_buf?)?;
1009 Ok(_response.uuid)
1010 }
1011 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 16]>(
1012 (),
1013 0x15db86969aaa7c37,
1014 fidl::encoding::DynamicFlags::empty(),
1015 _decode,
1016 )
1017 }
1018
1019 type PushChangesResponseFut = fidl::client::QueryResponseFut<
1020 ChangeValidationResult,
1021 fidl::encoding::DefaultFuchsiaResourceDialect,
1022 >;
1023 fn r#push_changes(&self, mut changes: &[Change]) -> Self::PushChangesResponseFut {
1024 fn _decode(
1025 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1026 ) -> Result<ChangeValidationResult, fidl::Error> {
1027 let _response = fidl::client::decode_transaction_body::<
1028 ChangeValidationResult,
1029 fidl::encoding::DefaultFuchsiaResourceDialect,
1030 0x2c814d42c2783ee6,
1031 >(_buf?)?;
1032 Ok(_response)
1033 }
1034 self.client
1035 .send_query_and_decode::<NamespaceControllerPushChangesRequest, ChangeValidationResult>(
1036 (changes,),
1037 0x2c814d42c2783ee6,
1038 fidl::encoding::DynamicFlags::empty(),
1039 _decode,
1040 )
1041 }
1042
1043 type CommitResponseFut =
1044 fidl::client::QueryResponseFut<CommitResult, fidl::encoding::DefaultFuchsiaResourceDialect>;
1045 fn r#commit(&self, mut payload: CommitOptions) -> Self::CommitResponseFut {
1046 fn _decode(
1047 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1048 ) -> Result<CommitResult, fidl::Error> {
1049 let _response = fidl::client::decode_transaction_body::<
1050 CommitResult,
1051 fidl::encoding::DefaultFuchsiaResourceDialect,
1052 0x49ed5545357963e4,
1053 >(_buf?)?;
1054 Ok(_response)
1055 }
1056 self.client.send_query_and_decode::<CommitOptions, CommitResult>(
1057 &mut payload,
1058 0x49ed5545357963e4,
1059 fidl::encoding::DynamicFlags::empty(),
1060 _decode,
1061 )
1062 }
1063}
1064
1065pub struct NamespaceControllerEventStream {
1066 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1067}
1068
1069impl std::marker::Unpin for NamespaceControllerEventStream {}
1070
1071impl futures::stream::FusedStream for NamespaceControllerEventStream {
1072 fn is_terminated(&self) -> bool {
1073 self.event_receiver.is_terminated()
1074 }
1075}
1076
1077impl futures::Stream for NamespaceControllerEventStream {
1078 type Item = Result<NamespaceControllerEvent, fidl::Error>;
1079
1080 fn poll_next(
1081 mut self: std::pin::Pin<&mut Self>,
1082 cx: &mut std::task::Context<'_>,
1083 ) -> std::task::Poll<Option<Self::Item>> {
1084 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1085 &mut self.event_receiver,
1086 cx
1087 )?) {
1088 Some(buf) => std::task::Poll::Ready(Some(NamespaceControllerEvent::decode(buf))),
1089 None => std::task::Poll::Ready(None),
1090 }
1091 }
1092}
1093
1094#[derive(Debug)]
1095pub enum NamespaceControllerEvent {
1096 OnIdAssigned { id: String },
1097}
1098
1099impl NamespaceControllerEvent {
1100 #[allow(irrefutable_let_patterns)]
1101 pub fn into_on_id_assigned(self) -> Option<String> {
1102 if let NamespaceControllerEvent::OnIdAssigned { id } = self { Some((id)) } else { None }
1103 }
1104
1105 fn decode(
1107 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1108 ) -> Result<NamespaceControllerEvent, fidl::Error> {
1109 let (bytes, _handles) = buf.split_mut();
1110 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1111 debug_assert_eq!(tx_header.tx_id, 0);
1112 match tx_header.ordinal {
1113 0x2e218c64a1d5ea74 => {
1114 let mut out = fidl::new_empty!(
1115 NamespaceControllerOnIdAssignedRequest,
1116 fidl::encoding::DefaultFuchsiaResourceDialect
1117 );
1118 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceControllerOnIdAssignedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1119 Ok((NamespaceControllerEvent::OnIdAssigned { id: out.id }))
1120 }
1121 _ => Err(fidl::Error::UnknownOrdinal {
1122 ordinal: tx_header.ordinal,
1123 protocol_name:
1124 <NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1125 }),
1126 }
1127 }
1128}
1129
1130pub struct NamespaceControllerRequestStream {
1132 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1133 is_terminated: bool,
1134}
1135
1136impl std::marker::Unpin for NamespaceControllerRequestStream {}
1137
1138impl futures::stream::FusedStream for NamespaceControllerRequestStream {
1139 fn is_terminated(&self) -> bool {
1140 self.is_terminated
1141 }
1142}
1143
1144impl fidl::endpoints::RequestStream for NamespaceControllerRequestStream {
1145 type Protocol = NamespaceControllerMarker;
1146 type ControlHandle = NamespaceControllerControlHandle;
1147
1148 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1149 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1150 }
1151
1152 fn control_handle(&self) -> Self::ControlHandle {
1153 NamespaceControllerControlHandle { inner: self.inner.clone() }
1154 }
1155
1156 fn into_inner(
1157 self,
1158 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1159 {
1160 (self.inner, self.is_terminated)
1161 }
1162
1163 fn from_inner(
1164 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1165 is_terminated: bool,
1166 ) -> Self {
1167 Self { inner, is_terminated }
1168 }
1169}
1170
1171impl futures::Stream for NamespaceControllerRequestStream {
1172 type Item = Result<NamespaceControllerRequest, fidl::Error>;
1173
1174 fn poll_next(
1175 mut self: std::pin::Pin<&mut Self>,
1176 cx: &mut std::task::Context<'_>,
1177 ) -> std::task::Poll<Option<Self::Item>> {
1178 let this = &mut *self;
1179 if this.inner.check_shutdown(cx) {
1180 this.is_terminated = true;
1181 return std::task::Poll::Ready(None);
1182 }
1183 if this.is_terminated {
1184 panic!("polled NamespaceControllerRequestStream after completion");
1185 }
1186 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1187 |bytes, handles| {
1188 match this.inner.channel().read_etc(cx, bytes, handles) {
1189 std::task::Poll::Ready(Ok(())) => {}
1190 std::task::Poll::Pending => return std::task::Poll::Pending,
1191 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1192 this.is_terminated = true;
1193 return std::task::Poll::Ready(None);
1194 }
1195 std::task::Poll::Ready(Err(e)) => {
1196 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1197 e.into(),
1198 ))));
1199 }
1200 }
1201
1202 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1204
1205 std::task::Poll::Ready(Some(match header.ordinal {
1206 0x15db86969aaa7c37 => {
1207 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1208 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1209 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1210 let control_handle = NamespaceControllerControlHandle {
1211 inner: this.inner.clone(),
1212 };
1213 Ok(NamespaceControllerRequest::Detach {
1214 responder: NamespaceControllerDetachResponder {
1215 control_handle: std::mem::ManuallyDrop::new(control_handle),
1216 tx_id: header.tx_id,
1217 },
1218 })
1219 }
1220 0x2c814d42c2783ee6 => {
1221 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1222 let mut req = fidl::new_empty!(NamespaceControllerPushChangesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1223 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceControllerPushChangesRequest>(&header, _body_bytes, handles, &mut req)?;
1224 let control_handle = NamespaceControllerControlHandle {
1225 inner: this.inner.clone(),
1226 };
1227 Ok(NamespaceControllerRequest::PushChanges {changes: req.changes,
1228
1229 responder: NamespaceControllerPushChangesResponder {
1230 control_handle: std::mem::ManuallyDrop::new(control_handle),
1231 tx_id: header.tx_id,
1232 },
1233 })
1234 }
1235 0x49ed5545357963e4 => {
1236 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1237 let mut req = fidl::new_empty!(CommitOptions, fidl::encoding::DefaultFuchsiaResourceDialect);
1238 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommitOptions>(&header, _body_bytes, handles, &mut req)?;
1239 let control_handle = NamespaceControllerControlHandle {
1240 inner: this.inner.clone(),
1241 };
1242 Ok(NamespaceControllerRequest::Commit {payload: req,
1243 responder: NamespaceControllerCommitResponder {
1244 control_handle: std::mem::ManuallyDrop::new(control_handle),
1245 tx_id: header.tx_id,
1246 },
1247 })
1248 }
1249 _ => Err(fidl::Error::UnknownOrdinal {
1250 ordinal: header.ordinal,
1251 protocol_name: <NamespaceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1252 }),
1253 }))
1254 },
1255 )
1256 }
1257}
1258
1259#[derive(Debug)]
1269pub enum NamespaceControllerRequest {
1270 Detach { responder: NamespaceControllerDetachResponder },
1292 PushChanges { changes: Vec<Change>, responder: NamespaceControllerPushChangesResponder },
1297 Commit { payload: CommitOptions, responder: NamespaceControllerCommitResponder },
1300}
1301
1302impl NamespaceControllerRequest {
1303 #[allow(irrefutable_let_patterns)]
1304 pub fn into_detach(self) -> Option<(NamespaceControllerDetachResponder)> {
1305 if let NamespaceControllerRequest::Detach { responder } = self {
1306 Some((responder))
1307 } else {
1308 None
1309 }
1310 }
1311
1312 #[allow(irrefutable_let_patterns)]
1313 pub fn into_push_changes(
1314 self,
1315 ) -> Option<(Vec<Change>, NamespaceControllerPushChangesResponder)> {
1316 if let NamespaceControllerRequest::PushChanges { changes, responder } = self {
1317 Some((changes, responder))
1318 } else {
1319 None
1320 }
1321 }
1322
1323 #[allow(irrefutable_let_patterns)]
1324 pub fn into_commit(self) -> Option<(CommitOptions, NamespaceControllerCommitResponder)> {
1325 if let NamespaceControllerRequest::Commit { payload, responder } = self {
1326 Some((payload, responder))
1327 } else {
1328 None
1329 }
1330 }
1331
1332 pub fn method_name(&self) -> &'static str {
1334 match *self {
1335 NamespaceControllerRequest::Detach { .. } => "detach",
1336 NamespaceControllerRequest::PushChanges { .. } => "push_changes",
1337 NamespaceControllerRequest::Commit { .. } => "commit",
1338 }
1339 }
1340}
1341
1342#[derive(Debug, Clone)]
1343pub struct NamespaceControllerControlHandle {
1344 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1345}
1346
1347impl fidl::endpoints::ControlHandle for NamespaceControllerControlHandle {
1348 fn shutdown(&self) {
1349 self.inner.shutdown()
1350 }
1351 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1352 self.inner.shutdown_with_epitaph(status)
1353 }
1354
1355 fn is_closed(&self) -> bool {
1356 self.inner.channel().is_closed()
1357 }
1358 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1359 self.inner.channel().on_closed()
1360 }
1361
1362 #[cfg(target_os = "fuchsia")]
1363 fn signal_peer(
1364 &self,
1365 clear_mask: zx::Signals,
1366 set_mask: zx::Signals,
1367 ) -> Result<(), zx_status::Status> {
1368 use fidl::Peered;
1369 self.inner.channel().signal_peer(clear_mask, set_mask)
1370 }
1371}
1372
1373impl NamespaceControllerControlHandle {
1374 pub fn send_on_id_assigned(&self, mut id: &str) -> Result<(), fidl::Error> {
1375 self.inner.send::<NamespaceControllerOnIdAssignedRequest>(
1376 (id,),
1377 0,
1378 0x2e218c64a1d5ea74,
1379 fidl::encoding::DynamicFlags::empty(),
1380 )
1381 }
1382}
1383
1384#[must_use = "FIDL methods require a response to be sent"]
1385#[derive(Debug)]
1386pub struct NamespaceControllerDetachResponder {
1387 control_handle: std::mem::ManuallyDrop<NamespaceControllerControlHandle>,
1388 tx_id: u32,
1389}
1390
1391impl std::ops::Drop for NamespaceControllerDetachResponder {
1395 fn drop(&mut self) {
1396 self.control_handle.shutdown();
1397 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1399 }
1400}
1401
1402impl fidl::endpoints::Responder for NamespaceControllerDetachResponder {
1403 type ControlHandle = NamespaceControllerControlHandle;
1404
1405 fn control_handle(&self) -> &NamespaceControllerControlHandle {
1406 &self.control_handle
1407 }
1408
1409 fn drop_without_shutdown(mut self) {
1410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1412 std::mem::forget(self);
1414 }
1415}
1416
1417impl NamespaceControllerDetachResponder {
1418 pub fn send(self, mut uuid: &[u8; 16]) -> Result<(), fidl::Error> {
1422 let _result = self.send_raw(uuid);
1423 if _result.is_err() {
1424 self.control_handle.shutdown();
1425 }
1426 self.drop_without_shutdown();
1427 _result
1428 }
1429
1430 pub fn send_no_shutdown_on_err(self, mut uuid: &[u8; 16]) -> Result<(), fidl::Error> {
1432 let _result = self.send_raw(uuid);
1433 self.drop_without_shutdown();
1434 _result
1435 }
1436
1437 fn send_raw(&self, mut uuid: &[u8; 16]) -> Result<(), fidl::Error> {
1438 self.control_handle.inner.send::<ControllerKey>(
1439 (uuid,),
1440 self.tx_id,
1441 0x15db86969aaa7c37,
1442 fidl::encoding::DynamicFlags::empty(),
1443 )
1444 }
1445}
1446
1447#[must_use = "FIDL methods require a response to be sent"]
1448#[derive(Debug)]
1449pub struct NamespaceControllerPushChangesResponder {
1450 control_handle: std::mem::ManuallyDrop<NamespaceControllerControlHandle>,
1451 tx_id: u32,
1452}
1453
1454impl std::ops::Drop for NamespaceControllerPushChangesResponder {
1458 fn drop(&mut self) {
1459 self.control_handle.shutdown();
1460 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1462 }
1463}
1464
1465impl fidl::endpoints::Responder for NamespaceControllerPushChangesResponder {
1466 type ControlHandle = NamespaceControllerControlHandle;
1467
1468 fn control_handle(&self) -> &NamespaceControllerControlHandle {
1469 &self.control_handle
1470 }
1471
1472 fn drop_without_shutdown(mut self) {
1473 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1475 std::mem::forget(self);
1477 }
1478}
1479
1480impl NamespaceControllerPushChangesResponder {
1481 pub fn send(self, mut payload: ChangeValidationResult) -> Result<(), fidl::Error> {
1485 let _result = self.send_raw(payload);
1486 if _result.is_err() {
1487 self.control_handle.shutdown();
1488 }
1489 self.drop_without_shutdown();
1490 _result
1491 }
1492
1493 pub fn send_no_shutdown_on_err(
1495 self,
1496 mut payload: ChangeValidationResult,
1497 ) -> Result<(), fidl::Error> {
1498 let _result = self.send_raw(payload);
1499 self.drop_without_shutdown();
1500 _result
1501 }
1502
1503 fn send_raw(&self, mut payload: ChangeValidationResult) -> Result<(), fidl::Error> {
1504 self.control_handle.inner.send::<ChangeValidationResult>(
1505 &mut payload,
1506 self.tx_id,
1507 0x2c814d42c2783ee6,
1508 fidl::encoding::DynamicFlags::empty(),
1509 )
1510 }
1511}
1512
1513#[must_use = "FIDL methods require a response to be sent"]
1514#[derive(Debug)]
1515pub struct NamespaceControllerCommitResponder {
1516 control_handle: std::mem::ManuallyDrop<NamespaceControllerControlHandle>,
1517 tx_id: u32,
1518}
1519
1520impl std::ops::Drop for NamespaceControllerCommitResponder {
1524 fn drop(&mut self) {
1525 self.control_handle.shutdown();
1526 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1528 }
1529}
1530
1531impl fidl::endpoints::Responder for NamespaceControllerCommitResponder {
1532 type ControlHandle = NamespaceControllerControlHandle;
1533
1534 fn control_handle(&self) -> &NamespaceControllerControlHandle {
1535 &self.control_handle
1536 }
1537
1538 fn drop_without_shutdown(mut self) {
1539 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1541 std::mem::forget(self);
1543 }
1544}
1545
1546impl NamespaceControllerCommitResponder {
1547 pub fn send(self, mut payload: CommitResult) -> Result<(), fidl::Error> {
1551 let _result = self.send_raw(payload);
1552 if _result.is_err() {
1553 self.control_handle.shutdown();
1554 }
1555 self.drop_without_shutdown();
1556 _result
1557 }
1558
1559 pub fn send_no_shutdown_on_err(self, mut payload: CommitResult) -> Result<(), fidl::Error> {
1561 let _result = self.send_raw(payload);
1562 self.drop_without_shutdown();
1563 _result
1564 }
1565
1566 fn send_raw(&self, mut payload: CommitResult) -> Result<(), fidl::Error> {
1567 self.control_handle.inner.send::<CommitResult>(
1568 &mut payload,
1569 self.tx_id,
1570 0x49ed5545357963e4,
1571 fidl::encoding::DynamicFlags::empty(),
1572 )
1573 }
1574}
1575
1576#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1577pub struct SocketControlMarker;
1578
1579impl fidl::endpoints::ProtocolMarker for SocketControlMarker {
1580 type Proxy = SocketControlProxy;
1581 type RequestStream = SocketControlRequestStream;
1582 #[cfg(target_os = "fuchsia")]
1583 type SynchronousProxy = SocketControlSynchronousProxy;
1584
1585 const DEBUG_NAME: &'static str = "fuchsia.net.filter.SocketControl";
1586}
1587impl fidl::endpoints::DiscoverableProtocolMarker for SocketControlMarker {}
1588pub type SocketControlAttachEbpfProgramResult = Result<(), SocketControlAttachEbpfProgramError>;
1589pub type SocketControlDetachEbpfProgramResult = Result<(), SocketControlDetachEbpfProgramError>;
1590
1591pub trait SocketControlProxyInterface: Send + Sync {
1592 type AttachEbpfProgramResponseFut: std::future::Future<Output = Result<SocketControlAttachEbpfProgramResult, fidl::Error>>
1593 + Send;
1594 fn r#attach_ebpf_program(
1595 &self,
1596 payload: AttachEbpfProgramOptions,
1597 ) -> Self::AttachEbpfProgramResponseFut;
1598 type DetachEbpfProgramResponseFut: std::future::Future<Output = Result<SocketControlDetachEbpfProgramResult, fidl::Error>>
1599 + Send;
1600 fn r#detach_ebpf_program(&self, hook: SocketHook) -> Self::DetachEbpfProgramResponseFut;
1601}
1602#[derive(Debug)]
1603#[cfg(target_os = "fuchsia")]
1604pub struct SocketControlSynchronousProxy {
1605 client: fidl::client::sync::Client,
1606}
1607
1608#[cfg(target_os = "fuchsia")]
1609impl fidl::endpoints::SynchronousProxy for SocketControlSynchronousProxy {
1610 type Proxy = SocketControlProxy;
1611 type Protocol = SocketControlMarker;
1612
1613 fn from_channel(inner: fidl::Channel) -> Self {
1614 Self::new(inner)
1615 }
1616
1617 fn into_channel(self) -> fidl::Channel {
1618 self.client.into_channel()
1619 }
1620
1621 fn as_channel(&self) -> &fidl::Channel {
1622 self.client.as_channel()
1623 }
1624}
1625
1626#[cfg(target_os = "fuchsia")]
1627impl SocketControlSynchronousProxy {
1628 pub fn new(channel: fidl::Channel) -> Self {
1629 let protocol_name = <SocketControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1630 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1631 }
1632
1633 pub fn into_channel(self) -> fidl::Channel {
1634 self.client.into_channel()
1635 }
1636
1637 pub fn wait_for_event(
1640 &self,
1641 deadline: zx::MonotonicInstant,
1642 ) -> Result<SocketControlEvent, fidl::Error> {
1643 SocketControlEvent::decode(self.client.wait_for_event(deadline)?)
1644 }
1645
1646 pub fn r#attach_ebpf_program(
1654 &self,
1655 mut payload: AttachEbpfProgramOptions,
1656 ___deadline: zx::MonotonicInstant,
1657 ) -> Result<SocketControlAttachEbpfProgramResult, fidl::Error> {
1658 let _response =
1659 self.client.send_query::<AttachEbpfProgramOptions, fidl::encoding::ResultType<
1660 fidl::encoding::EmptyStruct,
1661 SocketControlAttachEbpfProgramError,
1662 >>(
1663 &mut payload,
1664 0x35076256e3cc40e,
1665 fidl::encoding::DynamicFlags::empty(),
1666 ___deadline,
1667 )?;
1668 Ok(_response.map(|x| x))
1669 }
1670
1671 pub fn r#detach_ebpf_program(
1673 &self,
1674 mut hook: SocketHook,
1675 ___deadline: zx::MonotonicInstant,
1676 ) -> Result<SocketControlDetachEbpfProgramResult, fidl::Error> {
1677 let _response = self
1678 .client
1679 .send_query::<SocketControlDetachEbpfProgramRequest, fidl::encoding::ResultType<
1680 fidl::encoding::EmptyStruct,
1681 SocketControlDetachEbpfProgramError,
1682 >>(
1683 (hook,), 0x226db36c461b6c1, fidl::encoding::DynamicFlags::empty(), ___deadline
1684 )?;
1685 Ok(_response.map(|x| x))
1686 }
1687}
1688
1689#[cfg(target_os = "fuchsia")]
1690impl From<SocketControlSynchronousProxy> for zx::Handle {
1691 fn from(value: SocketControlSynchronousProxy) -> Self {
1692 value.into_channel().into()
1693 }
1694}
1695
1696#[cfg(target_os = "fuchsia")]
1697impl From<fidl::Channel> for SocketControlSynchronousProxy {
1698 fn from(value: fidl::Channel) -> Self {
1699 Self::new(value)
1700 }
1701}
1702
1703#[cfg(target_os = "fuchsia")]
1704impl fidl::endpoints::FromClient for SocketControlSynchronousProxy {
1705 type Protocol = SocketControlMarker;
1706
1707 fn from_client(value: fidl::endpoints::ClientEnd<SocketControlMarker>) -> Self {
1708 Self::new(value.into_channel())
1709 }
1710}
1711
1712#[derive(Debug, Clone)]
1713pub struct SocketControlProxy {
1714 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1715}
1716
1717impl fidl::endpoints::Proxy for SocketControlProxy {
1718 type Protocol = SocketControlMarker;
1719
1720 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1721 Self::new(inner)
1722 }
1723
1724 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1725 self.client.into_channel().map_err(|client| Self { client })
1726 }
1727
1728 fn as_channel(&self) -> &::fidl::AsyncChannel {
1729 self.client.as_channel()
1730 }
1731}
1732
1733impl SocketControlProxy {
1734 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1736 let protocol_name = <SocketControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1737 Self { client: fidl::client::Client::new(channel, protocol_name) }
1738 }
1739
1740 pub fn take_event_stream(&self) -> SocketControlEventStream {
1746 SocketControlEventStream { event_receiver: self.client.take_event_receiver() }
1747 }
1748
1749 pub fn r#attach_ebpf_program(
1757 &self,
1758 mut payload: AttachEbpfProgramOptions,
1759 ) -> fidl::client::QueryResponseFut<
1760 SocketControlAttachEbpfProgramResult,
1761 fidl::encoding::DefaultFuchsiaResourceDialect,
1762 > {
1763 SocketControlProxyInterface::r#attach_ebpf_program(self, payload)
1764 }
1765
1766 pub fn r#detach_ebpf_program(
1768 &self,
1769 mut hook: SocketHook,
1770 ) -> fidl::client::QueryResponseFut<
1771 SocketControlDetachEbpfProgramResult,
1772 fidl::encoding::DefaultFuchsiaResourceDialect,
1773 > {
1774 SocketControlProxyInterface::r#detach_ebpf_program(self, hook)
1775 }
1776}
1777
1778impl SocketControlProxyInterface for SocketControlProxy {
1779 type AttachEbpfProgramResponseFut = fidl::client::QueryResponseFut<
1780 SocketControlAttachEbpfProgramResult,
1781 fidl::encoding::DefaultFuchsiaResourceDialect,
1782 >;
1783 fn r#attach_ebpf_program(
1784 &self,
1785 mut payload: AttachEbpfProgramOptions,
1786 ) -> Self::AttachEbpfProgramResponseFut {
1787 fn _decode(
1788 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1789 ) -> Result<SocketControlAttachEbpfProgramResult, fidl::Error> {
1790 let _response = fidl::client::decode_transaction_body::<
1791 fidl::encoding::ResultType<
1792 fidl::encoding::EmptyStruct,
1793 SocketControlAttachEbpfProgramError,
1794 >,
1795 fidl::encoding::DefaultFuchsiaResourceDialect,
1796 0x35076256e3cc40e,
1797 >(_buf?)?;
1798 Ok(_response.map(|x| x))
1799 }
1800 self.client.send_query_and_decode::<
1801 AttachEbpfProgramOptions,
1802 SocketControlAttachEbpfProgramResult,
1803 >(
1804 &mut payload,
1805 0x35076256e3cc40e,
1806 fidl::encoding::DynamicFlags::empty(),
1807 _decode,
1808 )
1809 }
1810
1811 type DetachEbpfProgramResponseFut = fidl::client::QueryResponseFut<
1812 SocketControlDetachEbpfProgramResult,
1813 fidl::encoding::DefaultFuchsiaResourceDialect,
1814 >;
1815 fn r#detach_ebpf_program(&self, mut hook: SocketHook) -> Self::DetachEbpfProgramResponseFut {
1816 fn _decode(
1817 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1818 ) -> Result<SocketControlDetachEbpfProgramResult, fidl::Error> {
1819 let _response = fidl::client::decode_transaction_body::<
1820 fidl::encoding::ResultType<
1821 fidl::encoding::EmptyStruct,
1822 SocketControlDetachEbpfProgramError,
1823 >,
1824 fidl::encoding::DefaultFuchsiaResourceDialect,
1825 0x226db36c461b6c1,
1826 >(_buf?)?;
1827 Ok(_response.map(|x| x))
1828 }
1829 self.client.send_query_and_decode::<
1830 SocketControlDetachEbpfProgramRequest,
1831 SocketControlDetachEbpfProgramResult,
1832 >(
1833 (hook,),
1834 0x226db36c461b6c1,
1835 fidl::encoding::DynamicFlags::empty(),
1836 _decode,
1837 )
1838 }
1839}
1840
1841pub struct SocketControlEventStream {
1842 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1843}
1844
1845impl std::marker::Unpin for SocketControlEventStream {}
1846
1847impl futures::stream::FusedStream for SocketControlEventStream {
1848 fn is_terminated(&self) -> bool {
1849 self.event_receiver.is_terminated()
1850 }
1851}
1852
1853impl futures::Stream for SocketControlEventStream {
1854 type Item = Result<SocketControlEvent, fidl::Error>;
1855
1856 fn poll_next(
1857 mut self: std::pin::Pin<&mut Self>,
1858 cx: &mut std::task::Context<'_>,
1859 ) -> std::task::Poll<Option<Self::Item>> {
1860 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1861 &mut self.event_receiver,
1862 cx
1863 )?) {
1864 Some(buf) => std::task::Poll::Ready(Some(SocketControlEvent::decode(buf))),
1865 None => std::task::Poll::Ready(None),
1866 }
1867 }
1868}
1869
1870#[derive(Debug)]
1871pub enum SocketControlEvent {}
1872
1873impl SocketControlEvent {
1874 fn decode(
1876 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1877 ) -> Result<SocketControlEvent, fidl::Error> {
1878 let (bytes, _handles) = buf.split_mut();
1879 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1880 debug_assert_eq!(tx_header.tx_id, 0);
1881 match tx_header.ordinal {
1882 _ => Err(fidl::Error::UnknownOrdinal {
1883 ordinal: tx_header.ordinal,
1884 protocol_name: <SocketControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1885 }),
1886 }
1887 }
1888}
1889
1890pub struct SocketControlRequestStream {
1892 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1893 is_terminated: bool,
1894}
1895
1896impl std::marker::Unpin for SocketControlRequestStream {}
1897
1898impl futures::stream::FusedStream for SocketControlRequestStream {
1899 fn is_terminated(&self) -> bool {
1900 self.is_terminated
1901 }
1902}
1903
1904impl fidl::endpoints::RequestStream for SocketControlRequestStream {
1905 type Protocol = SocketControlMarker;
1906 type ControlHandle = SocketControlControlHandle;
1907
1908 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1909 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1910 }
1911
1912 fn control_handle(&self) -> Self::ControlHandle {
1913 SocketControlControlHandle { inner: self.inner.clone() }
1914 }
1915
1916 fn into_inner(
1917 self,
1918 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1919 {
1920 (self.inner, self.is_terminated)
1921 }
1922
1923 fn from_inner(
1924 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1925 is_terminated: bool,
1926 ) -> Self {
1927 Self { inner, is_terminated }
1928 }
1929}
1930
1931impl futures::Stream for SocketControlRequestStream {
1932 type Item = Result<SocketControlRequest, fidl::Error>;
1933
1934 fn poll_next(
1935 mut self: std::pin::Pin<&mut Self>,
1936 cx: &mut std::task::Context<'_>,
1937 ) -> std::task::Poll<Option<Self::Item>> {
1938 let this = &mut *self;
1939 if this.inner.check_shutdown(cx) {
1940 this.is_terminated = true;
1941 return std::task::Poll::Ready(None);
1942 }
1943 if this.is_terminated {
1944 panic!("polled SocketControlRequestStream after completion");
1945 }
1946 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1947 |bytes, handles| {
1948 match this.inner.channel().read_etc(cx, bytes, handles) {
1949 std::task::Poll::Ready(Ok(())) => {}
1950 std::task::Poll::Pending => return std::task::Poll::Pending,
1951 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1952 this.is_terminated = true;
1953 return std::task::Poll::Ready(None);
1954 }
1955 std::task::Poll::Ready(Err(e)) => {
1956 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1957 e.into(),
1958 ))));
1959 }
1960 }
1961
1962 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1964
1965 std::task::Poll::Ready(Some(match header.ordinal {
1966 0x35076256e3cc40e => {
1967 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1968 let mut req = fidl::new_empty!(
1969 AttachEbpfProgramOptions,
1970 fidl::encoding::DefaultFuchsiaResourceDialect
1971 );
1972 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AttachEbpfProgramOptions>(&header, _body_bytes, handles, &mut req)?;
1973 let control_handle =
1974 SocketControlControlHandle { inner: this.inner.clone() };
1975 Ok(SocketControlRequest::AttachEbpfProgram {
1976 payload: req,
1977 responder: SocketControlAttachEbpfProgramResponder {
1978 control_handle: std::mem::ManuallyDrop::new(control_handle),
1979 tx_id: header.tx_id,
1980 },
1981 })
1982 }
1983 0x226db36c461b6c1 => {
1984 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1985 let mut req = fidl::new_empty!(
1986 SocketControlDetachEbpfProgramRequest,
1987 fidl::encoding::DefaultFuchsiaResourceDialect
1988 );
1989 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SocketControlDetachEbpfProgramRequest>(&header, _body_bytes, handles, &mut req)?;
1990 let control_handle =
1991 SocketControlControlHandle { inner: this.inner.clone() };
1992 Ok(SocketControlRequest::DetachEbpfProgram {
1993 hook: req.hook,
1994
1995 responder: SocketControlDetachEbpfProgramResponder {
1996 control_handle: std::mem::ManuallyDrop::new(control_handle),
1997 tx_id: header.tx_id,
1998 },
1999 })
2000 }
2001 _ => Err(fidl::Error::UnknownOrdinal {
2002 ordinal: header.ordinal,
2003 protocol_name:
2004 <SocketControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2005 }),
2006 }))
2007 },
2008 )
2009 }
2010}
2011
2012#[derive(Debug)]
2020pub enum SocketControlRequest {
2021 AttachEbpfProgram {
2029 payload: AttachEbpfProgramOptions,
2030 responder: SocketControlAttachEbpfProgramResponder,
2031 },
2032 DetachEbpfProgram { hook: SocketHook, responder: SocketControlDetachEbpfProgramResponder },
2034}
2035
2036impl SocketControlRequest {
2037 #[allow(irrefutable_let_patterns)]
2038 pub fn into_attach_ebpf_program(
2039 self,
2040 ) -> Option<(AttachEbpfProgramOptions, SocketControlAttachEbpfProgramResponder)> {
2041 if let SocketControlRequest::AttachEbpfProgram { payload, responder } = self {
2042 Some((payload, responder))
2043 } else {
2044 None
2045 }
2046 }
2047
2048 #[allow(irrefutable_let_patterns)]
2049 pub fn into_detach_ebpf_program(
2050 self,
2051 ) -> Option<(SocketHook, SocketControlDetachEbpfProgramResponder)> {
2052 if let SocketControlRequest::DetachEbpfProgram { hook, responder } = self {
2053 Some((hook, responder))
2054 } else {
2055 None
2056 }
2057 }
2058
2059 pub fn method_name(&self) -> &'static str {
2061 match *self {
2062 SocketControlRequest::AttachEbpfProgram { .. } => "attach_ebpf_program",
2063 SocketControlRequest::DetachEbpfProgram { .. } => "detach_ebpf_program",
2064 }
2065 }
2066}
2067
2068#[derive(Debug, Clone)]
2069pub struct SocketControlControlHandle {
2070 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2071}
2072
2073impl fidl::endpoints::ControlHandle for SocketControlControlHandle {
2074 fn shutdown(&self) {
2075 self.inner.shutdown()
2076 }
2077 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2078 self.inner.shutdown_with_epitaph(status)
2079 }
2080
2081 fn is_closed(&self) -> bool {
2082 self.inner.channel().is_closed()
2083 }
2084 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2085 self.inner.channel().on_closed()
2086 }
2087
2088 #[cfg(target_os = "fuchsia")]
2089 fn signal_peer(
2090 &self,
2091 clear_mask: zx::Signals,
2092 set_mask: zx::Signals,
2093 ) -> Result<(), zx_status::Status> {
2094 use fidl::Peered;
2095 self.inner.channel().signal_peer(clear_mask, set_mask)
2096 }
2097}
2098
2099impl SocketControlControlHandle {}
2100
2101#[must_use = "FIDL methods require a response to be sent"]
2102#[derive(Debug)]
2103pub struct SocketControlAttachEbpfProgramResponder {
2104 control_handle: std::mem::ManuallyDrop<SocketControlControlHandle>,
2105 tx_id: u32,
2106}
2107
2108impl std::ops::Drop for SocketControlAttachEbpfProgramResponder {
2112 fn drop(&mut self) {
2113 self.control_handle.shutdown();
2114 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2116 }
2117}
2118
2119impl fidl::endpoints::Responder for SocketControlAttachEbpfProgramResponder {
2120 type ControlHandle = SocketControlControlHandle;
2121
2122 fn control_handle(&self) -> &SocketControlControlHandle {
2123 &self.control_handle
2124 }
2125
2126 fn drop_without_shutdown(mut self) {
2127 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2129 std::mem::forget(self);
2131 }
2132}
2133
2134impl SocketControlAttachEbpfProgramResponder {
2135 pub fn send(
2139 self,
2140 mut result: Result<(), SocketControlAttachEbpfProgramError>,
2141 ) -> Result<(), fidl::Error> {
2142 let _result = self.send_raw(result);
2143 if _result.is_err() {
2144 self.control_handle.shutdown();
2145 }
2146 self.drop_without_shutdown();
2147 _result
2148 }
2149
2150 pub fn send_no_shutdown_on_err(
2152 self,
2153 mut result: Result<(), SocketControlAttachEbpfProgramError>,
2154 ) -> Result<(), fidl::Error> {
2155 let _result = self.send_raw(result);
2156 self.drop_without_shutdown();
2157 _result
2158 }
2159
2160 fn send_raw(
2161 &self,
2162 mut result: Result<(), SocketControlAttachEbpfProgramError>,
2163 ) -> Result<(), fidl::Error> {
2164 self.control_handle.inner.send::<fidl::encoding::ResultType<
2165 fidl::encoding::EmptyStruct,
2166 SocketControlAttachEbpfProgramError,
2167 >>(
2168 result,
2169 self.tx_id,
2170 0x35076256e3cc40e,
2171 fidl::encoding::DynamicFlags::empty(),
2172 )
2173 }
2174}
2175
2176#[must_use = "FIDL methods require a response to be sent"]
2177#[derive(Debug)]
2178pub struct SocketControlDetachEbpfProgramResponder {
2179 control_handle: std::mem::ManuallyDrop<SocketControlControlHandle>,
2180 tx_id: u32,
2181}
2182
2183impl std::ops::Drop for SocketControlDetachEbpfProgramResponder {
2187 fn drop(&mut self) {
2188 self.control_handle.shutdown();
2189 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2191 }
2192}
2193
2194impl fidl::endpoints::Responder for SocketControlDetachEbpfProgramResponder {
2195 type ControlHandle = SocketControlControlHandle;
2196
2197 fn control_handle(&self) -> &SocketControlControlHandle {
2198 &self.control_handle
2199 }
2200
2201 fn drop_without_shutdown(mut self) {
2202 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2204 std::mem::forget(self);
2206 }
2207}
2208
2209impl SocketControlDetachEbpfProgramResponder {
2210 pub fn send(
2214 self,
2215 mut result: Result<(), SocketControlDetachEbpfProgramError>,
2216 ) -> Result<(), fidl::Error> {
2217 let _result = self.send_raw(result);
2218 if _result.is_err() {
2219 self.control_handle.shutdown();
2220 }
2221 self.drop_without_shutdown();
2222 _result
2223 }
2224
2225 pub fn send_no_shutdown_on_err(
2227 self,
2228 mut result: Result<(), SocketControlDetachEbpfProgramError>,
2229 ) -> Result<(), fidl::Error> {
2230 let _result = self.send_raw(result);
2231 self.drop_without_shutdown();
2232 _result
2233 }
2234
2235 fn send_raw(
2236 &self,
2237 mut result: Result<(), SocketControlDetachEbpfProgramError>,
2238 ) -> Result<(), fidl::Error> {
2239 self.control_handle.inner.send::<fidl::encoding::ResultType<
2240 fidl::encoding::EmptyStruct,
2241 SocketControlDetachEbpfProgramError,
2242 >>(
2243 result,
2244 self.tx_id,
2245 0x226db36c461b6c1,
2246 fidl::encoding::DynamicFlags::empty(),
2247 )
2248 }
2249}
2250
2251#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2252pub struct StateMarker;
2253
2254impl fidl::endpoints::ProtocolMarker for StateMarker {
2255 type Proxy = StateProxy;
2256 type RequestStream = StateRequestStream;
2257 #[cfg(target_os = "fuchsia")]
2258 type SynchronousProxy = StateSynchronousProxy;
2259
2260 const DEBUG_NAME: &'static str = "fuchsia.net.filter.State";
2261}
2262impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
2263
2264pub trait StateProxyInterface: Send + Sync {
2265 fn r#get_watcher(
2266 &self,
2267 options: &WatcherOptions,
2268 request: fidl::endpoints::ServerEnd<WatcherMarker>,
2269 ) -> Result<(), fidl::Error>;
2270}
2271#[derive(Debug)]
2272#[cfg(target_os = "fuchsia")]
2273pub struct StateSynchronousProxy {
2274 client: fidl::client::sync::Client,
2275}
2276
2277#[cfg(target_os = "fuchsia")]
2278impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
2279 type Proxy = StateProxy;
2280 type Protocol = StateMarker;
2281
2282 fn from_channel(inner: fidl::Channel) -> Self {
2283 Self::new(inner)
2284 }
2285
2286 fn into_channel(self) -> fidl::Channel {
2287 self.client.into_channel()
2288 }
2289
2290 fn as_channel(&self) -> &fidl::Channel {
2291 self.client.as_channel()
2292 }
2293}
2294
2295#[cfg(target_os = "fuchsia")]
2296impl StateSynchronousProxy {
2297 pub fn new(channel: fidl::Channel) -> Self {
2298 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2299 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2300 }
2301
2302 pub fn into_channel(self) -> fidl::Channel {
2303 self.client.into_channel()
2304 }
2305
2306 pub fn wait_for_event(
2309 &self,
2310 deadline: zx::MonotonicInstant,
2311 ) -> Result<StateEvent, fidl::Error> {
2312 StateEvent::decode(self.client.wait_for_event(deadline)?)
2313 }
2314
2315 pub fn r#get_watcher(
2317 &self,
2318 mut options: &WatcherOptions,
2319 mut request: fidl::endpoints::ServerEnd<WatcherMarker>,
2320 ) -> Result<(), fidl::Error> {
2321 self.client.send::<StateGetWatcherRequest>(
2322 (options, request),
2323 0x663aae2b6bc5aa14,
2324 fidl::encoding::DynamicFlags::empty(),
2325 )
2326 }
2327}
2328
2329#[cfg(target_os = "fuchsia")]
2330impl From<StateSynchronousProxy> for zx::Handle {
2331 fn from(value: StateSynchronousProxy) -> Self {
2332 value.into_channel().into()
2333 }
2334}
2335
2336#[cfg(target_os = "fuchsia")]
2337impl From<fidl::Channel> for StateSynchronousProxy {
2338 fn from(value: fidl::Channel) -> Self {
2339 Self::new(value)
2340 }
2341}
2342
2343#[cfg(target_os = "fuchsia")]
2344impl fidl::endpoints::FromClient for StateSynchronousProxy {
2345 type Protocol = StateMarker;
2346
2347 fn from_client(value: fidl::endpoints::ClientEnd<StateMarker>) -> Self {
2348 Self::new(value.into_channel())
2349 }
2350}
2351
2352#[derive(Debug, Clone)]
2353pub struct StateProxy {
2354 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2355}
2356
2357impl fidl::endpoints::Proxy for StateProxy {
2358 type Protocol = StateMarker;
2359
2360 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2361 Self::new(inner)
2362 }
2363
2364 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2365 self.client.into_channel().map_err(|client| Self { client })
2366 }
2367
2368 fn as_channel(&self) -> &::fidl::AsyncChannel {
2369 self.client.as_channel()
2370 }
2371}
2372
2373impl StateProxy {
2374 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2376 let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2377 Self { client: fidl::client::Client::new(channel, protocol_name) }
2378 }
2379
2380 pub fn take_event_stream(&self) -> StateEventStream {
2386 StateEventStream { event_receiver: self.client.take_event_receiver() }
2387 }
2388
2389 pub fn r#get_watcher(
2391 &self,
2392 mut options: &WatcherOptions,
2393 mut request: fidl::endpoints::ServerEnd<WatcherMarker>,
2394 ) -> Result<(), fidl::Error> {
2395 StateProxyInterface::r#get_watcher(self, options, request)
2396 }
2397}
2398
2399impl StateProxyInterface for StateProxy {
2400 fn r#get_watcher(
2401 &self,
2402 mut options: &WatcherOptions,
2403 mut request: fidl::endpoints::ServerEnd<WatcherMarker>,
2404 ) -> Result<(), fidl::Error> {
2405 self.client.send::<StateGetWatcherRequest>(
2406 (options, request),
2407 0x663aae2b6bc5aa14,
2408 fidl::encoding::DynamicFlags::empty(),
2409 )
2410 }
2411}
2412
2413pub struct StateEventStream {
2414 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2415}
2416
2417impl std::marker::Unpin for StateEventStream {}
2418
2419impl futures::stream::FusedStream for StateEventStream {
2420 fn is_terminated(&self) -> bool {
2421 self.event_receiver.is_terminated()
2422 }
2423}
2424
2425impl futures::Stream for StateEventStream {
2426 type Item = Result<StateEvent, fidl::Error>;
2427
2428 fn poll_next(
2429 mut self: std::pin::Pin<&mut Self>,
2430 cx: &mut std::task::Context<'_>,
2431 ) -> std::task::Poll<Option<Self::Item>> {
2432 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2433 &mut self.event_receiver,
2434 cx
2435 )?) {
2436 Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
2437 None => std::task::Poll::Ready(None),
2438 }
2439 }
2440}
2441
2442#[derive(Debug)]
2443pub enum StateEvent {}
2444
2445impl StateEvent {
2446 fn decode(
2448 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2449 ) -> Result<StateEvent, fidl::Error> {
2450 let (bytes, _handles) = buf.split_mut();
2451 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2452 debug_assert_eq!(tx_header.tx_id, 0);
2453 match tx_header.ordinal {
2454 _ => Err(fidl::Error::UnknownOrdinal {
2455 ordinal: tx_header.ordinal,
2456 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2457 }),
2458 }
2459 }
2460}
2461
2462pub struct StateRequestStream {
2464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2465 is_terminated: bool,
2466}
2467
2468impl std::marker::Unpin for StateRequestStream {}
2469
2470impl futures::stream::FusedStream for StateRequestStream {
2471 fn is_terminated(&self) -> bool {
2472 self.is_terminated
2473 }
2474}
2475
2476impl fidl::endpoints::RequestStream for StateRequestStream {
2477 type Protocol = StateMarker;
2478 type ControlHandle = StateControlHandle;
2479
2480 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2481 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2482 }
2483
2484 fn control_handle(&self) -> Self::ControlHandle {
2485 StateControlHandle { inner: self.inner.clone() }
2486 }
2487
2488 fn into_inner(
2489 self,
2490 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2491 {
2492 (self.inner, self.is_terminated)
2493 }
2494
2495 fn from_inner(
2496 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2497 is_terminated: bool,
2498 ) -> Self {
2499 Self { inner, is_terminated }
2500 }
2501}
2502
2503impl futures::Stream for StateRequestStream {
2504 type Item = Result<StateRequest, fidl::Error>;
2505
2506 fn poll_next(
2507 mut self: std::pin::Pin<&mut Self>,
2508 cx: &mut std::task::Context<'_>,
2509 ) -> std::task::Poll<Option<Self::Item>> {
2510 let this = &mut *self;
2511 if this.inner.check_shutdown(cx) {
2512 this.is_terminated = true;
2513 return std::task::Poll::Ready(None);
2514 }
2515 if this.is_terminated {
2516 panic!("polled StateRequestStream after completion");
2517 }
2518 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2519 |bytes, handles| {
2520 match this.inner.channel().read_etc(cx, bytes, handles) {
2521 std::task::Poll::Ready(Ok(())) => {}
2522 std::task::Poll::Pending => return std::task::Poll::Pending,
2523 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2524 this.is_terminated = true;
2525 return std::task::Poll::Ready(None);
2526 }
2527 std::task::Poll::Ready(Err(e)) => {
2528 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2529 e.into(),
2530 ))));
2531 }
2532 }
2533
2534 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2536
2537 std::task::Poll::Ready(Some(match header.ordinal {
2538 0x663aae2b6bc5aa14 => {
2539 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2540 let mut req = fidl::new_empty!(
2541 StateGetWatcherRequest,
2542 fidl::encoding::DefaultFuchsiaResourceDialect
2543 );
2544 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StateGetWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
2545 let control_handle = StateControlHandle { inner: this.inner.clone() };
2546 Ok(StateRequest::GetWatcher {
2547 options: req.options,
2548 request: req.request,
2549
2550 control_handle,
2551 })
2552 }
2553 _ => Err(fidl::Error::UnknownOrdinal {
2554 ordinal: header.ordinal,
2555 protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2556 }),
2557 }))
2558 },
2559 )
2560 }
2561}
2562
2563#[derive(Debug)]
2565pub enum StateRequest {
2566 GetWatcher {
2568 options: WatcherOptions,
2569 request: fidl::endpoints::ServerEnd<WatcherMarker>,
2570 control_handle: StateControlHandle,
2571 },
2572}
2573
2574impl StateRequest {
2575 #[allow(irrefutable_let_patterns)]
2576 pub fn into_get_watcher(
2577 self,
2578 ) -> Option<(WatcherOptions, fidl::endpoints::ServerEnd<WatcherMarker>, StateControlHandle)>
2579 {
2580 if let StateRequest::GetWatcher { options, request, control_handle } = self {
2581 Some((options, request, control_handle))
2582 } else {
2583 None
2584 }
2585 }
2586
2587 pub fn method_name(&self) -> &'static str {
2589 match *self {
2590 StateRequest::GetWatcher { .. } => "get_watcher",
2591 }
2592 }
2593}
2594
2595#[derive(Debug, Clone)]
2596pub struct StateControlHandle {
2597 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2598}
2599
2600impl fidl::endpoints::ControlHandle for StateControlHandle {
2601 fn shutdown(&self) {
2602 self.inner.shutdown()
2603 }
2604 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2605 self.inner.shutdown_with_epitaph(status)
2606 }
2607
2608 fn is_closed(&self) -> bool {
2609 self.inner.channel().is_closed()
2610 }
2611 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2612 self.inner.channel().on_closed()
2613 }
2614
2615 #[cfg(target_os = "fuchsia")]
2616 fn signal_peer(
2617 &self,
2618 clear_mask: zx::Signals,
2619 set_mask: zx::Signals,
2620 ) -> Result<(), zx_status::Status> {
2621 use fidl::Peered;
2622 self.inner.channel().signal_peer(clear_mask, set_mask)
2623 }
2624}
2625
2626impl StateControlHandle {}
2627
2628#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2629pub struct WatcherMarker;
2630
2631impl fidl::endpoints::ProtocolMarker for WatcherMarker {
2632 type Proxy = WatcherProxy;
2633 type RequestStream = WatcherRequestStream;
2634 #[cfg(target_os = "fuchsia")]
2635 type SynchronousProxy = WatcherSynchronousProxy;
2636
2637 const DEBUG_NAME: &'static str = "(anonymous) Watcher";
2638}
2639
2640pub trait WatcherProxyInterface: Send + Sync {
2641 type WatchResponseFut: std::future::Future<Output = Result<Vec<Event>, fidl::Error>> + Send;
2642 fn r#watch(&self) -> Self::WatchResponseFut;
2643}
2644#[derive(Debug)]
2645#[cfg(target_os = "fuchsia")]
2646pub struct WatcherSynchronousProxy {
2647 client: fidl::client::sync::Client,
2648}
2649
2650#[cfg(target_os = "fuchsia")]
2651impl fidl::endpoints::SynchronousProxy for WatcherSynchronousProxy {
2652 type Proxy = WatcherProxy;
2653 type Protocol = WatcherMarker;
2654
2655 fn from_channel(inner: fidl::Channel) -> Self {
2656 Self::new(inner)
2657 }
2658
2659 fn into_channel(self) -> fidl::Channel {
2660 self.client.into_channel()
2661 }
2662
2663 fn as_channel(&self) -> &fidl::Channel {
2664 self.client.as_channel()
2665 }
2666}
2667
2668#[cfg(target_os = "fuchsia")]
2669impl WatcherSynchronousProxy {
2670 pub fn new(channel: fidl::Channel) -> Self {
2671 let protocol_name = <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2672 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2673 }
2674
2675 pub fn into_channel(self) -> fidl::Channel {
2676 self.client.into_channel()
2677 }
2678
2679 pub fn wait_for_event(
2682 &self,
2683 deadline: zx::MonotonicInstant,
2684 ) -> Result<WatcherEvent, fidl::Error> {
2685 WatcherEvent::decode(self.client.wait_for_event(deadline)?)
2686 }
2687
2688 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Event>, fidl::Error> {
2709 let _response =
2710 self.client.send_query::<fidl::encoding::EmptyPayload, WatcherWatchResponse>(
2711 (),
2712 0x5f62165a0638ca75,
2713 fidl::encoding::DynamicFlags::empty(),
2714 ___deadline,
2715 )?;
2716 Ok(_response.events)
2717 }
2718}
2719
2720#[cfg(target_os = "fuchsia")]
2721impl From<WatcherSynchronousProxy> for zx::Handle {
2722 fn from(value: WatcherSynchronousProxy) -> Self {
2723 value.into_channel().into()
2724 }
2725}
2726
2727#[cfg(target_os = "fuchsia")]
2728impl From<fidl::Channel> for WatcherSynchronousProxy {
2729 fn from(value: fidl::Channel) -> Self {
2730 Self::new(value)
2731 }
2732}
2733
2734#[cfg(target_os = "fuchsia")]
2735impl fidl::endpoints::FromClient for WatcherSynchronousProxy {
2736 type Protocol = WatcherMarker;
2737
2738 fn from_client(value: fidl::endpoints::ClientEnd<WatcherMarker>) -> Self {
2739 Self::new(value.into_channel())
2740 }
2741}
2742
2743#[derive(Debug, Clone)]
2744pub struct WatcherProxy {
2745 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2746}
2747
2748impl fidl::endpoints::Proxy for WatcherProxy {
2749 type Protocol = WatcherMarker;
2750
2751 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2752 Self::new(inner)
2753 }
2754
2755 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2756 self.client.into_channel().map_err(|client| Self { client })
2757 }
2758
2759 fn as_channel(&self) -> &::fidl::AsyncChannel {
2760 self.client.as_channel()
2761 }
2762}
2763
2764impl WatcherProxy {
2765 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2767 let protocol_name = <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2768 Self { client: fidl::client::Client::new(channel, protocol_name) }
2769 }
2770
2771 pub fn take_event_stream(&self) -> WatcherEventStream {
2777 WatcherEventStream { event_receiver: self.client.take_event_receiver() }
2778 }
2779
2780 pub fn r#watch(
2801 &self,
2802 ) -> fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>
2803 {
2804 WatcherProxyInterface::r#watch(self)
2805 }
2806}
2807
2808impl WatcherProxyInterface for WatcherProxy {
2809 type WatchResponseFut =
2810 fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2811 fn r#watch(&self) -> Self::WatchResponseFut {
2812 fn _decode(
2813 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2814 ) -> Result<Vec<Event>, fidl::Error> {
2815 let _response = fidl::client::decode_transaction_body::<
2816 WatcherWatchResponse,
2817 fidl::encoding::DefaultFuchsiaResourceDialect,
2818 0x5f62165a0638ca75,
2819 >(_buf?)?;
2820 Ok(_response.events)
2821 }
2822 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Event>>(
2823 (),
2824 0x5f62165a0638ca75,
2825 fidl::encoding::DynamicFlags::empty(),
2826 _decode,
2827 )
2828 }
2829}
2830
2831pub struct WatcherEventStream {
2832 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2833}
2834
2835impl std::marker::Unpin for WatcherEventStream {}
2836
2837impl futures::stream::FusedStream for WatcherEventStream {
2838 fn is_terminated(&self) -> bool {
2839 self.event_receiver.is_terminated()
2840 }
2841}
2842
2843impl futures::Stream for WatcherEventStream {
2844 type Item = Result<WatcherEvent, fidl::Error>;
2845
2846 fn poll_next(
2847 mut self: std::pin::Pin<&mut Self>,
2848 cx: &mut std::task::Context<'_>,
2849 ) -> std::task::Poll<Option<Self::Item>> {
2850 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2851 &mut self.event_receiver,
2852 cx
2853 )?) {
2854 Some(buf) => std::task::Poll::Ready(Some(WatcherEvent::decode(buf))),
2855 None => std::task::Poll::Ready(None),
2856 }
2857 }
2858}
2859
2860#[derive(Debug)]
2861pub enum WatcherEvent {}
2862
2863impl WatcherEvent {
2864 fn decode(
2866 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2867 ) -> Result<WatcherEvent, fidl::Error> {
2868 let (bytes, _handles) = buf.split_mut();
2869 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2870 debug_assert_eq!(tx_header.tx_id, 0);
2871 match tx_header.ordinal {
2872 _ => Err(fidl::Error::UnknownOrdinal {
2873 ordinal: tx_header.ordinal,
2874 protocol_name: <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2875 }),
2876 }
2877 }
2878}
2879
2880pub struct WatcherRequestStream {
2882 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2883 is_terminated: bool,
2884}
2885
2886impl std::marker::Unpin for WatcherRequestStream {}
2887
2888impl futures::stream::FusedStream for WatcherRequestStream {
2889 fn is_terminated(&self) -> bool {
2890 self.is_terminated
2891 }
2892}
2893
2894impl fidl::endpoints::RequestStream for WatcherRequestStream {
2895 type Protocol = WatcherMarker;
2896 type ControlHandle = WatcherControlHandle;
2897
2898 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2899 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2900 }
2901
2902 fn control_handle(&self) -> Self::ControlHandle {
2903 WatcherControlHandle { inner: self.inner.clone() }
2904 }
2905
2906 fn into_inner(
2907 self,
2908 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2909 {
2910 (self.inner, self.is_terminated)
2911 }
2912
2913 fn from_inner(
2914 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2915 is_terminated: bool,
2916 ) -> Self {
2917 Self { inner, is_terminated }
2918 }
2919}
2920
2921impl futures::Stream for WatcherRequestStream {
2922 type Item = Result<WatcherRequest, fidl::Error>;
2923
2924 fn poll_next(
2925 mut self: std::pin::Pin<&mut Self>,
2926 cx: &mut std::task::Context<'_>,
2927 ) -> std::task::Poll<Option<Self::Item>> {
2928 let this = &mut *self;
2929 if this.inner.check_shutdown(cx) {
2930 this.is_terminated = true;
2931 return std::task::Poll::Ready(None);
2932 }
2933 if this.is_terminated {
2934 panic!("polled WatcherRequestStream after completion");
2935 }
2936 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2937 |bytes, handles| {
2938 match this.inner.channel().read_etc(cx, bytes, handles) {
2939 std::task::Poll::Ready(Ok(())) => {}
2940 std::task::Poll::Pending => return std::task::Poll::Pending,
2941 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2942 this.is_terminated = true;
2943 return std::task::Poll::Ready(None);
2944 }
2945 std::task::Poll::Ready(Err(e)) => {
2946 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2947 e.into(),
2948 ))));
2949 }
2950 }
2951
2952 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2954
2955 std::task::Poll::Ready(Some(match header.ordinal {
2956 0x5f62165a0638ca75 => {
2957 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2958 let mut req = fidl::new_empty!(
2959 fidl::encoding::EmptyPayload,
2960 fidl::encoding::DefaultFuchsiaResourceDialect
2961 );
2962 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2963 let control_handle = WatcherControlHandle { inner: this.inner.clone() };
2964 Ok(WatcherRequest::Watch {
2965 responder: WatcherWatchResponder {
2966 control_handle: std::mem::ManuallyDrop::new(control_handle),
2967 tx_id: header.tx_id,
2968 },
2969 })
2970 }
2971 _ => Err(fidl::Error::UnknownOrdinal {
2972 ordinal: header.ordinal,
2973 protocol_name:
2974 <WatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2975 }),
2976 }))
2977 },
2978 )
2979 }
2980}
2981
2982#[derive(Debug)]
2985pub enum WatcherRequest {
2986 Watch { responder: WatcherWatchResponder },
3007}
3008
3009impl WatcherRequest {
3010 #[allow(irrefutable_let_patterns)]
3011 pub fn into_watch(self) -> Option<(WatcherWatchResponder)> {
3012 if let WatcherRequest::Watch { responder } = self { Some((responder)) } else { None }
3013 }
3014
3015 pub fn method_name(&self) -> &'static str {
3017 match *self {
3018 WatcherRequest::Watch { .. } => "watch",
3019 }
3020 }
3021}
3022
3023#[derive(Debug, Clone)]
3024pub struct WatcherControlHandle {
3025 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3026}
3027
3028impl fidl::endpoints::ControlHandle for WatcherControlHandle {
3029 fn shutdown(&self) {
3030 self.inner.shutdown()
3031 }
3032 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3033 self.inner.shutdown_with_epitaph(status)
3034 }
3035
3036 fn is_closed(&self) -> bool {
3037 self.inner.channel().is_closed()
3038 }
3039 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3040 self.inner.channel().on_closed()
3041 }
3042
3043 #[cfg(target_os = "fuchsia")]
3044 fn signal_peer(
3045 &self,
3046 clear_mask: zx::Signals,
3047 set_mask: zx::Signals,
3048 ) -> Result<(), zx_status::Status> {
3049 use fidl::Peered;
3050 self.inner.channel().signal_peer(clear_mask, set_mask)
3051 }
3052}
3053
3054impl WatcherControlHandle {}
3055
3056#[must_use = "FIDL methods require a response to be sent"]
3057#[derive(Debug)]
3058pub struct WatcherWatchResponder {
3059 control_handle: std::mem::ManuallyDrop<WatcherControlHandle>,
3060 tx_id: u32,
3061}
3062
3063impl std::ops::Drop for WatcherWatchResponder {
3067 fn drop(&mut self) {
3068 self.control_handle.shutdown();
3069 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3071 }
3072}
3073
3074impl fidl::endpoints::Responder for WatcherWatchResponder {
3075 type ControlHandle = WatcherControlHandle;
3076
3077 fn control_handle(&self) -> &WatcherControlHandle {
3078 &self.control_handle
3079 }
3080
3081 fn drop_without_shutdown(mut self) {
3082 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3084 std::mem::forget(self);
3086 }
3087}
3088
3089impl WatcherWatchResponder {
3090 pub fn send(self, mut events: &[Event]) -> Result<(), fidl::Error> {
3094 let _result = self.send_raw(events);
3095 if _result.is_err() {
3096 self.control_handle.shutdown();
3097 }
3098 self.drop_without_shutdown();
3099 _result
3100 }
3101
3102 pub fn send_no_shutdown_on_err(self, mut events: &[Event]) -> Result<(), fidl::Error> {
3104 let _result = self.send_raw(events);
3105 self.drop_without_shutdown();
3106 _result
3107 }
3108
3109 fn send_raw(&self, mut events: &[Event]) -> Result<(), fidl::Error> {
3110 self.control_handle.inner.send::<WatcherWatchResponse>(
3111 (events,),
3112 self.tx_id,
3113 0x5f62165a0638ca75,
3114 fidl::encoding::DynamicFlags::empty(),
3115 )
3116 }
3117}
3118
3119mod internal {
3120 use super::*;
3121
3122 impl fidl::encoding::ResourceTypeMarker for ControlOpenControllerRequest {
3123 type Borrowed<'a> = &'a mut Self;
3124 fn take_or_borrow<'a>(
3125 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3126 ) -> Self::Borrowed<'a> {
3127 value
3128 }
3129 }
3130
3131 unsafe impl fidl::encoding::TypeMarker for ControlOpenControllerRequest {
3132 type Owned = Self;
3133
3134 #[inline(always)]
3135 fn inline_align(_context: fidl::encoding::Context) -> usize {
3136 8
3137 }
3138
3139 #[inline(always)]
3140 fn inline_size(_context: fidl::encoding::Context) -> usize {
3141 24
3142 }
3143 }
3144
3145 unsafe impl
3146 fidl::encoding::Encode<
3147 ControlOpenControllerRequest,
3148 fidl::encoding::DefaultFuchsiaResourceDialect,
3149 > for &mut ControlOpenControllerRequest
3150 {
3151 #[inline]
3152 unsafe fn encode(
3153 self,
3154 encoder: &mut fidl::encoding::Encoder<
3155 '_,
3156 fidl::encoding::DefaultFuchsiaResourceDialect,
3157 >,
3158 offset: usize,
3159 _depth: fidl::encoding::Depth,
3160 ) -> fidl::Result<()> {
3161 encoder.debug_check_bounds::<ControlOpenControllerRequest>(offset);
3162 fidl::encoding::Encode::<ControlOpenControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3164 (
3165 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3166 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
3167 ),
3168 encoder, offset, _depth
3169 )
3170 }
3171 }
3172 unsafe impl<
3173 T0: fidl::encoding::Encode<
3174 fidl::encoding::BoundedString<255>,
3175 fidl::encoding::DefaultFuchsiaResourceDialect,
3176 >,
3177 T1: fidl::encoding::Encode<
3178 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
3179 fidl::encoding::DefaultFuchsiaResourceDialect,
3180 >,
3181 >
3182 fidl::encoding::Encode<
3183 ControlOpenControllerRequest,
3184 fidl::encoding::DefaultFuchsiaResourceDialect,
3185 > for (T0, T1)
3186 {
3187 #[inline]
3188 unsafe fn encode(
3189 self,
3190 encoder: &mut fidl::encoding::Encoder<
3191 '_,
3192 fidl::encoding::DefaultFuchsiaResourceDialect,
3193 >,
3194 offset: usize,
3195 depth: fidl::encoding::Depth,
3196 ) -> fidl::Result<()> {
3197 encoder.debug_check_bounds::<ControlOpenControllerRequest>(offset);
3198 unsafe {
3201 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3202 (ptr as *mut u64).write_unaligned(0);
3203 }
3204 self.0.encode(encoder, offset + 0, depth)?;
3206 self.1.encode(encoder, offset + 16, depth)?;
3207 Ok(())
3208 }
3209 }
3210
3211 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3212 for ControlOpenControllerRequest
3213 {
3214 #[inline(always)]
3215 fn new_empty() -> Self {
3216 Self {
3217 id: fidl::new_empty!(
3218 fidl::encoding::BoundedString<255>,
3219 fidl::encoding::DefaultFuchsiaResourceDialect
3220 ),
3221 request: fidl::new_empty!(
3222 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
3223 fidl::encoding::DefaultFuchsiaResourceDialect
3224 ),
3225 }
3226 }
3227
3228 #[inline]
3229 unsafe fn decode(
3230 &mut self,
3231 decoder: &mut fidl::encoding::Decoder<
3232 '_,
3233 fidl::encoding::DefaultFuchsiaResourceDialect,
3234 >,
3235 offset: usize,
3236 _depth: fidl::encoding::Depth,
3237 ) -> fidl::Result<()> {
3238 decoder.debug_check_bounds::<Self>(offset);
3239 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3241 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3242 let mask = 0xffffffff00000000u64;
3243 let maskedval = padval & mask;
3244 if maskedval != 0 {
3245 return Err(fidl::Error::NonZeroPadding {
3246 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3247 });
3248 }
3249 fidl::decode!(
3250 fidl::encoding::BoundedString<255>,
3251 fidl::encoding::DefaultFuchsiaResourceDialect,
3252 &mut self.id,
3253 decoder,
3254 offset + 0,
3255 _depth
3256 )?;
3257 fidl::decode!(
3258 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
3259 fidl::encoding::DefaultFuchsiaResourceDialect,
3260 &mut self.request,
3261 decoder,
3262 offset + 16,
3263 _depth
3264 )?;
3265 Ok(())
3266 }
3267 }
3268
3269 impl fidl::encoding::ResourceTypeMarker for ControlReopenDetachedControllerRequest {
3270 type Borrowed<'a> = &'a mut Self;
3271 fn take_or_borrow<'a>(
3272 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3273 ) -> Self::Borrowed<'a> {
3274 value
3275 }
3276 }
3277
3278 unsafe impl fidl::encoding::TypeMarker for ControlReopenDetachedControllerRequest {
3279 type Owned = Self;
3280
3281 #[inline(always)]
3282 fn inline_align(_context: fidl::encoding::Context) -> usize {
3283 4
3284 }
3285
3286 #[inline(always)]
3287 fn inline_size(_context: fidl::encoding::Context) -> usize {
3288 20
3289 }
3290 }
3291
3292 unsafe impl
3293 fidl::encoding::Encode<
3294 ControlReopenDetachedControllerRequest,
3295 fidl::encoding::DefaultFuchsiaResourceDialect,
3296 > for &mut ControlReopenDetachedControllerRequest
3297 {
3298 #[inline]
3299 unsafe fn encode(
3300 self,
3301 encoder: &mut fidl::encoding::Encoder<
3302 '_,
3303 fidl::encoding::DefaultFuchsiaResourceDialect,
3304 >,
3305 offset: usize,
3306 _depth: fidl::encoding::Depth,
3307 ) -> fidl::Result<()> {
3308 encoder.debug_check_bounds::<ControlReopenDetachedControllerRequest>(offset);
3309 fidl::encoding::Encode::<ControlReopenDetachedControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3311 (
3312 <ControllerKey as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
3313 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
3314 ),
3315 encoder, offset, _depth
3316 )
3317 }
3318 }
3319 unsafe impl<
3320 T0: fidl::encoding::Encode<ControllerKey, fidl::encoding::DefaultFuchsiaResourceDialect>,
3321 T1: fidl::encoding::Encode<
3322 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
3323 fidl::encoding::DefaultFuchsiaResourceDialect,
3324 >,
3325 >
3326 fidl::encoding::Encode<
3327 ControlReopenDetachedControllerRequest,
3328 fidl::encoding::DefaultFuchsiaResourceDialect,
3329 > for (T0, T1)
3330 {
3331 #[inline]
3332 unsafe fn encode(
3333 self,
3334 encoder: &mut fidl::encoding::Encoder<
3335 '_,
3336 fidl::encoding::DefaultFuchsiaResourceDialect,
3337 >,
3338 offset: usize,
3339 depth: fidl::encoding::Depth,
3340 ) -> fidl::Result<()> {
3341 encoder.debug_check_bounds::<ControlReopenDetachedControllerRequest>(offset);
3342 self.0.encode(encoder, offset + 0, depth)?;
3346 self.1.encode(encoder, offset + 16, depth)?;
3347 Ok(())
3348 }
3349 }
3350
3351 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3352 for ControlReopenDetachedControllerRequest
3353 {
3354 #[inline(always)]
3355 fn new_empty() -> Self {
3356 Self {
3357 key: fidl::new_empty!(ControllerKey, fidl::encoding::DefaultFuchsiaResourceDialect),
3358 request: fidl::new_empty!(
3359 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
3360 fidl::encoding::DefaultFuchsiaResourceDialect
3361 ),
3362 }
3363 }
3364
3365 #[inline]
3366 unsafe fn decode(
3367 &mut self,
3368 decoder: &mut fidl::encoding::Decoder<
3369 '_,
3370 fidl::encoding::DefaultFuchsiaResourceDialect,
3371 >,
3372 offset: usize,
3373 _depth: fidl::encoding::Depth,
3374 ) -> fidl::Result<()> {
3375 decoder.debug_check_bounds::<Self>(offset);
3376 fidl::decode!(
3378 ControllerKey,
3379 fidl::encoding::DefaultFuchsiaResourceDialect,
3380 &mut self.key,
3381 decoder,
3382 offset + 0,
3383 _depth
3384 )?;
3385 fidl::decode!(
3386 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NamespaceControllerMarker>>,
3387 fidl::encoding::DefaultFuchsiaResourceDialect,
3388 &mut self.request,
3389 decoder,
3390 offset + 16,
3391 _depth
3392 )?;
3393 Ok(())
3394 }
3395 }
3396
3397 impl fidl::encoding::ResourceTypeMarker for NamespaceControllerPushChangesRequest {
3398 type Borrowed<'a> = &'a mut Self;
3399 fn take_or_borrow<'a>(
3400 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3401 ) -> Self::Borrowed<'a> {
3402 value
3403 }
3404 }
3405
3406 unsafe impl fidl::encoding::TypeMarker for NamespaceControllerPushChangesRequest {
3407 type Owned = Self;
3408
3409 #[inline(always)]
3410 fn inline_align(_context: fidl::encoding::Context) -> usize {
3411 8
3412 }
3413
3414 #[inline(always)]
3415 fn inline_size(_context: fidl::encoding::Context) -> usize {
3416 16
3417 }
3418 }
3419
3420 unsafe impl
3421 fidl::encoding::Encode<
3422 NamespaceControllerPushChangesRequest,
3423 fidl::encoding::DefaultFuchsiaResourceDialect,
3424 > for &mut NamespaceControllerPushChangesRequest
3425 {
3426 #[inline]
3427 unsafe fn encode(
3428 self,
3429 encoder: &mut fidl::encoding::Encoder<
3430 '_,
3431 fidl::encoding::DefaultFuchsiaResourceDialect,
3432 >,
3433 offset: usize,
3434 _depth: fidl::encoding::Depth,
3435 ) -> fidl::Result<()> {
3436 encoder.debug_check_bounds::<NamespaceControllerPushChangesRequest>(offset);
3437 fidl::encoding::Encode::<
3439 NamespaceControllerPushChangesRequest,
3440 fidl::encoding::DefaultFuchsiaResourceDialect,
3441 >::encode(
3442 (<fidl::encoding::Vector<Change, 42> as fidl::encoding::ValueTypeMarker>::borrow(
3443 &self.changes,
3444 ),),
3445 encoder,
3446 offset,
3447 _depth,
3448 )
3449 }
3450 }
3451 unsafe impl<
3452 T0: fidl::encoding::Encode<
3453 fidl::encoding::Vector<Change, 42>,
3454 fidl::encoding::DefaultFuchsiaResourceDialect,
3455 >,
3456 >
3457 fidl::encoding::Encode<
3458 NamespaceControllerPushChangesRequest,
3459 fidl::encoding::DefaultFuchsiaResourceDialect,
3460 > for (T0,)
3461 {
3462 #[inline]
3463 unsafe fn encode(
3464 self,
3465 encoder: &mut fidl::encoding::Encoder<
3466 '_,
3467 fidl::encoding::DefaultFuchsiaResourceDialect,
3468 >,
3469 offset: usize,
3470 depth: fidl::encoding::Depth,
3471 ) -> fidl::Result<()> {
3472 encoder.debug_check_bounds::<NamespaceControllerPushChangesRequest>(offset);
3473 self.0.encode(encoder, offset + 0, depth)?;
3477 Ok(())
3478 }
3479 }
3480
3481 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3482 for NamespaceControllerPushChangesRequest
3483 {
3484 #[inline(always)]
3485 fn new_empty() -> Self {
3486 Self {
3487 changes: fidl::new_empty!(fidl::encoding::Vector<Change, 42>, fidl::encoding::DefaultFuchsiaResourceDialect),
3488 }
3489 }
3490
3491 #[inline]
3492 unsafe fn decode(
3493 &mut self,
3494 decoder: &mut fidl::encoding::Decoder<
3495 '_,
3496 fidl::encoding::DefaultFuchsiaResourceDialect,
3497 >,
3498 offset: usize,
3499 _depth: fidl::encoding::Depth,
3500 ) -> fidl::Result<()> {
3501 decoder.debug_check_bounds::<Self>(offset);
3502 fidl::decode!(fidl::encoding::Vector<Change, 42>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.changes, decoder, offset + 0, _depth)?;
3504 Ok(())
3505 }
3506 }
3507
3508 impl fidl::encoding::ResourceTypeMarker for StateGetWatcherRequest {
3509 type Borrowed<'a> = &'a mut Self;
3510 fn take_or_borrow<'a>(
3511 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3512 ) -> Self::Borrowed<'a> {
3513 value
3514 }
3515 }
3516
3517 unsafe impl fidl::encoding::TypeMarker for StateGetWatcherRequest {
3518 type Owned = Self;
3519
3520 #[inline(always)]
3521 fn inline_align(_context: fidl::encoding::Context) -> usize {
3522 8
3523 }
3524
3525 #[inline(always)]
3526 fn inline_size(_context: fidl::encoding::Context) -> usize {
3527 24
3528 }
3529 }
3530
3531 unsafe impl
3532 fidl::encoding::Encode<
3533 StateGetWatcherRequest,
3534 fidl::encoding::DefaultFuchsiaResourceDialect,
3535 > for &mut StateGetWatcherRequest
3536 {
3537 #[inline]
3538 unsafe fn encode(
3539 self,
3540 encoder: &mut fidl::encoding::Encoder<
3541 '_,
3542 fidl::encoding::DefaultFuchsiaResourceDialect,
3543 >,
3544 offset: usize,
3545 _depth: fidl::encoding::Depth,
3546 ) -> fidl::Result<()> {
3547 encoder.debug_check_bounds::<StateGetWatcherRequest>(offset);
3548 fidl::encoding::Encode::<StateGetWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3550 (
3551 <WatcherOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3552 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
3553 ),
3554 encoder, offset, _depth
3555 )
3556 }
3557 }
3558 unsafe impl<
3559 T0: fidl::encoding::Encode<WatcherOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3560 T1: fidl::encoding::Encode<
3561 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>>,
3562 fidl::encoding::DefaultFuchsiaResourceDialect,
3563 >,
3564 >
3565 fidl::encoding::Encode<
3566 StateGetWatcherRequest,
3567 fidl::encoding::DefaultFuchsiaResourceDialect,
3568 > for (T0, T1)
3569 {
3570 #[inline]
3571 unsafe fn encode(
3572 self,
3573 encoder: &mut fidl::encoding::Encoder<
3574 '_,
3575 fidl::encoding::DefaultFuchsiaResourceDialect,
3576 >,
3577 offset: usize,
3578 depth: fidl::encoding::Depth,
3579 ) -> fidl::Result<()> {
3580 encoder.debug_check_bounds::<StateGetWatcherRequest>(offset);
3581 unsafe {
3584 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3585 (ptr as *mut u64).write_unaligned(0);
3586 }
3587 self.0.encode(encoder, offset + 0, depth)?;
3589 self.1.encode(encoder, offset + 16, depth)?;
3590 Ok(())
3591 }
3592 }
3593
3594 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3595 for StateGetWatcherRequest
3596 {
3597 #[inline(always)]
3598 fn new_empty() -> Self {
3599 Self {
3600 options: fidl::new_empty!(
3601 WatcherOptions,
3602 fidl::encoding::DefaultFuchsiaResourceDialect
3603 ),
3604 request: fidl::new_empty!(
3605 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>>,
3606 fidl::encoding::DefaultFuchsiaResourceDialect
3607 ),
3608 }
3609 }
3610
3611 #[inline]
3612 unsafe fn decode(
3613 &mut self,
3614 decoder: &mut fidl::encoding::Decoder<
3615 '_,
3616 fidl::encoding::DefaultFuchsiaResourceDialect,
3617 >,
3618 offset: usize,
3619 _depth: fidl::encoding::Depth,
3620 ) -> fidl::Result<()> {
3621 decoder.debug_check_bounds::<Self>(offset);
3622 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3624 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3625 let mask = 0xffffffff00000000u64;
3626 let maskedval = padval & mask;
3627 if maskedval != 0 {
3628 return Err(fidl::Error::NonZeroPadding {
3629 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3630 });
3631 }
3632 fidl::decode!(
3633 WatcherOptions,
3634 fidl::encoding::DefaultFuchsiaResourceDialect,
3635 &mut self.options,
3636 decoder,
3637 offset + 0,
3638 _depth
3639 )?;
3640 fidl::decode!(
3641 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WatcherMarker>>,
3642 fidl::encoding::DefaultFuchsiaResourceDialect,
3643 &mut self.request,
3644 decoder,
3645 offset + 16,
3646 _depth
3647 )?;
3648 Ok(())
3649 }
3650 }
3651
3652 impl AttachEbpfProgramOptions {
3653 #[inline(always)]
3654 fn max_ordinal_present(&self) -> u64 {
3655 if let Some(_) = self.program {
3656 return 2;
3657 }
3658 if let Some(_) = self.hook {
3659 return 1;
3660 }
3661 0
3662 }
3663 }
3664
3665 impl fidl::encoding::ResourceTypeMarker for AttachEbpfProgramOptions {
3666 type Borrowed<'a> = &'a mut Self;
3667 fn take_or_borrow<'a>(
3668 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3669 ) -> Self::Borrowed<'a> {
3670 value
3671 }
3672 }
3673
3674 unsafe impl fidl::encoding::TypeMarker for AttachEbpfProgramOptions {
3675 type Owned = Self;
3676
3677 #[inline(always)]
3678 fn inline_align(_context: fidl::encoding::Context) -> usize {
3679 8
3680 }
3681
3682 #[inline(always)]
3683 fn inline_size(_context: fidl::encoding::Context) -> usize {
3684 16
3685 }
3686 }
3687
3688 unsafe impl
3689 fidl::encoding::Encode<
3690 AttachEbpfProgramOptions,
3691 fidl::encoding::DefaultFuchsiaResourceDialect,
3692 > for &mut AttachEbpfProgramOptions
3693 {
3694 unsafe fn encode(
3695 self,
3696 encoder: &mut fidl::encoding::Encoder<
3697 '_,
3698 fidl::encoding::DefaultFuchsiaResourceDialect,
3699 >,
3700 offset: usize,
3701 mut depth: fidl::encoding::Depth,
3702 ) -> fidl::Result<()> {
3703 encoder.debug_check_bounds::<AttachEbpfProgramOptions>(offset);
3704 let max_ordinal: u64 = self.max_ordinal_present();
3706 encoder.write_num(max_ordinal, offset);
3707 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3708 if max_ordinal == 0 {
3710 return Ok(());
3711 }
3712 depth.increment()?;
3713 let envelope_size = 8;
3714 let bytes_len = max_ordinal as usize * envelope_size;
3715 #[allow(unused_variables)]
3716 let offset = encoder.out_of_line_offset(bytes_len);
3717 let mut _prev_end_offset: usize = 0;
3718 if 1 > max_ordinal {
3719 return Ok(());
3720 }
3721
3722 let cur_offset: usize = (1 - 1) * envelope_size;
3725
3726 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3728
3729 fidl::encoding::encode_in_envelope_optional::<
3734 SocketHook,
3735 fidl::encoding::DefaultFuchsiaResourceDialect,
3736 >(
3737 self.hook.as_ref().map(<SocketHook as fidl::encoding::ValueTypeMarker>::borrow),
3738 encoder,
3739 offset + cur_offset,
3740 depth,
3741 )?;
3742
3743 _prev_end_offset = cur_offset + envelope_size;
3744 if 2 > max_ordinal {
3745 return Ok(());
3746 }
3747
3748 let cur_offset: usize = (2 - 1) * envelope_size;
3751
3752 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3754
3755 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ebpf::VerifiedProgram, fidl::encoding::DefaultFuchsiaResourceDialect>(
3760 self.program.as_mut().map(<fidl_fuchsia_ebpf::VerifiedProgram as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3761 encoder, offset + cur_offset, depth
3762 )?;
3763
3764 _prev_end_offset = cur_offset + envelope_size;
3765
3766 Ok(())
3767 }
3768 }
3769
3770 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3771 for AttachEbpfProgramOptions
3772 {
3773 #[inline(always)]
3774 fn new_empty() -> Self {
3775 Self::default()
3776 }
3777
3778 unsafe fn decode(
3779 &mut self,
3780 decoder: &mut fidl::encoding::Decoder<
3781 '_,
3782 fidl::encoding::DefaultFuchsiaResourceDialect,
3783 >,
3784 offset: usize,
3785 mut depth: fidl::encoding::Depth,
3786 ) -> fidl::Result<()> {
3787 decoder.debug_check_bounds::<Self>(offset);
3788 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3789 None => return Err(fidl::Error::NotNullable),
3790 Some(len) => len,
3791 };
3792 if len == 0 {
3794 return Ok(());
3795 };
3796 depth.increment()?;
3797 let envelope_size = 8;
3798 let bytes_len = len * envelope_size;
3799 let offset = decoder.out_of_line_offset(bytes_len)?;
3800 let mut _next_ordinal_to_read = 0;
3802 let mut next_offset = offset;
3803 let end_offset = offset + bytes_len;
3804 _next_ordinal_to_read += 1;
3805 if next_offset >= end_offset {
3806 return Ok(());
3807 }
3808
3809 while _next_ordinal_to_read < 1 {
3811 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3812 _next_ordinal_to_read += 1;
3813 next_offset += envelope_size;
3814 }
3815
3816 let next_out_of_line = decoder.next_out_of_line();
3817 let handles_before = decoder.remaining_handles();
3818 if let Some((inlined, num_bytes, num_handles)) =
3819 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3820 {
3821 let member_inline_size =
3822 <SocketHook as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3823 if inlined != (member_inline_size <= 4) {
3824 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3825 }
3826 let inner_offset;
3827 let mut inner_depth = depth.clone();
3828 if inlined {
3829 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3830 inner_offset = next_offset;
3831 } else {
3832 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3833 inner_depth.increment()?;
3834 }
3835 let val_ref = self.hook.get_or_insert_with(|| {
3836 fidl::new_empty!(SocketHook, fidl::encoding::DefaultFuchsiaResourceDialect)
3837 });
3838 fidl::decode!(
3839 SocketHook,
3840 fidl::encoding::DefaultFuchsiaResourceDialect,
3841 val_ref,
3842 decoder,
3843 inner_offset,
3844 inner_depth
3845 )?;
3846 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3847 {
3848 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3849 }
3850 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3851 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3852 }
3853 }
3854
3855 next_offset += envelope_size;
3856 _next_ordinal_to_read += 1;
3857 if next_offset >= end_offset {
3858 return Ok(());
3859 }
3860
3861 while _next_ordinal_to_read < 2 {
3863 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3864 _next_ordinal_to_read += 1;
3865 next_offset += envelope_size;
3866 }
3867
3868 let next_out_of_line = decoder.next_out_of_line();
3869 let handles_before = decoder.remaining_handles();
3870 if let Some((inlined, num_bytes, num_handles)) =
3871 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3872 {
3873 let member_inline_size =
3874 <fidl_fuchsia_ebpf::VerifiedProgram as fidl::encoding::TypeMarker>::inline_size(
3875 decoder.context,
3876 );
3877 if inlined != (member_inline_size <= 4) {
3878 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3879 }
3880 let inner_offset;
3881 let mut inner_depth = depth.clone();
3882 if inlined {
3883 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3884 inner_offset = next_offset;
3885 } else {
3886 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3887 inner_depth.increment()?;
3888 }
3889 let val_ref = self.program.get_or_insert_with(|| {
3890 fidl::new_empty!(
3891 fidl_fuchsia_ebpf::VerifiedProgram,
3892 fidl::encoding::DefaultFuchsiaResourceDialect
3893 )
3894 });
3895 fidl::decode!(
3896 fidl_fuchsia_ebpf::VerifiedProgram,
3897 fidl::encoding::DefaultFuchsiaResourceDialect,
3898 val_ref,
3899 decoder,
3900 inner_offset,
3901 inner_depth
3902 )?;
3903 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3904 {
3905 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3906 }
3907 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3908 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3909 }
3910 }
3911
3912 next_offset += envelope_size;
3913
3914 while next_offset < end_offset {
3916 _next_ordinal_to_read += 1;
3917 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3918 next_offset += envelope_size;
3919 }
3920
3921 Ok(())
3922 }
3923 }
3924
3925 impl CommitOptions {
3926 #[inline(always)]
3927 fn max_ordinal_present(&self) -> u64 {
3928 if let Some(_) = self.idempotent {
3929 return 1;
3930 }
3931 0
3932 }
3933 }
3934
3935 impl fidl::encoding::ResourceTypeMarker for CommitOptions {
3936 type Borrowed<'a> = &'a mut Self;
3937 fn take_or_borrow<'a>(
3938 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3939 ) -> Self::Borrowed<'a> {
3940 value
3941 }
3942 }
3943
3944 unsafe impl fidl::encoding::TypeMarker for CommitOptions {
3945 type Owned = Self;
3946
3947 #[inline(always)]
3948 fn inline_align(_context: fidl::encoding::Context) -> usize {
3949 8
3950 }
3951
3952 #[inline(always)]
3953 fn inline_size(_context: fidl::encoding::Context) -> usize {
3954 16
3955 }
3956 }
3957
3958 unsafe impl fidl::encoding::Encode<CommitOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3959 for &mut CommitOptions
3960 {
3961 unsafe fn encode(
3962 self,
3963 encoder: &mut fidl::encoding::Encoder<
3964 '_,
3965 fidl::encoding::DefaultFuchsiaResourceDialect,
3966 >,
3967 offset: usize,
3968 mut depth: fidl::encoding::Depth,
3969 ) -> fidl::Result<()> {
3970 encoder.debug_check_bounds::<CommitOptions>(offset);
3971 let max_ordinal: u64 = self.max_ordinal_present();
3973 encoder.write_num(max_ordinal, offset);
3974 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3975 if max_ordinal == 0 {
3977 return Ok(());
3978 }
3979 depth.increment()?;
3980 let envelope_size = 8;
3981 let bytes_len = max_ordinal as usize * envelope_size;
3982 #[allow(unused_variables)]
3983 let offset = encoder.out_of_line_offset(bytes_len);
3984 let mut _prev_end_offset: usize = 0;
3985 if 1 > max_ordinal {
3986 return Ok(());
3987 }
3988
3989 let cur_offset: usize = (1 - 1) * envelope_size;
3992
3993 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3995
3996 fidl::encoding::encode_in_envelope_optional::<
4001 bool,
4002 fidl::encoding::DefaultFuchsiaResourceDialect,
4003 >(
4004 self.idempotent.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4005 encoder,
4006 offset + cur_offset,
4007 depth,
4008 )?;
4009
4010 _prev_end_offset = cur_offset + envelope_size;
4011
4012 Ok(())
4013 }
4014 }
4015
4016 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for CommitOptions {
4017 #[inline(always)]
4018 fn new_empty() -> Self {
4019 Self::default()
4020 }
4021
4022 unsafe fn decode(
4023 &mut self,
4024 decoder: &mut fidl::encoding::Decoder<
4025 '_,
4026 fidl::encoding::DefaultFuchsiaResourceDialect,
4027 >,
4028 offset: usize,
4029 mut depth: fidl::encoding::Depth,
4030 ) -> fidl::Result<()> {
4031 decoder.debug_check_bounds::<Self>(offset);
4032 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4033 None => return Err(fidl::Error::NotNullable),
4034 Some(len) => len,
4035 };
4036 if len == 0 {
4038 return Ok(());
4039 };
4040 depth.increment()?;
4041 let envelope_size = 8;
4042 let bytes_len = len * envelope_size;
4043 let offset = decoder.out_of_line_offset(bytes_len)?;
4044 let mut _next_ordinal_to_read = 0;
4046 let mut next_offset = offset;
4047 let end_offset = offset + bytes_len;
4048 _next_ordinal_to_read += 1;
4049 if next_offset >= end_offset {
4050 return Ok(());
4051 }
4052
4053 while _next_ordinal_to_read < 1 {
4055 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4056 _next_ordinal_to_read += 1;
4057 next_offset += envelope_size;
4058 }
4059
4060 let next_out_of_line = decoder.next_out_of_line();
4061 let handles_before = decoder.remaining_handles();
4062 if let Some((inlined, num_bytes, num_handles)) =
4063 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4064 {
4065 let member_inline_size =
4066 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4067 if inlined != (member_inline_size <= 4) {
4068 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4069 }
4070 let inner_offset;
4071 let mut inner_depth = depth.clone();
4072 if inlined {
4073 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4074 inner_offset = next_offset;
4075 } else {
4076 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4077 inner_depth.increment()?;
4078 }
4079 let val_ref = self.idempotent.get_or_insert_with(|| {
4080 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4081 });
4082 fidl::decode!(
4083 bool,
4084 fidl::encoding::DefaultFuchsiaResourceDialect,
4085 val_ref,
4086 decoder,
4087 inner_offset,
4088 inner_depth
4089 )?;
4090 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4091 {
4092 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4093 }
4094 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4095 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4096 }
4097 }
4098
4099 next_offset += envelope_size;
4100
4101 while next_offset < end_offset {
4103 _next_ordinal_to_read += 1;
4104 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4105 next_offset += envelope_size;
4106 }
4107
4108 Ok(())
4109 }
4110 }
4111
4112 impl fidl::encoding::ResourceTypeMarker for ChangeValidationResult {
4113 type Borrowed<'a> = &'a mut Self;
4114 fn take_or_borrow<'a>(
4115 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4116 ) -> Self::Borrowed<'a> {
4117 value
4118 }
4119 }
4120
4121 unsafe impl fidl::encoding::TypeMarker for ChangeValidationResult {
4122 type Owned = Self;
4123
4124 #[inline(always)]
4125 fn inline_align(_context: fidl::encoding::Context) -> usize {
4126 8
4127 }
4128
4129 #[inline(always)]
4130 fn inline_size(_context: fidl::encoding::Context) -> usize {
4131 16
4132 }
4133 }
4134
4135 unsafe impl
4136 fidl::encoding::Encode<
4137 ChangeValidationResult,
4138 fidl::encoding::DefaultFuchsiaResourceDialect,
4139 > for &mut ChangeValidationResult
4140 {
4141 #[inline]
4142 unsafe fn encode(
4143 self,
4144 encoder: &mut fidl::encoding::Encoder<
4145 '_,
4146 fidl::encoding::DefaultFuchsiaResourceDialect,
4147 >,
4148 offset: usize,
4149 _depth: fidl::encoding::Depth,
4150 ) -> fidl::Result<()> {
4151 encoder.debug_check_bounds::<ChangeValidationResult>(offset);
4152 encoder.write_num::<u64>(self.ordinal(), offset);
4153 match self {
4154 ChangeValidationResult::Ok(ref val) => {
4155 fidl::encoding::encode_in_envelope::<Empty, fidl::encoding::DefaultFuchsiaResourceDialect>(
4156 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4157 encoder, offset + 8, _depth
4158 )
4159 }
4160 ChangeValidationResult::TooManyChanges(ref val) => {
4161 fidl::encoding::encode_in_envelope::<Empty, fidl::encoding::DefaultFuchsiaResourceDialect>(
4162 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4163 encoder, offset + 8, _depth
4164 )
4165 }
4166 ChangeValidationResult::ErrorOnChange(ref val) => {
4167 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<ChangeValidationError, 42>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4168 <fidl::encoding::Vector<ChangeValidationError, 42> as fidl::encoding::ValueTypeMarker>::borrow(val),
4169 encoder, offset + 8, _depth
4170 )
4171 }
4172 ChangeValidationResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4173 }
4174 }
4175 }
4176
4177 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4178 for ChangeValidationResult
4179 {
4180 #[inline(always)]
4181 fn new_empty() -> Self {
4182 Self::__SourceBreaking { unknown_ordinal: 0 }
4183 }
4184
4185 #[inline]
4186 unsafe fn decode(
4187 &mut self,
4188 decoder: &mut fidl::encoding::Decoder<
4189 '_,
4190 fidl::encoding::DefaultFuchsiaResourceDialect,
4191 >,
4192 offset: usize,
4193 mut depth: fidl::encoding::Depth,
4194 ) -> fidl::Result<()> {
4195 decoder.debug_check_bounds::<Self>(offset);
4196 #[allow(unused_variables)]
4197 let next_out_of_line = decoder.next_out_of_line();
4198 let handles_before = decoder.remaining_handles();
4199 let (ordinal, inlined, num_bytes, num_handles) =
4200 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4201
4202 let member_inline_size = match ordinal {
4203 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4204 2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4205 3 => <fidl::encoding::Vector<ChangeValidationError, 42> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4206 0 => return Err(fidl::Error::UnknownUnionTag),
4207 _ => num_bytes as usize,
4208 };
4209
4210 if inlined != (member_inline_size <= 4) {
4211 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4212 }
4213 let _inner_offset;
4214 if inlined {
4215 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4216 _inner_offset = offset + 8;
4217 } else {
4218 depth.increment()?;
4219 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4220 }
4221 match ordinal {
4222 1 => {
4223 #[allow(irrefutable_let_patterns)]
4224 if let ChangeValidationResult::Ok(_) = self {
4225 } else {
4227 *self = ChangeValidationResult::Ok(fidl::new_empty!(
4229 Empty,
4230 fidl::encoding::DefaultFuchsiaResourceDialect
4231 ));
4232 }
4233 #[allow(irrefutable_let_patterns)]
4234 if let ChangeValidationResult::Ok(ref mut val) = self {
4235 fidl::decode!(
4236 Empty,
4237 fidl::encoding::DefaultFuchsiaResourceDialect,
4238 val,
4239 decoder,
4240 _inner_offset,
4241 depth
4242 )?;
4243 } else {
4244 unreachable!()
4245 }
4246 }
4247 2 => {
4248 #[allow(irrefutable_let_patterns)]
4249 if let ChangeValidationResult::TooManyChanges(_) = self {
4250 } else {
4252 *self = ChangeValidationResult::TooManyChanges(fidl::new_empty!(
4254 Empty,
4255 fidl::encoding::DefaultFuchsiaResourceDialect
4256 ));
4257 }
4258 #[allow(irrefutable_let_patterns)]
4259 if let ChangeValidationResult::TooManyChanges(ref mut val) = self {
4260 fidl::decode!(
4261 Empty,
4262 fidl::encoding::DefaultFuchsiaResourceDialect,
4263 val,
4264 decoder,
4265 _inner_offset,
4266 depth
4267 )?;
4268 } else {
4269 unreachable!()
4270 }
4271 }
4272 3 => {
4273 #[allow(irrefutable_let_patterns)]
4274 if let ChangeValidationResult::ErrorOnChange(_) = self {
4275 } else {
4277 *self = ChangeValidationResult::ErrorOnChange(
4279 fidl::new_empty!(fidl::encoding::Vector<ChangeValidationError, 42>, fidl::encoding::DefaultFuchsiaResourceDialect),
4280 );
4281 }
4282 #[allow(irrefutable_let_patterns)]
4283 if let ChangeValidationResult::ErrorOnChange(ref mut val) = self {
4284 fidl::decode!(fidl::encoding::Vector<ChangeValidationError, 42>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4285 } else {
4286 unreachable!()
4287 }
4288 }
4289 #[allow(deprecated)]
4290 ordinal => {
4291 for _ in 0..num_handles {
4292 decoder.drop_next_handle()?;
4293 }
4294 *self = ChangeValidationResult::__SourceBreaking { unknown_ordinal: ordinal };
4295 }
4296 }
4297 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4298 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4299 }
4300 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4301 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4302 }
4303 Ok(())
4304 }
4305 }
4306
4307 impl fidl::encoding::ResourceTypeMarker for CommitResult {
4308 type Borrowed<'a> = &'a mut Self;
4309 fn take_or_borrow<'a>(
4310 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4311 ) -> Self::Borrowed<'a> {
4312 value
4313 }
4314 }
4315
4316 unsafe impl fidl::encoding::TypeMarker for CommitResult {
4317 type Owned = Self;
4318
4319 #[inline(always)]
4320 fn inline_align(_context: fidl::encoding::Context) -> usize {
4321 8
4322 }
4323
4324 #[inline(always)]
4325 fn inline_size(_context: fidl::encoding::Context) -> usize {
4326 16
4327 }
4328 }
4329
4330 unsafe impl fidl::encoding::Encode<CommitResult, fidl::encoding::DefaultFuchsiaResourceDialect>
4331 for &mut CommitResult
4332 {
4333 #[inline]
4334 unsafe fn encode(
4335 self,
4336 encoder: &mut fidl::encoding::Encoder<
4337 '_,
4338 fidl::encoding::DefaultFuchsiaResourceDialect,
4339 >,
4340 offset: usize,
4341 _depth: fidl::encoding::Depth,
4342 ) -> fidl::Result<()> {
4343 encoder.debug_check_bounds::<CommitResult>(offset);
4344 encoder.write_num::<u64>(self.ordinal(), offset);
4345 match self {
4346 CommitResult::Ok(ref val) => {
4347 fidl::encoding::encode_in_envelope::<Empty, fidl::encoding::DefaultFuchsiaResourceDialect>(
4348 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4349 encoder, offset + 8, _depth
4350 )
4351 }
4352 CommitResult::RuleWithInvalidMatcher(ref val) => {
4353 fidl::encoding::encode_in_envelope::<RuleId, fidl::encoding::DefaultFuchsiaResourceDialect>(
4354 <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
4355 encoder, offset + 8, _depth
4356 )
4357 }
4358 CommitResult::RuleWithInvalidAction(ref val) => {
4359 fidl::encoding::encode_in_envelope::<RuleId, fidl::encoding::DefaultFuchsiaResourceDialect>(
4360 <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
4361 encoder, offset + 8, _depth
4362 )
4363 }
4364 CommitResult::CyclicalRoutineGraph(ref val) => {
4365 fidl::encoding::encode_in_envelope::<RoutineId, fidl::encoding::DefaultFuchsiaResourceDialect>(
4366 <RoutineId as fidl::encoding::ValueTypeMarker>::borrow(val),
4367 encoder, offset + 8, _depth
4368 )
4369 }
4370 CommitResult::ErrorOnChange(ref val) => {
4371 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<CommitError, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4372 <fidl::encoding::Vector<CommitError, 1024> as fidl::encoding::ValueTypeMarker>::borrow(val),
4373 encoder, offset + 8, _depth
4374 )
4375 }
4376 CommitResult::TransparentProxyWithInvalidMatcher(ref val) => {
4377 fidl::encoding::encode_in_envelope::<RuleId, fidl::encoding::DefaultFuchsiaResourceDialect>(
4378 <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
4379 encoder, offset + 8, _depth
4380 )
4381 }
4382 CommitResult::RedirectWithInvalidMatcher(ref val) => {
4383 fidl::encoding::encode_in_envelope::<RuleId, fidl::encoding::DefaultFuchsiaResourceDialect>(
4384 <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
4385 encoder, offset + 8, _depth
4386 )
4387 }
4388 CommitResult::MasqueradeWithInvalidMatcher(ref val) => {
4389 fidl::encoding::encode_in_envelope::<RuleId, fidl::encoding::DefaultFuchsiaResourceDialect>(
4390 <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
4391 encoder, offset + 8, _depth
4392 )
4393 }
4394 CommitResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4395 }
4396 }
4397 }
4398
4399 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for CommitResult {
4400 #[inline(always)]
4401 fn new_empty() -> Self {
4402 Self::__SourceBreaking { unknown_ordinal: 0 }
4403 }
4404
4405 #[inline]
4406 unsafe fn decode(
4407 &mut self,
4408 decoder: &mut fidl::encoding::Decoder<
4409 '_,
4410 fidl::encoding::DefaultFuchsiaResourceDialect,
4411 >,
4412 offset: usize,
4413 mut depth: fidl::encoding::Depth,
4414 ) -> fidl::Result<()> {
4415 decoder.debug_check_bounds::<Self>(offset);
4416 #[allow(unused_variables)]
4417 let next_out_of_line = decoder.next_out_of_line();
4418 let handles_before = decoder.remaining_handles();
4419 let (ordinal, inlined, num_bytes, num_handles) =
4420 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4421
4422 let member_inline_size = match ordinal {
4423 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4424 2 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4425 3 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4426 4 => <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4427 5 => <fidl::encoding::Vector<CommitError, 1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4428 6 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4429 7 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4430 8 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4431 0 => return Err(fidl::Error::UnknownUnionTag),
4432 _ => num_bytes as usize,
4433 };
4434
4435 if inlined != (member_inline_size <= 4) {
4436 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4437 }
4438 let _inner_offset;
4439 if inlined {
4440 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4441 _inner_offset = offset + 8;
4442 } else {
4443 depth.increment()?;
4444 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4445 }
4446 match ordinal {
4447 1 => {
4448 #[allow(irrefutable_let_patterns)]
4449 if let CommitResult::Ok(_) = self {
4450 } else {
4452 *self = CommitResult::Ok(fidl::new_empty!(
4454 Empty,
4455 fidl::encoding::DefaultFuchsiaResourceDialect
4456 ));
4457 }
4458 #[allow(irrefutable_let_patterns)]
4459 if let CommitResult::Ok(ref mut val) = self {
4460 fidl::decode!(
4461 Empty,
4462 fidl::encoding::DefaultFuchsiaResourceDialect,
4463 val,
4464 decoder,
4465 _inner_offset,
4466 depth
4467 )?;
4468 } else {
4469 unreachable!()
4470 }
4471 }
4472 2 => {
4473 #[allow(irrefutable_let_patterns)]
4474 if let CommitResult::RuleWithInvalidMatcher(_) = self {
4475 } else {
4477 *self = CommitResult::RuleWithInvalidMatcher(fidl::new_empty!(
4479 RuleId,
4480 fidl::encoding::DefaultFuchsiaResourceDialect
4481 ));
4482 }
4483 #[allow(irrefutable_let_patterns)]
4484 if let CommitResult::RuleWithInvalidMatcher(ref mut val) = self {
4485 fidl::decode!(
4486 RuleId,
4487 fidl::encoding::DefaultFuchsiaResourceDialect,
4488 val,
4489 decoder,
4490 _inner_offset,
4491 depth
4492 )?;
4493 } else {
4494 unreachable!()
4495 }
4496 }
4497 3 => {
4498 #[allow(irrefutable_let_patterns)]
4499 if let CommitResult::RuleWithInvalidAction(_) = self {
4500 } else {
4502 *self = CommitResult::RuleWithInvalidAction(fidl::new_empty!(
4504 RuleId,
4505 fidl::encoding::DefaultFuchsiaResourceDialect
4506 ));
4507 }
4508 #[allow(irrefutable_let_patterns)]
4509 if let CommitResult::RuleWithInvalidAction(ref mut val) = self {
4510 fidl::decode!(
4511 RuleId,
4512 fidl::encoding::DefaultFuchsiaResourceDialect,
4513 val,
4514 decoder,
4515 _inner_offset,
4516 depth
4517 )?;
4518 } else {
4519 unreachable!()
4520 }
4521 }
4522 4 => {
4523 #[allow(irrefutable_let_patterns)]
4524 if let CommitResult::CyclicalRoutineGraph(_) = self {
4525 } else {
4527 *self = CommitResult::CyclicalRoutineGraph(fidl::new_empty!(
4529 RoutineId,
4530 fidl::encoding::DefaultFuchsiaResourceDialect
4531 ));
4532 }
4533 #[allow(irrefutable_let_patterns)]
4534 if let CommitResult::CyclicalRoutineGraph(ref mut val) = self {
4535 fidl::decode!(
4536 RoutineId,
4537 fidl::encoding::DefaultFuchsiaResourceDialect,
4538 val,
4539 decoder,
4540 _inner_offset,
4541 depth
4542 )?;
4543 } else {
4544 unreachable!()
4545 }
4546 }
4547 5 => {
4548 #[allow(irrefutable_let_patterns)]
4549 if let CommitResult::ErrorOnChange(_) = self {
4550 } else {
4552 *self = CommitResult::ErrorOnChange(
4554 fidl::new_empty!(fidl::encoding::Vector<CommitError, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect),
4555 );
4556 }
4557 #[allow(irrefutable_let_patterns)]
4558 if let CommitResult::ErrorOnChange(ref mut val) = self {
4559 fidl::decode!(fidl::encoding::Vector<CommitError, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4560 } else {
4561 unreachable!()
4562 }
4563 }
4564 6 => {
4565 #[allow(irrefutable_let_patterns)]
4566 if let CommitResult::TransparentProxyWithInvalidMatcher(_) = self {
4567 } else {
4569 *self = CommitResult::TransparentProxyWithInvalidMatcher(fidl::new_empty!(
4571 RuleId,
4572 fidl::encoding::DefaultFuchsiaResourceDialect
4573 ));
4574 }
4575 #[allow(irrefutable_let_patterns)]
4576 if let CommitResult::TransparentProxyWithInvalidMatcher(ref mut val) = self {
4577 fidl::decode!(
4578 RuleId,
4579 fidl::encoding::DefaultFuchsiaResourceDialect,
4580 val,
4581 decoder,
4582 _inner_offset,
4583 depth
4584 )?;
4585 } else {
4586 unreachable!()
4587 }
4588 }
4589 7 => {
4590 #[allow(irrefutable_let_patterns)]
4591 if let CommitResult::RedirectWithInvalidMatcher(_) = self {
4592 } else {
4594 *self = CommitResult::RedirectWithInvalidMatcher(fidl::new_empty!(
4596 RuleId,
4597 fidl::encoding::DefaultFuchsiaResourceDialect
4598 ));
4599 }
4600 #[allow(irrefutable_let_patterns)]
4601 if let CommitResult::RedirectWithInvalidMatcher(ref mut val) = self {
4602 fidl::decode!(
4603 RuleId,
4604 fidl::encoding::DefaultFuchsiaResourceDialect,
4605 val,
4606 decoder,
4607 _inner_offset,
4608 depth
4609 )?;
4610 } else {
4611 unreachable!()
4612 }
4613 }
4614 8 => {
4615 #[allow(irrefutable_let_patterns)]
4616 if let CommitResult::MasqueradeWithInvalidMatcher(_) = self {
4617 } else {
4619 *self = CommitResult::MasqueradeWithInvalidMatcher(fidl::new_empty!(
4621 RuleId,
4622 fidl::encoding::DefaultFuchsiaResourceDialect
4623 ));
4624 }
4625 #[allow(irrefutable_let_patterns)]
4626 if let CommitResult::MasqueradeWithInvalidMatcher(ref mut val) = self {
4627 fidl::decode!(
4628 RuleId,
4629 fidl::encoding::DefaultFuchsiaResourceDialect,
4630 val,
4631 decoder,
4632 _inner_offset,
4633 depth
4634 )?;
4635 } else {
4636 unreachable!()
4637 }
4638 }
4639 #[allow(deprecated)]
4640 ordinal => {
4641 for _ in 0..num_handles {
4642 decoder.drop_next_handle()?;
4643 }
4644 *self = CommitResult::__SourceBreaking { unknown_ordinal: ordinal };
4645 }
4646 }
4647 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4648 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4649 }
4650 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4651 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4652 }
4653 Ok(())
4654 }
4655 }
4656}