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_interfaces_admin__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControlAddAddressRequest {
16 pub address: fidl_fuchsia_net::Subnet,
17 pub parameters: AddressParameters,
18 pub address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControlAddAddressRequest {}
22
23#[derive(Debug, PartialEq)]
24pub struct ControlGetAuthorizationForInterfaceResponse {
25 pub credential: fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29 for ControlGetAuthorizationForInterfaceResponse
30{
31}
32
33#[derive(Debug, PartialEq)]
34pub struct DeviceControlCreateInterfaceRequest {
35 pub port: fidl_fuchsia_hardware_network::PortId,
36 pub control: fidl::endpoints::ServerEnd<ControlMarker>,
37 pub options: Options,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41 for DeviceControlCreateInterfaceRequest
42{
43}
44
45#[derive(Debug, PartialEq)]
46pub struct InstallerInstallBlackholeInterfaceRequest {
47 pub interface: fidl::endpoints::ServerEnd<ControlMarker>,
48 pub options: Options,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52 for InstallerInstallBlackholeInterfaceRequest
53{
54}
55
56#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
57pub struct InstallerInstallDeviceRequest {
58 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
59 pub device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63 for InstallerInstallDeviceRequest
64{
65}
66
67#[derive(Debug, Default, PartialEq)]
69pub struct Options {
70 pub name: Option<String>,
74 pub metric: Option<u32>,
78 pub netstack_managed_routes_designation: Option<NetstackManagedRoutesDesignation>,
82 #[doc(hidden)]
83 pub __source_breaking: fidl::marker::SourceBreaking,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Options {}
87
88#[derive(Debug)]
91pub enum NetstackManagedRoutesDesignation {
92 Main(Empty),
94 InterfaceLocal(Empty),
100 #[doc(hidden)]
101 __SourceBreaking { unknown_ordinal: u64 },
102}
103
104#[macro_export]
106macro_rules! NetstackManagedRoutesDesignationUnknown {
107 () => {
108 _
109 };
110}
111
112impl PartialEq for NetstackManagedRoutesDesignation {
114 fn eq(&self, other: &Self) -> bool {
115 match (self, other) {
116 (Self::Main(x), Self::Main(y)) => *x == *y,
117 (Self::InterfaceLocal(x), Self::InterfaceLocal(y)) => *x == *y,
118 _ => false,
119 }
120 }
121}
122
123impl NetstackManagedRoutesDesignation {
124 #[inline]
125 pub fn ordinal(&self) -> u64 {
126 match *self {
127 Self::Main(_) => 1,
128 Self::InterfaceLocal(_) => 2,
129 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
130 }
131 }
132
133 #[inline]
134 pub fn unknown_variant_for_testing() -> Self {
135 Self::__SourceBreaking { unknown_ordinal: 0 }
136 }
137
138 #[inline]
139 pub fn is_unknown(&self) -> bool {
140 match self {
141 Self::__SourceBreaking { .. } => true,
142 _ => false,
143 }
144 }
145}
146
147impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
148 for NetstackManagedRoutesDesignation
149{
150}
151
152#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
153pub struct AddressStateProviderMarker;
154
155impl fidl::endpoints::ProtocolMarker for AddressStateProviderMarker {
156 type Proxy = AddressStateProviderProxy;
157 type RequestStream = AddressStateProviderRequestStream;
158 #[cfg(target_os = "fuchsia")]
159 type SynchronousProxy = AddressStateProviderSynchronousProxy;
160
161 const DEBUG_NAME: &'static str = "(anonymous) AddressStateProvider";
162}
163
164pub trait AddressStateProviderProxyInterface: Send + Sync {
165 type UpdateAddressPropertiesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
166 + Send;
167 fn r#update_address_properties(
168 &self,
169 address_properties: &AddressProperties,
170 ) -> Self::UpdateAddressPropertiesResponseFut;
171 type WatchAddressAssignmentStateResponseFut: std::future::Future<
172 Output = Result<fidl_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error>,
173 > + Send;
174 fn r#watch_address_assignment_state(&self) -> Self::WatchAddressAssignmentStateResponseFut;
175 fn r#detach(&self) -> Result<(), fidl::Error>;
176 fn r#remove(&self) -> Result<(), fidl::Error>;
177}
178#[derive(Debug)]
179#[cfg(target_os = "fuchsia")]
180pub struct AddressStateProviderSynchronousProxy {
181 client: fidl::client::sync::Client,
182}
183
184#[cfg(target_os = "fuchsia")]
185impl fidl::endpoints::SynchronousProxy for AddressStateProviderSynchronousProxy {
186 type Proxy = AddressStateProviderProxy;
187 type Protocol = AddressStateProviderMarker;
188
189 fn from_channel(inner: fidl::Channel) -> Self {
190 Self::new(inner)
191 }
192
193 fn into_channel(self) -> fidl::Channel {
194 self.client.into_channel()
195 }
196
197 fn as_channel(&self) -> &fidl::Channel {
198 self.client.as_channel()
199 }
200}
201
202#[cfg(target_os = "fuchsia")]
203impl AddressStateProviderSynchronousProxy {
204 pub fn new(channel: fidl::Channel) -> Self {
205 let protocol_name =
206 <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
207 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
208 }
209
210 pub fn into_channel(self) -> fidl::Channel {
211 self.client.into_channel()
212 }
213
214 pub fn wait_for_event(
217 &self,
218 deadline: zx::MonotonicInstant,
219 ) -> Result<AddressStateProviderEvent, fidl::Error> {
220 AddressStateProviderEvent::decode(self.client.wait_for_event(deadline)?)
221 }
222
223 pub fn r#update_address_properties(
235 &self,
236 mut address_properties: &AddressProperties,
237 ___deadline: zx::MonotonicInstant,
238 ) -> Result<(), fidl::Error> {
239 let _response = self.client.send_query::<
240 AddressStateProviderUpdateAddressPropertiesRequest,
241 fidl::encoding::EmptyPayload,
242 >(
243 (address_properties,),
244 0x52bdf5ed96ef573c,
245 fidl::encoding::DynamicFlags::empty(),
246 ___deadline,
247 )?;
248 Ok(_response)
249 }
250
251 pub fn r#watch_address_assignment_state(
265 &self,
266 ___deadline: zx::MonotonicInstant,
267 ) -> Result<fidl_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error> {
268 let _response = self.client.send_query::<
269 fidl::encoding::EmptyPayload,
270 AddressStateProviderWatchAddressAssignmentStateResponse,
271 >(
272 (),
273 0x740bb58c1b2d3188,
274 fidl::encoding::DynamicFlags::empty(),
275 ___deadline,
276 )?;
277 Ok(_response.assignment_state)
278 }
279
280 pub fn r#detach(&self) -> Result<(), fidl::Error> {
285 self.client.send::<fidl::encoding::EmptyPayload>(
286 (),
287 0xc752381d739622f,
288 fidl::encoding::DynamicFlags::empty(),
289 )
290 }
291
292 pub fn r#remove(&self) -> Result<(), fidl::Error> {
297 self.client.send::<fidl::encoding::EmptyPayload>(
298 (),
299 0x554407fe183e78ad,
300 fidl::encoding::DynamicFlags::empty(),
301 )
302 }
303}
304
305#[cfg(target_os = "fuchsia")]
306impl From<AddressStateProviderSynchronousProxy> for zx::Handle {
307 fn from(value: AddressStateProviderSynchronousProxy) -> Self {
308 value.into_channel().into()
309 }
310}
311
312#[cfg(target_os = "fuchsia")]
313impl From<fidl::Channel> for AddressStateProviderSynchronousProxy {
314 fn from(value: fidl::Channel) -> Self {
315 Self::new(value)
316 }
317}
318
319#[cfg(target_os = "fuchsia")]
320impl fidl::endpoints::FromClient for AddressStateProviderSynchronousProxy {
321 type Protocol = AddressStateProviderMarker;
322
323 fn from_client(value: fidl::endpoints::ClientEnd<AddressStateProviderMarker>) -> Self {
324 Self::new(value.into_channel())
325 }
326}
327
328#[derive(Debug, Clone)]
329pub struct AddressStateProviderProxy {
330 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
331}
332
333impl fidl::endpoints::Proxy for AddressStateProviderProxy {
334 type Protocol = AddressStateProviderMarker;
335
336 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
337 Self::new(inner)
338 }
339
340 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
341 self.client.into_channel().map_err(|client| Self { client })
342 }
343
344 fn as_channel(&self) -> &::fidl::AsyncChannel {
345 self.client.as_channel()
346 }
347}
348
349impl AddressStateProviderProxy {
350 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
352 let protocol_name =
353 <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
354 Self { client: fidl::client::Client::new(channel, protocol_name) }
355 }
356
357 pub fn take_event_stream(&self) -> AddressStateProviderEventStream {
363 AddressStateProviderEventStream { event_receiver: self.client.take_event_receiver() }
364 }
365
366 pub fn r#update_address_properties(
378 &self,
379 mut address_properties: &AddressProperties,
380 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
381 AddressStateProviderProxyInterface::r#update_address_properties(self, address_properties)
382 }
383
384 pub fn r#watch_address_assignment_state(
398 &self,
399 ) -> fidl::client::QueryResponseFut<
400 fidl_fuchsia_net_interfaces::AddressAssignmentState,
401 fidl::encoding::DefaultFuchsiaResourceDialect,
402 > {
403 AddressStateProviderProxyInterface::r#watch_address_assignment_state(self)
404 }
405
406 pub fn r#detach(&self) -> Result<(), fidl::Error> {
411 AddressStateProviderProxyInterface::r#detach(self)
412 }
413
414 pub fn r#remove(&self) -> Result<(), fidl::Error> {
419 AddressStateProviderProxyInterface::r#remove(self)
420 }
421}
422
423impl AddressStateProviderProxyInterface for AddressStateProviderProxy {
424 type UpdateAddressPropertiesResponseFut =
425 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
426 fn r#update_address_properties(
427 &self,
428 mut address_properties: &AddressProperties,
429 ) -> Self::UpdateAddressPropertiesResponseFut {
430 fn _decode(
431 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
432 ) -> Result<(), fidl::Error> {
433 let _response = fidl::client::decode_transaction_body::<
434 fidl::encoding::EmptyPayload,
435 fidl::encoding::DefaultFuchsiaResourceDialect,
436 0x52bdf5ed96ef573c,
437 >(_buf?)?;
438 Ok(_response)
439 }
440 self.client.send_query_and_decode::<AddressStateProviderUpdateAddressPropertiesRequest, ()>(
441 (address_properties,),
442 0x52bdf5ed96ef573c,
443 fidl::encoding::DynamicFlags::empty(),
444 _decode,
445 )
446 }
447
448 type WatchAddressAssignmentStateResponseFut = fidl::client::QueryResponseFut<
449 fidl_fuchsia_net_interfaces::AddressAssignmentState,
450 fidl::encoding::DefaultFuchsiaResourceDialect,
451 >;
452 fn r#watch_address_assignment_state(&self) -> Self::WatchAddressAssignmentStateResponseFut {
453 fn _decode(
454 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
455 ) -> Result<fidl_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error> {
456 let _response = fidl::client::decode_transaction_body::<
457 AddressStateProviderWatchAddressAssignmentStateResponse,
458 fidl::encoding::DefaultFuchsiaResourceDialect,
459 0x740bb58c1b2d3188,
460 >(_buf?)?;
461 Ok(_response.assignment_state)
462 }
463 self.client.send_query_and_decode::<
464 fidl::encoding::EmptyPayload,
465 fidl_fuchsia_net_interfaces::AddressAssignmentState,
466 >(
467 (),
468 0x740bb58c1b2d3188,
469 fidl::encoding::DynamicFlags::empty(),
470 _decode,
471 )
472 }
473
474 fn r#detach(&self) -> Result<(), fidl::Error> {
475 self.client.send::<fidl::encoding::EmptyPayload>(
476 (),
477 0xc752381d739622f,
478 fidl::encoding::DynamicFlags::empty(),
479 )
480 }
481
482 fn r#remove(&self) -> Result<(), fidl::Error> {
483 self.client.send::<fidl::encoding::EmptyPayload>(
484 (),
485 0x554407fe183e78ad,
486 fidl::encoding::DynamicFlags::empty(),
487 )
488 }
489}
490
491pub struct AddressStateProviderEventStream {
492 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
493}
494
495impl std::marker::Unpin for AddressStateProviderEventStream {}
496
497impl futures::stream::FusedStream for AddressStateProviderEventStream {
498 fn is_terminated(&self) -> bool {
499 self.event_receiver.is_terminated()
500 }
501}
502
503impl futures::Stream for AddressStateProviderEventStream {
504 type Item = Result<AddressStateProviderEvent, fidl::Error>;
505
506 fn poll_next(
507 mut self: std::pin::Pin<&mut Self>,
508 cx: &mut std::task::Context<'_>,
509 ) -> std::task::Poll<Option<Self::Item>> {
510 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
511 &mut self.event_receiver,
512 cx
513 )?) {
514 Some(buf) => std::task::Poll::Ready(Some(AddressStateProviderEvent::decode(buf))),
515 None => std::task::Poll::Ready(None),
516 }
517 }
518}
519
520#[derive(Debug)]
521pub enum AddressStateProviderEvent {
522 OnAddressAdded {},
523 OnAddressRemoved { error: AddressRemovalReason },
524}
525
526impl AddressStateProviderEvent {
527 #[allow(irrefutable_let_patterns)]
528 pub fn into_on_address_added(self) -> Option<()> {
529 if let AddressStateProviderEvent::OnAddressAdded {} = self { Some(()) } else { None }
530 }
531 #[allow(irrefutable_let_patterns)]
532 pub fn into_on_address_removed(self) -> Option<AddressRemovalReason> {
533 if let AddressStateProviderEvent::OnAddressRemoved { error } = self {
534 Some((error))
535 } else {
536 None
537 }
538 }
539
540 fn decode(
542 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
543 ) -> Result<AddressStateProviderEvent, fidl::Error> {
544 let (bytes, _handles) = buf.split_mut();
545 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
546 debug_assert_eq!(tx_header.tx_id, 0);
547 match tx_header.ordinal {
548 0x624f6ea62cce189e => {
549 let mut out = fidl::new_empty!(
550 fidl::encoding::EmptyPayload,
551 fidl::encoding::DefaultFuchsiaResourceDialect
552 );
553 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
554 Ok((AddressStateProviderEvent::OnAddressAdded {}))
555 }
556 0x2480eb672ffd5962 => {
557 let mut out = fidl::new_empty!(
558 AddressStateProviderOnAddressRemovedRequest,
559 fidl::encoding::DefaultFuchsiaResourceDialect
560 );
561 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AddressStateProviderOnAddressRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
562 Ok((AddressStateProviderEvent::OnAddressRemoved { error: out.error }))
563 }
564 _ => Err(fidl::Error::UnknownOrdinal {
565 ordinal: tx_header.ordinal,
566 protocol_name:
567 <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
568 }),
569 }
570 }
571}
572
573pub struct AddressStateProviderRequestStream {
575 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
576 is_terminated: bool,
577}
578
579impl std::marker::Unpin for AddressStateProviderRequestStream {}
580
581impl futures::stream::FusedStream for AddressStateProviderRequestStream {
582 fn is_terminated(&self) -> bool {
583 self.is_terminated
584 }
585}
586
587impl fidl::endpoints::RequestStream for AddressStateProviderRequestStream {
588 type Protocol = AddressStateProviderMarker;
589 type ControlHandle = AddressStateProviderControlHandle;
590
591 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
592 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
593 }
594
595 fn control_handle(&self) -> Self::ControlHandle {
596 AddressStateProviderControlHandle { inner: self.inner.clone() }
597 }
598
599 fn into_inner(
600 self,
601 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
602 {
603 (self.inner, self.is_terminated)
604 }
605
606 fn from_inner(
607 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
608 is_terminated: bool,
609 ) -> Self {
610 Self { inner, is_terminated }
611 }
612}
613
614impl futures::Stream for AddressStateProviderRequestStream {
615 type Item = Result<AddressStateProviderRequest, fidl::Error>;
616
617 fn poll_next(
618 mut self: std::pin::Pin<&mut Self>,
619 cx: &mut std::task::Context<'_>,
620 ) -> std::task::Poll<Option<Self::Item>> {
621 let this = &mut *self;
622 if this.inner.check_shutdown(cx) {
623 this.is_terminated = true;
624 return std::task::Poll::Ready(None);
625 }
626 if this.is_terminated {
627 panic!("polled AddressStateProviderRequestStream after completion");
628 }
629 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
630 |bytes, handles| {
631 match this.inner.channel().read_etc(cx, bytes, handles) {
632 std::task::Poll::Ready(Ok(())) => {}
633 std::task::Poll::Pending => return std::task::Poll::Pending,
634 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
635 this.is_terminated = true;
636 return std::task::Poll::Ready(None);
637 }
638 std::task::Poll::Ready(Err(e)) => {
639 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
640 e.into(),
641 ))));
642 }
643 }
644
645 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
647
648 std::task::Poll::Ready(Some(match header.ordinal {
649 0x52bdf5ed96ef573c => {
650 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
651 let mut req = fidl::new_empty!(AddressStateProviderUpdateAddressPropertiesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
652 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AddressStateProviderUpdateAddressPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
653 let control_handle = AddressStateProviderControlHandle {
654 inner: this.inner.clone(),
655 };
656 Ok(AddressStateProviderRequest::UpdateAddressProperties {address_properties: req.address_properties,
657
658 responder: AddressStateProviderUpdateAddressPropertiesResponder {
659 control_handle: std::mem::ManuallyDrop::new(control_handle),
660 tx_id: header.tx_id,
661 },
662 })
663 }
664 0x740bb58c1b2d3188 => {
665 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
666 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
667 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
668 let control_handle = AddressStateProviderControlHandle {
669 inner: this.inner.clone(),
670 };
671 Ok(AddressStateProviderRequest::WatchAddressAssignmentState {
672 responder: AddressStateProviderWatchAddressAssignmentStateResponder {
673 control_handle: std::mem::ManuallyDrop::new(control_handle),
674 tx_id: header.tx_id,
675 },
676 })
677 }
678 0xc752381d739622f => {
679 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
680 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
681 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
682 let control_handle = AddressStateProviderControlHandle {
683 inner: this.inner.clone(),
684 };
685 Ok(AddressStateProviderRequest::Detach {
686 control_handle,
687 })
688 }
689 0x554407fe183e78ad => {
690 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
691 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
692 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
693 let control_handle = AddressStateProviderControlHandle {
694 inner: this.inner.clone(),
695 };
696 Ok(AddressStateProviderRequest::Remove {
697 control_handle,
698 })
699 }
700 _ => Err(fidl::Error::UnknownOrdinal {
701 ordinal: header.ordinal,
702 protocol_name: <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
703 }),
704 }))
705 },
706 )
707 }
708}
709
710#[derive(Debug)]
720pub enum AddressStateProviderRequest {
721 UpdateAddressProperties {
733 address_properties: AddressProperties,
734 responder: AddressStateProviderUpdateAddressPropertiesResponder,
735 },
736 WatchAddressAssignmentState {
750 responder: AddressStateProviderWatchAddressAssignmentStateResponder,
751 },
752 Detach { control_handle: AddressStateProviderControlHandle },
757 Remove { control_handle: AddressStateProviderControlHandle },
762}
763
764impl AddressStateProviderRequest {
765 #[allow(irrefutable_let_patterns)]
766 pub fn into_update_address_properties(
767 self,
768 ) -> Option<(AddressProperties, AddressStateProviderUpdateAddressPropertiesResponder)> {
769 if let AddressStateProviderRequest::UpdateAddressProperties {
770 address_properties,
771 responder,
772 } = self
773 {
774 Some((address_properties, responder))
775 } else {
776 None
777 }
778 }
779
780 #[allow(irrefutable_let_patterns)]
781 pub fn into_watch_address_assignment_state(
782 self,
783 ) -> Option<(AddressStateProviderWatchAddressAssignmentStateResponder)> {
784 if let AddressStateProviderRequest::WatchAddressAssignmentState { responder } = self {
785 Some((responder))
786 } else {
787 None
788 }
789 }
790
791 #[allow(irrefutable_let_patterns)]
792 pub fn into_detach(self) -> Option<(AddressStateProviderControlHandle)> {
793 if let AddressStateProviderRequest::Detach { control_handle } = self {
794 Some((control_handle))
795 } else {
796 None
797 }
798 }
799
800 #[allow(irrefutable_let_patterns)]
801 pub fn into_remove(self) -> Option<(AddressStateProviderControlHandle)> {
802 if let AddressStateProviderRequest::Remove { control_handle } = self {
803 Some((control_handle))
804 } else {
805 None
806 }
807 }
808
809 pub fn method_name(&self) -> &'static str {
811 match *self {
812 AddressStateProviderRequest::UpdateAddressProperties { .. } => {
813 "update_address_properties"
814 }
815 AddressStateProviderRequest::WatchAddressAssignmentState { .. } => {
816 "watch_address_assignment_state"
817 }
818 AddressStateProviderRequest::Detach { .. } => "detach",
819 AddressStateProviderRequest::Remove { .. } => "remove",
820 }
821 }
822}
823
824#[derive(Debug, Clone)]
825pub struct AddressStateProviderControlHandle {
826 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
827}
828
829impl fidl::endpoints::ControlHandle for AddressStateProviderControlHandle {
830 fn shutdown(&self) {
831 self.inner.shutdown()
832 }
833 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
834 self.inner.shutdown_with_epitaph(status)
835 }
836
837 fn is_closed(&self) -> bool {
838 self.inner.channel().is_closed()
839 }
840 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
841 self.inner.channel().on_closed()
842 }
843
844 #[cfg(target_os = "fuchsia")]
845 fn signal_peer(
846 &self,
847 clear_mask: zx::Signals,
848 set_mask: zx::Signals,
849 ) -> Result<(), zx_status::Status> {
850 use fidl::Peered;
851 self.inner.channel().signal_peer(clear_mask, set_mask)
852 }
853}
854
855impl AddressStateProviderControlHandle {
856 pub fn send_on_address_added(&self) -> Result<(), fidl::Error> {
857 self.inner.send::<fidl::encoding::EmptyPayload>(
858 (),
859 0,
860 0x624f6ea62cce189e,
861 fidl::encoding::DynamicFlags::empty(),
862 )
863 }
864
865 pub fn send_on_address_removed(
866 &self,
867 mut error: AddressRemovalReason,
868 ) -> Result<(), fidl::Error> {
869 self.inner.send::<AddressStateProviderOnAddressRemovedRequest>(
870 (error,),
871 0,
872 0x2480eb672ffd5962,
873 fidl::encoding::DynamicFlags::empty(),
874 )
875 }
876}
877
878#[must_use = "FIDL methods require a response to be sent"]
879#[derive(Debug)]
880pub struct AddressStateProviderUpdateAddressPropertiesResponder {
881 control_handle: std::mem::ManuallyDrop<AddressStateProviderControlHandle>,
882 tx_id: u32,
883}
884
885impl std::ops::Drop for AddressStateProviderUpdateAddressPropertiesResponder {
889 fn drop(&mut self) {
890 self.control_handle.shutdown();
891 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
893 }
894}
895
896impl fidl::endpoints::Responder for AddressStateProviderUpdateAddressPropertiesResponder {
897 type ControlHandle = AddressStateProviderControlHandle;
898
899 fn control_handle(&self) -> &AddressStateProviderControlHandle {
900 &self.control_handle
901 }
902
903 fn drop_without_shutdown(mut self) {
904 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
906 std::mem::forget(self);
908 }
909}
910
911impl AddressStateProviderUpdateAddressPropertiesResponder {
912 pub fn send(self) -> Result<(), fidl::Error> {
916 let _result = self.send_raw();
917 if _result.is_err() {
918 self.control_handle.shutdown();
919 }
920 self.drop_without_shutdown();
921 _result
922 }
923
924 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
926 let _result = self.send_raw();
927 self.drop_without_shutdown();
928 _result
929 }
930
931 fn send_raw(&self) -> Result<(), fidl::Error> {
932 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
933 (),
934 self.tx_id,
935 0x52bdf5ed96ef573c,
936 fidl::encoding::DynamicFlags::empty(),
937 )
938 }
939}
940
941#[must_use = "FIDL methods require a response to be sent"]
942#[derive(Debug)]
943pub struct AddressStateProviderWatchAddressAssignmentStateResponder {
944 control_handle: std::mem::ManuallyDrop<AddressStateProviderControlHandle>,
945 tx_id: u32,
946}
947
948impl std::ops::Drop for AddressStateProviderWatchAddressAssignmentStateResponder {
952 fn drop(&mut self) {
953 self.control_handle.shutdown();
954 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
956 }
957}
958
959impl fidl::endpoints::Responder for AddressStateProviderWatchAddressAssignmentStateResponder {
960 type ControlHandle = AddressStateProviderControlHandle;
961
962 fn control_handle(&self) -> &AddressStateProviderControlHandle {
963 &self.control_handle
964 }
965
966 fn drop_without_shutdown(mut self) {
967 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
969 std::mem::forget(self);
971 }
972}
973
974impl AddressStateProviderWatchAddressAssignmentStateResponder {
975 pub fn send(
979 self,
980 mut assignment_state: fidl_fuchsia_net_interfaces::AddressAssignmentState,
981 ) -> Result<(), fidl::Error> {
982 let _result = self.send_raw(assignment_state);
983 if _result.is_err() {
984 self.control_handle.shutdown();
985 }
986 self.drop_without_shutdown();
987 _result
988 }
989
990 pub fn send_no_shutdown_on_err(
992 self,
993 mut assignment_state: fidl_fuchsia_net_interfaces::AddressAssignmentState,
994 ) -> Result<(), fidl::Error> {
995 let _result = self.send_raw(assignment_state);
996 self.drop_without_shutdown();
997 _result
998 }
999
1000 fn send_raw(
1001 &self,
1002 mut assignment_state: fidl_fuchsia_net_interfaces::AddressAssignmentState,
1003 ) -> Result<(), fidl::Error> {
1004 self.control_handle.inner.send::<AddressStateProviderWatchAddressAssignmentStateResponse>(
1005 (assignment_state,),
1006 self.tx_id,
1007 0x740bb58c1b2d3188,
1008 fidl::encoding::DynamicFlags::empty(),
1009 )
1010 }
1011}
1012
1013#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1014pub struct ControlMarker;
1015
1016impl fidl::endpoints::ProtocolMarker for ControlMarker {
1017 type Proxy = ControlProxy;
1018 type RequestStream = ControlRequestStream;
1019 #[cfg(target_os = "fuchsia")]
1020 type SynchronousProxy = ControlSynchronousProxy;
1021
1022 const DEBUG_NAME: &'static str = "(anonymous) Control";
1023}
1024pub type ControlRemoveAddressResult = Result<bool, ControlRemoveAddressError>;
1025pub type ControlSetConfigurationResult = Result<Configuration, ControlSetConfigurationError>;
1026pub type ControlGetConfigurationResult = Result<Configuration, ControlGetConfigurationError>;
1027pub type ControlEnableResult = Result<bool, ControlEnableError>;
1028pub type ControlDisableResult = Result<bool, ControlDisableError>;
1029pub type ControlRemoveResult = Result<(), ControlRemoveError>;
1030
1031pub trait ControlProxyInterface: Send + Sync {
1032 fn r#add_address(
1033 &self,
1034 address: &fidl_fuchsia_net::Subnet,
1035 parameters: &AddressParameters,
1036 address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1037 ) -> Result<(), fidl::Error>;
1038 type RemoveAddressResponseFut: std::future::Future<Output = Result<ControlRemoveAddressResult, fidl::Error>>
1039 + Send;
1040 fn r#remove_address(
1041 &self,
1042 address: &fidl_fuchsia_net::Subnet,
1043 ) -> Self::RemoveAddressResponseFut;
1044 type GetIdResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
1045 fn r#get_id(&self) -> Self::GetIdResponseFut;
1046 type SetConfigurationResponseFut: std::future::Future<Output = Result<ControlSetConfigurationResult, fidl::Error>>
1047 + Send;
1048 fn r#set_configuration(&self, config: &Configuration) -> Self::SetConfigurationResponseFut;
1049 type GetConfigurationResponseFut: std::future::Future<Output = Result<ControlGetConfigurationResult, fidl::Error>>
1050 + Send;
1051 fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
1052 type EnableResponseFut: std::future::Future<Output = Result<ControlEnableResult, fidl::Error>>
1053 + Send;
1054 fn r#enable(&self) -> Self::EnableResponseFut;
1055 type DisableResponseFut: std::future::Future<Output = Result<ControlDisableResult, fidl::Error>>
1056 + Send;
1057 fn r#disable(&self) -> Self::DisableResponseFut;
1058 fn r#detach(&self) -> Result<(), fidl::Error>;
1059 type GetAuthorizationForInterfaceResponseFut: std::future::Future<
1060 Output = Result<
1061 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
1062 fidl::Error,
1063 >,
1064 > + Send;
1065 fn r#get_authorization_for_interface(&self) -> Self::GetAuthorizationForInterfaceResponseFut;
1066 type RemoveResponseFut: std::future::Future<Output = Result<ControlRemoveResult, fidl::Error>>
1067 + Send;
1068 fn r#remove(&self) -> Self::RemoveResponseFut;
1069}
1070#[derive(Debug)]
1071#[cfg(target_os = "fuchsia")]
1072pub struct ControlSynchronousProxy {
1073 client: fidl::client::sync::Client,
1074}
1075
1076#[cfg(target_os = "fuchsia")]
1077impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
1078 type Proxy = ControlProxy;
1079 type Protocol = ControlMarker;
1080
1081 fn from_channel(inner: fidl::Channel) -> Self {
1082 Self::new(inner)
1083 }
1084
1085 fn into_channel(self) -> fidl::Channel {
1086 self.client.into_channel()
1087 }
1088
1089 fn as_channel(&self) -> &fidl::Channel {
1090 self.client.as_channel()
1091 }
1092}
1093
1094#[cfg(target_os = "fuchsia")]
1095impl ControlSynchronousProxy {
1096 pub fn new(channel: fidl::Channel) -> Self {
1097 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1098 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1099 }
1100
1101 pub fn into_channel(self) -> fidl::Channel {
1102 self.client.into_channel()
1103 }
1104
1105 pub fn wait_for_event(
1108 &self,
1109 deadline: zx::MonotonicInstant,
1110 ) -> Result<ControlEvent, fidl::Error> {
1111 ControlEvent::decode(self.client.wait_for_event(deadline)?)
1112 }
1113
1114 pub fn r#add_address(
1124 &self,
1125 mut address: &fidl_fuchsia_net::Subnet,
1126 mut parameters: &AddressParameters,
1127 mut address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1128 ) -> Result<(), fidl::Error> {
1129 self.client.send::<ControlAddAddressRequest>(
1130 (address, parameters, address_state_provider),
1131 0x1349d36da453ce,
1132 fidl::encoding::DynamicFlags::empty(),
1133 )
1134 }
1135
1136 pub fn r#remove_address(
1142 &self,
1143 mut address: &fidl_fuchsia_net::Subnet,
1144 ___deadline: zx::MonotonicInstant,
1145 ) -> Result<ControlRemoveAddressResult, fidl::Error> {
1146 let _response =
1147 self.client.send_query::<ControlRemoveAddressRequest, fidl::encoding::ResultType<
1148 ControlRemoveAddressResponse,
1149 ControlRemoveAddressError,
1150 >>(
1151 (address,),
1152 0x213ba73da997a620,
1153 fidl::encoding::DynamicFlags::empty(),
1154 ___deadline,
1155 )?;
1156 Ok(_response.map(|x| x.did_remove))
1157 }
1158
1159 pub fn r#get_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u64, fidl::Error> {
1163 let _response =
1164 self.client.send_query::<fidl::encoding::EmptyPayload, ControlGetIdResponse>(
1165 (),
1166 0x2a2459768d9ecc6f,
1167 fidl::encoding::DynamicFlags::empty(),
1168 ___deadline,
1169 )?;
1170 Ok(_response.id)
1171 }
1172
1173 pub fn r#set_configuration(
1185 &self,
1186 mut config: &Configuration,
1187 ___deadline: zx::MonotonicInstant,
1188 ) -> Result<ControlSetConfigurationResult, fidl::Error> {
1189 let _response = self
1190 .client
1191 .send_query::<ControlSetConfigurationRequest, fidl::encoding::ResultType<
1192 ControlSetConfigurationResponse,
1193 ControlSetConfigurationError,
1194 >>(
1195 (config,), 0x573923b7b4bde27f, fidl::encoding::DynamicFlags::empty(), ___deadline
1196 )?;
1197 Ok(_response.map(|x| x.previous_config))
1198 }
1199
1200 pub fn r#get_configuration(
1209 &self,
1210 ___deadline: zx::MonotonicInstant,
1211 ) -> Result<ControlGetConfigurationResult, fidl::Error> {
1212 let _response = self
1213 .client
1214 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1215 ControlGetConfigurationResponse,
1216 ControlGetConfigurationError,
1217 >>(
1218 (), 0x5f5d239820bdcc65, fidl::encoding::DynamicFlags::empty(), ___deadline
1219 )?;
1220 Ok(_response.map(|x| x.config))
1221 }
1222
1223 pub fn r#enable(
1228 &self,
1229 ___deadline: zx::MonotonicInstant,
1230 ) -> Result<ControlEnableResult, fidl::Error> {
1231 let _response = self.client.send_query::<
1232 fidl::encoding::EmptyPayload,
1233 fidl::encoding::ResultType<ControlEnableResponse, ControlEnableError>,
1234 >(
1235 (),
1236 0x15c983d3a8ac0b98,
1237 fidl::encoding::DynamicFlags::empty(),
1238 ___deadline,
1239 )?;
1240 Ok(_response.map(|x| x.did_enable))
1241 }
1242
1243 pub fn r#disable(
1248 &self,
1249 ___deadline: zx::MonotonicInstant,
1250 ) -> Result<ControlDisableResult, fidl::Error> {
1251 let _response = self.client.send_query::<
1252 fidl::encoding::EmptyPayload,
1253 fidl::encoding::ResultType<ControlDisableResponse, ControlDisableError>,
1254 >(
1255 (),
1256 0x98d3a585d905473,
1257 fidl::encoding::DynamicFlags::empty(),
1258 ___deadline,
1259 )?;
1260 Ok(_response.map(|x| x.did_disable))
1261 }
1262
1263 pub fn r#detach(&self) -> Result<(), fidl::Error> {
1268 self.client.send::<fidl::encoding::EmptyPayload>(
1269 (),
1270 0x78ee27518b2dbfa,
1271 fidl::encoding::DynamicFlags::empty(),
1272 )
1273 }
1274
1275 pub fn r#get_authorization_for_interface(
1287 &self,
1288 ___deadline: zx::MonotonicInstant,
1289 ) -> Result<fidl_fuchsia_net_resources::GrantForInterfaceAuthorization, fidl::Error> {
1290 let _response = self.client.send_query::<
1291 fidl::encoding::EmptyPayload,
1292 ControlGetAuthorizationForInterfaceResponse,
1293 >(
1294 (),
1295 0xc1de2ab60b5cb9e,
1296 fidl::encoding::DynamicFlags::empty(),
1297 ___deadline,
1298 )?;
1299 Ok(_response.credential)
1300 }
1301
1302 pub fn r#remove(
1308 &self,
1309 ___deadline: zx::MonotonicInstant,
1310 ) -> Result<ControlRemoveResult, fidl::Error> {
1311 let _response =
1312 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1313 fidl::encoding::EmptyStruct,
1314 ControlRemoveError,
1315 >>(
1316 (),
1317 0x13aab8bbecc7ff0b,
1318 fidl::encoding::DynamicFlags::empty(),
1319 ___deadline,
1320 )?;
1321 Ok(_response.map(|x| x))
1322 }
1323}
1324
1325#[cfg(target_os = "fuchsia")]
1326impl From<ControlSynchronousProxy> for zx::Handle {
1327 fn from(value: ControlSynchronousProxy) -> Self {
1328 value.into_channel().into()
1329 }
1330}
1331
1332#[cfg(target_os = "fuchsia")]
1333impl From<fidl::Channel> for ControlSynchronousProxy {
1334 fn from(value: fidl::Channel) -> Self {
1335 Self::new(value)
1336 }
1337}
1338
1339#[cfg(target_os = "fuchsia")]
1340impl fidl::endpoints::FromClient for ControlSynchronousProxy {
1341 type Protocol = ControlMarker;
1342
1343 fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
1344 Self::new(value.into_channel())
1345 }
1346}
1347
1348#[derive(Debug, Clone)]
1349pub struct ControlProxy {
1350 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1351}
1352
1353impl fidl::endpoints::Proxy for ControlProxy {
1354 type Protocol = ControlMarker;
1355
1356 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1357 Self::new(inner)
1358 }
1359
1360 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1361 self.client.into_channel().map_err(|client| Self { client })
1362 }
1363
1364 fn as_channel(&self) -> &::fidl::AsyncChannel {
1365 self.client.as_channel()
1366 }
1367}
1368
1369impl ControlProxy {
1370 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1372 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1373 Self { client: fidl::client::Client::new(channel, protocol_name) }
1374 }
1375
1376 pub fn take_event_stream(&self) -> ControlEventStream {
1382 ControlEventStream { event_receiver: self.client.take_event_receiver() }
1383 }
1384
1385 pub fn r#add_address(
1395 &self,
1396 mut address: &fidl_fuchsia_net::Subnet,
1397 mut parameters: &AddressParameters,
1398 mut address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1399 ) -> Result<(), fidl::Error> {
1400 ControlProxyInterface::r#add_address(self, address, parameters, address_state_provider)
1401 }
1402
1403 pub fn r#remove_address(
1409 &self,
1410 mut address: &fidl_fuchsia_net::Subnet,
1411 ) -> fidl::client::QueryResponseFut<
1412 ControlRemoveAddressResult,
1413 fidl::encoding::DefaultFuchsiaResourceDialect,
1414 > {
1415 ControlProxyInterface::r#remove_address(self, address)
1416 }
1417
1418 pub fn r#get_id(
1422 &self,
1423 ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
1424 ControlProxyInterface::r#get_id(self)
1425 }
1426
1427 pub fn r#set_configuration(
1439 &self,
1440 mut config: &Configuration,
1441 ) -> fidl::client::QueryResponseFut<
1442 ControlSetConfigurationResult,
1443 fidl::encoding::DefaultFuchsiaResourceDialect,
1444 > {
1445 ControlProxyInterface::r#set_configuration(self, config)
1446 }
1447
1448 pub fn r#get_configuration(
1457 &self,
1458 ) -> fidl::client::QueryResponseFut<
1459 ControlGetConfigurationResult,
1460 fidl::encoding::DefaultFuchsiaResourceDialect,
1461 > {
1462 ControlProxyInterface::r#get_configuration(self)
1463 }
1464
1465 pub fn r#enable(
1470 &self,
1471 ) -> fidl::client::QueryResponseFut<
1472 ControlEnableResult,
1473 fidl::encoding::DefaultFuchsiaResourceDialect,
1474 > {
1475 ControlProxyInterface::r#enable(self)
1476 }
1477
1478 pub fn r#disable(
1483 &self,
1484 ) -> fidl::client::QueryResponseFut<
1485 ControlDisableResult,
1486 fidl::encoding::DefaultFuchsiaResourceDialect,
1487 > {
1488 ControlProxyInterface::r#disable(self)
1489 }
1490
1491 pub fn r#detach(&self) -> Result<(), fidl::Error> {
1496 ControlProxyInterface::r#detach(self)
1497 }
1498
1499 pub fn r#get_authorization_for_interface(
1511 &self,
1512 ) -> fidl::client::QueryResponseFut<
1513 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 > {
1516 ControlProxyInterface::r#get_authorization_for_interface(self)
1517 }
1518
1519 pub fn r#remove(
1525 &self,
1526 ) -> fidl::client::QueryResponseFut<
1527 ControlRemoveResult,
1528 fidl::encoding::DefaultFuchsiaResourceDialect,
1529 > {
1530 ControlProxyInterface::r#remove(self)
1531 }
1532}
1533
1534impl ControlProxyInterface for ControlProxy {
1535 fn r#add_address(
1536 &self,
1537 mut address: &fidl_fuchsia_net::Subnet,
1538 mut parameters: &AddressParameters,
1539 mut address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1540 ) -> Result<(), fidl::Error> {
1541 self.client.send::<ControlAddAddressRequest>(
1542 (address, parameters, address_state_provider),
1543 0x1349d36da453ce,
1544 fidl::encoding::DynamicFlags::empty(),
1545 )
1546 }
1547
1548 type RemoveAddressResponseFut = fidl::client::QueryResponseFut<
1549 ControlRemoveAddressResult,
1550 fidl::encoding::DefaultFuchsiaResourceDialect,
1551 >;
1552 fn r#remove_address(
1553 &self,
1554 mut address: &fidl_fuchsia_net::Subnet,
1555 ) -> Self::RemoveAddressResponseFut {
1556 fn _decode(
1557 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1558 ) -> Result<ControlRemoveAddressResult, fidl::Error> {
1559 let _response = fidl::client::decode_transaction_body::<
1560 fidl::encoding::ResultType<ControlRemoveAddressResponse, ControlRemoveAddressError>,
1561 fidl::encoding::DefaultFuchsiaResourceDialect,
1562 0x213ba73da997a620,
1563 >(_buf?)?;
1564 Ok(_response.map(|x| x.did_remove))
1565 }
1566 self.client
1567 .send_query_and_decode::<ControlRemoveAddressRequest, ControlRemoveAddressResult>(
1568 (address,),
1569 0x213ba73da997a620,
1570 fidl::encoding::DynamicFlags::empty(),
1571 _decode,
1572 )
1573 }
1574
1575 type GetIdResponseFut =
1576 fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
1577 fn r#get_id(&self) -> Self::GetIdResponseFut {
1578 fn _decode(
1579 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1580 ) -> Result<u64, fidl::Error> {
1581 let _response = fidl::client::decode_transaction_body::<
1582 ControlGetIdResponse,
1583 fidl::encoding::DefaultFuchsiaResourceDialect,
1584 0x2a2459768d9ecc6f,
1585 >(_buf?)?;
1586 Ok(_response.id)
1587 }
1588 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
1589 (),
1590 0x2a2459768d9ecc6f,
1591 fidl::encoding::DynamicFlags::empty(),
1592 _decode,
1593 )
1594 }
1595
1596 type SetConfigurationResponseFut = fidl::client::QueryResponseFut<
1597 ControlSetConfigurationResult,
1598 fidl::encoding::DefaultFuchsiaResourceDialect,
1599 >;
1600 fn r#set_configuration(&self, mut config: &Configuration) -> Self::SetConfigurationResponseFut {
1601 fn _decode(
1602 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1603 ) -> Result<ControlSetConfigurationResult, fidl::Error> {
1604 let _response = fidl::client::decode_transaction_body::<
1605 fidl::encoding::ResultType<
1606 ControlSetConfigurationResponse,
1607 ControlSetConfigurationError,
1608 >,
1609 fidl::encoding::DefaultFuchsiaResourceDialect,
1610 0x573923b7b4bde27f,
1611 >(_buf?)?;
1612 Ok(_response.map(|x| x.previous_config))
1613 }
1614 self.client
1615 .send_query_and_decode::<ControlSetConfigurationRequest, ControlSetConfigurationResult>(
1616 (config,),
1617 0x573923b7b4bde27f,
1618 fidl::encoding::DynamicFlags::empty(),
1619 _decode,
1620 )
1621 }
1622
1623 type GetConfigurationResponseFut = fidl::client::QueryResponseFut<
1624 ControlGetConfigurationResult,
1625 fidl::encoding::DefaultFuchsiaResourceDialect,
1626 >;
1627 fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
1628 fn _decode(
1629 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1630 ) -> Result<ControlGetConfigurationResult, fidl::Error> {
1631 let _response = fidl::client::decode_transaction_body::<
1632 fidl::encoding::ResultType<
1633 ControlGetConfigurationResponse,
1634 ControlGetConfigurationError,
1635 >,
1636 fidl::encoding::DefaultFuchsiaResourceDialect,
1637 0x5f5d239820bdcc65,
1638 >(_buf?)?;
1639 Ok(_response.map(|x| x.config))
1640 }
1641 self.client
1642 .send_query_and_decode::<fidl::encoding::EmptyPayload, ControlGetConfigurationResult>(
1643 (),
1644 0x5f5d239820bdcc65,
1645 fidl::encoding::DynamicFlags::empty(),
1646 _decode,
1647 )
1648 }
1649
1650 type EnableResponseFut = fidl::client::QueryResponseFut<
1651 ControlEnableResult,
1652 fidl::encoding::DefaultFuchsiaResourceDialect,
1653 >;
1654 fn r#enable(&self) -> Self::EnableResponseFut {
1655 fn _decode(
1656 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1657 ) -> Result<ControlEnableResult, fidl::Error> {
1658 let _response = fidl::client::decode_transaction_body::<
1659 fidl::encoding::ResultType<ControlEnableResponse, ControlEnableError>,
1660 fidl::encoding::DefaultFuchsiaResourceDialect,
1661 0x15c983d3a8ac0b98,
1662 >(_buf?)?;
1663 Ok(_response.map(|x| x.did_enable))
1664 }
1665 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlEnableResult>(
1666 (),
1667 0x15c983d3a8ac0b98,
1668 fidl::encoding::DynamicFlags::empty(),
1669 _decode,
1670 )
1671 }
1672
1673 type DisableResponseFut = fidl::client::QueryResponseFut<
1674 ControlDisableResult,
1675 fidl::encoding::DefaultFuchsiaResourceDialect,
1676 >;
1677 fn r#disable(&self) -> Self::DisableResponseFut {
1678 fn _decode(
1679 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1680 ) -> Result<ControlDisableResult, fidl::Error> {
1681 let _response = fidl::client::decode_transaction_body::<
1682 fidl::encoding::ResultType<ControlDisableResponse, ControlDisableError>,
1683 fidl::encoding::DefaultFuchsiaResourceDialect,
1684 0x98d3a585d905473,
1685 >(_buf?)?;
1686 Ok(_response.map(|x| x.did_disable))
1687 }
1688 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlDisableResult>(
1689 (),
1690 0x98d3a585d905473,
1691 fidl::encoding::DynamicFlags::empty(),
1692 _decode,
1693 )
1694 }
1695
1696 fn r#detach(&self) -> Result<(), fidl::Error> {
1697 self.client.send::<fidl::encoding::EmptyPayload>(
1698 (),
1699 0x78ee27518b2dbfa,
1700 fidl::encoding::DynamicFlags::empty(),
1701 )
1702 }
1703
1704 type GetAuthorizationForInterfaceResponseFut = fidl::client::QueryResponseFut<
1705 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
1706 fidl::encoding::DefaultFuchsiaResourceDialect,
1707 >;
1708 fn r#get_authorization_for_interface(&self) -> Self::GetAuthorizationForInterfaceResponseFut {
1709 fn _decode(
1710 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1711 ) -> Result<fidl_fuchsia_net_resources::GrantForInterfaceAuthorization, fidl::Error>
1712 {
1713 let _response = fidl::client::decode_transaction_body::<
1714 ControlGetAuthorizationForInterfaceResponse,
1715 fidl::encoding::DefaultFuchsiaResourceDialect,
1716 0xc1de2ab60b5cb9e,
1717 >(_buf?)?;
1718 Ok(_response.credential)
1719 }
1720 self.client.send_query_and_decode::<
1721 fidl::encoding::EmptyPayload,
1722 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
1723 >(
1724 (),
1725 0xc1de2ab60b5cb9e,
1726 fidl::encoding::DynamicFlags::empty(),
1727 _decode,
1728 )
1729 }
1730
1731 type RemoveResponseFut = fidl::client::QueryResponseFut<
1732 ControlRemoveResult,
1733 fidl::encoding::DefaultFuchsiaResourceDialect,
1734 >;
1735 fn r#remove(&self) -> Self::RemoveResponseFut {
1736 fn _decode(
1737 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1738 ) -> Result<ControlRemoveResult, fidl::Error> {
1739 let _response = fidl::client::decode_transaction_body::<
1740 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControlRemoveError>,
1741 fidl::encoding::DefaultFuchsiaResourceDialect,
1742 0x13aab8bbecc7ff0b,
1743 >(_buf?)?;
1744 Ok(_response.map(|x| x))
1745 }
1746 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlRemoveResult>(
1747 (),
1748 0x13aab8bbecc7ff0b,
1749 fidl::encoding::DynamicFlags::empty(),
1750 _decode,
1751 )
1752 }
1753}
1754
1755pub struct ControlEventStream {
1756 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1757}
1758
1759impl std::marker::Unpin for ControlEventStream {}
1760
1761impl futures::stream::FusedStream for ControlEventStream {
1762 fn is_terminated(&self) -> bool {
1763 self.event_receiver.is_terminated()
1764 }
1765}
1766
1767impl futures::Stream for ControlEventStream {
1768 type Item = Result<ControlEvent, fidl::Error>;
1769
1770 fn poll_next(
1771 mut self: std::pin::Pin<&mut Self>,
1772 cx: &mut std::task::Context<'_>,
1773 ) -> std::task::Poll<Option<Self::Item>> {
1774 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1775 &mut self.event_receiver,
1776 cx
1777 )?) {
1778 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1779 None => std::task::Poll::Ready(None),
1780 }
1781 }
1782}
1783
1784#[derive(Debug)]
1785pub enum ControlEvent {
1786 OnInterfaceRemoved { reason: InterfaceRemovedReason },
1787}
1788
1789impl ControlEvent {
1790 #[allow(irrefutable_let_patterns)]
1791 pub fn into_on_interface_removed(self) -> Option<InterfaceRemovedReason> {
1792 if let ControlEvent::OnInterfaceRemoved { reason } = self { Some((reason)) } else { None }
1793 }
1794
1795 fn decode(
1797 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1798 ) -> Result<ControlEvent, fidl::Error> {
1799 let (bytes, _handles) = buf.split_mut();
1800 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1801 debug_assert_eq!(tx_header.tx_id, 0);
1802 match tx_header.ordinal {
1803 0x800d39e76c1cddd => {
1804 let mut out = fidl::new_empty!(
1805 ControlOnInterfaceRemovedRequest,
1806 fidl::encoding::DefaultFuchsiaResourceDialect
1807 );
1808 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlOnInterfaceRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1809 Ok((ControlEvent::OnInterfaceRemoved { reason: out.reason }))
1810 }
1811 _ => Err(fidl::Error::UnknownOrdinal {
1812 ordinal: tx_header.ordinal,
1813 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1814 }),
1815 }
1816 }
1817}
1818
1819pub struct ControlRequestStream {
1821 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1822 is_terminated: bool,
1823}
1824
1825impl std::marker::Unpin for ControlRequestStream {}
1826
1827impl futures::stream::FusedStream for ControlRequestStream {
1828 fn is_terminated(&self) -> bool {
1829 self.is_terminated
1830 }
1831}
1832
1833impl fidl::endpoints::RequestStream for ControlRequestStream {
1834 type Protocol = ControlMarker;
1835 type ControlHandle = ControlControlHandle;
1836
1837 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1838 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1839 }
1840
1841 fn control_handle(&self) -> Self::ControlHandle {
1842 ControlControlHandle { inner: self.inner.clone() }
1843 }
1844
1845 fn into_inner(
1846 self,
1847 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1848 {
1849 (self.inner, self.is_terminated)
1850 }
1851
1852 fn from_inner(
1853 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1854 is_terminated: bool,
1855 ) -> Self {
1856 Self { inner, is_terminated }
1857 }
1858}
1859
1860impl futures::Stream for ControlRequestStream {
1861 type Item = Result<ControlRequest, fidl::Error>;
1862
1863 fn poll_next(
1864 mut self: std::pin::Pin<&mut Self>,
1865 cx: &mut std::task::Context<'_>,
1866 ) -> std::task::Poll<Option<Self::Item>> {
1867 let this = &mut *self;
1868 if this.inner.check_shutdown(cx) {
1869 this.is_terminated = true;
1870 return std::task::Poll::Ready(None);
1871 }
1872 if this.is_terminated {
1873 panic!("polled ControlRequestStream after completion");
1874 }
1875 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1876 |bytes, handles| {
1877 match this.inner.channel().read_etc(cx, bytes, handles) {
1878 std::task::Poll::Ready(Ok(())) => {}
1879 std::task::Poll::Pending => return std::task::Poll::Pending,
1880 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1881 this.is_terminated = true;
1882 return std::task::Poll::Ready(None);
1883 }
1884 std::task::Poll::Ready(Err(e)) => {
1885 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1886 e.into(),
1887 ))));
1888 }
1889 }
1890
1891 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1893
1894 std::task::Poll::Ready(Some(match header.ordinal {
1895 0x1349d36da453ce => {
1896 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1897 let mut req = fidl::new_empty!(
1898 ControlAddAddressRequest,
1899 fidl::encoding::DefaultFuchsiaResourceDialect
1900 );
1901 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlAddAddressRequest>(&header, _body_bytes, handles, &mut req)?;
1902 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1903 Ok(ControlRequest::AddAddress {
1904 address: req.address,
1905 parameters: req.parameters,
1906 address_state_provider: req.address_state_provider,
1907
1908 control_handle,
1909 })
1910 }
1911 0x213ba73da997a620 => {
1912 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1913 let mut req = fidl::new_empty!(
1914 ControlRemoveAddressRequest,
1915 fidl::encoding::DefaultFuchsiaResourceDialect
1916 );
1917 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlRemoveAddressRequest>(&header, _body_bytes, handles, &mut req)?;
1918 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1919 Ok(ControlRequest::RemoveAddress {
1920 address: req.address,
1921
1922 responder: ControlRemoveAddressResponder {
1923 control_handle: std::mem::ManuallyDrop::new(control_handle),
1924 tx_id: header.tx_id,
1925 },
1926 })
1927 }
1928 0x2a2459768d9ecc6f => {
1929 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1930 let mut req = fidl::new_empty!(
1931 fidl::encoding::EmptyPayload,
1932 fidl::encoding::DefaultFuchsiaResourceDialect
1933 );
1934 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1935 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1936 Ok(ControlRequest::GetId {
1937 responder: ControlGetIdResponder {
1938 control_handle: std::mem::ManuallyDrop::new(control_handle),
1939 tx_id: header.tx_id,
1940 },
1941 })
1942 }
1943 0x573923b7b4bde27f => {
1944 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1945 let mut req = fidl::new_empty!(
1946 ControlSetConfigurationRequest,
1947 fidl::encoding::DefaultFuchsiaResourceDialect
1948 );
1949 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
1950 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1951 Ok(ControlRequest::SetConfiguration {
1952 config: req.config,
1953
1954 responder: ControlSetConfigurationResponder {
1955 control_handle: std::mem::ManuallyDrop::new(control_handle),
1956 tx_id: header.tx_id,
1957 },
1958 })
1959 }
1960 0x5f5d239820bdcc65 => {
1961 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1962 let mut req = fidl::new_empty!(
1963 fidl::encoding::EmptyPayload,
1964 fidl::encoding::DefaultFuchsiaResourceDialect
1965 );
1966 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1967 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1968 Ok(ControlRequest::GetConfiguration {
1969 responder: ControlGetConfigurationResponder {
1970 control_handle: std::mem::ManuallyDrop::new(control_handle),
1971 tx_id: header.tx_id,
1972 },
1973 })
1974 }
1975 0x15c983d3a8ac0b98 => {
1976 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1977 let mut req = fidl::new_empty!(
1978 fidl::encoding::EmptyPayload,
1979 fidl::encoding::DefaultFuchsiaResourceDialect
1980 );
1981 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1982 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1983 Ok(ControlRequest::Enable {
1984 responder: ControlEnableResponder {
1985 control_handle: std::mem::ManuallyDrop::new(control_handle),
1986 tx_id: header.tx_id,
1987 },
1988 })
1989 }
1990 0x98d3a585d905473 => {
1991 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1992 let mut req = fidl::new_empty!(
1993 fidl::encoding::EmptyPayload,
1994 fidl::encoding::DefaultFuchsiaResourceDialect
1995 );
1996 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1997 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1998 Ok(ControlRequest::Disable {
1999 responder: ControlDisableResponder {
2000 control_handle: std::mem::ManuallyDrop::new(control_handle),
2001 tx_id: header.tx_id,
2002 },
2003 })
2004 }
2005 0x78ee27518b2dbfa => {
2006 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2007 let mut req = fidl::new_empty!(
2008 fidl::encoding::EmptyPayload,
2009 fidl::encoding::DefaultFuchsiaResourceDialect
2010 );
2011 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2012 let control_handle = ControlControlHandle { inner: this.inner.clone() };
2013 Ok(ControlRequest::Detach { control_handle })
2014 }
2015 0xc1de2ab60b5cb9e => {
2016 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2017 let mut req = fidl::new_empty!(
2018 fidl::encoding::EmptyPayload,
2019 fidl::encoding::DefaultFuchsiaResourceDialect
2020 );
2021 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2022 let control_handle = ControlControlHandle { inner: this.inner.clone() };
2023 Ok(ControlRequest::GetAuthorizationForInterface {
2024 responder: ControlGetAuthorizationForInterfaceResponder {
2025 control_handle: std::mem::ManuallyDrop::new(control_handle),
2026 tx_id: header.tx_id,
2027 },
2028 })
2029 }
2030 0x13aab8bbecc7ff0b => {
2031 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2032 let mut req = fidl::new_empty!(
2033 fidl::encoding::EmptyPayload,
2034 fidl::encoding::DefaultFuchsiaResourceDialect
2035 );
2036 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2037 let control_handle = ControlControlHandle { inner: this.inner.clone() };
2038 Ok(ControlRequest::Remove {
2039 responder: ControlRemoveResponder {
2040 control_handle: std::mem::ManuallyDrop::new(control_handle),
2041 tx_id: header.tx_id,
2042 },
2043 })
2044 }
2045 _ => Err(fidl::Error::UnknownOrdinal {
2046 ordinal: header.ordinal,
2047 protocol_name:
2048 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2049 }),
2050 }))
2051 },
2052 )
2053 }
2054}
2055
2056#[derive(Debug)]
2066pub enum ControlRequest {
2067 AddAddress {
2077 address: fidl_fuchsia_net::Subnet,
2078 parameters: AddressParameters,
2079 address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
2080 control_handle: ControlControlHandle,
2081 },
2082 RemoveAddress { address: fidl_fuchsia_net::Subnet, responder: ControlRemoveAddressResponder },
2088 GetId { responder: ControlGetIdResponder },
2092 SetConfiguration { config: Configuration, responder: ControlSetConfigurationResponder },
2104 GetConfiguration { responder: ControlGetConfigurationResponder },
2113 Enable { responder: ControlEnableResponder },
2118 Disable { responder: ControlDisableResponder },
2123 Detach { control_handle: ControlControlHandle },
2128 GetAuthorizationForInterface { responder: ControlGetAuthorizationForInterfaceResponder },
2140 Remove { responder: ControlRemoveResponder },
2146}
2147
2148impl ControlRequest {
2149 #[allow(irrefutable_let_patterns)]
2150 pub fn into_add_address(
2151 self,
2152 ) -> Option<(
2153 fidl_fuchsia_net::Subnet,
2154 AddressParameters,
2155 fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
2156 ControlControlHandle,
2157 )> {
2158 if let ControlRequest::AddAddress {
2159 address,
2160 parameters,
2161 address_state_provider,
2162 control_handle,
2163 } = self
2164 {
2165 Some((address, parameters, address_state_provider, control_handle))
2166 } else {
2167 None
2168 }
2169 }
2170
2171 #[allow(irrefutable_let_patterns)]
2172 pub fn into_remove_address(
2173 self,
2174 ) -> Option<(fidl_fuchsia_net::Subnet, ControlRemoveAddressResponder)> {
2175 if let ControlRequest::RemoveAddress { address, responder } = self {
2176 Some((address, responder))
2177 } else {
2178 None
2179 }
2180 }
2181
2182 #[allow(irrefutable_let_patterns)]
2183 pub fn into_get_id(self) -> Option<(ControlGetIdResponder)> {
2184 if let ControlRequest::GetId { responder } = self { Some((responder)) } else { None }
2185 }
2186
2187 #[allow(irrefutable_let_patterns)]
2188 pub fn into_set_configuration(
2189 self,
2190 ) -> Option<(Configuration, ControlSetConfigurationResponder)> {
2191 if let ControlRequest::SetConfiguration { config, responder } = self {
2192 Some((config, responder))
2193 } else {
2194 None
2195 }
2196 }
2197
2198 #[allow(irrefutable_let_patterns)]
2199 pub fn into_get_configuration(self) -> Option<(ControlGetConfigurationResponder)> {
2200 if let ControlRequest::GetConfiguration { responder } = self {
2201 Some((responder))
2202 } else {
2203 None
2204 }
2205 }
2206
2207 #[allow(irrefutable_let_patterns)]
2208 pub fn into_enable(self) -> Option<(ControlEnableResponder)> {
2209 if let ControlRequest::Enable { responder } = self { Some((responder)) } else { None }
2210 }
2211
2212 #[allow(irrefutable_let_patterns)]
2213 pub fn into_disable(self) -> Option<(ControlDisableResponder)> {
2214 if let ControlRequest::Disable { responder } = self { Some((responder)) } else { None }
2215 }
2216
2217 #[allow(irrefutable_let_patterns)]
2218 pub fn into_detach(self) -> Option<(ControlControlHandle)> {
2219 if let ControlRequest::Detach { control_handle } = self {
2220 Some((control_handle))
2221 } else {
2222 None
2223 }
2224 }
2225
2226 #[allow(irrefutable_let_patterns)]
2227 pub fn into_get_authorization_for_interface(
2228 self,
2229 ) -> Option<(ControlGetAuthorizationForInterfaceResponder)> {
2230 if let ControlRequest::GetAuthorizationForInterface { responder } = self {
2231 Some((responder))
2232 } else {
2233 None
2234 }
2235 }
2236
2237 #[allow(irrefutable_let_patterns)]
2238 pub fn into_remove(self) -> Option<(ControlRemoveResponder)> {
2239 if let ControlRequest::Remove { responder } = self { Some((responder)) } else { None }
2240 }
2241
2242 pub fn method_name(&self) -> &'static str {
2244 match *self {
2245 ControlRequest::AddAddress { .. } => "add_address",
2246 ControlRequest::RemoveAddress { .. } => "remove_address",
2247 ControlRequest::GetId { .. } => "get_id",
2248 ControlRequest::SetConfiguration { .. } => "set_configuration",
2249 ControlRequest::GetConfiguration { .. } => "get_configuration",
2250 ControlRequest::Enable { .. } => "enable",
2251 ControlRequest::Disable { .. } => "disable",
2252 ControlRequest::Detach { .. } => "detach",
2253 ControlRequest::GetAuthorizationForInterface { .. } => {
2254 "get_authorization_for_interface"
2255 }
2256 ControlRequest::Remove { .. } => "remove",
2257 }
2258 }
2259}
2260
2261#[derive(Debug, Clone)]
2262pub struct ControlControlHandle {
2263 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2264}
2265
2266impl fidl::endpoints::ControlHandle for ControlControlHandle {
2267 fn shutdown(&self) {
2268 self.inner.shutdown()
2269 }
2270 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2271 self.inner.shutdown_with_epitaph(status)
2272 }
2273
2274 fn is_closed(&self) -> bool {
2275 self.inner.channel().is_closed()
2276 }
2277 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2278 self.inner.channel().on_closed()
2279 }
2280
2281 #[cfg(target_os = "fuchsia")]
2282 fn signal_peer(
2283 &self,
2284 clear_mask: zx::Signals,
2285 set_mask: zx::Signals,
2286 ) -> Result<(), zx_status::Status> {
2287 use fidl::Peered;
2288 self.inner.channel().signal_peer(clear_mask, set_mask)
2289 }
2290}
2291
2292impl ControlControlHandle {
2293 pub fn send_on_interface_removed(
2294 &self,
2295 mut reason: InterfaceRemovedReason,
2296 ) -> Result<(), fidl::Error> {
2297 self.inner.send::<ControlOnInterfaceRemovedRequest>(
2298 (reason,),
2299 0,
2300 0x800d39e76c1cddd,
2301 fidl::encoding::DynamicFlags::empty(),
2302 )
2303 }
2304}
2305
2306#[must_use = "FIDL methods require a response to be sent"]
2307#[derive(Debug)]
2308pub struct ControlRemoveAddressResponder {
2309 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2310 tx_id: u32,
2311}
2312
2313impl std::ops::Drop for ControlRemoveAddressResponder {
2317 fn drop(&mut self) {
2318 self.control_handle.shutdown();
2319 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2321 }
2322}
2323
2324impl fidl::endpoints::Responder for ControlRemoveAddressResponder {
2325 type ControlHandle = ControlControlHandle;
2326
2327 fn control_handle(&self) -> &ControlControlHandle {
2328 &self.control_handle
2329 }
2330
2331 fn drop_without_shutdown(mut self) {
2332 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2334 std::mem::forget(self);
2336 }
2337}
2338
2339impl ControlRemoveAddressResponder {
2340 pub fn send(
2344 self,
2345 mut result: Result<bool, ControlRemoveAddressError>,
2346 ) -> Result<(), fidl::Error> {
2347 let _result = self.send_raw(result);
2348 if _result.is_err() {
2349 self.control_handle.shutdown();
2350 }
2351 self.drop_without_shutdown();
2352 _result
2353 }
2354
2355 pub fn send_no_shutdown_on_err(
2357 self,
2358 mut result: Result<bool, ControlRemoveAddressError>,
2359 ) -> Result<(), fidl::Error> {
2360 let _result = self.send_raw(result);
2361 self.drop_without_shutdown();
2362 _result
2363 }
2364
2365 fn send_raw(
2366 &self,
2367 mut result: Result<bool, ControlRemoveAddressError>,
2368 ) -> Result<(), fidl::Error> {
2369 self.control_handle.inner.send::<fidl::encoding::ResultType<
2370 ControlRemoveAddressResponse,
2371 ControlRemoveAddressError,
2372 >>(
2373 result.map(|did_remove| (did_remove,)),
2374 self.tx_id,
2375 0x213ba73da997a620,
2376 fidl::encoding::DynamicFlags::empty(),
2377 )
2378 }
2379}
2380
2381#[must_use = "FIDL methods require a response to be sent"]
2382#[derive(Debug)]
2383pub struct ControlGetIdResponder {
2384 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2385 tx_id: u32,
2386}
2387
2388impl std::ops::Drop for ControlGetIdResponder {
2392 fn drop(&mut self) {
2393 self.control_handle.shutdown();
2394 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2396 }
2397}
2398
2399impl fidl::endpoints::Responder for ControlGetIdResponder {
2400 type ControlHandle = ControlControlHandle;
2401
2402 fn control_handle(&self) -> &ControlControlHandle {
2403 &self.control_handle
2404 }
2405
2406 fn drop_without_shutdown(mut self) {
2407 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2409 std::mem::forget(self);
2411 }
2412}
2413
2414impl ControlGetIdResponder {
2415 pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
2419 let _result = self.send_raw(id);
2420 if _result.is_err() {
2421 self.control_handle.shutdown();
2422 }
2423 self.drop_without_shutdown();
2424 _result
2425 }
2426
2427 pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
2429 let _result = self.send_raw(id);
2430 self.drop_without_shutdown();
2431 _result
2432 }
2433
2434 fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
2435 self.control_handle.inner.send::<ControlGetIdResponse>(
2436 (id,),
2437 self.tx_id,
2438 0x2a2459768d9ecc6f,
2439 fidl::encoding::DynamicFlags::empty(),
2440 )
2441 }
2442}
2443
2444#[must_use = "FIDL methods require a response to be sent"]
2445#[derive(Debug)]
2446pub struct ControlSetConfigurationResponder {
2447 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2448 tx_id: u32,
2449}
2450
2451impl std::ops::Drop for ControlSetConfigurationResponder {
2455 fn drop(&mut self) {
2456 self.control_handle.shutdown();
2457 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2459 }
2460}
2461
2462impl fidl::endpoints::Responder for ControlSetConfigurationResponder {
2463 type ControlHandle = ControlControlHandle;
2464
2465 fn control_handle(&self) -> &ControlControlHandle {
2466 &self.control_handle
2467 }
2468
2469 fn drop_without_shutdown(mut self) {
2470 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2472 std::mem::forget(self);
2474 }
2475}
2476
2477impl ControlSetConfigurationResponder {
2478 pub fn send(
2482 self,
2483 mut result: Result<&Configuration, ControlSetConfigurationError>,
2484 ) -> Result<(), fidl::Error> {
2485 let _result = self.send_raw(result);
2486 if _result.is_err() {
2487 self.control_handle.shutdown();
2488 }
2489 self.drop_without_shutdown();
2490 _result
2491 }
2492
2493 pub fn send_no_shutdown_on_err(
2495 self,
2496 mut result: Result<&Configuration, ControlSetConfigurationError>,
2497 ) -> Result<(), fidl::Error> {
2498 let _result = self.send_raw(result);
2499 self.drop_without_shutdown();
2500 _result
2501 }
2502
2503 fn send_raw(
2504 &self,
2505 mut result: Result<&Configuration, ControlSetConfigurationError>,
2506 ) -> Result<(), fidl::Error> {
2507 self.control_handle.inner.send::<fidl::encoding::ResultType<
2508 ControlSetConfigurationResponse,
2509 ControlSetConfigurationError,
2510 >>(
2511 result.map(|previous_config| (previous_config,)),
2512 self.tx_id,
2513 0x573923b7b4bde27f,
2514 fidl::encoding::DynamicFlags::empty(),
2515 )
2516 }
2517}
2518
2519#[must_use = "FIDL methods require a response to be sent"]
2520#[derive(Debug)]
2521pub struct ControlGetConfigurationResponder {
2522 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2523 tx_id: u32,
2524}
2525
2526impl std::ops::Drop for ControlGetConfigurationResponder {
2530 fn drop(&mut self) {
2531 self.control_handle.shutdown();
2532 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2534 }
2535}
2536
2537impl fidl::endpoints::Responder for ControlGetConfigurationResponder {
2538 type ControlHandle = ControlControlHandle;
2539
2540 fn control_handle(&self) -> &ControlControlHandle {
2541 &self.control_handle
2542 }
2543
2544 fn drop_without_shutdown(mut self) {
2545 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2547 std::mem::forget(self);
2549 }
2550}
2551
2552impl ControlGetConfigurationResponder {
2553 pub fn send(
2557 self,
2558 mut result: Result<&Configuration, ControlGetConfigurationError>,
2559 ) -> Result<(), fidl::Error> {
2560 let _result = self.send_raw(result);
2561 if _result.is_err() {
2562 self.control_handle.shutdown();
2563 }
2564 self.drop_without_shutdown();
2565 _result
2566 }
2567
2568 pub fn send_no_shutdown_on_err(
2570 self,
2571 mut result: Result<&Configuration, ControlGetConfigurationError>,
2572 ) -> Result<(), fidl::Error> {
2573 let _result = self.send_raw(result);
2574 self.drop_without_shutdown();
2575 _result
2576 }
2577
2578 fn send_raw(
2579 &self,
2580 mut result: Result<&Configuration, ControlGetConfigurationError>,
2581 ) -> Result<(), fidl::Error> {
2582 self.control_handle.inner.send::<fidl::encoding::ResultType<
2583 ControlGetConfigurationResponse,
2584 ControlGetConfigurationError,
2585 >>(
2586 result.map(|config| (config,)),
2587 self.tx_id,
2588 0x5f5d239820bdcc65,
2589 fidl::encoding::DynamicFlags::empty(),
2590 )
2591 }
2592}
2593
2594#[must_use = "FIDL methods require a response to be sent"]
2595#[derive(Debug)]
2596pub struct ControlEnableResponder {
2597 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2598 tx_id: u32,
2599}
2600
2601impl std::ops::Drop for ControlEnableResponder {
2605 fn drop(&mut self) {
2606 self.control_handle.shutdown();
2607 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2609 }
2610}
2611
2612impl fidl::endpoints::Responder for ControlEnableResponder {
2613 type ControlHandle = ControlControlHandle;
2614
2615 fn control_handle(&self) -> &ControlControlHandle {
2616 &self.control_handle
2617 }
2618
2619 fn drop_without_shutdown(mut self) {
2620 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2622 std::mem::forget(self);
2624 }
2625}
2626
2627impl ControlEnableResponder {
2628 pub fn send(self, mut result: Result<bool, ControlEnableError>) -> Result<(), fidl::Error> {
2632 let _result = self.send_raw(result);
2633 if _result.is_err() {
2634 self.control_handle.shutdown();
2635 }
2636 self.drop_without_shutdown();
2637 _result
2638 }
2639
2640 pub fn send_no_shutdown_on_err(
2642 self,
2643 mut result: Result<bool, ControlEnableError>,
2644 ) -> Result<(), fidl::Error> {
2645 let _result = self.send_raw(result);
2646 self.drop_without_shutdown();
2647 _result
2648 }
2649
2650 fn send_raw(&self, mut result: Result<bool, ControlEnableError>) -> Result<(), fidl::Error> {
2651 self.control_handle.inner.send::<fidl::encoding::ResultType<
2652 ControlEnableResponse,
2653 ControlEnableError,
2654 >>(
2655 result.map(|did_enable| (did_enable,)),
2656 self.tx_id,
2657 0x15c983d3a8ac0b98,
2658 fidl::encoding::DynamicFlags::empty(),
2659 )
2660 }
2661}
2662
2663#[must_use = "FIDL methods require a response to be sent"]
2664#[derive(Debug)]
2665pub struct ControlDisableResponder {
2666 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2667 tx_id: u32,
2668}
2669
2670impl std::ops::Drop for ControlDisableResponder {
2674 fn drop(&mut self) {
2675 self.control_handle.shutdown();
2676 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2678 }
2679}
2680
2681impl fidl::endpoints::Responder for ControlDisableResponder {
2682 type ControlHandle = ControlControlHandle;
2683
2684 fn control_handle(&self) -> &ControlControlHandle {
2685 &self.control_handle
2686 }
2687
2688 fn drop_without_shutdown(mut self) {
2689 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2691 std::mem::forget(self);
2693 }
2694}
2695
2696impl ControlDisableResponder {
2697 pub fn send(self, mut result: Result<bool, ControlDisableError>) -> Result<(), fidl::Error> {
2701 let _result = self.send_raw(result);
2702 if _result.is_err() {
2703 self.control_handle.shutdown();
2704 }
2705 self.drop_without_shutdown();
2706 _result
2707 }
2708
2709 pub fn send_no_shutdown_on_err(
2711 self,
2712 mut result: Result<bool, ControlDisableError>,
2713 ) -> Result<(), fidl::Error> {
2714 let _result = self.send_raw(result);
2715 self.drop_without_shutdown();
2716 _result
2717 }
2718
2719 fn send_raw(&self, mut result: Result<bool, ControlDisableError>) -> Result<(), fidl::Error> {
2720 self.control_handle.inner.send::<fidl::encoding::ResultType<
2721 ControlDisableResponse,
2722 ControlDisableError,
2723 >>(
2724 result.map(|did_disable| (did_disable,)),
2725 self.tx_id,
2726 0x98d3a585d905473,
2727 fidl::encoding::DynamicFlags::empty(),
2728 )
2729 }
2730}
2731
2732#[must_use = "FIDL methods require a response to be sent"]
2733#[derive(Debug)]
2734pub struct ControlGetAuthorizationForInterfaceResponder {
2735 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2736 tx_id: u32,
2737}
2738
2739impl std::ops::Drop for ControlGetAuthorizationForInterfaceResponder {
2743 fn drop(&mut self) {
2744 self.control_handle.shutdown();
2745 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2747 }
2748}
2749
2750impl fidl::endpoints::Responder for ControlGetAuthorizationForInterfaceResponder {
2751 type ControlHandle = ControlControlHandle;
2752
2753 fn control_handle(&self) -> &ControlControlHandle {
2754 &self.control_handle
2755 }
2756
2757 fn drop_without_shutdown(mut self) {
2758 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2760 std::mem::forget(self);
2762 }
2763}
2764
2765impl ControlGetAuthorizationForInterfaceResponder {
2766 pub fn send(
2770 self,
2771 mut credential: fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
2772 ) -> Result<(), fidl::Error> {
2773 let _result = self.send_raw(credential);
2774 if _result.is_err() {
2775 self.control_handle.shutdown();
2776 }
2777 self.drop_without_shutdown();
2778 _result
2779 }
2780
2781 pub fn send_no_shutdown_on_err(
2783 self,
2784 mut credential: fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
2785 ) -> Result<(), fidl::Error> {
2786 let _result = self.send_raw(credential);
2787 self.drop_without_shutdown();
2788 _result
2789 }
2790
2791 fn send_raw(
2792 &self,
2793 mut credential: fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
2794 ) -> Result<(), fidl::Error> {
2795 self.control_handle.inner.send::<ControlGetAuthorizationForInterfaceResponse>(
2796 (&mut credential,),
2797 self.tx_id,
2798 0xc1de2ab60b5cb9e,
2799 fidl::encoding::DynamicFlags::empty(),
2800 )
2801 }
2802}
2803
2804#[must_use = "FIDL methods require a response to be sent"]
2805#[derive(Debug)]
2806pub struct ControlRemoveResponder {
2807 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2808 tx_id: u32,
2809}
2810
2811impl std::ops::Drop for ControlRemoveResponder {
2815 fn drop(&mut self) {
2816 self.control_handle.shutdown();
2817 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2819 }
2820}
2821
2822impl fidl::endpoints::Responder for ControlRemoveResponder {
2823 type ControlHandle = ControlControlHandle;
2824
2825 fn control_handle(&self) -> &ControlControlHandle {
2826 &self.control_handle
2827 }
2828
2829 fn drop_without_shutdown(mut self) {
2830 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2832 std::mem::forget(self);
2834 }
2835}
2836
2837impl ControlRemoveResponder {
2838 pub fn send(self, mut result: Result<(), ControlRemoveError>) -> Result<(), fidl::Error> {
2842 let _result = self.send_raw(result);
2843 if _result.is_err() {
2844 self.control_handle.shutdown();
2845 }
2846 self.drop_without_shutdown();
2847 _result
2848 }
2849
2850 pub fn send_no_shutdown_on_err(
2852 self,
2853 mut result: Result<(), ControlRemoveError>,
2854 ) -> Result<(), fidl::Error> {
2855 let _result = self.send_raw(result);
2856 self.drop_without_shutdown();
2857 _result
2858 }
2859
2860 fn send_raw(&self, mut result: Result<(), ControlRemoveError>) -> Result<(), fidl::Error> {
2861 self.control_handle.inner.send::<fidl::encoding::ResultType<
2862 fidl::encoding::EmptyStruct,
2863 ControlRemoveError,
2864 >>(
2865 result,
2866 self.tx_id,
2867 0x13aab8bbecc7ff0b,
2868 fidl::encoding::DynamicFlags::empty(),
2869 )
2870 }
2871}
2872
2873#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2874pub struct DeviceControlMarker;
2875
2876impl fidl::endpoints::ProtocolMarker for DeviceControlMarker {
2877 type Proxy = DeviceControlProxy;
2878 type RequestStream = DeviceControlRequestStream;
2879 #[cfg(target_os = "fuchsia")]
2880 type SynchronousProxy = DeviceControlSynchronousProxy;
2881
2882 const DEBUG_NAME: &'static str = "(anonymous) DeviceControl";
2883}
2884
2885pub trait DeviceControlProxyInterface: Send + Sync {
2886 fn r#create_interface(
2887 &self,
2888 port: &fidl_fuchsia_hardware_network::PortId,
2889 control: fidl::endpoints::ServerEnd<ControlMarker>,
2890 options: Options,
2891 ) -> Result<(), fidl::Error>;
2892 fn r#detach(&self) -> Result<(), fidl::Error>;
2893}
2894#[derive(Debug)]
2895#[cfg(target_os = "fuchsia")]
2896pub struct DeviceControlSynchronousProxy {
2897 client: fidl::client::sync::Client,
2898}
2899
2900#[cfg(target_os = "fuchsia")]
2901impl fidl::endpoints::SynchronousProxy for DeviceControlSynchronousProxy {
2902 type Proxy = DeviceControlProxy;
2903 type Protocol = DeviceControlMarker;
2904
2905 fn from_channel(inner: fidl::Channel) -> Self {
2906 Self::new(inner)
2907 }
2908
2909 fn into_channel(self) -> fidl::Channel {
2910 self.client.into_channel()
2911 }
2912
2913 fn as_channel(&self) -> &fidl::Channel {
2914 self.client.as_channel()
2915 }
2916}
2917
2918#[cfg(target_os = "fuchsia")]
2919impl DeviceControlSynchronousProxy {
2920 pub fn new(channel: fidl::Channel) -> Self {
2921 let protocol_name = <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2922 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2923 }
2924
2925 pub fn into_channel(self) -> fidl::Channel {
2926 self.client.into_channel()
2927 }
2928
2929 pub fn wait_for_event(
2932 &self,
2933 deadline: zx::MonotonicInstant,
2934 ) -> Result<DeviceControlEvent, fidl::Error> {
2935 DeviceControlEvent::decode(self.client.wait_for_event(deadline)?)
2936 }
2937
2938 pub fn r#create_interface(
2943 &self,
2944 mut port: &fidl_fuchsia_hardware_network::PortId,
2945 mut control: fidl::endpoints::ServerEnd<ControlMarker>,
2946 mut options: Options,
2947 ) -> Result<(), fidl::Error> {
2948 self.client.send::<DeviceControlCreateInterfaceRequest>(
2949 (port, control, &mut options),
2950 0x4ff8be7351d12f86,
2951 fidl::encoding::DynamicFlags::empty(),
2952 )
2953 }
2954
2955 pub fn r#detach(&self) -> Result<(), fidl::Error> {
2962 self.client.send::<fidl::encoding::EmptyPayload>(
2963 (),
2964 0x57489f1554d489d2,
2965 fidl::encoding::DynamicFlags::empty(),
2966 )
2967 }
2968}
2969
2970#[cfg(target_os = "fuchsia")]
2971impl From<DeviceControlSynchronousProxy> for zx::Handle {
2972 fn from(value: DeviceControlSynchronousProxy) -> Self {
2973 value.into_channel().into()
2974 }
2975}
2976
2977#[cfg(target_os = "fuchsia")]
2978impl From<fidl::Channel> for DeviceControlSynchronousProxy {
2979 fn from(value: fidl::Channel) -> Self {
2980 Self::new(value)
2981 }
2982}
2983
2984#[cfg(target_os = "fuchsia")]
2985impl fidl::endpoints::FromClient for DeviceControlSynchronousProxy {
2986 type Protocol = DeviceControlMarker;
2987
2988 fn from_client(value: fidl::endpoints::ClientEnd<DeviceControlMarker>) -> Self {
2989 Self::new(value.into_channel())
2990 }
2991}
2992
2993#[derive(Debug, Clone)]
2994pub struct DeviceControlProxy {
2995 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2996}
2997
2998impl fidl::endpoints::Proxy for DeviceControlProxy {
2999 type Protocol = DeviceControlMarker;
3000
3001 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3002 Self::new(inner)
3003 }
3004
3005 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3006 self.client.into_channel().map_err(|client| Self { client })
3007 }
3008
3009 fn as_channel(&self) -> &::fidl::AsyncChannel {
3010 self.client.as_channel()
3011 }
3012}
3013
3014impl DeviceControlProxy {
3015 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3017 let protocol_name = <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3018 Self { client: fidl::client::Client::new(channel, protocol_name) }
3019 }
3020
3021 pub fn take_event_stream(&self) -> DeviceControlEventStream {
3027 DeviceControlEventStream { event_receiver: self.client.take_event_receiver() }
3028 }
3029
3030 pub fn r#create_interface(
3035 &self,
3036 mut port: &fidl_fuchsia_hardware_network::PortId,
3037 mut control: fidl::endpoints::ServerEnd<ControlMarker>,
3038 mut options: Options,
3039 ) -> Result<(), fidl::Error> {
3040 DeviceControlProxyInterface::r#create_interface(self, port, control, options)
3041 }
3042
3043 pub fn r#detach(&self) -> Result<(), fidl::Error> {
3050 DeviceControlProxyInterface::r#detach(self)
3051 }
3052}
3053
3054impl DeviceControlProxyInterface for DeviceControlProxy {
3055 fn r#create_interface(
3056 &self,
3057 mut port: &fidl_fuchsia_hardware_network::PortId,
3058 mut control: fidl::endpoints::ServerEnd<ControlMarker>,
3059 mut options: Options,
3060 ) -> Result<(), fidl::Error> {
3061 self.client.send::<DeviceControlCreateInterfaceRequest>(
3062 (port, control, &mut options),
3063 0x4ff8be7351d12f86,
3064 fidl::encoding::DynamicFlags::empty(),
3065 )
3066 }
3067
3068 fn r#detach(&self) -> Result<(), fidl::Error> {
3069 self.client.send::<fidl::encoding::EmptyPayload>(
3070 (),
3071 0x57489f1554d489d2,
3072 fidl::encoding::DynamicFlags::empty(),
3073 )
3074 }
3075}
3076
3077pub struct DeviceControlEventStream {
3078 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3079}
3080
3081impl std::marker::Unpin for DeviceControlEventStream {}
3082
3083impl futures::stream::FusedStream for DeviceControlEventStream {
3084 fn is_terminated(&self) -> bool {
3085 self.event_receiver.is_terminated()
3086 }
3087}
3088
3089impl futures::Stream for DeviceControlEventStream {
3090 type Item = Result<DeviceControlEvent, fidl::Error>;
3091
3092 fn poll_next(
3093 mut self: std::pin::Pin<&mut Self>,
3094 cx: &mut std::task::Context<'_>,
3095 ) -> std::task::Poll<Option<Self::Item>> {
3096 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3097 &mut self.event_receiver,
3098 cx
3099 )?) {
3100 Some(buf) => std::task::Poll::Ready(Some(DeviceControlEvent::decode(buf))),
3101 None => std::task::Poll::Ready(None),
3102 }
3103 }
3104}
3105
3106#[derive(Debug)]
3107pub enum DeviceControlEvent {}
3108
3109impl DeviceControlEvent {
3110 fn decode(
3112 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3113 ) -> Result<DeviceControlEvent, fidl::Error> {
3114 let (bytes, _handles) = buf.split_mut();
3115 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3116 debug_assert_eq!(tx_header.tx_id, 0);
3117 match tx_header.ordinal {
3118 _ => Err(fidl::Error::UnknownOrdinal {
3119 ordinal: tx_header.ordinal,
3120 protocol_name: <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3121 }),
3122 }
3123 }
3124}
3125
3126pub struct DeviceControlRequestStream {
3128 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3129 is_terminated: bool,
3130}
3131
3132impl std::marker::Unpin for DeviceControlRequestStream {}
3133
3134impl futures::stream::FusedStream for DeviceControlRequestStream {
3135 fn is_terminated(&self) -> bool {
3136 self.is_terminated
3137 }
3138}
3139
3140impl fidl::endpoints::RequestStream for DeviceControlRequestStream {
3141 type Protocol = DeviceControlMarker;
3142 type ControlHandle = DeviceControlControlHandle;
3143
3144 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3145 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3146 }
3147
3148 fn control_handle(&self) -> Self::ControlHandle {
3149 DeviceControlControlHandle { inner: self.inner.clone() }
3150 }
3151
3152 fn into_inner(
3153 self,
3154 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3155 {
3156 (self.inner, self.is_terminated)
3157 }
3158
3159 fn from_inner(
3160 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3161 is_terminated: bool,
3162 ) -> Self {
3163 Self { inner, is_terminated }
3164 }
3165}
3166
3167impl futures::Stream for DeviceControlRequestStream {
3168 type Item = Result<DeviceControlRequest, fidl::Error>;
3169
3170 fn poll_next(
3171 mut self: std::pin::Pin<&mut Self>,
3172 cx: &mut std::task::Context<'_>,
3173 ) -> std::task::Poll<Option<Self::Item>> {
3174 let this = &mut *self;
3175 if this.inner.check_shutdown(cx) {
3176 this.is_terminated = true;
3177 return std::task::Poll::Ready(None);
3178 }
3179 if this.is_terminated {
3180 panic!("polled DeviceControlRequestStream after completion");
3181 }
3182 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3183 |bytes, handles| {
3184 match this.inner.channel().read_etc(cx, bytes, handles) {
3185 std::task::Poll::Ready(Ok(())) => {}
3186 std::task::Poll::Pending => return std::task::Poll::Pending,
3187 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3188 this.is_terminated = true;
3189 return std::task::Poll::Ready(None);
3190 }
3191 std::task::Poll::Ready(Err(e)) => {
3192 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3193 e.into(),
3194 ))));
3195 }
3196 }
3197
3198 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3200
3201 std::task::Poll::Ready(Some(match header.ordinal {
3202 0x4ff8be7351d12f86 => {
3203 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3204 let mut req = fidl::new_empty!(
3205 DeviceControlCreateInterfaceRequest,
3206 fidl::encoding::DefaultFuchsiaResourceDialect
3207 );
3208 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceControlCreateInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3209 let control_handle =
3210 DeviceControlControlHandle { inner: this.inner.clone() };
3211 Ok(DeviceControlRequest::CreateInterface {
3212 port: req.port,
3213 control: req.control,
3214 options: req.options,
3215
3216 control_handle,
3217 })
3218 }
3219 0x57489f1554d489d2 => {
3220 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3221 let mut req = fidl::new_empty!(
3222 fidl::encoding::EmptyPayload,
3223 fidl::encoding::DefaultFuchsiaResourceDialect
3224 );
3225 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3226 let control_handle =
3227 DeviceControlControlHandle { inner: this.inner.clone() };
3228 Ok(DeviceControlRequest::Detach { control_handle })
3229 }
3230 _ => Err(fidl::Error::UnknownOrdinal {
3231 ordinal: header.ordinal,
3232 protocol_name:
3233 <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3234 }),
3235 }))
3236 },
3237 )
3238 }
3239}
3240
3241#[derive(Debug)]
3264pub enum DeviceControlRequest {
3265 CreateInterface {
3270 port: fidl_fuchsia_hardware_network::PortId,
3271 control: fidl::endpoints::ServerEnd<ControlMarker>,
3272 options: Options,
3273 control_handle: DeviceControlControlHandle,
3274 },
3275 Detach { control_handle: DeviceControlControlHandle },
3282}
3283
3284impl DeviceControlRequest {
3285 #[allow(irrefutable_let_patterns)]
3286 pub fn into_create_interface(
3287 self,
3288 ) -> Option<(
3289 fidl_fuchsia_hardware_network::PortId,
3290 fidl::endpoints::ServerEnd<ControlMarker>,
3291 Options,
3292 DeviceControlControlHandle,
3293 )> {
3294 if let DeviceControlRequest::CreateInterface { port, control, options, control_handle } =
3295 self
3296 {
3297 Some((port, control, options, control_handle))
3298 } else {
3299 None
3300 }
3301 }
3302
3303 #[allow(irrefutable_let_patterns)]
3304 pub fn into_detach(self) -> Option<(DeviceControlControlHandle)> {
3305 if let DeviceControlRequest::Detach { control_handle } = self {
3306 Some((control_handle))
3307 } else {
3308 None
3309 }
3310 }
3311
3312 pub fn method_name(&self) -> &'static str {
3314 match *self {
3315 DeviceControlRequest::CreateInterface { .. } => "create_interface",
3316 DeviceControlRequest::Detach { .. } => "detach",
3317 }
3318 }
3319}
3320
3321#[derive(Debug, Clone)]
3322pub struct DeviceControlControlHandle {
3323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3324}
3325
3326impl fidl::endpoints::ControlHandle for DeviceControlControlHandle {
3327 fn shutdown(&self) {
3328 self.inner.shutdown()
3329 }
3330 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3331 self.inner.shutdown_with_epitaph(status)
3332 }
3333
3334 fn is_closed(&self) -> bool {
3335 self.inner.channel().is_closed()
3336 }
3337 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3338 self.inner.channel().on_closed()
3339 }
3340
3341 #[cfg(target_os = "fuchsia")]
3342 fn signal_peer(
3343 &self,
3344 clear_mask: zx::Signals,
3345 set_mask: zx::Signals,
3346 ) -> Result<(), zx_status::Status> {
3347 use fidl::Peered;
3348 self.inner.channel().signal_peer(clear_mask, set_mask)
3349 }
3350}
3351
3352impl DeviceControlControlHandle {}
3353
3354#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3355pub struct InstallerMarker;
3356
3357impl fidl::endpoints::ProtocolMarker for InstallerMarker {
3358 type Proxy = InstallerProxy;
3359 type RequestStream = InstallerRequestStream;
3360 #[cfg(target_os = "fuchsia")]
3361 type SynchronousProxy = InstallerSynchronousProxy;
3362
3363 const DEBUG_NAME: &'static str = "fuchsia.net.interfaces.admin.Installer";
3364}
3365impl fidl::endpoints::DiscoverableProtocolMarker for InstallerMarker {}
3366
3367pub trait InstallerProxyInterface: Send + Sync {
3368 fn r#install_device(
3369 &self,
3370 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3371 device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3372 ) -> Result<(), fidl::Error>;
3373 fn r#install_blackhole_interface(
3374 &self,
3375 interface: fidl::endpoints::ServerEnd<ControlMarker>,
3376 options: Options,
3377 ) -> Result<(), fidl::Error>;
3378}
3379#[derive(Debug)]
3380#[cfg(target_os = "fuchsia")]
3381pub struct InstallerSynchronousProxy {
3382 client: fidl::client::sync::Client,
3383}
3384
3385#[cfg(target_os = "fuchsia")]
3386impl fidl::endpoints::SynchronousProxy for InstallerSynchronousProxy {
3387 type Proxy = InstallerProxy;
3388 type Protocol = InstallerMarker;
3389
3390 fn from_channel(inner: fidl::Channel) -> Self {
3391 Self::new(inner)
3392 }
3393
3394 fn into_channel(self) -> fidl::Channel {
3395 self.client.into_channel()
3396 }
3397
3398 fn as_channel(&self) -> &fidl::Channel {
3399 self.client.as_channel()
3400 }
3401}
3402
3403#[cfg(target_os = "fuchsia")]
3404impl InstallerSynchronousProxy {
3405 pub fn new(channel: fidl::Channel) -> Self {
3406 let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3407 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3408 }
3409
3410 pub fn into_channel(self) -> fidl::Channel {
3411 self.client.into_channel()
3412 }
3413
3414 pub fn wait_for_event(
3417 &self,
3418 deadline: zx::MonotonicInstant,
3419 ) -> Result<InstallerEvent, fidl::Error> {
3420 InstallerEvent::decode(self.client.wait_for_event(deadline)?)
3421 }
3422
3423 pub fn r#install_device(
3428 &self,
3429 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3430 mut device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3431 ) -> Result<(), fidl::Error> {
3432 self.client.send::<InstallerInstallDeviceRequest>(
3433 (device, device_control),
3434 0x3e84524dcecab23a,
3435 fidl::encoding::DynamicFlags::empty(),
3436 )
3437 }
3438
3439 pub fn r#install_blackhole_interface(
3446 &self,
3447 mut interface: fidl::endpoints::ServerEnd<ControlMarker>,
3448 mut options: Options,
3449 ) -> Result<(), fidl::Error> {
3450 self.client.send::<InstallerInstallBlackholeInterfaceRequest>(
3451 (interface, &mut options),
3452 0x2ce57e87cdbcb809,
3453 fidl::encoding::DynamicFlags::empty(),
3454 )
3455 }
3456}
3457
3458#[cfg(target_os = "fuchsia")]
3459impl From<InstallerSynchronousProxy> for zx::Handle {
3460 fn from(value: InstallerSynchronousProxy) -> Self {
3461 value.into_channel().into()
3462 }
3463}
3464
3465#[cfg(target_os = "fuchsia")]
3466impl From<fidl::Channel> for InstallerSynchronousProxy {
3467 fn from(value: fidl::Channel) -> Self {
3468 Self::new(value)
3469 }
3470}
3471
3472#[cfg(target_os = "fuchsia")]
3473impl fidl::endpoints::FromClient for InstallerSynchronousProxy {
3474 type Protocol = InstallerMarker;
3475
3476 fn from_client(value: fidl::endpoints::ClientEnd<InstallerMarker>) -> Self {
3477 Self::new(value.into_channel())
3478 }
3479}
3480
3481#[derive(Debug, Clone)]
3482pub struct InstallerProxy {
3483 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3484}
3485
3486impl fidl::endpoints::Proxy for InstallerProxy {
3487 type Protocol = InstallerMarker;
3488
3489 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3490 Self::new(inner)
3491 }
3492
3493 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3494 self.client.into_channel().map_err(|client| Self { client })
3495 }
3496
3497 fn as_channel(&self) -> &::fidl::AsyncChannel {
3498 self.client.as_channel()
3499 }
3500}
3501
3502impl InstallerProxy {
3503 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3505 let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3506 Self { client: fidl::client::Client::new(channel, protocol_name) }
3507 }
3508
3509 pub fn take_event_stream(&self) -> InstallerEventStream {
3515 InstallerEventStream { event_receiver: self.client.take_event_receiver() }
3516 }
3517
3518 pub fn r#install_device(
3523 &self,
3524 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3525 mut device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3526 ) -> Result<(), fidl::Error> {
3527 InstallerProxyInterface::r#install_device(self, device, device_control)
3528 }
3529
3530 pub fn r#install_blackhole_interface(
3537 &self,
3538 mut interface: fidl::endpoints::ServerEnd<ControlMarker>,
3539 mut options: Options,
3540 ) -> Result<(), fidl::Error> {
3541 InstallerProxyInterface::r#install_blackhole_interface(self, interface, options)
3542 }
3543}
3544
3545impl InstallerProxyInterface for InstallerProxy {
3546 fn r#install_device(
3547 &self,
3548 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3549 mut device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3550 ) -> Result<(), fidl::Error> {
3551 self.client.send::<InstallerInstallDeviceRequest>(
3552 (device, device_control),
3553 0x3e84524dcecab23a,
3554 fidl::encoding::DynamicFlags::empty(),
3555 )
3556 }
3557
3558 fn r#install_blackhole_interface(
3559 &self,
3560 mut interface: fidl::endpoints::ServerEnd<ControlMarker>,
3561 mut options: Options,
3562 ) -> Result<(), fidl::Error> {
3563 self.client.send::<InstallerInstallBlackholeInterfaceRequest>(
3564 (interface, &mut options),
3565 0x2ce57e87cdbcb809,
3566 fidl::encoding::DynamicFlags::empty(),
3567 )
3568 }
3569}
3570
3571pub struct InstallerEventStream {
3572 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3573}
3574
3575impl std::marker::Unpin for InstallerEventStream {}
3576
3577impl futures::stream::FusedStream for InstallerEventStream {
3578 fn is_terminated(&self) -> bool {
3579 self.event_receiver.is_terminated()
3580 }
3581}
3582
3583impl futures::Stream for InstallerEventStream {
3584 type Item = Result<InstallerEvent, fidl::Error>;
3585
3586 fn poll_next(
3587 mut self: std::pin::Pin<&mut Self>,
3588 cx: &mut std::task::Context<'_>,
3589 ) -> std::task::Poll<Option<Self::Item>> {
3590 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3591 &mut self.event_receiver,
3592 cx
3593 )?) {
3594 Some(buf) => std::task::Poll::Ready(Some(InstallerEvent::decode(buf))),
3595 None => std::task::Poll::Ready(None),
3596 }
3597 }
3598}
3599
3600#[derive(Debug)]
3601pub enum InstallerEvent {}
3602
3603impl InstallerEvent {
3604 fn decode(
3606 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3607 ) -> Result<InstallerEvent, fidl::Error> {
3608 let (bytes, _handles) = buf.split_mut();
3609 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3610 debug_assert_eq!(tx_header.tx_id, 0);
3611 match tx_header.ordinal {
3612 _ => Err(fidl::Error::UnknownOrdinal {
3613 ordinal: tx_header.ordinal,
3614 protocol_name: <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3615 }),
3616 }
3617 }
3618}
3619
3620pub struct InstallerRequestStream {
3622 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3623 is_terminated: bool,
3624}
3625
3626impl std::marker::Unpin for InstallerRequestStream {}
3627
3628impl futures::stream::FusedStream for InstallerRequestStream {
3629 fn is_terminated(&self) -> bool {
3630 self.is_terminated
3631 }
3632}
3633
3634impl fidl::endpoints::RequestStream for InstallerRequestStream {
3635 type Protocol = InstallerMarker;
3636 type ControlHandle = InstallerControlHandle;
3637
3638 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3639 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3640 }
3641
3642 fn control_handle(&self) -> Self::ControlHandle {
3643 InstallerControlHandle { inner: self.inner.clone() }
3644 }
3645
3646 fn into_inner(
3647 self,
3648 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3649 {
3650 (self.inner, self.is_terminated)
3651 }
3652
3653 fn from_inner(
3654 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3655 is_terminated: bool,
3656 ) -> Self {
3657 Self { inner, is_terminated }
3658 }
3659}
3660
3661impl futures::Stream for InstallerRequestStream {
3662 type Item = Result<InstallerRequest, fidl::Error>;
3663
3664 fn poll_next(
3665 mut self: std::pin::Pin<&mut Self>,
3666 cx: &mut std::task::Context<'_>,
3667 ) -> std::task::Poll<Option<Self::Item>> {
3668 let this = &mut *self;
3669 if this.inner.check_shutdown(cx) {
3670 this.is_terminated = true;
3671 return std::task::Poll::Ready(None);
3672 }
3673 if this.is_terminated {
3674 panic!("polled InstallerRequestStream after completion");
3675 }
3676 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3677 |bytes, handles| {
3678 match this.inner.channel().read_etc(cx, bytes, handles) {
3679 std::task::Poll::Ready(Ok(())) => {}
3680 std::task::Poll::Pending => return std::task::Poll::Pending,
3681 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3682 this.is_terminated = true;
3683 return std::task::Poll::Ready(None);
3684 }
3685 std::task::Poll::Ready(Err(e)) => {
3686 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3687 e.into(),
3688 ))));
3689 }
3690 }
3691
3692 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3694
3695 std::task::Poll::Ready(Some(match header.ordinal {
3696 0x3e84524dcecab23a => {
3697 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3698 let mut req = fidl::new_empty!(
3699 InstallerInstallDeviceRequest,
3700 fidl::encoding::DefaultFuchsiaResourceDialect
3701 );
3702 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerInstallDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
3703 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
3704 Ok(InstallerRequest::InstallDevice {
3705 device: req.device,
3706 device_control: req.device_control,
3707
3708 control_handle,
3709 })
3710 }
3711 0x2ce57e87cdbcb809 => {
3712 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3713 let mut req = fidl::new_empty!(
3714 InstallerInstallBlackholeInterfaceRequest,
3715 fidl::encoding::DefaultFuchsiaResourceDialect
3716 );
3717 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerInstallBlackholeInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3718 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
3719 Ok(InstallerRequest::InstallBlackholeInterface {
3720 interface: req.interface,
3721 options: req.options,
3722
3723 control_handle,
3724 })
3725 }
3726 _ => Err(fidl::Error::UnknownOrdinal {
3727 ordinal: header.ordinal,
3728 protocol_name:
3729 <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3730 }),
3731 }))
3732 },
3733 )
3734 }
3735}
3736
3737#[derive(Debug)]
3739pub enum InstallerRequest {
3740 InstallDevice {
3745 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3746 device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3747 control_handle: InstallerControlHandle,
3748 },
3749 InstallBlackholeInterface {
3756 interface: fidl::endpoints::ServerEnd<ControlMarker>,
3757 options: Options,
3758 control_handle: InstallerControlHandle,
3759 },
3760}
3761
3762impl InstallerRequest {
3763 #[allow(irrefutable_let_patterns)]
3764 pub fn into_install_device(
3765 self,
3766 ) -> Option<(
3767 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3768 fidl::endpoints::ServerEnd<DeviceControlMarker>,
3769 InstallerControlHandle,
3770 )> {
3771 if let InstallerRequest::InstallDevice { device, device_control, control_handle } = self {
3772 Some((device, device_control, control_handle))
3773 } else {
3774 None
3775 }
3776 }
3777
3778 #[allow(irrefutable_let_patterns)]
3779 pub fn into_install_blackhole_interface(
3780 self,
3781 ) -> Option<(fidl::endpoints::ServerEnd<ControlMarker>, Options, InstallerControlHandle)> {
3782 if let InstallerRequest::InstallBlackholeInterface { interface, options, control_handle } =
3783 self
3784 {
3785 Some((interface, options, control_handle))
3786 } else {
3787 None
3788 }
3789 }
3790
3791 pub fn method_name(&self) -> &'static str {
3793 match *self {
3794 InstallerRequest::InstallDevice { .. } => "install_device",
3795 InstallerRequest::InstallBlackholeInterface { .. } => "install_blackhole_interface",
3796 }
3797 }
3798}
3799
3800#[derive(Debug, Clone)]
3801pub struct InstallerControlHandle {
3802 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3803}
3804
3805impl fidl::endpoints::ControlHandle for InstallerControlHandle {
3806 fn shutdown(&self) {
3807 self.inner.shutdown()
3808 }
3809 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3810 self.inner.shutdown_with_epitaph(status)
3811 }
3812
3813 fn is_closed(&self) -> bool {
3814 self.inner.channel().is_closed()
3815 }
3816 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3817 self.inner.channel().on_closed()
3818 }
3819
3820 #[cfg(target_os = "fuchsia")]
3821 fn signal_peer(
3822 &self,
3823 clear_mask: zx::Signals,
3824 set_mask: zx::Signals,
3825 ) -> Result<(), zx_status::Status> {
3826 use fidl::Peered;
3827 self.inner.channel().signal_peer(clear_mask, set_mask)
3828 }
3829}
3830
3831impl InstallerControlHandle {}
3832
3833mod internal {
3834 use super::*;
3835
3836 impl fidl::encoding::ResourceTypeMarker for ControlAddAddressRequest {
3837 type Borrowed<'a> = &'a mut Self;
3838 fn take_or_borrow<'a>(
3839 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3840 ) -> Self::Borrowed<'a> {
3841 value
3842 }
3843 }
3844
3845 unsafe impl fidl::encoding::TypeMarker for ControlAddAddressRequest {
3846 type Owned = Self;
3847
3848 #[inline(always)]
3849 fn inline_align(_context: fidl::encoding::Context) -> usize {
3850 8
3851 }
3852
3853 #[inline(always)]
3854 fn inline_size(_context: fidl::encoding::Context) -> usize {
3855 48
3856 }
3857 }
3858
3859 unsafe impl
3860 fidl::encoding::Encode<
3861 ControlAddAddressRequest,
3862 fidl::encoding::DefaultFuchsiaResourceDialect,
3863 > for &mut ControlAddAddressRequest
3864 {
3865 #[inline]
3866 unsafe fn encode(
3867 self,
3868 encoder: &mut fidl::encoding::Encoder<
3869 '_,
3870 fidl::encoding::DefaultFuchsiaResourceDialect,
3871 >,
3872 offset: usize,
3873 _depth: fidl::encoding::Depth,
3874 ) -> fidl::Result<()> {
3875 encoder.debug_check_bounds::<ControlAddAddressRequest>(offset);
3876 fidl::encoding::Encode::<
3878 ControlAddAddressRequest,
3879 fidl::encoding::DefaultFuchsiaResourceDialect,
3880 >::encode(
3881 (
3882 <fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(
3883 &self.address,
3884 ),
3885 <AddressParameters as fidl::encoding::ValueTypeMarker>::borrow(
3886 &self.parameters,
3887 ),
3888 <fidl::encoding::Endpoint<
3889 fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
3890 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3891 &mut self.address_state_provider,
3892 ),
3893 ),
3894 encoder,
3895 offset,
3896 _depth,
3897 )
3898 }
3899 }
3900 unsafe impl<
3901 T0: fidl::encoding::Encode<
3902 fidl_fuchsia_net::Subnet,
3903 fidl::encoding::DefaultFuchsiaResourceDialect,
3904 >,
3905 T1: fidl::encoding::Encode<AddressParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
3906 T2: fidl::encoding::Encode<
3907 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AddressStateProviderMarker>>,
3908 fidl::encoding::DefaultFuchsiaResourceDialect,
3909 >,
3910 >
3911 fidl::encoding::Encode<
3912 ControlAddAddressRequest,
3913 fidl::encoding::DefaultFuchsiaResourceDialect,
3914 > for (T0, T1, T2)
3915 {
3916 #[inline]
3917 unsafe fn encode(
3918 self,
3919 encoder: &mut fidl::encoding::Encoder<
3920 '_,
3921 fidl::encoding::DefaultFuchsiaResourceDialect,
3922 >,
3923 offset: usize,
3924 depth: fidl::encoding::Depth,
3925 ) -> fidl::Result<()> {
3926 encoder.debug_check_bounds::<ControlAddAddressRequest>(offset);
3927 unsafe {
3930 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
3931 (ptr as *mut u64).write_unaligned(0);
3932 }
3933 self.0.encode(encoder, offset + 0, depth)?;
3935 self.1.encode(encoder, offset + 24, depth)?;
3936 self.2.encode(encoder, offset + 40, depth)?;
3937 Ok(())
3938 }
3939 }
3940
3941 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3942 for ControlAddAddressRequest
3943 {
3944 #[inline(always)]
3945 fn new_empty() -> Self {
3946 Self {
3947 address: fidl::new_empty!(
3948 fidl_fuchsia_net::Subnet,
3949 fidl::encoding::DefaultFuchsiaResourceDialect
3950 ),
3951 parameters: fidl::new_empty!(
3952 AddressParameters,
3953 fidl::encoding::DefaultFuchsiaResourceDialect
3954 ),
3955 address_state_provider: fidl::new_empty!(
3956 fidl::encoding::Endpoint<
3957 fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
3958 >,
3959 fidl::encoding::DefaultFuchsiaResourceDialect
3960 ),
3961 }
3962 }
3963
3964 #[inline]
3965 unsafe fn decode(
3966 &mut self,
3967 decoder: &mut fidl::encoding::Decoder<
3968 '_,
3969 fidl::encoding::DefaultFuchsiaResourceDialect,
3970 >,
3971 offset: usize,
3972 _depth: fidl::encoding::Depth,
3973 ) -> fidl::Result<()> {
3974 decoder.debug_check_bounds::<Self>(offset);
3975 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
3977 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3978 let mask = 0xffffffff00000000u64;
3979 let maskedval = padval & mask;
3980 if maskedval != 0 {
3981 return Err(fidl::Error::NonZeroPadding {
3982 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
3983 });
3984 }
3985 fidl::decode!(
3986 fidl_fuchsia_net::Subnet,
3987 fidl::encoding::DefaultFuchsiaResourceDialect,
3988 &mut self.address,
3989 decoder,
3990 offset + 0,
3991 _depth
3992 )?;
3993 fidl::decode!(
3994 AddressParameters,
3995 fidl::encoding::DefaultFuchsiaResourceDialect,
3996 &mut self.parameters,
3997 decoder,
3998 offset + 24,
3999 _depth
4000 )?;
4001 fidl::decode!(
4002 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AddressStateProviderMarker>>,
4003 fidl::encoding::DefaultFuchsiaResourceDialect,
4004 &mut self.address_state_provider,
4005 decoder,
4006 offset + 40,
4007 _depth
4008 )?;
4009 Ok(())
4010 }
4011 }
4012
4013 impl fidl::encoding::ResourceTypeMarker for ControlGetAuthorizationForInterfaceResponse {
4014 type Borrowed<'a> = &'a mut Self;
4015 fn take_or_borrow<'a>(
4016 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4017 ) -> Self::Borrowed<'a> {
4018 value
4019 }
4020 }
4021
4022 unsafe impl fidl::encoding::TypeMarker for ControlGetAuthorizationForInterfaceResponse {
4023 type Owned = Self;
4024
4025 #[inline(always)]
4026 fn inline_align(_context: fidl::encoding::Context) -> usize {
4027 8
4028 }
4029
4030 #[inline(always)]
4031 fn inline_size(_context: fidl::encoding::Context) -> usize {
4032 16
4033 }
4034 }
4035
4036 unsafe impl
4037 fidl::encoding::Encode<
4038 ControlGetAuthorizationForInterfaceResponse,
4039 fidl::encoding::DefaultFuchsiaResourceDialect,
4040 > for &mut ControlGetAuthorizationForInterfaceResponse
4041 {
4042 #[inline]
4043 unsafe fn encode(
4044 self,
4045 encoder: &mut fidl::encoding::Encoder<
4046 '_,
4047 fidl::encoding::DefaultFuchsiaResourceDialect,
4048 >,
4049 offset: usize,
4050 _depth: fidl::encoding::Depth,
4051 ) -> fidl::Result<()> {
4052 encoder.debug_check_bounds::<ControlGetAuthorizationForInterfaceResponse>(offset);
4053 fidl::encoding::Encode::<ControlGetAuthorizationForInterfaceResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4055 (
4056 <fidl_fuchsia_net_resources::GrantForInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
4057 ),
4058 encoder, offset, _depth
4059 )
4060 }
4061 }
4062 unsafe impl<
4063 T0: fidl::encoding::Encode<
4064 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
4065 fidl::encoding::DefaultFuchsiaResourceDialect,
4066 >,
4067 >
4068 fidl::encoding::Encode<
4069 ControlGetAuthorizationForInterfaceResponse,
4070 fidl::encoding::DefaultFuchsiaResourceDialect,
4071 > for (T0,)
4072 {
4073 #[inline]
4074 unsafe fn encode(
4075 self,
4076 encoder: &mut fidl::encoding::Encoder<
4077 '_,
4078 fidl::encoding::DefaultFuchsiaResourceDialect,
4079 >,
4080 offset: usize,
4081 depth: fidl::encoding::Depth,
4082 ) -> fidl::Result<()> {
4083 encoder.debug_check_bounds::<ControlGetAuthorizationForInterfaceResponse>(offset);
4084 self.0.encode(encoder, offset + 0, depth)?;
4088 Ok(())
4089 }
4090 }
4091
4092 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4093 for ControlGetAuthorizationForInterfaceResponse
4094 {
4095 #[inline(always)]
4096 fn new_empty() -> Self {
4097 Self {
4098 credential: fidl::new_empty!(
4099 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
4100 fidl::encoding::DefaultFuchsiaResourceDialect
4101 ),
4102 }
4103 }
4104
4105 #[inline]
4106 unsafe fn decode(
4107 &mut self,
4108 decoder: &mut fidl::encoding::Decoder<
4109 '_,
4110 fidl::encoding::DefaultFuchsiaResourceDialect,
4111 >,
4112 offset: usize,
4113 _depth: fidl::encoding::Depth,
4114 ) -> fidl::Result<()> {
4115 decoder.debug_check_bounds::<Self>(offset);
4116 fidl::decode!(
4118 fidl_fuchsia_net_resources::GrantForInterfaceAuthorization,
4119 fidl::encoding::DefaultFuchsiaResourceDialect,
4120 &mut self.credential,
4121 decoder,
4122 offset + 0,
4123 _depth
4124 )?;
4125 Ok(())
4126 }
4127 }
4128
4129 impl fidl::encoding::ResourceTypeMarker for DeviceControlCreateInterfaceRequest {
4130 type Borrowed<'a> = &'a mut Self;
4131 fn take_or_borrow<'a>(
4132 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4133 ) -> Self::Borrowed<'a> {
4134 value
4135 }
4136 }
4137
4138 unsafe impl fidl::encoding::TypeMarker for DeviceControlCreateInterfaceRequest {
4139 type Owned = Self;
4140
4141 #[inline(always)]
4142 fn inline_align(_context: fidl::encoding::Context) -> usize {
4143 8
4144 }
4145
4146 #[inline(always)]
4147 fn inline_size(_context: fidl::encoding::Context) -> usize {
4148 24
4149 }
4150 }
4151
4152 unsafe impl
4153 fidl::encoding::Encode<
4154 DeviceControlCreateInterfaceRequest,
4155 fidl::encoding::DefaultFuchsiaResourceDialect,
4156 > for &mut DeviceControlCreateInterfaceRequest
4157 {
4158 #[inline]
4159 unsafe fn encode(
4160 self,
4161 encoder: &mut fidl::encoding::Encoder<
4162 '_,
4163 fidl::encoding::DefaultFuchsiaResourceDialect,
4164 >,
4165 offset: usize,
4166 _depth: fidl::encoding::Depth,
4167 ) -> fidl::Result<()> {
4168 encoder.debug_check_bounds::<DeviceControlCreateInterfaceRequest>(offset);
4169 fidl::encoding::Encode::<DeviceControlCreateInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4171 (
4172 <fidl_fuchsia_hardware_network::PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
4173 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
4174 <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
4175 ),
4176 encoder, offset, _depth
4177 )
4178 }
4179 }
4180 unsafe impl<
4181 T0: fidl::encoding::Encode<
4182 fidl_fuchsia_hardware_network::PortId,
4183 fidl::encoding::DefaultFuchsiaResourceDialect,
4184 >,
4185 T1: fidl::encoding::Encode<
4186 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4187 fidl::encoding::DefaultFuchsiaResourceDialect,
4188 >,
4189 T2: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
4190 >
4191 fidl::encoding::Encode<
4192 DeviceControlCreateInterfaceRequest,
4193 fidl::encoding::DefaultFuchsiaResourceDialect,
4194 > for (T0, T1, T2)
4195 {
4196 #[inline]
4197 unsafe fn encode(
4198 self,
4199 encoder: &mut fidl::encoding::Encoder<
4200 '_,
4201 fidl::encoding::DefaultFuchsiaResourceDialect,
4202 >,
4203 offset: usize,
4204 depth: fidl::encoding::Depth,
4205 ) -> fidl::Result<()> {
4206 encoder.debug_check_bounds::<DeviceControlCreateInterfaceRequest>(offset);
4207 unsafe {
4210 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4211 (ptr as *mut u64).write_unaligned(0);
4212 }
4213 self.0.encode(encoder, offset + 0, depth)?;
4215 self.1.encode(encoder, offset + 4, depth)?;
4216 self.2.encode(encoder, offset + 8, depth)?;
4217 Ok(())
4218 }
4219 }
4220
4221 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4222 for DeviceControlCreateInterfaceRequest
4223 {
4224 #[inline(always)]
4225 fn new_empty() -> Self {
4226 Self {
4227 port: fidl::new_empty!(
4228 fidl_fuchsia_hardware_network::PortId,
4229 fidl::encoding::DefaultFuchsiaResourceDialect
4230 ),
4231 control: fidl::new_empty!(
4232 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4233 fidl::encoding::DefaultFuchsiaResourceDialect
4234 ),
4235 options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
4236 }
4237 }
4238
4239 #[inline]
4240 unsafe fn decode(
4241 &mut self,
4242 decoder: &mut fidl::encoding::Decoder<
4243 '_,
4244 fidl::encoding::DefaultFuchsiaResourceDialect,
4245 >,
4246 offset: usize,
4247 _depth: fidl::encoding::Depth,
4248 ) -> fidl::Result<()> {
4249 decoder.debug_check_bounds::<Self>(offset);
4250 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4252 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4253 let mask = 0xffff0000u64;
4254 let maskedval = padval & mask;
4255 if maskedval != 0 {
4256 return Err(fidl::Error::NonZeroPadding {
4257 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4258 });
4259 }
4260 fidl::decode!(
4261 fidl_fuchsia_hardware_network::PortId,
4262 fidl::encoding::DefaultFuchsiaResourceDialect,
4263 &mut self.port,
4264 decoder,
4265 offset + 0,
4266 _depth
4267 )?;
4268 fidl::decode!(
4269 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4270 fidl::encoding::DefaultFuchsiaResourceDialect,
4271 &mut self.control,
4272 decoder,
4273 offset + 4,
4274 _depth
4275 )?;
4276 fidl::decode!(
4277 Options,
4278 fidl::encoding::DefaultFuchsiaResourceDialect,
4279 &mut self.options,
4280 decoder,
4281 offset + 8,
4282 _depth
4283 )?;
4284 Ok(())
4285 }
4286 }
4287
4288 impl fidl::encoding::ResourceTypeMarker for InstallerInstallBlackholeInterfaceRequest {
4289 type Borrowed<'a> = &'a mut Self;
4290 fn take_or_borrow<'a>(
4291 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4292 ) -> Self::Borrowed<'a> {
4293 value
4294 }
4295 }
4296
4297 unsafe impl fidl::encoding::TypeMarker for InstallerInstallBlackholeInterfaceRequest {
4298 type Owned = Self;
4299
4300 #[inline(always)]
4301 fn inline_align(_context: fidl::encoding::Context) -> usize {
4302 8
4303 }
4304
4305 #[inline(always)]
4306 fn inline_size(_context: fidl::encoding::Context) -> usize {
4307 24
4308 }
4309 }
4310
4311 unsafe impl
4312 fidl::encoding::Encode<
4313 InstallerInstallBlackholeInterfaceRequest,
4314 fidl::encoding::DefaultFuchsiaResourceDialect,
4315 > for &mut InstallerInstallBlackholeInterfaceRequest
4316 {
4317 #[inline]
4318 unsafe fn encode(
4319 self,
4320 encoder: &mut fidl::encoding::Encoder<
4321 '_,
4322 fidl::encoding::DefaultFuchsiaResourceDialect,
4323 >,
4324 offset: usize,
4325 _depth: fidl::encoding::Depth,
4326 ) -> fidl::Result<()> {
4327 encoder.debug_check_bounds::<InstallerInstallBlackholeInterfaceRequest>(offset);
4328 fidl::encoding::Encode::<InstallerInstallBlackholeInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4330 (
4331 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
4332 <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
4333 ),
4334 encoder, offset, _depth
4335 )
4336 }
4337 }
4338 unsafe impl<
4339 T0: fidl::encoding::Encode<
4340 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4341 fidl::encoding::DefaultFuchsiaResourceDialect,
4342 >,
4343 T1: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
4344 >
4345 fidl::encoding::Encode<
4346 InstallerInstallBlackholeInterfaceRequest,
4347 fidl::encoding::DefaultFuchsiaResourceDialect,
4348 > for (T0, T1)
4349 {
4350 #[inline]
4351 unsafe fn encode(
4352 self,
4353 encoder: &mut fidl::encoding::Encoder<
4354 '_,
4355 fidl::encoding::DefaultFuchsiaResourceDialect,
4356 >,
4357 offset: usize,
4358 depth: fidl::encoding::Depth,
4359 ) -> fidl::Result<()> {
4360 encoder.debug_check_bounds::<InstallerInstallBlackholeInterfaceRequest>(offset);
4361 unsafe {
4364 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4365 (ptr as *mut u64).write_unaligned(0);
4366 }
4367 self.0.encode(encoder, offset + 0, depth)?;
4369 self.1.encode(encoder, offset + 8, depth)?;
4370 Ok(())
4371 }
4372 }
4373
4374 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4375 for InstallerInstallBlackholeInterfaceRequest
4376 {
4377 #[inline(always)]
4378 fn new_empty() -> Self {
4379 Self {
4380 interface: fidl::new_empty!(
4381 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4382 fidl::encoding::DefaultFuchsiaResourceDialect
4383 ),
4384 options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
4385 }
4386 }
4387
4388 #[inline]
4389 unsafe fn decode(
4390 &mut self,
4391 decoder: &mut fidl::encoding::Decoder<
4392 '_,
4393 fidl::encoding::DefaultFuchsiaResourceDialect,
4394 >,
4395 offset: usize,
4396 _depth: fidl::encoding::Depth,
4397 ) -> fidl::Result<()> {
4398 decoder.debug_check_bounds::<Self>(offset);
4399 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4401 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4402 let mask = 0xffffffff00000000u64;
4403 let maskedval = padval & mask;
4404 if maskedval != 0 {
4405 return Err(fidl::Error::NonZeroPadding {
4406 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4407 });
4408 }
4409 fidl::decode!(
4410 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4411 fidl::encoding::DefaultFuchsiaResourceDialect,
4412 &mut self.interface,
4413 decoder,
4414 offset + 0,
4415 _depth
4416 )?;
4417 fidl::decode!(
4418 Options,
4419 fidl::encoding::DefaultFuchsiaResourceDialect,
4420 &mut self.options,
4421 decoder,
4422 offset + 8,
4423 _depth
4424 )?;
4425 Ok(())
4426 }
4427 }
4428
4429 impl fidl::encoding::ResourceTypeMarker for InstallerInstallDeviceRequest {
4430 type Borrowed<'a> = &'a mut Self;
4431 fn take_or_borrow<'a>(
4432 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4433 ) -> Self::Borrowed<'a> {
4434 value
4435 }
4436 }
4437
4438 unsafe impl fidl::encoding::TypeMarker for InstallerInstallDeviceRequest {
4439 type Owned = Self;
4440
4441 #[inline(always)]
4442 fn inline_align(_context: fidl::encoding::Context) -> usize {
4443 4
4444 }
4445
4446 #[inline(always)]
4447 fn inline_size(_context: fidl::encoding::Context) -> usize {
4448 8
4449 }
4450 }
4451
4452 unsafe impl
4453 fidl::encoding::Encode<
4454 InstallerInstallDeviceRequest,
4455 fidl::encoding::DefaultFuchsiaResourceDialect,
4456 > for &mut InstallerInstallDeviceRequest
4457 {
4458 #[inline]
4459 unsafe fn encode(
4460 self,
4461 encoder: &mut fidl::encoding::Encoder<
4462 '_,
4463 fidl::encoding::DefaultFuchsiaResourceDialect,
4464 >,
4465 offset: usize,
4466 _depth: fidl::encoding::Depth,
4467 ) -> fidl::Result<()> {
4468 encoder.debug_check_bounds::<InstallerInstallDeviceRequest>(offset);
4469 fidl::encoding::Encode::<InstallerInstallDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4471 (
4472 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
4473 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_control),
4474 ),
4475 encoder, offset, _depth
4476 )
4477 }
4478 }
4479 unsafe impl<
4480 T0: fidl::encoding::Encode<
4481 fidl::encoding::Endpoint<
4482 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4483 >,
4484 fidl::encoding::DefaultFuchsiaResourceDialect,
4485 >,
4486 T1: fidl::encoding::Encode<
4487 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>>,
4488 fidl::encoding::DefaultFuchsiaResourceDialect,
4489 >,
4490 >
4491 fidl::encoding::Encode<
4492 InstallerInstallDeviceRequest,
4493 fidl::encoding::DefaultFuchsiaResourceDialect,
4494 > for (T0, T1)
4495 {
4496 #[inline]
4497 unsafe fn encode(
4498 self,
4499 encoder: &mut fidl::encoding::Encoder<
4500 '_,
4501 fidl::encoding::DefaultFuchsiaResourceDialect,
4502 >,
4503 offset: usize,
4504 depth: fidl::encoding::Depth,
4505 ) -> fidl::Result<()> {
4506 encoder.debug_check_bounds::<InstallerInstallDeviceRequest>(offset);
4507 self.0.encode(encoder, offset + 0, depth)?;
4511 self.1.encode(encoder, offset + 4, depth)?;
4512 Ok(())
4513 }
4514 }
4515
4516 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4517 for InstallerInstallDeviceRequest
4518 {
4519 #[inline(always)]
4520 fn new_empty() -> Self {
4521 Self {
4522 device: fidl::new_empty!(
4523 fidl::encoding::Endpoint<
4524 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4525 >,
4526 fidl::encoding::DefaultFuchsiaResourceDialect
4527 ),
4528 device_control: fidl::new_empty!(
4529 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>>,
4530 fidl::encoding::DefaultFuchsiaResourceDialect
4531 ),
4532 }
4533 }
4534
4535 #[inline]
4536 unsafe fn decode(
4537 &mut self,
4538 decoder: &mut fidl::encoding::Decoder<
4539 '_,
4540 fidl::encoding::DefaultFuchsiaResourceDialect,
4541 >,
4542 offset: usize,
4543 _depth: fidl::encoding::Depth,
4544 ) -> fidl::Result<()> {
4545 decoder.debug_check_bounds::<Self>(offset);
4546 fidl::decode!(
4548 fidl::encoding::Endpoint<
4549 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4550 >,
4551 fidl::encoding::DefaultFuchsiaResourceDialect,
4552 &mut self.device,
4553 decoder,
4554 offset + 0,
4555 _depth
4556 )?;
4557 fidl::decode!(
4558 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>>,
4559 fidl::encoding::DefaultFuchsiaResourceDialect,
4560 &mut self.device_control,
4561 decoder,
4562 offset + 4,
4563 _depth
4564 )?;
4565 Ok(())
4566 }
4567 }
4568
4569 impl Options {
4570 #[inline(always)]
4571 fn max_ordinal_present(&self) -> u64 {
4572 if let Some(_) = self.netstack_managed_routes_designation {
4573 return 3;
4574 }
4575 if let Some(_) = self.metric {
4576 return 2;
4577 }
4578 if let Some(_) = self.name {
4579 return 1;
4580 }
4581 0
4582 }
4583 }
4584
4585 impl fidl::encoding::ResourceTypeMarker for Options {
4586 type Borrowed<'a> = &'a mut Self;
4587 fn take_or_borrow<'a>(
4588 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4589 ) -> Self::Borrowed<'a> {
4590 value
4591 }
4592 }
4593
4594 unsafe impl fidl::encoding::TypeMarker for Options {
4595 type Owned = Self;
4596
4597 #[inline(always)]
4598 fn inline_align(_context: fidl::encoding::Context) -> usize {
4599 8
4600 }
4601
4602 #[inline(always)]
4603 fn inline_size(_context: fidl::encoding::Context) -> usize {
4604 16
4605 }
4606 }
4607
4608 unsafe impl fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
4609 for &mut Options
4610 {
4611 unsafe fn encode(
4612 self,
4613 encoder: &mut fidl::encoding::Encoder<
4614 '_,
4615 fidl::encoding::DefaultFuchsiaResourceDialect,
4616 >,
4617 offset: usize,
4618 mut depth: fidl::encoding::Depth,
4619 ) -> fidl::Result<()> {
4620 encoder.debug_check_bounds::<Options>(offset);
4621 let max_ordinal: u64 = self.max_ordinal_present();
4623 encoder.write_num(max_ordinal, offset);
4624 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4625 if max_ordinal == 0 {
4627 return Ok(());
4628 }
4629 depth.increment()?;
4630 let envelope_size = 8;
4631 let bytes_len = max_ordinal as usize * envelope_size;
4632 #[allow(unused_variables)]
4633 let offset = encoder.out_of_line_offset(bytes_len);
4634 let mut _prev_end_offset: usize = 0;
4635 if 1 > max_ordinal {
4636 return Ok(());
4637 }
4638
4639 let cur_offset: usize = (1 - 1) * envelope_size;
4642
4643 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4645
4646 fidl::encoding::encode_in_envelope_optional::<
4651 fidl::encoding::BoundedString<15>,
4652 fidl::encoding::DefaultFuchsiaResourceDialect,
4653 >(
4654 self.name.as_ref().map(
4655 <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow,
4656 ),
4657 encoder,
4658 offset + cur_offset,
4659 depth,
4660 )?;
4661
4662 _prev_end_offset = cur_offset + envelope_size;
4663 if 2 > max_ordinal {
4664 return Ok(());
4665 }
4666
4667 let cur_offset: usize = (2 - 1) * envelope_size;
4670
4671 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4673
4674 fidl::encoding::encode_in_envelope_optional::<
4679 u32,
4680 fidl::encoding::DefaultFuchsiaResourceDialect,
4681 >(
4682 self.metric.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4683 encoder,
4684 offset + cur_offset,
4685 depth,
4686 )?;
4687
4688 _prev_end_offset = cur_offset + envelope_size;
4689 if 3 > max_ordinal {
4690 return Ok(());
4691 }
4692
4693 let cur_offset: usize = (3 - 1) * envelope_size;
4696
4697 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4699
4700 fidl::encoding::encode_in_envelope_optional::<NetstackManagedRoutesDesignation, fidl::encoding::DefaultFuchsiaResourceDialect>(
4705 self.netstack_managed_routes_designation.as_mut().map(<NetstackManagedRoutesDesignation as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4706 encoder, offset + cur_offset, depth
4707 )?;
4708
4709 _prev_end_offset = cur_offset + envelope_size;
4710
4711 Ok(())
4712 }
4713 }
4714
4715 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Options {
4716 #[inline(always)]
4717 fn new_empty() -> Self {
4718 Self::default()
4719 }
4720
4721 unsafe fn decode(
4722 &mut self,
4723 decoder: &mut fidl::encoding::Decoder<
4724 '_,
4725 fidl::encoding::DefaultFuchsiaResourceDialect,
4726 >,
4727 offset: usize,
4728 mut depth: fidl::encoding::Depth,
4729 ) -> fidl::Result<()> {
4730 decoder.debug_check_bounds::<Self>(offset);
4731 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4732 None => return Err(fidl::Error::NotNullable),
4733 Some(len) => len,
4734 };
4735 if len == 0 {
4737 return Ok(());
4738 };
4739 depth.increment()?;
4740 let envelope_size = 8;
4741 let bytes_len = len * envelope_size;
4742 let offset = decoder.out_of_line_offset(bytes_len)?;
4743 let mut _next_ordinal_to_read = 0;
4745 let mut next_offset = offset;
4746 let end_offset = offset + bytes_len;
4747 _next_ordinal_to_read += 1;
4748 if next_offset >= end_offset {
4749 return Ok(());
4750 }
4751
4752 while _next_ordinal_to_read < 1 {
4754 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4755 _next_ordinal_to_read += 1;
4756 next_offset += envelope_size;
4757 }
4758
4759 let next_out_of_line = decoder.next_out_of_line();
4760 let handles_before = decoder.remaining_handles();
4761 if let Some((inlined, num_bytes, num_handles)) =
4762 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4763 {
4764 let member_inline_size =
4765 <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(
4766 decoder.context,
4767 );
4768 if inlined != (member_inline_size <= 4) {
4769 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4770 }
4771 let inner_offset;
4772 let mut inner_depth = depth.clone();
4773 if inlined {
4774 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4775 inner_offset = next_offset;
4776 } else {
4777 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4778 inner_depth.increment()?;
4779 }
4780 let val_ref = self.name.get_or_insert_with(|| {
4781 fidl::new_empty!(
4782 fidl::encoding::BoundedString<15>,
4783 fidl::encoding::DefaultFuchsiaResourceDialect
4784 )
4785 });
4786 fidl::decode!(
4787 fidl::encoding::BoundedString<15>,
4788 fidl::encoding::DefaultFuchsiaResourceDialect,
4789 val_ref,
4790 decoder,
4791 inner_offset,
4792 inner_depth
4793 )?;
4794 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4795 {
4796 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4797 }
4798 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4799 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4800 }
4801 }
4802
4803 next_offset += envelope_size;
4804 _next_ordinal_to_read += 1;
4805 if next_offset >= end_offset {
4806 return Ok(());
4807 }
4808
4809 while _next_ordinal_to_read < 2 {
4811 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4812 _next_ordinal_to_read += 1;
4813 next_offset += envelope_size;
4814 }
4815
4816 let next_out_of_line = decoder.next_out_of_line();
4817 let handles_before = decoder.remaining_handles();
4818 if let Some((inlined, num_bytes, num_handles)) =
4819 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4820 {
4821 let member_inline_size =
4822 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4823 if inlined != (member_inline_size <= 4) {
4824 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4825 }
4826 let inner_offset;
4827 let mut inner_depth = depth.clone();
4828 if inlined {
4829 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4830 inner_offset = next_offset;
4831 } else {
4832 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4833 inner_depth.increment()?;
4834 }
4835 let val_ref = self.metric.get_or_insert_with(|| {
4836 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4837 });
4838 fidl::decode!(
4839 u32,
4840 fidl::encoding::DefaultFuchsiaResourceDialect,
4841 val_ref,
4842 decoder,
4843 inner_offset,
4844 inner_depth
4845 )?;
4846 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4847 {
4848 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4849 }
4850 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4851 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4852 }
4853 }
4854
4855 next_offset += envelope_size;
4856 _next_ordinal_to_read += 1;
4857 if next_offset >= end_offset {
4858 return Ok(());
4859 }
4860
4861 while _next_ordinal_to_read < 3 {
4863 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4864 _next_ordinal_to_read += 1;
4865 next_offset += envelope_size;
4866 }
4867
4868 let next_out_of_line = decoder.next_out_of_line();
4869 let handles_before = decoder.remaining_handles();
4870 if let Some((inlined, num_bytes, num_handles)) =
4871 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4872 {
4873 let member_inline_size =
4874 <NetstackManagedRoutesDesignation as fidl::encoding::TypeMarker>::inline_size(
4875 decoder.context,
4876 );
4877 if inlined != (member_inline_size <= 4) {
4878 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4879 }
4880 let inner_offset;
4881 let mut inner_depth = depth.clone();
4882 if inlined {
4883 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4884 inner_offset = next_offset;
4885 } else {
4886 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4887 inner_depth.increment()?;
4888 }
4889 let val_ref = self.netstack_managed_routes_designation.get_or_insert_with(|| {
4890 fidl::new_empty!(
4891 NetstackManagedRoutesDesignation,
4892 fidl::encoding::DefaultFuchsiaResourceDialect
4893 )
4894 });
4895 fidl::decode!(
4896 NetstackManagedRoutesDesignation,
4897 fidl::encoding::DefaultFuchsiaResourceDialect,
4898 val_ref,
4899 decoder,
4900 inner_offset,
4901 inner_depth
4902 )?;
4903 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4904 {
4905 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4906 }
4907 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4908 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4909 }
4910 }
4911
4912 next_offset += envelope_size;
4913
4914 while next_offset < end_offset {
4916 _next_ordinal_to_read += 1;
4917 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4918 next_offset += envelope_size;
4919 }
4920
4921 Ok(())
4922 }
4923 }
4924
4925 impl fidl::encoding::ResourceTypeMarker for NetstackManagedRoutesDesignation {
4926 type Borrowed<'a> = &'a mut Self;
4927 fn take_or_borrow<'a>(
4928 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4929 ) -> Self::Borrowed<'a> {
4930 value
4931 }
4932 }
4933
4934 unsafe impl fidl::encoding::TypeMarker for NetstackManagedRoutesDesignation {
4935 type Owned = Self;
4936
4937 #[inline(always)]
4938 fn inline_align(_context: fidl::encoding::Context) -> usize {
4939 8
4940 }
4941
4942 #[inline(always)]
4943 fn inline_size(_context: fidl::encoding::Context) -> usize {
4944 16
4945 }
4946 }
4947
4948 unsafe impl
4949 fidl::encoding::Encode<
4950 NetstackManagedRoutesDesignation,
4951 fidl::encoding::DefaultFuchsiaResourceDialect,
4952 > for &mut NetstackManagedRoutesDesignation
4953 {
4954 #[inline]
4955 unsafe fn encode(
4956 self,
4957 encoder: &mut fidl::encoding::Encoder<
4958 '_,
4959 fidl::encoding::DefaultFuchsiaResourceDialect,
4960 >,
4961 offset: usize,
4962 _depth: fidl::encoding::Depth,
4963 ) -> fidl::Result<()> {
4964 encoder.debug_check_bounds::<NetstackManagedRoutesDesignation>(offset);
4965 encoder.write_num::<u64>(self.ordinal(), offset);
4966 match self {
4967 NetstackManagedRoutesDesignation::Main(ref val) => {
4968 fidl::encoding::encode_in_envelope::<
4969 Empty,
4970 fidl::encoding::DefaultFuchsiaResourceDialect,
4971 >(
4972 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4973 encoder,
4974 offset + 8,
4975 _depth,
4976 )
4977 }
4978 NetstackManagedRoutesDesignation::InterfaceLocal(ref val) => {
4979 fidl::encoding::encode_in_envelope::<
4980 Empty,
4981 fidl::encoding::DefaultFuchsiaResourceDialect,
4982 >(
4983 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
4984 encoder,
4985 offset + 8,
4986 _depth,
4987 )
4988 }
4989 NetstackManagedRoutesDesignation::__SourceBreaking { .. } => {
4990 Err(fidl::Error::UnknownUnionTag)
4991 }
4992 }
4993 }
4994 }
4995
4996 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4997 for NetstackManagedRoutesDesignation
4998 {
4999 #[inline(always)]
5000 fn new_empty() -> Self {
5001 Self::__SourceBreaking { unknown_ordinal: 0 }
5002 }
5003
5004 #[inline]
5005 unsafe fn decode(
5006 &mut self,
5007 decoder: &mut fidl::encoding::Decoder<
5008 '_,
5009 fidl::encoding::DefaultFuchsiaResourceDialect,
5010 >,
5011 offset: usize,
5012 mut depth: fidl::encoding::Depth,
5013 ) -> fidl::Result<()> {
5014 decoder.debug_check_bounds::<Self>(offset);
5015 #[allow(unused_variables)]
5016 let next_out_of_line = decoder.next_out_of_line();
5017 let handles_before = decoder.remaining_handles();
5018 let (ordinal, inlined, num_bytes, num_handles) =
5019 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5020
5021 let member_inline_size = match ordinal {
5022 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5023 2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5024 0 => return Err(fidl::Error::UnknownUnionTag),
5025 _ => num_bytes as usize,
5026 };
5027
5028 if inlined != (member_inline_size <= 4) {
5029 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5030 }
5031 let _inner_offset;
5032 if inlined {
5033 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5034 _inner_offset = offset + 8;
5035 } else {
5036 depth.increment()?;
5037 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5038 }
5039 match ordinal {
5040 1 => {
5041 #[allow(irrefutable_let_patterns)]
5042 if let NetstackManagedRoutesDesignation::Main(_) = self {
5043 } else {
5045 *self = NetstackManagedRoutesDesignation::Main(fidl::new_empty!(
5047 Empty,
5048 fidl::encoding::DefaultFuchsiaResourceDialect
5049 ));
5050 }
5051 #[allow(irrefutable_let_patterns)]
5052 if let NetstackManagedRoutesDesignation::Main(ref mut val) = self {
5053 fidl::decode!(
5054 Empty,
5055 fidl::encoding::DefaultFuchsiaResourceDialect,
5056 val,
5057 decoder,
5058 _inner_offset,
5059 depth
5060 )?;
5061 } else {
5062 unreachable!()
5063 }
5064 }
5065 2 => {
5066 #[allow(irrefutable_let_patterns)]
5067 if let NetstackManagedRoutesDesignation::InterfaceLocal(_) = self {
5068 } else {
5070 *self = NetstackManagedRoutesDesignation::InterfaceLocal(fidl::new_empty!(
5072 Empty,
5073 fidl::encoding::DefaultFuchsiaResourceDialect
5074 ));
5075 }
5076 #[allow(irrefutable_let_patterns)]
5077 if let NetstackManagedRoutesDesignation::InterfaceLocal(ref mut val) = self {
5078 fidl::decode!(
5079 Empty,
5080 fidl::encoding::DefaultFuchsiaResourceDialect,
5081 val,
5082 decoder,
5083 _inner_offset,
5084 depth
5085 )?;
5086 } else {
5087 unreachable!()
5088 }
5089 }
5090 #[allow(deprecated)]
5091 ordinal => {
5092 for _ in 0..num_handles {
5093 decoder.drop_next_handle()?;
5094 }
5095 *self = NetstackManagedRoutesDesignation::__SourceBreaking {
5096 unknown_ordinal: ordinal,
5097 };
5098 }
5099 }
5100 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5101 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5102 }
5103 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5104 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5105 }
5106 Ok(())
5107 }
5108 }
5109}