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